public override void TryExecute() { RimWorld.Tornado tornado = (RimWorld.Tornado)GenSpawn.Spawn(ThingDefOf.Tornado, loc, map); string text = "A mobile, destructive vortex of violently rotating winds have appeard. Seek safe shelter!"; Find.LetterStack.ReceiveLetter("Tornado", text, LetterDefOf.NegativeEvent, tornado); }
public override void TryExecute() { int count = 0; List <Thing> tornados = new List <Thing>(); while (CellFinder.TryFindRandomCellInsideWith(cellRect, (IntVec3 x) => this.CanSpawnTornadoAt(x, map), out loc) && count < 3) { count++; RimWorld.Tornado tornado = (RimWorld.Tornado)GenSpawn.Spawn(ThingDefOf.Tornado, loc, map); tornados.Add(tornado); } string text = "A mobile, destructive vortex of violently rotating winds have appeard. Seek safe shelter!"; Find.LetterStack.ReceiveLetter("Tornados", text, LetterDefOf.NegativeEvent, tornados); }
public override void Execute(string displayName) { CellRect cellRect = CellRect.WholeMap(Find.CurrentMap).ContractedBy(30); if (cellRect.IsEmpty) { cellRect = CellRect.WholeMap(Find.CurrentMap); } if (!CellFinder.TryFindRandomCellInsideWith(cellRect, (IntVec3 x) => CanSpawnTornadoAt(x, Find.CurrentMap), out IntVec3 location)) { Log.Error("Cannot find location to spawn tornado"); return; } RimWorld.Tornado tornado = (RimWorld.Tornado)GenSpawn.Spawn(ThingDefOf.Tornado, location, Find.CurrentMap, WipeMode.Vanish); Find.LetterStack.ReceiveLetter("Tornado", "A mobile, destructive vortext of violently rotating winds have appeared. Seek shelter or flee!", LetterDefOf.ThreatBig); }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; CellRect cellRect = CellRect.WholeMap(map).ContractedBy(30); if (cellRect.IsEmpty) { cellRect = CellRect.WholeMap(map); } IntVec3 loc = default(IntVec3); if (!CellFinder.TryFindRandomCellInsideWith(cellRect, (Predicate <IntVec3>)((IntVec3 x) => this.CanSpawnTornadoAt(x, map)), out loc)) { return(false); } Tornado t = (Tornado)GenSpawn.Spawn(ThingDefOf.Tornado, loc, map); base.SendStandardLetter(t); return(true); }