private void RoundStart() { foreach (var point in PluginClass.Config.TranquilizerSpawns) { var item = new SynapseItem(PluginClass.TranquilizerID, 18, 0, 0, 0); item.Position = point.Parse().Position; item.Drop(); } }
public void Spawn035Item() { RemoveScp035Items(); if (Server.Get.GetPlayers(x => x.RoleID == (int)RoleType.Spectator && !x.OverWatch).Count < 1) { return; } for (int i = PluginClass.Config.Scp035ItemsAmount - Map.Get.Items.Where(x => IsScp035Item(x)).Count(); i > 0; i--) { if (PluginClass.Config.Possible035Items.Count < 1) { return; } var type = PluginClass.Config.Possible035Items.ElementAt(UnityEngine.Random.Range(0, PluginClass.Config.Possible035Items.Count)); var items = Map.Get.Items.Where(x => x.State == Synapse.Api.Enum.ItemState.Map); var pos = items.ElementAt(UnityEngine.Random.Range(0, items.Count())).Position; var item = new SynapseItem(type + 100); item.Drop(pos); } }
private static bool Prefix(CharacterClassManager __instance, bool lite, bool escape) { try { var player = __instance.GetPlayer(); var curRole = __instance.CurRole; if (!__instance._wasAnytimeAlive && player.RoleType != RoleType.Spectator && player.RoleType != RoleType.None) { __instance._wasAnytimeAlive = true; } __instance.InitSCPs(); __instance.AliveTime = 0f; if (player.Team - Team.RSC <= 1) { __instance.EscapeStartTime = (int)Time.realtimeSinceStartup; } try { __instance._hub.footstepSync.SetLoudness(curRole.team, curRole.roleId.Is939()); } catch { } if (NetworkServer.active) { player.Handcuffs.ClearTarget(); player.Handcuffs.NetworkCufferId = -1; player.Handcuffs.NetworkForceCuff = false; if (curRole.roleId != RoleType.Spectator && Respawning.RespawnManager.CurrentSequence() != Respawning.RespawnManager.RespawnSequencePhase.SpawningSelectedTeam && Respawning.NamingRules.UnitNamingManager.RolesWithEnforcedDefaultName.TryGetValue(curRole.roleId, out var spawnableTeamType) && Respawning.RespawnManager.Singleton.NamingManager.TryGetAllNamesFromGroup((byte)spawnableTeamType, out var array) && array.Length != 0) { __instance.NetworkCurSpawnableTeamType = (byte)spawnableTeamType; __instance.NetworkCurUnitName = array[0]; } else if (__instance.CurSpawnableTeamType != 0) { __instance.NetworkCurSpawnableTeamType = 0; __instance.NetworkCurUnitName = string.Empty; } } if (player.Team != Team.RIP) { if (NetworkServer.active && !lite) { player.PlayerMovementSync.OnPlayerClassChange(player.spawnPosition, player.spawnRotation); player.PlayerMovementSync.IsAFK = true; if (escape && CharacterClassManager.KeepItemsAfterEscaping) { for (var num = 0; num < 3; num++) { if (player.AmmoBox[num] >= 15) { var item = new SynapseItem(player.AmmoBox.types[num].inventoryID, player.AmmoBox[num], 0, 0, 0); item.Drop(player.spawnPosition); } } } player.AmmoBox.ResetAmmo(); if (!__instance.SpawnProtected && CharacterClassManager.EnableSP && CharacterClassManager.SProtectedTeam.Contains((int)curRole.team)) { __instance.GodMode = true; __instance.SpawnProtected = true; __instance.ProtectedTime = Time.time; } } if (!__instance.isLocalPlayer) { player.MaxHealth = curRole.maxHP; } } return(false); } catch (Exception e) { Logger.Get.Error($"Synapse-Event: PlayerSetClass(position) failed!!\n{e}\nStackTrace:\n{e.StackTrace}"); return(true); } }