private void Button_SpawnBot() { bool flag = this.robot != null || this.robotIsDestroyed; if (!flag) { bool flag2 = GenText.NullOrEmpty(this.spawnThingDef); if (flag2) { Log.Error("Robot Recharge Station: Wanted to spawn robot, but spawnThingDef is null or empty!"); } else { bool flag3 = !this.IsRobotInContainer(); ArcBaseRobot bot; if (flag3) { bot = Building_BaseRobotCreator.CreateRobot(this.spawnThingDef, base.Position, base.Map, Faction.OfPlayer); } else { bot = this.container [0]; this.container.Remove(bot); bot = (GenSpawn.Spawn(bot, base.Position, base.Map) as ArcBaseRobot); } this.robot = bot; this.robot.rechargeStation = this; this.robotSpawnedOnce = true; this.SpawnRobotAfterRecharge = true; } } }
public static ArcBaseRobot CreateRobot(string pawnDefName, IntVec3 position, Map map, Faction faction) { PawnKindDef named = DefDatabase <PawnKindDef> .GetNamed(pawnDefName, true); //PawnGenerationRequest pawnGenerationRequest = new PawnGenerationRequest (named, faction, 2, -1, true, true, false, false, false, false, 0, false, false, true, false, false, null, new float? (0), new float? (0), new Gender? (1), new float? (0), null); PawnGenerationRequest gen = new PawnGenerationRequest(named, faction, PawnGenerationContext.NonPlayer, -1, true, true, false, false, false, false, 0, false, false, true, false, false, false, false, null, 0, 0, 0, Gender.None, 0, null); ArcBaseRobot newThing = (ArcBaseRobot)PawnGenerator.GeneratePawn(gen); return((ArcBaseRobot)Building_BaseRobotCreator.Spawn(newThing, position, map)); }
// // Methods // public override void Tick() { bool flag = this.destroy; if (flag) { this.Destroy(0); } else { try { Building_BaseRobotCreator.CreateRobot("BaseRobot_Hauler", base.Position, base.Map); } catch (Exception ex) { Log.Error("Error while creating Robot." + ex.Message + "STACK: " + ex.StackTrace); } this.destroy = true; } }
public static Thing Spawn(Thing newThing, IntVec3 loc, Map map) { return(Building_BaseRobotCreator.Spawn(newThing, loc, map, Rot4.South)); }
// // Static Methods // public static ArcBaseRobot CreateRobot(string pawnDefName, IntVec3 position, Map map) { return(Building_BaseRobotCreator.CreateRobot(pawnDefName, position, map, Faction.OfPlayer)); }