RimWorld

RimWorld

Psychology (unofficial) v1.1-1.5
Winter Mar 8, 2020 @ 12:21am
Androids compatibility
Just in case you'd be interesting in smoothing out the interaction between Psychology and the android mods, here's a couple of changes I made to my local copy a year or so ago:

In PsychologyBase.cs, in the DefsLoaded function around line 237, setting it to

IEnumerable<ThingDef> things = ( from def in DefDatabase<ThingDef>.AllDefs where def.race?.intelligence == Intelligence.Humanlike && !def.defName.Contains("AIPawn") && !def.defName.Contains("ChjDroid") && !def.defName.Contains("ChjBattleDroid") && !def.defName.Contains("Robot") && (zombieThinkTree == null || def.race.thinkTreeMain != zombieThinkTree) select def );

prevents the psyche tab from being added to ChJees worker droids and battle droids, while still allowing ChJees androids and Tiers androids (all of which are social pawns) to have a psyche tab.

In the main\Conversations\Rendezvous folder, in LordJob_HangOut.cs, in the ShouldBeCalledOff function around line 70, setting it to

return !PartyUtility.AcceptableGameConditionsToContinueParty(base.Map) || this.initiator.GetTimeAssignment() == TimeAssignmentDefOf.Work || this.recipient.GetTimeAssignment() == TimeAssignmentDefOf.Work || (this.initiator.needs.rest != null && this.initiator.needs.rest.CurLevel < 0.3f) || (this.recipient.needs.rest != null && this.recipient.needs.rest.CurLevel < 0.3f);

adds a check to see if a rest need exists, before seeing if the rest need is low; this prevents a situation where hanging out never ends.
< >
Showing 1-8 of 8 comments
che_lovek  [developer] Mar 9, 2020 @ 8:43am 
I added compatability for Androids and removed Psyche tab from Droids and Battle droids as you suggested. However, I am still unable to recreate that unending hangout bug. The code you provided is quite similar to what is alredy there.
Winter Mar 9, 2020 @ 12:04pm 
Thanks for your work.

The version of the hangout bug I had run into only occurred when one of the participants was a Tiers android, which might not happen during the lifespan of the average colony. The only change I made was to check to see if the rest need exists (needs.rest != null) before reading the rest level, which seemed to clear it up. It's probably fine without the change.
Winter Mar 9, 2020 @ 1:03pm 
And of course, less than an hour after I said that, one of my Tiers androids asked someone to hang out with him, leading to the debug log saying:

Exception while ticking lord with job Psychology.LordJob_HangOut:
System.NullReferenceException: Object reference not set to an instance of an object
at Psychology.LordJob_HangOut.ShouldBeCalledOff () [0x00032] in <c5a07323ccb84d2882a72e1c3fe7a96e>:0

once per tick.

A little anesthetic put a stop to it, but maybe it would be good to have the "needs.rest != null" check in there.
crazykid080 Mar 9, 2020 @ 8:35pm 
Yeah, having this bug too, apparently I had a 12 GB log file due to the errors
che_lovek  [developer] Mar 10, 2020 @ 1:31pm 
Should be fixed now.
Winter Mar 10, 2020 @ 3:05pm 
Looks good. Just started up a test colony, spawned a dozen androids, ran it for a couple of days, and had two hang-outs run start and end successfully.
che_lovek  [developer] Mar 10, 2020 @ 3:11pm 
Happy to hear! Also, thanks for pointing out what to fix.
crazykid080 Mar 10, 2020 @ 3:13pm 
Yep, looks like the errors are gone too! Thanks for taking the time to fix it! Much appreciated
< >
Showing 1-8 of 8 comments
Per page: 1530 50