mirror of
https://github.com/FalloutCollaborationProject/FCP-Tools.git
synced 2026-07-27 16:59:37 -07:00
30 lines
862 B
C#
30 lines
862 B
C#
using System.Collections.Generic;
|
|||
|
|
using Verse;
|
||
|
|
using Verse.AI;
|
||
|
|
|
||
|
|
namespace FCP.Core.Robotics
|
||
|
|
{
|
||
|
|
public class JobDriver_ControlRobots : JobDriver
|
||
|
|
{
|
||
|
|
private Thing Terminal => job.GetTarget(TargetIndex.A).Thing;
|
||
|
|
|
||
|
|
public override bool TryMakePreToilReservations(bool errorOnFailed)
|
||
|
|
{
|
||
|
|
return pawn.Reserve(Terminal, job, 1, -1, null, errorOnFailed);
|
||
|
|
}
|
||
|
|
|
||
|
|
protected override IEnumerable<Toil> MakeNewToils()
|
||
|
|
{
|
||
|
|
this.FailOnDestroyedOrNull(TargetIndex.A);
|
||
|
|
|
||
|
|
yield return Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell);
|
||
|
|
|
||
|
|
yield return new Toil
|
||
|
|
{
|
||
|
|
initAction = () => Terminal.TryGetComp<CompRobotController>()?.OpenRobotSelectMenu(),
|
||
|
|
defaultCompleteMode = ToilCompleteMode.Instant,
|
||
|
|
};
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|