public void DropDroid() { if (!IsAvailableForReactivation) { GenSpawn.Spawn(InnerDroid, InteractionCell); innerDroid = null; SetPowerUsage(); } }
public void Disable() { if (parent.SpawnedInWorld) { DeactivatedDroid disabledDroid = (DeactivatedDroid)ThingMaker.MakeThing(DefDatabase <ThingDef> .GetNamed(DeactivatedDroidDefName)); disabledDroid.InnerDroid = parent; IntVec3 pos = parent.Position; parent.DeSpawn(); GenSpawn.Spawn(disabledDroid, pos); } }
protected override void FillTab() { Pawn pawn = null; if (base.SelPawn != null) { pawn = base.SelPawn; } else if (base.SelThing is Corpse) { Corpse corpse = base.SelThing as Corpse; if (corpse != null) { pawn = corpse.innerPawn; } } else if (base.SelThing is DeactivatedDroid) { DeactivatedDroid droid = base.SelThing as DeactivatedDroid; if (droid != null) { pawn = droid.InnerDroid; } } else if (base.SelThing is Building_RepairStation) { Building_RepairStation rps = base.SelThing as Building_RepairStation; if (rps != null) { pawn = rps.InnerDroid.InnerDroid; } } if (pawn == null) { Log.Error("Health tab found no selected pawn to display."); return; } Corpse corpse2 = base.SelThing as Corpse; bool showBloodLoss = corpse2 == null || corpse2.Age < 60000; bool flag = base.SelThing.def.AllRecipes.Any <RecipeDef>(); bool flag2 = !pawn.RaceProps.Humanlike && pawn.Downed; bool allowOperations = flag && !pawn.Dead && (pawn.IsColonist || pawn.HostFaction == Faction.OfColony || flag2); Rect outRect = new Rect(0f, 20f, this.size.x, this.size.y - 20f); HealthCardUtility.DrawPawnHealthCard(outRect, pawn, allowOperations, showBloodLoss, base.SelThing); }
public void AddDroid(DeactivatedDroid droid) { if (IsAvailableForReactivation) { innerDroid = droid; if (droid.SpawnedInWorld) { droid.DeSpawn(); } innerDroid.InnerDroid.ShouldUsePower = false; SetPowerUsage(); } else { Log.Message("Tried to add a deactivated droid to: " + this.ToString() + " but it already had something in it!"); } }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnBurningImmobile(DeactivatedDroid); this.FailOnBurningImmobile(RPS); this.FailOnDestroyedOrForbidden(DeactivatedDroid); this.FailOnDestroyedOrForbidden(RPS); DeactivatedDroid droid = TargetThingA as DeactivatedDroid; Building_RepairStation rps = TargetThingB as Building_RepairStation; //Reserve the item yield return(Toils_Reserve.Reserve(DeactivatedDroid)); //Go to the item yield return(Toils_Goto.GotoThing(DeactivatedDroid, PathEndMode.ClosestTouch)); //Pick up the item yield return(Toils_Haul.StartCarryThing(DeactivatedDroid)); //Go to the rps yield return(Toils_Goto.GotoThing(RPS, PathEndMode.InteractionCell)); //Drop the item Toil toil = new Toil(); toil.initAction = delegate { Thing thing; if (!toil.actor.carryHands.TryDropCarriedThing(rps.InteractionCell, ThingPlaceMode.Direct, out thing)) { toil.actor.jobs.EndCurrentJob(JobCondition.Incompletable); } }; yield return(toil); //Add the item to the rps toil = new Toil(); toil.initAction = delegate { rps.AddDroid(droid); }; yield return(toil); }
public void ReactivateDroid(bool dropDroid = false) { if (!IsAvailableForReactivation) { if (ReadyForReactivation) { Droid droid = InnerDroid.InnerDroid; droid.playerController.Drafted = false; droid.ShouldUsePower = true; GenSpawn.Spawn(droid, InteractionCell); Messages.Message("DroidReactivated".Translate(new object[] { droid.LabelBase }), MessageSound.Benefit); innerDroid.Destroy(); innerDroid = null; SetPowerUsage(); } else if (dropDroid) { DropDroid(); } } }
public override bool HasJobOnThing(Pawn pawn, Thing t) { DeactivatedDroid droid = t as DeactivatedDroid; return(droid != null && ListerDroids.AllRepairStations.Any((Building_RepairStation rps) => rps.IsAvailableForReactivation) && pawn.CanReserveAndReach(droid, PathEndMode, Danger.Some, 1)); }
public void ReactivateDroid(bool dropDroid = false) { if (!IsAvailableForReactivation) { if (ReadyForReactivation) { Droid droid = InnerDroid.InnerDroid; droid.playerController.Drafted = false; droid.ShouldUsePower = true; GenSpawn.Spawn(droid, InteractionCell); Messages.Message("DroidReactivated".Translate(new object[] { droid.LabelBase }), MessageSound.Benefit); innerDroid.Destroy(); innerDroid = null; SetPowerUsage(); } else if (dropDroid) DropDroid(); } }
public void AddDroid(DeactivatedDroid droid) { if (IsAvailableForReactivation) { innerDroid = droid; if (droid.SpawnedInWorld) droid.DeSpawn(); innerDroid.InnerDroid.ShouldUsePower = false; SetPowerUsage(); } else Log.Message("Tried to add a deactivated droid to: " + this.ToString() + " but it already had something in it!"); }