public void Set() { if (lastPolicy == "") { lastPolicy = SetBetterPawnControl.CurrentPolicy(); SetBetterPawnControl.SetPawnControlPolicy(Settings.Get().betterPawnControlBattlePolicy); } }
public void Set(string policy) { if (lastPolicy == "") { lastPolicy = SetBetterPawnControl.CurrentPolicy(); } SetBetterPawnControl.SetPawnControlPolicy(policy ?? Mod.settings.betterPawnControlBattlePolicy); }
public void Revert() { if (lastPolicy == "") { return; } SetBetterPawnControl.SetPawnControlPolicy(lastPolicy); lastPolicy = ""; }
public override IEnumerable <Gizmo> CompGetGizmosExtra() { if (this.parent is Pawn gizmoPawn) { GearUpMapComponent component = gizmoPawn.Map?.GetComponent <GearUpMapComponent>(); yield return(new Command_GearUpAndGo() { defaultLabel = "TD.GearAndGo".Translate(), defaultDesc = "TD.GearAndGoDesc".Translate(), icon = component.active ? TexGearUpAndGo.guagIconActive : TexGearUpAndGo.guagIcon, action = delegate(IntVec3 target) { Log.Message("GearUpAndGo to " + target); GearUpMapComponent comp = gizmoPawn.Map?.GetComponent <GearUpMapComponent>(); comp.active = true; if (comp.lastPolicy == "") { comp.lastPolicy = SetBetterPawnControl.CurrentPolicy(); SetBetterPawnControl.SetPawnControlPolicy(Settings.Get().betterPawnControlBattlePolicy); } foreach (Pawn p in Find.Selector.SelectedObjects .Where(o => o is Pawn p && p.IsColonistPlayerControlled).Cast <Pawn>()) { p.jobs.StartJob(new Verse.AI.Job(GearUpAndGoJobDefOf.GearUpAndGo, target), Verse.AI.JobCondition.InterruptForced); } }, actionEnd = delegate() { GearUpMapComponent comp = gizmoPawn.Map?.GetComponent <GearUpMapComponent>(); if (!comp.active) { return; } comp.active = false; Log.Message("GearUpAndGo done"); SetBetterPawnControl.SetPawnControlPolicy(comp.lastPolicy); comp.lastPolicy = ""; foreach (Pawn p in Find.Selector.SelectedObjects .Where(o => o is Pawn p && p.IsColonistPlayerControlled).Cast <Pawn>()) { p.jobs.ClearQueuedJobs(); p.jobs.EndCurrentJob(Verse.AI.JobCondition.InterruptForced); p.drafter.Drafted = false; } } });