为乌拉族引入了新的“机体维护”需求,通过`WULA_Maintenance_Neglect`健康状况(Hediff)体现。该状况会随时间推移而恶化,影响角色能力。 新增建筑“维护舱”(`WULA_MaintenancePod`),乌拉族成员可进入其中进行维护,以清除“维护疏忽”的负面效果。维护过程需要消耗电力和零部件,所需零部件数量与负面效果的严重程度相关。 实现了配套的自动化工作逻辑: - 当维护需求达到阈值时,角色会自动进入维护舱。 - 当维护舱缺少零部件时,搬运工会自动为其装填。 此外,事件系统中增加了一个新的条件 `Condition_FactionExists`。
40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using Verse;
|
|
|
|
namespace WulaFallenEmpire
|
|
{
|
|
public class HediffCompProperties_MaintenanceNeed : HediffCompProperties
|
|
{
|
|
public float severityPerDayBeforeThreshold = 0.0f;
|
|
public float severityPerDayAfterThreshold = 0.0f;
|
|
public float thresholdDays = 0.0f;
|
|
|
|
public HediffCompProperties_MaintenanceNeed()
|
|
{
|
|
compClass = typeof(HediffComp_MaintenanceNeed);
|
|
}
|
|
}
|
|
|
|
public class HediffComp_MaintenanceNeed : HediffComp
|
|
{
|
|
private HediffCompProperties_MaintenanceNeed Props => (HediffCompProperties_MaintenanceNeed)props;
|
|
|
|
public override void CompPostTick(ref float severityAdjustment)
|
|
{
|
|
base.CompPostTick(ref severityAdjustment);
|
|
|
|
// We adjust severity once per game day (60000 ticks)
|
|
if (parent.ageTicks % 60000 == 0)
|
|
{
|
|
float ageInDays = (float)parent.ageTicks / 60000f;
|
|
if (ageInDays < Props.thresholdDays)
|
|
{
|
|
severityAdjustment += Props.severityPerDayBeforeThreshold;
|
|
}
|
|
else
|
|
{
|
|
severityAdjustment += Props.severityPerDayAfterThreshold;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |