Files
RickGrymes 0eed170531 Overhaul robotics with hediff loadouts
Refactors robot customization from apparel/equipment to hediff-driven body part overlays, adds a reusable upgrade dialog, and expands DefOf support for Protectron, Securitron, Mr. Handy, and Sentry Bot variants. Introduces manual power toggling, robot bed assignment/power-down behavior, new control modes (including Securitron guard point and Mr. Handy role-based work modes), and AI checks that respect fuel/power state and pending upgrade bench calls. Also adds new radiant quest nodes, improves settlement tile fallback logic, updates several workbench sizes/textures, and adds additional trader backstories.
2026-07-19 00:57:55 -05:00

74 lines
1.9 KiB
C#

using RimWorld;
using Verse;
namespace FCP.Core.Robotics
{
public enum MrHandyMode : byte
{
Wander,
Guard,
GuardPawn,
Cook,
Clean,
Garden,
BasicCare,
Tend,
Childcare
}
public class CompProperties_MrHandyMode : CompProperties
{
public CompProperties_MrHandyMode()
{
compClass = typeof(CompMrHandyMode);
}
}
public class CompMrHandyMode : ThingComp
{
private MrHandyMode mode = MrHandyMode.Wander;
private Pawn guardedPawn;
public CompProperties_MrHandyMode Props => (CompProperties_MrHandyMode)props;
public MrHandyMode Mode => mode;
public Pawn GuardedPawn => guardedPawn;
public void SetMode(MrHandyMode newMode)
{
mode = newMode;
if (newMode != MrHandyMode.GuardPawn)
{
guardedPawn = null;
}
}
public void SetGuardPawn(Pawn pawn)
{
mode = MrHandyMode.GuardPawn;
guardedPawn = pawn;
}
public override void PostExposeData()
{
base.PostExposeData();
Scribe_Values.Look(ref mode, "mrHandyMode", MrHandyMode.Wander);
Scribe_References.Look(ref guardedPawn, "mrHandyGuardedPawn");
}
public override string CompInspectStringExtra()
{
if ((parent as Pawn)?.Faction != Faction.OfPlayer)
{
return "FCP_ProtectronMode_Inspect".Translate("FCP_RobotMode_Wandering".Translate());
}
if (mode == MrHandyMode.GuardPawn)
{
return "FCP_ProtectronMode_Inspect".Translate("FCP_SecuritronMode_GuardPawn".Translate(guardedPawn?.LabelShort ?? "?"));
}
return "FCP_ProtectronMode_Inspect".Translate(mode.ToString());
}
}
}