Hello,
I am working on a Sapper only mod, and one of the changes I would like to introduce is that they prioritize geothermal reactors over beds.
What class do I need to investigate to alter AI target behaviour? I looked at JobGiver_AISapper.cs but it doesn't seem to have anything to do with it.
Quote from: Eitch on December 20, 2018, 10:31:41 PM
Hello,
I am working on a Sapper only mod, and one of the changes I would like to introduce is that they prioritize geothermal reactors over beds.
What class do I need to investigate to alter AI target behaviour? I looked at JobGiver_AISapper.cs but it doesn't seem to have anything to do with it.
Awesome. I like it already. JobGiver_AISapper starts with
protected override Job TryGiveJob(Pawn pawn)
{
IntVec3 intVec = (IntVec3)pawn.mindState.duty.focus;
which somehow grabs an IntVec3 out of seemingly thin air and that's the pawns target. This isn't thin air, but it's tricky to find unless you're already reasonably familiar with RimWorld and its job assignment. It gets assigned in a PawnDuty constructor. Hit analyse, find Assigned By, search where the constructor its used. You will find that
// LordToil_AssaultColonySappers.UpdateAllDuties is one of them. It assigned a pawn the Sapper DutyDef with
pawn3.mindState.duty = new PawnDuty(DutyDefOf.Sapper, Data.sapperDest);. The Data.sapperDest got set earlier:
Data.sapperDest = GenAI.RandomRaidDest(lord.ownedPawns[0].Position, base.Map);
@Mehni
Thank you for the detailed response! I remember you being the author of interesting Sun Tzu mod. :)
This is my first .dll mod attempt so I likely won't be able to use the knowledge you provided me, but let's see what can be done when I get more free time in the future...