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 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 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 StartCooldown(float cooldown) { this.IsCompromised = true; yield return((object)CoroutineEx.waitForSeconds(cooldown)); this.IsCompromised = false; }
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 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); } } } } }