RimWorld

RimWorld

Psychology (unofficial) v1.1-1.5
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.
< >
Zobrazeno 18 z 8 komentářů
che_lovek  [vývojář] 9. bře. 2020 v 8.43 
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.
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.
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.
Yeah, having this bug too, apparently I had a 12 GB log file due to the errors
che_lovek  [vývojář] 10. bře. 2020 v 13.31 
Should be fixed now.
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  [vývojář] 10. bře. 2020 v 15.11 
Happy to hear! Also, thanks for pointing out what to fix.
Yep, looks like the errors are gone too! Thanks for taking the time to fix it! Much appreciated
< >
Zobrazeno 18 z 8 komentářů
Na stránku: 1530 50