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; } } }
// // 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; } }
// // Static Methods // public static ArcBaseRobot CreateRobot(string pawnDefName, IntVec3 position, Map map) { return(Building_BaseRobotCreator.CreateRobot(pawnDefName, position, map, Faction.OfPlayer)); }