private static bool IsInit = false; // prevent on 2nd game ? public static void Init(int playerId) { /* * Should be safe to do multiple calls ... * - Depends on Map so need re apply on game change * - Should only be called once per game (mostly because of thread start) * * - Check: multiplayer local * - Called twice with 2 local players -> if below * - Each player triggers on connect ? */ /* I should put this all in the buff ?? Anythin here may be duplicate */ if (IsInit) { Printer.Write("Zombiome is already init !", playerId); // if (AutoStart) { // ZombiomeManager.Reset(playerId, ""); // } return; } Printer.Write("Zombiome.Init():", playerId); CSutils.Routines.Sanitizer.Fixer = () => ZombiomeManager._Reset(-1); CSutils.Catcher.SwallowErrors = SwallowError; rand = GameRandomManager.Instance.CreateGameRandom(); worldSeed = GamePrefs.GetString(EnumGamePrefs.WorldGenSeed); worldSize = GamePrefs.GetInt(EnumGamePrefs.WorldGenSize); ZBiomeInfo.Define(); if (nz4) { Zone.Get = Zone.GetFour; } else { Zone.Get = position => new Zone[] { Zone.GetSingle(position) } }; ZBActivity.ZombiomeActivitySelector.Initialize(); if (AutoStart) { ZombiomeManager.Reset(playerId, ""); } IsInit = true; // bugs on restart new game coz no one set to none - use World hash ? Printer.Write("Zombiome..Init: Done"); // ZombiomeManager.Start(playerId); // manually until release }
public override void Execute(List <string> _params, CommandSenderInfo _senderInfo) { // Debug.Log("ConsoleCmdZombiome"); // foreach (string p in _params) Debug.Log(p); // GameManager.Instance.World.aiDirector.GetComponent<AIDirectorWanderingHordeComponent>().SpawnWanderingHorde(false); // PersistentPlayerData x =_world.GetGameManager().GetPersistentLocalPlayer() List <EntityPlayerLocal> players = GameManager.Instance.World.GetLocalPlayers(); // multiple on console only? EntityPlayerLocal player = players[0]; Vector3 pos = player.GetPosition(); if (_params[0] == "select" || _params[0] == "sel") { ZBActivity.ZombiomeActivitySelector.SelectDebug(_params[1]); Zone.ClearCache(); return; } if (_params[0] == "log") // Set log level { Printer.level = int.Parse(_params[1]); return; } if (_params[0] == "f") // Debug: force activity { Zombiome.IgnoreScale = (_params.Count >= 2) ? bool.Parse(_params[1]) : !Zombiome.IgnoreScale; return; } if (_params[0] == "g") // Debug: select a ghost { ZBActivity.Entities.Ghost.ghost_type = (_params.Count >= 2) ? _params[1] : ""; return; } if (_params[0] == "w") // Debug: select a water block { ZBiomeInfo.force_water_block = (_params.Count >= 2) ? _params[1] : ""; return; } if (_params[0] == "nz") // Debug: restrict one zone { int nz = int.Parse(_params[1]); if (nz == 1) { Zone.Get = position => new Zone[] { Zone.GetSingle(position) } } ; if (nz == 4) { Zone.Get = Zone.GetFour; } return; } if (_params[0] == "start") { string res = (_params.Count > 1) ? _params[1] : ""; ZombiomeManager.Reset(player.entityId, res); } else if (_params[0] == "stop") { ZombiomeManager.Stop(player.entityId, true); // do not use this, it is definitive ! } else if (_params[0] == "pause") { ZombiomeManager.Stop(player.entityId, false); } } }