diff --git a/About/About.xml b/About/About.xml index 435caf2..613ba37 100644 --- a/About/About.xml +++ b/About/About.xml @@ -25,7 +25,7 @@
  • Multiplayer
  • brrainz.zombieland - 4.3.5.0 + 4.3.6.0 928376710 Do you like The Walking Dead? Are you afraid of The Undead? Good. Because this mod will give you the Heebie-jeebies! diff --git a/About/Manifest.xml b/About/Manifest.xml index fb61435..b219a9c 100644 --- a/About/Manifest.xml +++ b/About/Manifest.xml @@ -1,7 +1,7 @@  net.pardeike.rimworld.mod.zombieland - 4.3.5.0 + 4.3.6.0
  • 1.4.0
  • diff --git a/Assemblies/ZombieLand.dll b/Assemblies/ZombieLand.dll index 9dffdee..a1b18d9 100644 Binary files a/Assemblies/ZombieLand.dll and b/Assemblies/ZombieLand.dll differ diff --git a/Directory.Build.props b/Directory.Build.props index 110d30a..3198ec6 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,7 +4,7 @@ ZombieLand ZombieLand https://github.com/pardeike/Zombieland - 4.3.5.0 + 4.3.6.0 {34AA2AF2-8E82-4C5B-8ABA-9AC53DA7C110} diff --git a/Source/JobDriver_Stumble.cs b/Source/JobDriver_Stumble.cs index dedb8c4..93dab9d 100644 --- a/Source/JobDriver_Stumble.cs +++ b/Source/JobDriver_Stumble.cs @@ -13,12 +13,14 @@ public class JobDriver_Stumble : JobDriver public Thing eatTarget; public Pawn lastEatTarget; + public IntVec3 lastEatTargetPosition; public int eatDelayCounter; public int eatDelay; void InitAction() { destination = IntVec3.Invalid; + lastEatTargetPosition = IntVec3.Invalid; } public override void ExposeData() @@ -27,12 +29,16 @@ public override void ExposeData() Scribe_Values.Look(ref destination, "destination", IntVec3.Invalid); Scribe_References.Look(ref eatTarget, "eatTarget"); Scribe_References.Look(ref lastEatTarget, "lastEatTarget"); + Scribe_Values.Look(ref lastEatTargetPosition, "lastEatTargetPosition", IntVec3.Invalid); Scribe_Values.Look(ref eatDelayCounter, "eatDelayCounter"); // previous versions of Zombieland stored the inner pawn of a corpse // in the eatTarget. We have since then changed it to contain the corpse // itself. For older saves, we need to convert this. // + // we also need to update lastEatTargetPosition since it was not present + // in older saves + // if (Scribe.mode == LoadSaveMode.PostLoadInit) { if (eatTarget is Pawn p && p.Map != null) @@ -43,6 +49,9 @@ public override void ExposeData() .OfType() .FirstOrDefault(c => c.InnerPawn == eatTarget); } + + // update lastEatTargetPosition + lastEatTargetPosition = lastEatTarget?.Position ?? IntVec3.Invalid; } } diff --git a/Source/ZombieStateHandler.cs b/Source/ZombieStateHandler.cs index 4d9bbfe..b2fbd2f 100644 --- a/Source/ZombieStateHandler.cs +++ b/Source/ZombieStateHandler.cs @@ -337,10 +337,11 @@ public static bool Eat(this JobDriver_Stumble driver, Zombie zombie, PheromoneGr if (zombie.hasTankyShield != -1f || zombie.hasTankyHelmet != -1f || zombie.hasTankySuit != -1f) return false; - if (driver.eatTarget != null && driver.eatTarget.Spawned == false) + if (driver.eatTarget != null && (driver.eatTarget.Spawned == false || driver.eatTarget.Position != driver.lastEatTargetPosition)) { driver.eatTarget = null; driver.lastEatTarget = null; + driver.lastEatTargetPosition = IntVec3.Invalid; driver.eatDelayCounter = 0; } if (driver.eatTarget == null && grid.GetZombieCount(zombie.Position) <= 2) @@ -371,7 +372,8 @@ static bool LeanAndDelay(this JobDriver_Stumble driver, Zombie zombie, Pawn eatT if (eatTargetPawn != driver.lastEatTarget) { driver.lastEatTarget = eatTargetPawn; - zombie.rotationTracker.FaceCell(driver.eatTarget.Position); + driver.lastEatTargetPosition = eatTargetPawn.Position; + zombie.rotationTracker.FaceCell(driver.lastEatTargetPosition); if (zombie.Drawer.leaner is ZombieLeaner zombieLeaner) { var offset = (driver.eatTarget.Position.ToVector3() - zombie.Position.ToVector3()) * 0.5f;