暂存
This commit is contained in:
Binary file not shown.
@@ -1787,6 +1787,8 @@
|
|||||||
<!-- 食物列表 -->
|
<!-- 食物列表 -->
|
||||||
<whiteFoodList>
|
<whiteFoodList>
|
||||||
<li>ARA_InsectJelly</li>
|
<li>ARA_InsectJelly</li>
|
||||||
|
<li>ARA_NutrientPasteMeal</li>
|
||||||
|
<li>ARA_PheromoneSolvent</li>
|
||||||
</whiteFoodList>
|
</whiteFoodList>
|
||||||
<onlyEatRaceRestrictedFood>true</onlyEatRaceRestrictedFood>
|
<onlyEatRaceRestrictedFood>true</onlyEatRaceRestrictedFood>
|
||||||
<!-- 可以驯服的宠物,主要是防止小虫由别人驯服 -->
|
<!-- 可以驯服的宠物,主要是防止小虫由别人驯服 -->
|
||||||
|
|||||||
@@ -299,7 +299,8 @@
|
|||||||
<terrainAffordanceNeeded>Heavy</terrainAffordanceNeeded>
|
<terrainAffordanceNeeded>Heavy</terrainAffordanceNeeded>
|
||||||
<comps>
|
<comps>
|
||||||
<li Class="CompProperties_Forbiddable" />
|
<li Class="CompProperties_Forbiddable" />
|
||||||
<li Class="ArachnaeSwarm.CompProperties_RefuelableNutrition">
|
<li Class="ArachnaeSwarm.CompProperties_RefuelableNutrition_WithKey">
|
||||||
|
<saveKeysPrefix>nutrition</saveKeysPrefix>
|
||||||
<fuelCapacity>5.0</fuelCapacity>
|
<fuelCapacity>5.0</fuelCapacity>
|
||||||
<fuelFilter>
|
<fuelFilter>
|
||||||
<thingDefs>
|
<thingDefs>
|
||||||
@@ -451,7 +452,8 @@
|
|||||||
<terrainAffordanceNeeded>Heavy</terrainAffordanceNeeded>
|
<terrainAffordanceNeeded>Heavy</terrainAffordanceNeeded>
|
||||||
<comps>
|
<comps>
|
||||||
<li Class="CompProperties_Forbiddable" />
|
<li Class="CompProperties_Forbiddable" />
|
||||||
<li Class="ArachnaeSwarm.CompProperties_RefuelableNutrition">
|
<li Class="ArachnaeSwarm.CompProperties_RefuelableNutrition_WithKey">
|
||||||
|
<saveKeysPrefix>nutrition</saveKeysPrefix>
|
||||||
<fuelCapacity>5.0</fuelCapacity>
|
<fuelCapacity>5.0</fuelCapacity>
|
||||||
<fuelFilter>
|
<fuelFilter>
|
||||||
<thingDefs>
|
<thingDefs>
|
||||||
@@ -623,7 +625,8 @@
|
|||||||
</statBases>
|
</statBases>
|
||||||
<tickerType>Normal</tickerType>
|
<tickerType>Normal</tickerType>
|
||||||
<comps>
|
<comps>
|
||||||
<li Class="ArachnaeSwarm.CompProperties_RefuelableNutrition">
|
<li Class="ArachnaeSwarm.CompProperties_RefuelableNutrition_WithKey">
|
||||||
|
<saveKeysPrefix>nutrition</saveKeysPrefix>
|
||||||
<fuelCapacity>5.0</fuelCapacity>
|
<fuelCapacity>5.0</fuelCapacity>
|
||||||
<fuelFilter>
|
<fuelFilter>
|
||||||
<thingDefs>
|
<thingDefs>
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using RimWorld;
|
using RimWorld;
|
||||||
using Verse;
|
using Verse;
|
||||||
|
using System.Reflection;
|
||||||
|
using HarmonyLib;
|
||||||
|
|
||||||
namespace ArachnaeSwarm
|
namespace ArachnaeSwarm
|
||||||
{
|
{
|
||||||
@@ -17,6 +19,36 @@ namespace ArachnaeSwarm
|
|||||||
{
|
{
|
||||||
public new CompProperties_RefuelableWithKey Props => (CompProperties_RefuelableWithKey)props;
|
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()
|
public new void Notify_UsedThisTick()
|
||||||
{
|
{
|
||||||
if (Props.consumeFuelOnlyWhenUsed)
|
if (Props.consumeFuelOnlyWhenUsed)
|
||||||
|
|||||||
Reference in New Issue
Block a user