private IEnumerator SpawnGroupTick() { SpawnHandler spawnHandler = null; while (true) { yield return(CoroutineEx.waitForEndOfFrame); if (spawnHandler.spawnTick && Spawn.respawn_groups) { yield return(CoroutineEx.waitForSeconds(1f)); for (int i = 0; i < spawnHandler.SpawnGroups.Count; i++) { ISpawnGroup item = spawnHandler.SpawnGroups[i]; if (item != null) { try { item.SpawnRepeating(); } catch (Exception exception) { UnityEngine.Debug.LogError(exception); } yield return(CoroutineEx.waitForEndOfFrame); } } } } }
private IEnumerator ServerRestartWarning(string info, int iSeconds) { if (iSeconds >= 0) { if (!string.IsNullOrEmpty(info)) { ConsoleNetwork.BroadcastToAllClients("chat.add", (object)0, (object)("<color=#fff>SERVER</color> Restarting: " + info)); } for (int i = iSeconds; i > 0; --i) { if (i == iSeconds || i % 60 == 0 || i < 300 && i % 30 == 0 || (i < 60 && i % 10 == 0 || i < 10)) { ConsoleNetwork.BroadcastToAllClients("chat.add", (object)0, (object)("<color=#fff>SERVER</color> Restarting in " + (object)i + " seconds!")); Debug.Log((object)("Restarting in " + (object)i + " seconds")); } yield return((object)CoroutineEx.waitForSeconds(1f)); } ConsoleNetwork.BroadcastToAllClients("chat.add", (object)0, (object)"<color=#fff>SERVER</color> Restarting"); yield return((object)CoroutineEx.waitForSeconds(2f)); foreach (BasePlayer basePlayer in BasePlayer.activePlayerList.ToArray()) { basePlayer.Kick("Server Restarting"); } yield return((object)CoroutineEx.waitForSeconds(1f)); ConsoleSystem.Run(ConsoleSystem.Option.get_Server(), "quit", (object[])Array.Empty <object>()); } }
private IEnumerator SpawnIndividualTick() { SpawnHandler spawnHandler = null; while (true) { yield return(CoroutineEx.waitForEndOfFrame); if (spawnHandler.spawnTick && Spawn.respawn_individuals) { yield return(CoroutineEx.waitForSeconds(Spawn.tick_individuals)); for (int i = 0; i < spawnHandler.SpawnIndividuals.Count; i++) { SpawnIndividual item = spawnHandler.SpawnIndividuals[i]; try { spawnHandler.Spawn(Prefab.Load <Spawnable>(item.PrefabID, null, null), item.Position, item.Rotation); } catch (Exception exception) { UnityEngine.Debug.LogError(exception); } yield return(CoroutineEx.waitForEndOfFrame); } } } }
private IEnumerator SpawnGroupTick() { label_1: do { yield return((object)CoroutineEx.waitForEndOfFrame); }while (!this.spawnTick || !Spawn.respawn_groups); yield return((object)CoroutineEx.waitForSeconds(1f)); for (int i = 0; i < this.SpawnGroups.Count; ++i) { ISpawnGroup spawnGroup = this.SpawnGroups[i]; if (spawnGroup != null) { try { spawnGroup.SpawnRepeating(); } catch (Exception ex) { Debug.LogError((object)ex); } yield return((object)CoroutineEx.waitForEndOfFrame); } } goto label_1; }
private IEnumerator SpawnRoundHelicopters() { int helicoptersToSpawn = Mathf.Max(1, Mathf.RoundToInt((float)maxHelicopters * ((float)currentRound / (float)rounds))); for (int i = 0; i < helicoptersToSpawn; i++) { Vector3 destination = _spawnSelectorA.GetSpawnPoint(); Vector2 random = (UnityEngine.Random.insideUnitCircle.normalized * Configuration.MaxTravelDistance); Vector3 position = destination + new Vector3(random.x, 50f, random.y); BaseHelicopter baseHelicopter = GameManager.server.CreateEntity(HELICOPTER_PREFAB, position) as BaseHelicopter; baseHelicopter.enableSaving = false; baseHelicopter.Spawn(); EventHelicopter eventHelicopter = baseHelicopter.gameObject.AddComponent <EventHelicopter>(); eventHelicopter.OnHelicopterSpawned(this, i + 1); eventHelicopter.Entity.health = heliHealth; eventHelicopter.Entity.SendNetworkUpdate(BasePlayer.NetworkQueue.Update); eventHelicopters.Add(eventHelicopter); yield return(CoroutineEx.waitForSeconds(1f)); eventHelicopter.SetPositionDestination(position, destination); } }
private IEnumerator StartCooldown(float cooldown) { this.IsCompromised = true; yield return((object)CoroutineEx.waitForSeconds(cooldown)); this.IsCompromised = false; }
private IEnumerator SpawnTick() { label_1: do { yield return((object)CoroutineEx.waitForEndOfFrame); }while (!this.spawnTick || !Spawn.respawn_populations); yield return((object)CoroutineEx.waitForSeconds(Spawn.tick_populations)); for (int i = 0; i < this.AllSpawnPopulations.Length; ++i) { SpawnPopulation allSpawnPopulation = this.AllSpawnPopulations[i]; if (!((BaseScriptableObject)allSpawnPopulation == (BaseScriptableObject)null)) { SpawnDistribution spawnDistribution = this.SpawnDistributions[i]; if (spawnDistribution != null) { try { if (this.SpawnDistributions != null) { this.SpawnRepeating(allSpawnPopulation, spawnDistribution); } } catch (Exception ex) { Debug.LogError((object)ex); } yield return((object)CoroutineEx.waitForEndOfFrame); } } } goto label_1; }
private IEnumerator StartCooldown(float cooldown) { CoverPoint coverPoint = null; coverPoint.IsCompromised = true; yield return(CoroutineEx.waitForSeconds(cooldown)); coverPoint.IsCompromised = false; }
private IEnumerator PlayEffects(HTNAnimal target) { while (this._isEffectRunning && Object.op_Inequality((Object)target, (Object)null) && (Object.op_Inequality((Object)((Component)target).get_transform(), (Object)null) && !target.IsDestroyed) && !target.IsDead()) { if (this.IdleEffect.isValid) { Effect.server.Run(this.IdleEffect.resourcePath, (BaseEntity)target, StringPool.Get("head"), Vector3.get_zero(), Vector3.get_zero(), (Connection)null, false); } yield return((object)CoroutineEx.waitForSeconds(Random.Range((float)this.IdleEffectRepeatRange.x, (float)(this.IdleEffectRepeatRange.y + 1.0)))); } }
private IEnumerator DespawnRoutine() { for (int i = _events.Count - 1; i >= 0; i--) { CrateEvent crateEvent = _events.ElementAt(i); crateEvent?.StopEvent(); yield return(CoroutineEx.waitForSeconds(0.25f)); } yield return(null); }
private IEnumerator SaveRegularly() { SaveRestore saveRestore = this; while (true) { do { yield return((object)CoroutineEx.waitForSeconds((float)ConVar.Server.saveinterval)); }while (!saveRestore.timedSave || saveRestore.timedSavePause > 0); yield return((object)((MonoBehaviour)saveRestore).StartCoroutine(saveRestore.DoAutomatedSave(false))); } }
private IEnumerator RadioChatter(HTNPlayer target) { ScientistAStarDefinition scientistAStarDefinition = null; while (scientistAStarDefinition._isRadioEffectRunning && target != null && target.transform != null && !target.IsDestroyed && !target.IsDead()) { if (scientistAStarDefinition.RadioEffect.isValid) { Effect.server.Run(scientistAStarDefinition.RadioEffect.resourcePath, target, StringPool.Get("head"), Vector3.zero, Vector3.zero, null, false); } float single = UnityEngine.Random.Range(scientistAStarDefinition.RadioEffectRepeatRange.x, scientistAStarDefinition.RadioEffectRepeatRange.y + 1f); yield return(CoroutineEx.waitForSeconds(single)); } }
private IEnumerator PlayEffects(HTNAnimal target) { BearDefinition bearDefinition = null; while (bearDefinition._isEffectRunning && target != null && target.transform != null && !target.IsDestroyed && !target.IsDead()) { if (bearDefinition.IdleEffect.isValid) { Effect.server.Run(bearDefinition.IdleEffect.resourcePath, target, StringPool.Get("head"), Vector3.zero, Vector3.zero, null, false); } float single = UnityEngine.Random.Range(bearDefinition.IdleEffectRepeatRange.x, bearDefinition.IdleEffectRepeatRange.y + 1f); yield return(CoroutineEx.waitForSeconds(single)); } }
private IEnumerator EquipWeapon(HTNPlayer target) { yield return(CoroutineEx.waitForSeconds(0.25f)); if (target == null || target.IsDestroyed || target.IsDead() || target.IsWounded() || target.inventory == null || target.inventory.containerBelt == null) { yield break; } Item item = target.inventory.containerBelt.GetSlot(0); if (item == null) { yield break; } target.UpdateActiveItem(item.uid); yield return(CoroutineEx.waitForSeconds(0.25f)); ScientistAStarDomain aiDomain = target.AiDomain as ScientistAStarDomain; if (aiDomain) { if (item.info.category == ItemCategory.Weapon) { BaseEntity heldEntity = item.GetHeldEntity(); if (heldEntity is BaseProjectile) { aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.ProjectileWeapon, true, true, true); aiDomain.ReloadFirearm(); } else if (heldEntity is BaseMelee) { aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.MeleeWeapon, true, true, true); } else if (heldEntity is ThrownWeapon) { aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.ThrowableWeapon, true, true, true); } } else if (item.info.category == ItemCategory.Medical) { aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.HealingItem, true, true, true); } else if (item.info.category == ItemCategory.Tool) { aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.LightSourceItem, true, true, true); } } }
private IEnumerator SpawnAI() { for (int i = 0; i < _settings.NpcCount; i++) { Vector3 position = GetPointNavmesh(_position, 8f, (360 / _settings.NpcCount * i)); if (position == Vector3.zero) { continue; } SpawnNpc(position, Quaternion.LookRotation(position - _position)); yield return(CoroutineEx.waitForSeconds(0.25f)); } }
private IEnumerator EquipWeapon(HTNPlayer target) { yield return((object)CoroutineEx.waitForSeconds(0.25f)); if (!Object.op_Equality((Object)target, (Object)null) && !target.IsDestroyed && (!target.IsDead() && !target.IsWounded()) && (!Object.op_Equality((Object)target.inventory, (Object)null) && target.inventory.containerBelt != null)) { Item slot = target.inventory.containerBelt.GetSlot(0); if (slot != null) { target.UpdateActiveItem(slot.uid); yield return((object)CoroutineEx.waitForSeconds(0.25f)); ScientistAStarDomain aiDomain = target.AiDomain as ScientistAStarDomain; if (Object.op_Implicit((Object)aiDomain)) { if (slot.info.category == ItemCategory.Weapon) { BaseEntity heldEntity = slot.GetHeldEntity(); if (heldEntity is BaseProjectile) { aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.ProjectileWeapon, true, true, true); aiDomain.ReloadFirearm(); } else if (heldEntity is BaseMelee) { aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.MeleeWeapon, true, true, true); } else if (heldEntity is ThrownWeapon) { aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.ThrowableWeapon, true, true, true); } } else if (slot.info.category == ItemCategory.Medical) { aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.HealingItem, true, true, true); } else if (slot.info.category == ItemCategory.Tool) { aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.LightSourceItem, true, true, true); } } } } }
private IEnumerator ServerRestartWarning(string info, int iSeconds) { int j = 0; if (iSeconds < 0) { yield break; } if (!string.IsNullOrEmpty(info)) { object[] objArray = new object[] { 0, string.Concat("<color=#fff>SERVER</color> Restarting: ", info) }; ConsoleNetwork.BroadcastToAllClients("chat.add", objArray); } for (int i = iSeconds; i > 0; i = j - 1) { if (i == iSeconds || i % 60 == 0 || i < 300 && i % 30 == 0 || i < 60 && i % 10 == 0 || i < 10) { object[] objArray1 = new object[] { 0, string.Format("<color=#fff>SERVER</color> Restarting in {0} seconds!", i) }; ConsoleNetwork.BroadcastToAllClients("chat.add", objArray1); UnityEngine.Debug.Log(string.Format("Restarting in {0} seconds", i)); } yield return(CoroutineEx.waitForSeconds(1f)); j = i; } object[] objArray2 = new object[] { 0, "<color=#fff>SERVER</color> Restarting" }; ConsoleNetwork.BroadcastToAllClients("chat.add", objArray2); yield return(CoroutineEx.waitForSeconds(2f)); BasePlayer[] array = BasePlayer.activePlayerList.ToArray(); for (j = 0; j < (int)array.Length; j++) { array[j].Kick("Server Restarting"); } yield return(CoroutineEx.waitForSeconds(1f)); ConsoleSystem.Run(ConsoleSystem.Option.Server, "quit", Array.Empty <object>()); }
private IEnumerator SpawnTick() { SpawnHandler spawnHandler = null; while (true) { yield return(CoroutineEx.waitForEndOfFrame); if (spawnHandler.spawnTick && Spawn.respawn_populations) { yield return(CoroutineEx.waitForSeconds(Spawn.tick_populations)); for (int i = 0; i < (int)spawnHandler.AllSpawnPopulations.Length; i++) { SpawnPopulation allSpawnPopulations = spawnHandler.AllSpawnPopulations[i]; if (allSpawnPopulations != null) { SpawnDistribution spawnDistributions = spawnHandler.SpawnDistributions[i]; if (spawnDistributions != null) { try { if (spawnHandler.SpawnDistributions != null) { spawnHandler.SpawnRepeating(allSpawnPopulations, spawnDistributions); } } catch (Exception exception) { UnityEngine.Debug.LogError(exception); } yield return(CoroutineEx.waitForEndOfFrame); } } } } } }
private IEnumerator ProcessInventoryResult(Inventory.Result result) { SteamInventory steamInventory = this; float count = 0.0f; while (result.get_IsPending()) { ++count; yield return((object)CoroutineEx.waitForSeconds(1f)); if ((double)count > 30.0) { Debug.LogFormat("Steam Inventory result timed out for {0}", new object[1] { (object)steamInventory.baseEntity.displayName }); } } if (result.get_Items() != null) { steamInventory.Items = result.get_Items(); } result.Dispose(); }
private IEnumerator SpawnIndividualTick() { label_1: do { yield return((object)CoroutineEx.waitForEndOfFrame); }while (!this.spawnTick || !Spawn.respawn_individuals); yield return((object)CoroutineEx.waitForSeconds(Spawn.tick_individuals)); for (int i = 0; i < this.SpawnIndividuals.Count; ++i) { SpawnIndividual spawnIndividual = this.SpawnIndividuals[i]; try { this.Spawn(Prefab.Load <Spawnable>(spawnIndividual.PrefabID, (GameManager)null, (PrefabAttribute.Library)null), spawnIndividual.Position, spawnIndividual.Rotation); } catch (Exception ex) { Debug.LogError((object)ex); } yield return((object)CoroutineEx.waitForEndOfFrame); } goto label_1; }
private IEnumerator EquipTool(HTNPlayer target) { yield return((object)CoroutineEx.waitForSeconds(0.25f)); if (!Object.op_Equality((Object)target, (Object)null) && !target.IsDestroyed && (!target.IsDead() && !target.IsWounded()) && (!Object.op_Equality((Object)target.inventory, (Object)null) && target.inventory.containerBelt != null)) { int slot1 = 1; if (Object.op_Inequality((Object)TOD_Sky.get_Instance(), (Object)null) && TOD_Sky.get_Instance().get_IsNight()) { slot1 = 2; } Item slot = target.inventory.containerBelt.GetSlot(slot1); if (slot == null) { slot = target.inventory.containerBelt.GetSlot(0); if (slot == null) { yield break; } } target.UpdateActiveItem(slot.uid); yield return((object)CoroutineEx.waitForSeconds(0.25f)); ScientistJunkpileDomain aiDomain = target.AiDomain as ScientistJunkpileDomain; if (Object.op_Implicit((Object)aiDomain)) { if (slot.info.category == ItemCategory.Weapon) { BaseEntity heldEntity = slot.GetHeldEntity(); if (heldEntity is BaseProjectile) { aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.ProjectileWeapon, true, true, true); aiDomain.ReloadFirearm(); } else if (heldEntity is BaseMelee) { aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.MeleeWeapon, true, true, true); } else if (heldEntity is ThrownWeapon) { aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.ThrowableWeapon, true, true, true); } } else if (slot.info.category == ItemCategory.Medical) { aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.HealingItem, true, true, true); } else if (slot.info.category == ItemCategory.Tool) { HeldEntity heldEntity = target.GetHeldEntity(); if (Object.op_Inequality((Object)heldEntity, (Object)null) && heldEntity.LightsOn()) { aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.LightSourceItem, true, true, true); } else { aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.ResearchItem, true, true, true); } } } } }
public static IEnumerator StartServer(bool doLoad, string saveFileOverride, bool allowOutOfDateSaves) { float single = UnityEngine.Time.timeScale; if (ConVar.Time.pausewhileloading) { UnityEngine.Time.timeScale = 0f; } RCon.Initialize(); BaseEntity.Query.Server = new BaseEntity.Query.EntityTree(8096f); if (SingletonComponent <WorldSetup> .Instance) { yield return(SingletonComponent <WorldSetup> .Instance.StartCoroutine(SingletonComponent <WorldSetup> .Instance.InitCoroutine())); } if (SingletonComponent <DynamicNavMesh> .Instance && SingletonComponent <DynamicNavMesh> .Instance.enabled && !AiManager.nav_disable) { yield return(SingletonComponent <DynamicNavMesh> .Instance.StartCoroutine(SingletonComponent <DynamicNavMesh> .Instance.UpdateNavMeshAndWait())); } if (SingletonComponent <AiManager> .Instance && SingletonComponent <AiManager> .Instance.enabled) { SingletonComponent <AiManager> .Instance.Initialize(); if (!AiManager.nav_disable && AI.npc_enable && TerrainMeta.Path != null) { foreach (MonumentInfo monument in TerrainMeta.Path.Monuments) { if (!monument.HasNavmesh) { continue; } yield return(monument.StartCoroutine(monument.GetMonumentNavMesh().UpdateNavMeshAndWait())); } } } GameObject gameObject = GameManager.server.CreatePrefab("assets/bundled/prefabs/system/server.prefab", true); UnityEngine.Object.DontDestroyOnLoad(gameObject); ServerMgr component = gameObject.GetComponent <ServerMgr>(); component.Initialize(doLoad, saveFileOverride, allowOutOfDateSaves, false); yield return(CoroutineEx.waitForSecondsRealtime(0.1f)); ColliderGrid.RefreshAll(); yield return(CoroutineEx.waitForSecondsRealtime(0.1f)); SaveRestore.InitializeEntityLinks(); yield return(CoroutineEx.waitForSecondsRealtime(0.1f)); SaveRestore.InitializeEntitySupports(); yield return(CoroutineEx.waitForSecondsRealtime(0.1f)); SaveRestore.InitializeEntityConditionals(); yield return(CoroutineEx.waitForSecondsRealtime(0.1f)); ColliderGrid.RefreshAll(); yield return(CoroutineEx.waitForSecondsRealtime(0.1f)); SaveRestore.GetSaveCache(); yield return(CoroutineEx.waitForSecondsRealtime(0.1f)); component.OpenConnection(); if (ConVar.Time.pausewhileloading) { UnityEngine.Time.timeScale = single; } Bootstrap.WriteToLog("Server startup complete"); }
public static IEnumerator StartServer( bool doLoad, string saveFileOverride, bool allowOutOfDateSaves) { float timeScale = Time.get_timeScale(); if (Time.pausewhileloading) { Time.set_timeScale(0.0f); } RCon.Initialize(); BaseEntity.Query.Server = new BaseEntity.Query.EntityTree(8096f); if (Object.op_Implicit((Object)SingletonComponent <WorldSetup> .Instance)) { yield return((object)((MonoBehaviour)SingletonComponent <WorldSetup> .Instance).StartCoroutine(((WorldSetup)SingletonComponent <WorldSetup> .Instance).InitCoroutine())); } if (Object.op_Implicit((Object)SingletonComponent <DynamicNavMesh> .Instance) && ((Behaviour)SingletonComponent <DynamicNavMesh> .Instance).get_enabled() && !AiManager.nav_disable) { yield return((object)((MonoBehaviour)SingletonComponent <DynamicNavMesh> .Instance).StartCoroutine(((DynamicNavMesh)SingletonComponent <DynamicNavMesh> .Instance).UpdateNavMeshAndWait())); } if (Object.op_Implicit((Object)SingletonComponent <AiManager> .Instance) && ((Behaviour)SingletonComponent <AiManager> .Instance).get_enabled()) { ((AiManager)SingletonComponent <AiManager> .Instance).Initialize(); if (!AiManager.nav_disable && AI.npc_enable && Object.op_Inequality((Object)TerrainMeta.Path, (Object)null)) { foreach (MonumentInfo monument in TerrainMeta.Path.Monuments) { if (monument.HasNavmesh) { yield return((object)monument.StartCoroutine(monument.GetMonumentNavMesh().UpdateNavMeshAndWait())); } } } } GameObject prefab = GameManager.server.CreatePrefab("assets/bundled/prefabs/system/server.prefab", true); Object.DontDestroyOnLoad((Object)prefab); ServerMgr serverMgr = (ServerMgr)prefab.GetComponent <ServerMgr>(); serverMgr.Initialize(doLoad, saveFileOverride, allowOutOfDateSaves, false); yield return((object)CoroutineEx.waitForSecondsRealtime(0.1f)); ColliderGrid.RefreshAll(); yield return((object)CoroutineEx.waitForSecondsRealtime(0.1f)); SaveRestore.InitializeEntityLinks(); yield return((object)CoroutineEx.waitForSecondsRealtime(0.1f)); SaveRestore.InitializeEntitySupports(); yield return((object)CoroutineEx.waitForSecondsRealtime(0.1f)); SaveRestore.InitializeEntityConditionals(); yield return((object)CoroutineEx.waitForSecondsRealtime(0.1f)); ColliderGrid.RefreshAll(); yield return((object)CoroutineEx.waitForSecondsRealtime(0.1f)); SaveRestore.GetSaveCache(); yield return((object)CoroutineEx.waitForSecondsRealtime(0.1f)); serverMgr.OpenConnection(); if (Time.pausewhileloading) { Time.set_timeScale(timeScale); } Bootstrap.WriteToLog("Server startup complete"); }
internal PausableTask() { _stopped = true; _enumeratorWrap = EnumeratorWrapper(); _enumerator = new CoroutineEx(); }
public static IEnumerator StartServer(bool doLoad, string saveFileOverride, bool allowOutOfDateSaves) { float timeScale = UnityEngine.Time.timeScale; if (ConVar.Time.pausewhileloading) { UnityEngine.Time.timeScale = 0f; } RCon.Initialize(); BaseEntity.Query.Server = new BaseEntity.Query.EntityTree(8096f); if ((bool)SingletonComponent <WorldSetup> .Instance) { yield return(SingletonComponent <WorldSetup> .Instance.StartCoroutine(SingletonComponent <WorldSetup> .Instance.InitCoroutine())); } if ((bool)SingletonComponent <DynamicNavMesh> .Instance && SingletonComponent <DynamicNavMesh> .Instance.enabled && !AiManager.nav_disable) { yield return(SingletonComponent <DynamicNavMesh> .Instance.StartCoroutine(SingletonComponent <DynamicNavMesh> .Instance.UpdateNavMeshAndWait())); } if ((bool)SingletonComponent <AiManager> .Instance && SingletonComponent <AiManager> .Instance.enabled) { SingletonComponent <AiManager> .Instance.Initialize(); if (!AiManager.nav_disable && AI.npc_enable && TerrainMeta.Path != null) { foreach (MonumentInfo monument in TerrainMeta.Path.Monuments) { if (monument.HasNavmesh) { yield return(monument.StartCoroutine(monument.GetMonumentNavMesh().UpdateNavMeshAndWait())); } } if ((bool)TerrainMeta.Path && (bool)TerrainMeta.Path.DungeonRoot) { DungeonNavmesh dungeonNavmesh = TerrainMeta.Path.DungeonRoot.AddComponent <DungeonNavmesh>(); dungeonNavmesh.NavMeshCollectGeometry = NavMeshCollectGeometry.PhysicsColliders; dungeonNavmesh.LayerMask = 65537; yield return(dungeonNavmesh.StartCoroutine(dungeonNavmesh.UpdateNavMeshAndWait())); } else { Debug.LogError("Failed to find DungeonRoot, NOT generating Dungeon navmesh"); } } } GameObject gameObject = GameManager.server.CreatePrefab("assets/bundled/prefabs/system/server.prefab"); Object.DontDestroyOnLoad(gameObject); ServerMgr serverMgr = gameObject.GetComponent <ServerMgr>(); serverMgr.Initialize(doLoad, saveFileOverride, allowOutOfDateSaves); yield return(CoroutineEx.waitForSecondsRealtime(0.1f)); SaveRestore.InitializeEntityLinks(); yield return(CoroutineEx.waitForSecondsRealtime(0.1f)); SaveRestore.InitializeEntitySupports(); yield return(CoroutineEx.waitForSecondsRealtime(0.1f)); SaveRestore.InitializeEntityConditionals(); yield return(CoroutineEx.waitForSecondsRealtime(0.1f)); SaveRestore.GetSaveCache(); yield return(CoroutineEx.waitForSecondsRealtime(0.1f)); BaseGameMode.CreateGameMode(); yield return(CoroutineEx.waitForSecondsRealtime(0.1f)); serverMgr.OpenConnection(); CompanionServer.Server.Initialize(); using (BenchmarkTimer.New("Boombox.LoadStations")) { BoomBox.LoadStations(); } if (ConVar.Time.pausewhileloading) { UnityEngine.Time.timeScale = timeScale; } WriteToLog("Server startup complete"); }