public void ResolveSpawn() { if (currentStatus == SpawnerStatus.Countdown && ticksUntilSpawned <= 0) { currentStatus = SpawnerStatus.Spawning; TrySpawnPawns(); } }
public StarVampireSpawn(PawnKindDef pkd, Faction fac, Map map, IntVec3 position, int num, int ticks) { starVampireSpawnType = pkd; starVampireFac = fac; mapLocation = map; positionToSpawn = position; numberToSpawn = num; ticksUntilSpawned = ticks; currentStatus = SpawnerStatus.Countdown; }
private void TrySpawnPawns() { for (int i = 0; i < numberToSpawn; i++) { int index = this.starVampireSpawnType.lifeStages.Count - 1; Pawn pawn = PawnGenerator.GeneratePawn(new PawnGenerationRequest(this.starVampireSpawnType, this.starVampireFac, PawnGenerationContext.NonPlayer, -1, false, false, false, false, true, false, 1f, false, true, true, true, false, false, false, false, 0f, 0f, null, 1f, null, null, null, null, null, new float?(this.starVampireSpawnType.race.race.lifeStageAges[index].minAge), null, null, null, null, null, null, null, false, false, false)); GenSpawn.Spawn(pawn, CellFinder.RandomClosewalkCellNear(this.positionToSpawn, this.mapLocation, 1, null), this.mapLocation, WipeMode.Vanish); Lord lord = mapLocation.GetComponent <MapComponent_StarVampireTracker>().GetStarVampireLord(pawn); lord.AddPawn(pawn); } currentStatus = SpawnerStatus.MarkedForRemoval; }
private void HandleSpawnerStatusMsg(InsightNetworkMessage netMsg) { SpawnerStatus message = netMsg.ReadMessage <SpawnerStatus>(); for (int i = 0; i < registeredSpawners.Count; i++) { if (registeredSpawners[i].connectionId == netMsg.connectionId) { SpawnerContainer instance = registeredSpawners[i]; instance.CurrentThreads = message.CurrentThreads; } } }