// ######## Tick ######## // public override void Tick() { // Check if a new building is cutting the laser fence. if ((Find.TickManager.TicksGame % 30) == 0) { if (this.Position.GetEdifice() != null) { if (pylon != null) { pylon.InformEdificeIsBlocking(); } } } // Check if a plant or pawn is in the laser fence path. if ((Find.TickManager.TicksGame % 200) == 0) { List <Thing> thingList = this.Position.GetThingList(); for (int thingIndex = thingList.Count - 1; thingIndex >= 0; thingIndex--) { Thing thing = thingList[thingIndex]; if (thing is Plant) { FireUtility.TryStartFireIn(this.Position, 0.1f); break; } if (thing is Pawn) { FireUtility.TryAttachFire(thing, 0.1f); break; } } } }
// ######## Tick ######## // public override void Tick() { // Check if a new building is cutting the laser fence. if (Find.TickManager.TicksGame > this.nextBuildingCheckTick) { this.nextBuildingCheckTick = Find.TickManager.TicksGame + (GenTicks.TicksPerRealSecond / 2); if (this.Position.GetEdifice(this.Map) != null) { if (pylon != null) { pylon.InformEdificeIsBlocking(); } } } // Check if a plant or pawn is in the laser fence path. if (Find.TickManager.TicksGame > this.nextPlantCheckTick) { this.nextPlantCheckTick = Find.TickManager.TicksGame + GenTicks.TickRareInterval; List <Thing> thingList = this.Position.GetThingList(this.Map); for (int thingIndex = thingList.Count - 1; thingIndex >= 0; thingIndex--) { Thing thing = thingList[thingIndex]; if (thing is Plant) { FireUtility.TryStartFireIn(this.Position, this.Map, 0.1f); break; } if (thing is Pawn) { FireUtility.TryAttachFire(thing, 0.1f); break; } } } }