diff --git a/SCP-343/SCP-343.csproj b/SCP-343/SCP-343.csproj index 2d2323f..dd8b92e 100644 --- a/SCP-343/SCP-343.csproj +++ b/SCP-343/SCP-343.csproj @@ -41,6 +41,9 @@ false + + ..\..\..\..\steamcmd\steamapps\common\SCP Secret Laboratory\SCPSL_Data\Managed\Assembly-CSharp.dll + ..\..\..\..\steamcmd\steamapps\common\SCP Secret Laboratory\SCPSL_Data\Managed\Smod2.dll @@ -50,6 +53,18 @@ + + ..\..\..\..\steamcmd\steamapps\common\SCP Secret Laboratory\SCPSL_Data\Managed\UnityEngine.dll + + + ..\..\..\..\steamcmd\steamapps\common\SCP Secret Laboratory\SCPSL_Data\Managed\UnityEngine.CoreModule.dll + + + ..\..\..\..\steamcmd\steamapps\common\SCP Secret Laboratory\SCPSL_Data\Managed\UnityEngine.Networking.dll + + + ..\..\..\..\steamcmd\steamapps\common\SCP Secret Laboratory\SCPSL_Data\Managed\UnityEngine.PhysicsModule.dll + diff --git a/SCP-343/SCP_343.cs b/SCP-343/SCP_343.cs index ae4f189..0b4fea2 100644 --- a/SCP-343/SCP_343.cs +++ b/SCP-343/SCP_343.cs @@ -8,7 +8,7 @@ namespace SCP_343 name = "SCP-343", description = "SCP-343 is a passive immortal D-Class Personnel. He spawns with one Flashlight and any weapon he picks up is morphed to prevent violence. He seeks to help out who he deems worthy.", id = "Mith.SCP-343", - version = "1.4.0", + version = "1.4.1", SmodMajor = 3, SmodMinor = 4, SmodRevision = 0 diff --git a/SCP-343/SCP_343Commands.cs b/SCP-343/SCP_343Commands.cs index 5341943..61ea4ce 100644 --- a/SCP-343/SCP_343Commands.cs +++ b/SCP-343/SCP_343Commands.cs @@ -37,37 +37,37 @@ public string[] OnCall(ICommandSender sender, string[] args) Regex regex = new Regex(@"\D+"); string PlayerIDString = regex.Replace(args[0],""); - foreach (Player Playa in PluginManager.Manager.Server.GetPlayers()) + foreach (Player player in PluginManager.Manager.Server.GetPlayers()) { if (Int32.TryParse(PlayerIDString, out int PlayerIDInt)) { - if (Playa.PlayerId == PlayerIDInt) + if (player.PlayerId == PlayerIDInt) { - Playa.ChangeRole(Smod2.API.Role.CLASSD, true, true, true); - Playa.GiveItem(ItemType.FLASHLIGHT); + player.ChangeRole(Smod2.API.Role.CLASSD, true, true, true); + player.GiveItem(ItemType.FLASHLIGHT); if (pluginOptions.SCP343_HP != -1) { - Playa.SetHealth(pluginOptions.SCP343_HP); + player.SetHealth(pluginOptions.SCP343_HP); } - if (Playa.GetUserGroup().BadgeText == null) + if (player.GetUserGroup().BadgeText == null) { - Active343AndBadgeDict.Add(Playa.SteamId, new PlayerInfo("", "")); + Active343AndBadgeDict.Add(player.SteamId, new PlayerInfo("", "")); } else { - Active343AndBadgeDict.Add(Playa.SteamId, new PlayerInfo(Playa.GetUserGroup().BadgeText, Playa.GetUserGroup().Color)); + Active343AndBadgeDict.Add(player.SteamId, new PlayerInfo(player.GetUserGroup().BadgeText, player.GetUserGroup().Color)); } if (pluginOptions.SCP343_shouldbroadcast) { - Playa.PersonalBroadcast(5, "You're SCP-343! Check your console for more information about SCP-343.", true); - Playa.SendConsoleMessage("----------------------------------------------------------- \n" + pluginOptions.SCP343_broadcastinfo + "\n ----------------------------------------------------------- "); + player.PersonalBroadcast(5, "You're SCP-343! Check your console for more information about SCP-343.", true); + player.SendConsoleMessage("----------------------------------------------------------- \n" + pluginOptions.SCP343_broadcastinfo + "\n ----------------------------------------------------------- "); } - Playa.SetRank("red", "SCP-343"); - return new string[] { "Made " + Playa.Name + " SCP343!" }; + player.SetRank("red", "SCP-343"); + return new string[] { "Made " + player.Name + " SCP343!" }; } } } diff --git a/SCP-343/SCP_343EventLogic.cs b/SCP-343/SCP_343EventLogic.cs index 8b444c9..d52e2df 100644 --- a/SCP-343/SCP_343EventLogic.cs +++ b/SCP-343/SCP_343EventLogic.cs @@ -12,11 +12,13 @@ public class EventLogic : IEventHandlerPlayerPickupItem, IEventHandlerRoundStart { Random RNG = new Random(); + DateTime timeOnEvent = DateTime.Now; + public Dictionary Active343AndBadgeDict = new Dictionary(); - public Dictionary teamAliveCount = - new Dictionary(); + public Dictionary teamAliveCount = + new Dictionary(); public PluginOptions _343Config = new PluginOptions(); @@ -51,11 +53,11 @@ public void OnRoundStart(RoundStartEvent ev) return; } - foreach (Smod2.API.Player Playa in plugin.PluginManager.Server.GetPlayers()) + foreach (Smod2.API.Player player in plugin.PluginManager.Server.GetPlayers()) { - if (Playa.TeamRole.Role == Smod2.API.Role.CLASSD) + if (player.TeamRole.Role == Smod2.API.Role.CLASSD) { - DClassList.Add(Playa); + DClassList.Add(player); } } @@ -155,7 +157,7 @@ public void OnPlayerHurt(PlayerHurtEvent ev) { if (Active343AndBadgeDict.ContainsKey(ev.Player.SteamId)) { - if (ev.Attacker?.TeamRole.Team == Team.SCP) + if (ev.Attacker?.TeamRole.Team == Smod2.API.Team.SCP) { ev.Damage = 0; } @@ -241,48 +243,61 @@ public void OnCheckRoundEnd(CheckRoundEndEvent ev) if (Active343AndBadgeDict.Count >= 1 && !_343Config.SCP343_debug) { teamAliveCount.Clear(); - foreach (Team team in Enum.GetValues(typeof(Team))) + foreach (Smod2.API.Team team in Enum.GetValues(typeof(Smod2.API.Team))) { teamAliveCount[team] = 0; } foreach (Player player in PluginManager.Manager.Server.GetPlayers()) { + if (DateTime.Now >= timeOnEvent) + { + if (Active343AndBadgeDict.ContainsKey(player.SteamId)) + { + UnityEngine.GameObject playerGameObject = ((UnityEngine.GameObject)player.GetGameObject()); + if (playerGameObject?.GetComponent()?.NetworkMyText != "SCP-343" || playerGameObject?.GetComponent()?.NetworkMyColor != "red") + { + player.HideTag(false); + player.SetRank("red","SCP-343"); + timeOnEvent = DateTime.Now.AddSeconds(1); + } + } + } teamAliveCount[player.TeamRole.Team]++; } if (_343Config.SCP343_HP == -1) { - if (teamAliveCount[Team.SCP] == 0 - && teamAliveCount[Team.CHAOS_INSURGENCY] == 0 - && teamAliveCount[Team.CLASSD] == Active343AndBadgeDict.Count - && teamAliveCount[Team.SCIENTIST] == 0) + if (teamAliveCount[Smod2.API.Team.SCP] == 0 + && teamAliveCount[Smod2.API.Team.CHAOS_INSURGENCY] == 0 + && teamAliveCount[Smod2.API.Team.CLASSD] == Active343AndBadgeDict.Count + && teamAliveCount[Smod2.API.Team.SCIENTIST] == 0) { Smod2.PluginManager.Manager.Server.Round.Stats.ScientistsEscaped = 1; Smod2.PluginManager.Manager.Server.Round.Stats.ClassDEscaped = 0; ev.Status = ROUND_END_STATUS.MTF_VICTORY; }//If SCPs, Chaos, ClassD and Scientists are dead then MTF win. - else if (teamAliveCount[Team.SCP] == 0 - && teamAliveCount[Team.CLASSD] == Active343AndBadgeDict.Count - && teamAliveCount[Team.SCIENTIST] == 0 - && teamAliveCount[Team.NINETAILFOX] == 0) + else if (teamAliveCount[Smod2.API.Team.SCP] == 0 + && teamAliveCount[Smod2.API.Team.CLASSD] == Active343AndBadgeDict.Count + && teamAliveCount[Smod2.API.Team.SCIENTIST] == 0 + && teamAliveCount[Smod2.API.Team.NINETAILFOX] == 0) { Smod2.PluginManager.Manager.Server.Round.Stats.ClassDEscaped = 0; Smod2.PluginManager.Manager.Server.Round.Stats.ScientistsEscaped = 0; ev.Status = ROUND_END_STATUS.CI_VICTORY; }//If SCPs, ClassD, Scientists and MTF are dead then Chaos win. - else if (teamAliveCount[Team.NINETAILFOX] == 0 - && teamAliveCount[Team.CHAOS_INSURGENCY] == 0 - && teamAliveCount[Team.CLASSD] == Active343AndBadgeDict.Count - && teamAliveCount[Team.SCIENTIST] == 0) + else if (teamAliveCount[Smod2.API.Team.NINETAILFOX] == 0 + && teamAliveCount[Smod2.API.Team.CHAOS_INSURGENCY] == 0 + && teamAliveCount[Smod2.API.Team.CLASSD] == Active343AndBadgeDict.Count + && teamAliveCount[Smod2.API.Team.SCIENTIST] == 0) { Smod2.PluginManager.Manager.Server.Round.Stats.ClassDEscaped = 0; Smod2.PluginManager.Manager.Server.Round.Stats.ScientistsEscaped = 0; ev.Status = ROUND_END_STATUS.SCP_VICTORY; } //If MTF, Chaos, ClassD and Scientists are dead then SCPs win. - else if (teamAliveCount[Team.NINETAILFOX] == 0 - && teamAliveCount[Team.CLASSD] == Active343AndBadgeDict.Count - && teamAliveCount[Team.SCIENTIST] == 0) + else if (teamAliveCount[Smod2.API.Team.NINETAILFOX] == 0 + && teamAliveCount[Smod2.API.Team.CLASSD] == Active343AndBadgeDict.Count + && teamAliveCount[Smod2.API.Team.SCIENTIST] == 0) { Smod2.PluginManager.Manager.Server.Round.Stats.ClassDEscaped = 0; Smod2.PluginManager.Manager.Server.Round.Stats.ScientistsEscaped = 0; @@ -291,18 +306,18 @@ public void OnCheckRoundEnd(CheckRoundEndEvent ev) } else { - if (teamAliveCount[Team.NINETAILFOX] == 0 - && teamAliveCount[Team.CHAOS_INSURGENCY] == 0 - && teamAliveCount[Team.CLASSD] == Active343AndBadgeDict.Count - && teamAliveCount[Team.SCIENTIST] == 0) + if (teamAliveCount[Smod2.API.Team.NINETAILFOX] == 0 + && teamAliveCount[Smod2.API.Team.CHAOS_INSURGENCY] == 0 + && teamAliveCount[Smod2.API.Team.CLASSD] == Active343AndBadgeDict.Count + && teamAliveCount[Smod2.API.Team.SCIENTIST] == 0) { Smod2.PluginManager.Manager.Server.Round.Stats.ClassDEscaped = 0; Smod2.PluginManager.Manager.Server.Round.Stats.ScientistsEscaped = 0; ev.Status = ROUND_END_STATUS.SCP_VICTORY; } //If MTF, Chaos, ClassD and Scientists are dead then SCPs win. - else if (teamAliveCount[Team.NINETAILFOX] == 0 - && teamAliveCount[Team.CLASSD] == Active343AndBadgeDict.Count - && teamAliveCount[Team.SCIENTIST] == 0) + else if (teamAliveCount[Smod2.API.Team.NINETAILFOX] == 0 + && teamAliveCount[Smod2.API.Team.CLASSD] == Active343AndBadgeDict.Count + && teamAliveCount[Smod2.API.Team.SCIENTIST] == 0) { Smod2.PluginManager.Manager.Server.Round.Stats.ClassDEscaped = 1; Smod2.PluginManager.Manager.Server.Round.Stats.ScientistsEscaped = 0; @@ -346,13 +361,13 @@ public void OnPocketDimensionEnter(PlayerPocketDimensionEnterEvent ev) /// public void OnRoundEnd(RoundEndEvent ev) { - foreach (Player playa in Smod2.PluginManager.Manager.Server.GetPlayers()) + foreach (Player player in Smod2.PluginManager.Manager.Server.GetPlayers()) { - if (Active343AndBadgeDict.ContainsKey(playa.SteamId)) + if (Active343AndBadgeDict.ContainsKey(player.SteamId)) { - playa.SetRank(Active343AndBadgeDict[playa.SteamId].BadgeColor, Active343AndBadgeDict[playa.SteamId].BadgeName); - playa.SetHealth(100); - Active343AndBadgeDict.Remove(playa.SteamId); + player.SetRank(Active343AndBadgeDict[player.SteamId].BadgeColor, Active343AndBadgeDict[player.SteamId].BadgeName); + player.SetHealth(100); + Active343AndBadgeDict.Remove(player.SteamId); } } Active343AndBadgeDict.Clear();