2026-07-15 23:24:32 -05:00
|
|
|
using Verse;
|
|
|
|
|
|
|
|
|
|
namespace FCP.Core.Robotics
|
|
|
|
|
{
|
|
|
|
|
public enum SecuritronMode : byte
|
|
|
|
|
{
|
|
|
|
|
GuardHome,
|
2026-07-19 00:57:55 -05:00
|
|
|
GuardPawn,
|
|
|
|
|
GuardPoint
|
2026-07-15 23:24:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class CompProperties_SecuritronMode : CompProperties
|
|
|
|
|
{
|
|
|
|
|
public CompProperties_SecuritronMode()
|
|
|
|
|
{
|
|
|
|
|
compClass = typeof(CompSecuritronMode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class CompSecuritronMode : ThingComp
|
|
|
|
|
{
|
|
|
|
|
private SecuritronMode mode = SecuritronMode.GuardHome;
|
|
|
|
|
private Pawn guardedPawn;
|
2026-07-19 00:57:55 -05:00
|
|
|
private IntVec3 guardedPoint = IntVec3.Invalid;
|
2026-07-15 23:24:32 -05:00
|
|
|
|
|
|
|
|
public CompProperties_SecuritronMode Props => (CompProperties_SecuritronMode)props;
|
|
|
|
|
public SecuritronMode Mode => mode;
|
|
|
|
|
public Pawn GuardedPawn => guardedPawn;
|
2026-07-19 00:57:55 -05:00
|
|
|
public IntVec3 GuardedPoint => guardedPoint;
|
2026-07-15 23:24:32 -05:00
|
|
|
|
|
|
|
|
public void SetGuardHome()
|
|
|
|
|
{
|
|
|
|
|
mode = SecuritronMode.GuardHome;
|
|
|
|
|
guardedPawn = null;
|
2026-07-19 00:57:55 -05:00
|
|
|
guardedPoint = IntVec3.Invalid;
|
2026-07-15 23:24:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetGuardPawn(Pawn pawn)
|
|
|
|
|
{
|
|
|
|
|
mode = SecuritronMode.GuardPawn;
|
|
|
|
|
guardedPawn = pawn;
|
2026-07-19 00:57:55 -05:00
|
|
|
guardedPoint = IntVec3.Invalid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetGuardPoint(IntVec3 point)
|
|
|
|
|
{
|
|
|
|
|
mode = SecuritronMode.GuardPoint;
|
|
|
|
|
guardedPawn = null;
|
|
|
|
|
guardedPoint = point;
|
2026-07-15 23:24:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void PostExposeData()
|
|
|
|
|
{
|
|
|
|
|
base.PostExposeData();
|
|
|
|
|
Scribe_Values.Look(ref mode, "securitronMode", SecuritronMode.GuardHome);
|
|
|
|
|
Scribe_References.Look(ref guardedPawn, "guardedPawn");
|
2026-07-19 00:57:55 -05:00
|
|
|
Scribe_Values.Look(ref guardedPoint, "guardedPoint", IntVec3.Invalid);
|
2026-07-15 23:24:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string CompInspectStringExtra()
|
|
|
|
|
{
|
|
|
|
|
if ((parent as Pawn)?.Faction != RimWorld.Faction.OfPlayer)
|
|
|
|
|
{
|
|
|
|
|
return "FCP_SecuritronMode_Inspect".Translate("FCP_RobotMode_Wandering".Translate());
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-19 00:57:55 -05:00
|
|
|
return mode switch
|
|
|
|
|
{
|
|
|
|
|
SecuritronMode.GuardPawn => "FCP_SecuritronMode_Inspect".Translate("FCP_SecuritronMode_GuardPawn".Translate(guardedPawn?.LabelShort ?? "?")),
|
|
|
|
|
SecuritronMode.GuardPoint => "FCP_SecuritronMode_Inspect".Translate("FCP_SecuritronMode_GuardPoint".Translate(guardedPoint.ToString())),
|
|
|
|
|
_ => "FCP_SecuritronMode_Inspect".Translate("FCP_SecuritronMode_GuardHome".Translate()),
|
|
|
|
|
};
|
2026-07-15 23:24:32 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|