From e2142405c4822c6d761e4bb889829439316ec43d Mon Sep 17 00:00:00 2001 From: Mith <25213249+MrMith@users.noreply.github.com> Date: Mon, 24 Dec 2018 14:50:21 -0600 Subject: [PATCH] Fixed spawning command (how long was that hecked up? yikes) and end round conditions should workTM --- README.md | 3 +- SCP-343/SCP_343.cs | 6 +-- SCP-343/SCP_343Commands.cs | 9 ++-- SCP-343/SCP_343EventLogic.cs | 96 +++++++++++++++++++++++------------- 4 files changed, 71 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index aa2ecdc..75367cf 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,9 @@ Put SCP-343.dll under the release tab into sm_plugins folder. | :---: | :---: | :---: | :---: | | scp343_spawnchance | Float | 10 | Percent chance for SPC-343 to spawn at the start of the round. | | scp343_opendoortime | Integer | 300 | How many seconds after roundstart till SCP-343 can open any door in the game (Like door bypass). | -| scp343_hp | Integer | -1 | How much health should SCP-343 have, set to -1 for GodMode. | +| scp343_hp | Integer | -1 | How much health should SCP-343 have. Set to -1 for GodMode. | | scp343_nuke_interact | Boolean | false | Should SCP-343 beable to interact with the nuke? | +| scp343_ispassive | Boolean | false | Should SCP-343 be a passive SCP? (Do you need to kill him to end the round.)| | scp343_itemconverttoggle | Boolean | false | Should SPC-343 convert items? | | scp343_itemdroplist | Integer List | 0,1,2,3,4,5,6,7,8,9,10,11,14,17,19,22,27,28,29 | What items SCP-343 drops instead of picking up.| | scp343_itemstoconvert | Integer List | 13,16,20,21,23,24,25,26,30 | What items SCP-343 converts. | diff --git a/SCP-343/SCP_343.cs b/SCP-343/SCP_343.cs index 0cd1700..9b1b105 100644 --- a/SCP-343/SCP_343.cs +++ b/SCP-343/SCP_343.cs @@ -10,10 +10,10 @@ 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.3.2", + version = "1.3.3", SmodMajor = 3, SmodMinor = 2, - SmodRevision = 0 + SmodRevision = 1 )] class SCP343 : Plugin { @@ -60,7 +60,7 @@ public override void Register() this.AddConfig(new Smod2.Config.ConfigSetting("scp343_spawnchance", 10f, Smod2.Config.SettingType.FLOAT, true, "Percent chance for SPC-343 to spawn at the start of the round.")); this.AddConfig(new Smod2.Config.ConfigSetting("scp343_itemconverttoggle", false, Smod2.Config.SettingType.BOOL, true, "Should SPC-343 convert items?")); this.AddConfig(new Smod2.Config.ConfigSetting("scp343_opendoortime", 300, Smod2.Config.SettingType.NUMERIC, true, "How long in seconds till SPC-343 can open any door.")); - this.AddConfig(new Smod2.Config.ConfigSetting("scp343_hp", -1, Smod2.Config.SettingType.NUMERIC, true, "How much health should SCP-343 have. Set to -1 for GodMode.")); + this.AddConfig(new Smod2.Config.ConfigSetting("scp343_hp", -1, Smod2.Config.SettingType.NUMERIC, true, "How much health should SCP-343 have. Set to -1 for GodMode and if set to anything but -1 then he is counted as a normal SCP and MTF must kill him like a normal SCP.")); this.AddConfig(new Smod2.Config.ConfigSetting("scp343_nuke_interact", false, Smod2.Config.SettingType.BOOL, true, "Should SPC-343 beable to interact with the nuke.")); this.AddConfig(new Smod2.Config.ConfigSetting("scp343_disable", false, Smod2.Config.SettingType.BOOL, true, "Should SPC-343 beable to interact with the nuke.")); this.AddConfig(new Smod2.Config.ConfigSetting("scp343_debug", false, Smod2.Config.SettingType.BOOL, true, "Internal testing config so I stop pushing commits that are broken >:(")); diff --git a/SCP-343/SCP_343Commands.cs b/SCP-343/SCP_343Commands.cs index 38cbc80..9e40f92 100644 --- a/SCP-343/SCP_343Commands.cs +++ b/SCP-343/SCP_343Commands.cs @@ -29,9 +29,11 @@ public string[] OnCall(ICommandSender sender, string[] args) { if (args.Length > 0) { + Regex regex = new Regex(@"\D+"); + string PlayerIDString = regex.Replace(args[0],""); + foreach (Player Playa in PluginManager.Manager.Server.GetPlayers()) { - string PlayerIDString = Regex.Match(args[0], @"\d+").Value; if (Int32.TryParse(PlayerIDString, out int PlayerIDInt)) { if (Playa.PlayerId == PlayerIDInt) @@ -42,16 +44,15 @@ public string[] OnCall(ICommandSender sender, string[] args) { Playa.SetHealth(EventLogic._343Config.SCP343_HP); } - + SCP343.Active343AndBadgeDict.Add(Playa.SteamId, new SCP343.PlayerInfo(Playa.GetUserGroup().Name, Playa.GetUserGroup().Color)); Playa.SetRank("red", "SCP-343"); return new string[] { "Made " + Playa.Name + " SCP343!" }; } } - return new string[] {"Couldn't parse playerid."}; } - return new string[] { "" }; + return new string[] { "Couldn't parse playerid." }; } else { return new string[] { "You must put a playerid." }; } } diff --git a/SCP-343/SCP_343EventLogic.cs b/SCP-343/SCP_343EventLogic.cs index 4fd090d..4841a64 100644 --- a/SCP-343/SCP_343EventLogic.cs +++ b/SCP-343/SCP_343EventLogic.cs @@ -216,56 +216,82 @@ public void OnCheckEscape(PlayerCheckEscapeEvent ev) #region OnCheckRoundEnd /// - /// Checks all teams to do custom round end if 343 is alive and all MTF for example. + /// Checks all teams to do custom round end if 343 is alive and all MTF for example, and if hp is set to anything but -1 then he is counted as a normal SCP and MTF must kill him like a normal SCP. /// public void OnCheckRoundEnd(CheckRoundEndEvent ev) { - if (SCP343.Active343AndBadgeDict.Count >= 1 && !_343Config.scp343_debug && _343Config.SCP343_HP == -1) + if (SCP343.Active343AndBadgeDict.Count >= 1 && !_343Config.scp343_debug) { SCP343.teamAliveCount.Clear(); - foreach(Team team in Enum.GetValues(typeof(Team))) + foreach (Team team in Enum.GetValues(typeof(Team))) { SCP343.teamAliveCount[team] = 0; } - foreach(Player player in PluginManager.Manager.Server.GetPlayers()) + foreach (Player player in PluginManager.Manager.Server.GetPlayers()) { SCP343.teamAliveCount[player.TeamRole.Team]++; + } - if (SCP343.teamAliveCount[Team.SCP] == 0 - && SCP343.teamAliveCount[Team.CHAOS_INSURGENCY] == 0 - && SCP343.teamAliveCount[Team.CLASSD] == SCP343.Active343AndBadgeDict.Count - && SCP343.teamAliveCount[Team.SCIENTIST] == 0) - { - 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 (SCP343.teamAliveCount[Team.SCP] == 0 - && SCP343.teamAliveCount[Team.CLASSD] == SCP343.Active343AndBadgeDict.Count - && SCP343.teamAliveCount[Team.SCIENTIST] == 0 - && SCP343.teamAliveCount[Team.NINETAILFOX] == 0) - { - ev.Status = ROUND_END_STATUS.CI_VICTORY; - Smod2.PluginManager.Manager.Server.Round.Stats.ScientistsEscaped = 0; - }//If SCPs, ClassD, Scientists and MTF are dead then Chaos win. - else if (SCP343.teamAliveCount[Team.NINETAILFOX] == 0 - && SCP343.teamAliveCount[Team.CHAOS_INSURGENCY] == 0 - && SCP343.teamAliveCount[Team.CLASSD] == SCP343.Active343AndBadgeDict.Count - && SCP343.teamAliveCount[Team.SCIENTIST] == 0) + if (_343Config.SCP343_HP == -1) { - ev.Status = ROUND_END_STATUS.SCP_VICTORY; - Smod2.PluginManager.Manager.Server.Round.Stats.ClassDEscaped = 0; - Smod2.PluginManager.Manager.Server.Round.Stats.ScientistsEscaped = 0; - } //If MTF, Chaos, ClassD and Scientists are dead then SCPs win. - else if (SCP343.teamAliveCount[Team.NINETAILFOX] == 0 - && SCP343.teamAliveCount[Team.CLASSD] == SCP343.Active343AndBadgeDict.Count - && SCP343.teamAliveCount[Team.SCIENTIST] == 0) + if (SCP343.teamAliveCount[Team.SCP] == 0 + && SCP343.teamAliveCount[Team.CHAOS_INSURGENCY] == 0 + && SCP343.teamAliveCount[Team.CLASSD] == SCP343.Active343AndBadgeDict.Count + && SCP343.teamAliveCount[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 (SCP343.teamAliveCount[Team.SCP] == 0 + && SCP343.teamAliveCount[Team.CLASSD] == SCP343.Active343AndBadgeDict.Count + && SCP343.teamAliveCount[Team.SCIENTIST] == 0 + && SCP343.teamAliveCount[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 (SCP343.teamAliveCount[Team.NINETAILFOX] == 0 + && SCP343.teamAliveCount[Team.CHAOS_INSURGENCY] == 0 + && SCP343.teamAliveCount[Team.CLASSD] == SCP343.Active343AndBadgeDict.Count + && SCP343.teamAliveCount[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 (SCP343.teamAliveCount[Team.NINETAILFOX] == 0 + && SCP343.teamAliveCount[Team.CLASSD] == SCP343.Active343AndBadgeDict.Count + && SCP343.teamAliveCount[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_CI_VICTORY; + }//If MTF, ClassD and Scientists are dead then SCPS & Chaos win. + } + else { - ev.Status = ROUND_END_STATUS.SCP_CI_VICTORY; - Smod2.PluginManager.Manager.Server.Round.Stats.ClassDEscaped = 0; - Smod2.PluginManager.Manager.Server.Round.Stats.ScientistsEscaped = 0; - }//If MTF, ClassD and Scientists are dead then SCPS & Chaos win. + if (SCP343.teamAliveCount[Team.NINETAILFOX] == 0 + && SCP343.teamAliveCount[Team.CHAOS_INSURGENCY] == 0 + && SCP343.teamAliveCount[Team.CLASSD] == SCP343.Active343AndBadgeDict.Count + && SCP343.teamAliveCount[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 (SCP343.teamAliveCount[Team.NINETAILFOX] == 0 + && SCP343.teamAliveCount[Team.CLASSD] == SCP343.Active343AndBadgeDict.Count + && SCP343.teamAliveCount[Team.SCIENTIST] == 0) + { + Smod2.PluginManager.Manager.Server.Round.Stats.ClassDEscaped = 1; + Smod2.PluginManager.Manager.Server.Round.Stats.ScientistsEscaped = 0; + ev.Status = ROUND_END_STATUS.SCP_CI_VICTORY; + }//If MTF, ClassD and Scientists are dead then SCPS & Chaos win. + } } } #endregion