private void Destroy() { if (chargee != null) { chargee.Parent.jobs.EndCurrentJob(Verse.AI.JobCondition.Incompletable); } ListerDroids.DeregisterCharger(parent); }
public override Job JobOnThing(Pawn pawn, Thing t) { Building_RepairStation rps = ListerDroids.ClosestRepairStationFor(pawn, t); Job job = new Job(ReactivateDroidJobDef, t, rps); job.maxNumToCarry = 1; return(job); }
protected override Job TryGiveTerminalJob(Pawn pawn) { if (!(pawn is ICharge)) { return(null); } ICharge chargee = (ICharge)pawn; Droid droid = (Droid)pawn; if (droid != null && !droid.Active) { return(null); } float chargeThreshold; float distance; switch (stage) { case 1: { chargeThreshold = chargee.PowerSafeThreshold; distance = 20f; break; } case 2: { chargeThreshold = chargee.PowerLowThreshold; distance = 50f; break; } case 3: { chargeThreshold = chargee.PowerCriticalThreshold; distance = 9999f; break; } default: { chargeThreshold = chargee.PowerLowThreshold; distance = 50f; break; } } if (chargee.TotalCharge <= chargee.MaxEnergy * chargeThreshold) { Thing target = ListerDroids.ClosestChargerFor(chargee, distance); if (target != null) { return(new Job(DefDatabase <JobDef> .GetNamed("MD2ChargeDroid"), new TargetInfo(target))); } } return(null); }
public override void SpawnSetup() { ListerDroids.RegisterDroid(this); meta = new MetaDataManager(this); backstory = new BackstoryManager(this); backstory.SpawnSetup(); work.SpawnSetup(); base.SpawnSetup(); drawManager.SpawnSetup(); }
private void Notify_RepairStationDespawned() { ListerDroids.DeregisterRepairStation(this); ReactivateDroid(true); if (suppliers.Count > 0) { foreach (var s in suppliers) { s.Notify_RepairStationDespawned(this); } } }
public Dialog_AddBill(AssemblyStation assembly, string fileName) { _assembly = assembly; _fileName = fileName; _name = ListerDroids.GetNumberedName(); base.SetCentered(280f, 175f); this.drawPriority = 2000; this.closeOnEscapeKey = true; this.doCloseX = true; this.absorbAllInput = true; this.clearNonEditWindows = false; this.forcePause = true; }
public override void PostSpawnSetup() { base.PostSpawnSetup(); if (!initialised) { EndCharge(); initialised = true; } ListerDroids.RegisterCharger(parent); if (Power != null) { Power.powerOutputInt = -1f; } }
public override void Destroy(DestroyMode mode = DestroyMode.Vanish) { ListerDroids.DeregisterDroid(this); base.Destroy(mode); if (mode == DestroyMode.Kill) { Messages.Message(this.LabelBase + " was destroyed!", MessageSound.Negative); if (meta.ExplodeOnDeath) { GenExplosion.DoExplosion(this.Position, meta.ExplosionRadius, DamageDefOf.Bomb, this); } } }
private void Notify_RepairStationSpawned() { ListerDroids.RegisterRepairStation(this); foreach (var c in GenAdj.CellsAdjacentCardinal(this)) { Building b = Find.ThingGrid.ThingAt <Building>(c); if (b != null) { CompRepairStationSupplier supplier = b.GetComp <CompRepairStationSupplier>(); if (supplier != null) { supplier.Notify_RepairStationSpawned(this); } } } }
public void CheckPowerRemaining() { if (!parent.playerController.Drafted) { if (parent.TotalCharge <= parent.meta.PowerCriticalThreshold && parent.CurJob.def != ChargeJob) { Thing target = ListerDroids.ClosestChargerFor(parent); if (target != null) { parent.jobs.StartJob(new Job(ChargeJob, new TargetInfo(target)), JobCondition.InterruptForced); } } } if (parent.TotalCharge < 1f) { Disable("DroidOutOfPower".Translate(), "DeactivatedNoPower".Translate(), true); } }
public ListerDroids() { ListerDroids.listerDroids = this; }
public override void DeSpawn() { ListerDroids.DeregisterDroid(this); base.DeSpawn(); }