LifeForceEmpath uses new XML DefModExtension

This commit is contained in:
Vegapnk 2023-07-17 07:09:05 +02:00
parent ef1e3cdd0f
commit 132344b294
6 changed files with 16 additions and 10 deletions

View file

@ -274,13 +274,19 @@
<backgroundPathXenogenes>Genes/Icons/RJW_Genes_Xenogene_Background</backgroundPathXenogenes> <backgroundPathXenogenes>Genes/Icons/RJW_Genes_Xenogene_Background</backgroundPathXenogenes>
</li> </li>
<li Class="RJW_Genes.LifeForceEmpathExtension"> <li Class="RJW_Genes.LifeForceEmpathExtension">
<!-- One day has 60k ticks, so we check every hour with 60000/24 = 2500-->
<tickInterval>2500</tickInterval>
<empathDistance>25</empathDistance> <empathDistance>25</empathDistance>
<aheagoIncrement>0.02</aheagoIncrement> <aheagoIncrement>0.02</aheagoIncrement>
<satisfactionIncrement>0.01</satisfactionIncrement> <satisfactionIncrement>0.01</satisfactionIncrement>
<frustratedDecrement>-0.01</frustratedDecrement> <frustratedDecrement>-0.01</frustratedDecrement>
</li> </li>
<li Class="RJW_Genes.TickIntervalExtension">
<!-- One day has 60k ticks, so we check every hour with 60000/24 = 2500-->
<tickInterval>2500</tickInterval>
</li>
<li Class="RJW_Genes.DistanceExtension">
<!-- distance 25 means 25 tiles in every direction from the empath.-->
<distance>25</distance>
</li>
</modExtensions> </modExtensions>
</GeneDef> </GeneDef>

View file

@ -15,6 +15,6 @@ namespace RJW_Genes
/// </summary> /// </summary>
public class DistanceExtension : DefModExtension public class DistanceExtension : DefModExtension
{ {
public int Distance; public int distance;
} }
} }

View file

@ -14,7 +14,7 @@ namespace RJW_Genes
{ {
DistanceExtension distanceExt = defOf.GetModExtension<DistanceExtension>(); DistanceExtension distanceExt = defOf.GetModExtension<DistanceExtension>();
int potentialDistance = distanceExt?.Distance ?? fallback; int potentialDistance = distanceExt?.distance ?? fallback;
if (potentialDistance > 0) if (potentialDistance > 0)
{ {

View file

@ -9,9 +9,6 @@ namespace RJW_Genes
{ {
public class LifeForceEmpathExtension : DefModExtension public class LifeForceEmpathExtension : DefModExtension
{ {
public int tickInterval;
public int empathDistance;
public float aheagoIncrement; public float aheagoIncrement;
public float satisfactionIncrement; public float satisfactionIncrement;
public float frustratedDecrement; public float frustratedDecrement;

View file

@ -29,8 +29,8 @@ namespace RJW_Genes
{ {
LifeForceEmpathExtension empathExt = GeneDefOf.rjw_genes_lifeforce_empath.GetModExtension<LifeForceEmpathExtension>(); LifeForceEmpathExtension empathExt = GeneDefOf.rjw_genes_lifeforce_empath.GetModExtension<LifeForceEmpathExtension>();
tickInterval = empathExt?.tickInterval ?? TICK_INTERVAL_FALLBACK; tickInterval = ModExtensionHelper.GetTickIntervalFromModExtension(GeneDefOf.rjw_genes_lifeforce_empath, TICK_INTERVAL_FALLBACK);
empathDistance = empathExt?.empathDistance ?? EMPATH_DISTANCE_FALLBACK; empathDistance = ModExtensionHelper.GetTickIntervalFromModExtension(GeneDefOf.rjw_genes_lifeforce_empath, EMPATH_DISTANCE_FALLBACK);
aheagoIncrement = empathExt?.aheagoIncrement ?? AHEAGO_FALLBACK; aheagoIncrement = empathExt?.aheagoIncrement ?? AHEAGO_FALLBACK;
satisfiedIncrement = empathExt?.satisfactionIncrement ?? SATISFIED_FALLBACK; satisfiedIncrement = empathExt?.satisfactionIncrement ?? SATISFIED_FALLBACK;

View file

@ -39,7 +39,10 @@
<Compile Include="Animal_Inheritance\Settings\RJW_BGSSettings.cs" /> <Compile Include="Animal_Inheritance\Settings\RJW_BGSSettings.cs" />
<Compile Include="Animal_Inheritance\Settings\RJW_BGSSettingsController.cs" /> <Compile Include="Animal_Inheritance\Settings\RJW_BGSSettingsController.cs" />
<Compile Include="Animal_Inheritance\Defs\BestialityGeneInheritanceDef.cs" /> <Compile Include="Animal_Inheritance\Defs\BestialityGeneInheritanceDef.cs" />
<Compile Include="Common\Defs\DistanceExtension.cs" />
<Compile Include="Common\Defs\ModExtensionHelper.cs" />
<Compile Include="Common\ModLog.cs" /> <Compile Include="Common\ModLog.cs" />
<Compile Include="Common\Defs\TickIntervalExtension.cs" />
<Compile Include="GeneDefOf.cs" /> <Compile Include="GeneDefOf.cs" />
<Compile Include="Genes\Breeding\Gene_MechBreeder.cs" /> <Compile Include="Genes\Breeding\Gene_MechBreeder.cs" />
<Compile Include="Genes\Breeding\PatchMechBirth.cs" /> <Compile Include="Genes\Breeding\PatchMechBirth.cs" />