diff --git a/1.6/1.6/Assemblies/ArachnaeSwarm.dll b/1.6/1.6/Assemblies/ArachnaeSwarm.dll index 62e7030..425adde 100644 Binary files a/1.6/1.6/Assemblies/ArachnaeSwarm.dll and b/1.6/1.6/Assemblies/ArachnaeSwarm.dll differ diff --git a/1.6/1.6/Defs/ThingDef_Races/ARA_RaceNodeSwarm.xml b/1.6/1.6/Defs/ThingDef_Races/ARA_RaceNodeSwarm.xml index 1a17e46..4b0bd7f 100644 --- a/1.6/1.6/Defs/ThingDef_Races/ARA_RaceNodeSwarm.xml +++ b/1.6/1.6/Defs/ThingDef_Races/ARA_RaceNodeSwarm.xml @@ -1787,6 +1787,8 @@
  • ARA_InsectJelly
  • +
  • ARA_NutrientPasteMeal
  • +
  • ARA_PheromoneSolvent
  • true diff --git a/1.6/1.6/Defs/Thing_building/ARA_SwarmTurret.xml b/1.6/1.6/Defs/Thing_building/ARA_SwarmTurret.xml index f7c4662..f5683dd 100644 --- a/1.6/1.6/Defs/Thing_building/ARA_SwarmTurret.xml +++ b/1.6/1.6/Defs/Thing_building/ARA_SwarmTurret.xml @@ -299,7 +299,8 @@ Heavy
  • -
  • +
  • + nutrition 5.0 @@ -451,7 +452,8 @@ Heavy
  • -
  • +
  • + nutrition 5.0 @@ -623,7 +625,8 @@ Normal -
  • +
  • + nutrition 5.0 diff --git a/Source/ArachnaeSwarm/Building_Comps/WULA_MutiFuelSpawner/CompRefuelableWithKey.cs b/Source/ArachnaeSwarm/Building_Comps/WULA_MutiFuelSpawner/CompRefuelableWithKey.cs index 39e4107..388ebda 100644 --- a/Source/ArachnaeSwarm/Building_Comps/WULA_MutiFuelSpawner/CompRefuelableWithKey.cs +++ b/Source/ArachnaeSwarm/Building_Comps/WULA_MutiFuelSpawner/CompRefuelableWithKey.cs @@ -1,5 +1,7 @@ using RimWorld; using Verse; +using System.Reflection; +using HarmonyLib; namespace ArachnaeSwarm { @@ -17,6 +19,36 @@ namespace ArachnaeSwarm { public new CompProperties_RefuelableWithKey Props => (CompProperties_RefuelableWithKey)props; + public override void PostExposeData() + { + string prefix = Props.saveKeysPrefix; + if (prefix.NullOrEmpty()) + { + Log.ErrorOnce($"CompRefuelableWithKey on {parent.def.defName} has a null or empty saveKeysPrefix. Defaulting to standard save.", GetHashCode()); + base.PostExposeData(); + return; + } + + FieldInfo fuelField = AccessTools.Field(typeof(CompRefuelable), "fuel"); + FieldInfo configuredTargetFuelLevelField = AccessTools.Field(typeof(CompRefuelable), "configuredTargetFuelLevel"); + FieldInfo allowAutoRefuelField = AccessTools.Field(typeof(CompRefuelable), "allowAutoRefuel"); + + float currentFuel = (float)fuelField.GetValue(this); + float currentConfiguredLevel = (float)configuredTargetFuelLevelField.GetValue(this); + bool currentAllowAuto = (bool)allowAutoRefuelField.GetValue(this); + + Scribe_Values.Look(ref currentFuel, prefix + "_fuel", 0f); + Scribe_Values.Look(ref currentConfiguredLevel, prefix + "_configuredTargetFuelLevel", -1f); + Scribe_Values.Look(ref currentAllowAuto, prefix + "_allowAutoRefuel", true); + + if (Scribe.mode == LoadSaveMode.LoadingVars) + { + fuelField.SetValue(this, currentFuel); + configuredTargetFuelLevelField.SetValue(this, currentConfiguredLevel); + allowAutoRefuelField.SetValue(this, currentAllowAuto); + } + } + public new void Notify_UsedThisTick() { if (Props.consumeFuelOnlyWhenUsed)