void HandleIncidents() { if (incidentTickCounter++ < GenDate.TicksPerHour) { return; } incidentTickCounter = 0; if (ZombiesRising.ZombiesForNewIncident(this)) { var success = ZombiesRising.TryExecute(map, incidentInfo.parameters.incidentSize, IntVec3.Invalid); if (success == false) { Log.Warning("Incident creation failed. Most likely no valid spawn point found."); } } }
private void HandleIncidents() { if (incidentTickCounter++ < GenDate.TicksPerHour) { return; } incidentTickCounter = 0; var incidentSize = ZombiesRising.ZombiesForNewIncident(map); if (incidentSize > 0) { Log.Warning("Zombieland incident with " + incidentSize + " zombies"); var success = ZombiesRising.TryExecute(map, incidentSize); if (success == false) { Log.Warning("Incident creation failed. Most likely no valid spawn point found."); // TODO incident failed, so mark it for new executing asap } } }
protected override void DoListingItems() { base.DoListingItems(); if (Current.ProgramState != ProgramState.Playing) { return; } var map = Find.CurrentMap; if (map == null) { return; } DoGap(); DoLabel("Tools - Zombies"); DebugToolMap("Spawn: Zombie (dig out)", delegate { SpawnZombie(ZombieGenerator.ZombieType.Normal, false); }); DebugToolMap("Spawn: Zombie (standing)", delegate { SpawnZombie(ZombieGenerator.ZombieType.Normal, true); }); DebugToolMap("Spawn: Suicide bomber", delegate { SpawnZombie(ZombieGenerator.ZombieType.SuicideBomber, true); }); DebugToolMap("Spawn: Toxic Splasher", delegate { SpawnZombie(ZombieGenerator.ZombieType.ToxicSplasher, true); }); DebugToolMap("Spawn: Tanky Operator", delegate { SpawnZombie(ZombieGenerator.ZombieType.TankyOperator, true); }); DebugToolMap("Spawn: Miner", delegate { SpawnZombie(ZombieGenerator.ZombieType.Miner, true); }); DebugToolMap("Spawn: Random zombie", delegate { SpawnZombie(ZombieGenerator.ZombieType.Random, true); }); DebugToolMap("Spawn: Zombie incident (4)", delegate { ZombiesRising.TryExecute(map, 4, UI.MouseCell(), true); }); DebugToolMap("Spawn: Zombie incident (25)", delegate { ZombiesRising.TryExecute(map, 25, UI.MouseCell(), true); }); DebugToolMap("Spawn: Zombie incident (100)", delegate { ZombiesRising.TryExecute(map, 100, UI.MouseCell(), true); }); DebugToolMap("Spawn: Zombie incident (200)", delegate { ZombiesRising.TryExecute(map, 200, UI.MouseCell(), true); }); DebugToolMap("Convert: Make Zombie", delegate { foreach (var thing in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell())) { var pawn = thing as Pawn; if (pawn == null || pawn is Zombie) { continue; } Tools.ConvertToZombie(pawn, true); } }); DebugToolMap("Apply: Trigger rotting", delegate { foreach (var thing in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell())) { var compRottable = thing.TryGetComp <CompRottable>(); if (compRottable != null) { compRottable.RotProgress = compRottable.PropsRot.TicksToRotStart; } } }); DebugToolMap("Apply: Add infection", delegate { foreach (var thing in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell())) { var pawn = thing as Pawn; if (pawn == null || pawn is Zombie) { continue; } var bodyPart = pawn.health.hediffSet .GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Undefined) .FirstOrDefault(part => part.IsCorePart == false); if (bodyPart == null) { bodyPart = pawn.health.hediffSet .GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Undefined).RandomElement(); } var def = HediffDef.Named("ZombieBite"); var bite = (Hediff_Injury_ZombieBite)HediffMaker.MakeHediff(def, pawn, bodyPart); bite.mayBecomeZombieWhenDead = true; bite.TendDuration.ZombieInfector.MakeHarmfull(); var damageInfo = new DamageInfo(Tools.ZombieBiteDamageDef, 2); pawn.health.AddHediff(bite, bodyPart, damageInfo); } }); DebugToolMap("Apply: Remove infection", delegate { foreach (var thing in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell())) { var pawn = thing as Pawn; if (pawn == null || pawn is Zombie) { continue; } pawn.health.hediffSet .GetHediffs <Hediff_Injury_ZombieBite>() .Do(bite => { bite.mayBecomeZombieWhenDead = false; var tendDuration = bite.TryGetComp <HediffComp_Zombie_TendDuration>(); tendDuration.ZombieInfector.MakeHarmless(); }); } }); DebugToolMap("Apply: Zombie raging", delegate { foreach (var thing in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell())) { var zombie = thing as Zombie; if (zombie == null) { continue; } ZombieStateHandler.StartRage(zombie); } }); }