Skip to content
This repository has been archived by the owner on Jul 8, 2021. It is now read-only.

Commit

Permalink
Added scp343_broadcast and scp343_broadcastinfo to give more informat…
Browse files Browse the repository at this point in the history
…ion to users about SCP-343
  • Loading branch information
MrMith committed Mar 21, 2019
1 parent 3e8327c commit 2d13948
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 28 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Put SCP-343.dll under the release tab into sm_plugins folder.
| scp343_itemstoconvert | Integer List | 13,16,20,21,23,24,25,26,30 | What items SCP-343 converts. |
| scp343_converteditems | Integer List | 15 | What a item should be converted to. |
| scp343_disable | Boolean | false | Disable all of SCP-343. |
| scp343_broadcast | Boolean | true | When 343 spawns should that person be given information about 343 |
| scp343_broadcastinfo | String | "" | What 343 is shown if scp343_broadcast is true. |
For more information about scp343_broadcastinfo see [This page](https://github.com/MrMith/SCP-343/wiki/scp343_broadcastinfo)

| Command(s) | Value Type | Description |
| :---: | :---: | :---: |
Expand Down
6 changes: 4 additions & 2 deletions SCP-343/SCP_343.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,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.3.7",
version = "1.3.8",
SmodMajor = 3,
SmodMinor = 3,
SmodRevision = 0
Expand Down Expand Up @@ -63,7 +63,9 @@ public override void Register()
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 >:("));

this.AddConfig(new Smod2.Config.ConfigSetting("scp343_broadcast", true, Smod2.Config.SettingType.BOOL, true, "When 343 spawns should that person be given information about 343"));
this.AddConfig(new Smod2.Config.ConfigSetting("scp343_broadcastinfo", "", Smod2.Config.SettingType.STRING, true, "What 343 is shown if scp343_broadcast is true."));

//https://github.com/Grover-c13/Smod2/wiki/Enum-Lists#itemtype
this.AddConfig(new Smod2.Config.ConfigSetting("scp343_itemdroplist", new int[] {0,1,2,3,4,5,6,7,8,9,10,11,14,17,19,22,27,28,29 }, Smod2.Config.SettingType.NUMERIC_LIST, true, "What items SCP-343 drops instead of picking up."));
this.AddConfig(new Smod2.Config.ConfigSetting("scp343_itemstoconvert", new int[]{13,16,20,21,23,24,25,26,30}, Smod2.Config.SettingType.NUMERIC_LIST, true, "What items SCP-343 converts."));
Expand Down
7 changes: 6 additions & 1 deletion SCP-343/SCP_343Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ public string[] OnCall(ICommandSender sender, string[] args)
{
SCP343.Active343AndBadgeDict.Add(Playa.SteamId, new SCP343.PlayerInfo(Playa.GetUserGroup().BadgeText, Playa.GetUserGroup().Color));
}


if (EventLogic._343Config.SCP343_shouldbroadcast)
{
Playa.PersonalBroadcast(5, "You're SCP-343! Check your console for more information about SCP-343.", true);
Playa.SendConsoleMessage("----------------------------------------------------------- \n" + EventLogic._343Config.SCP343_broadcastinfo + "\n ----------------------------------------------------------- ");
}

Playa.SetRank("red", "SCP-343");
return new string[] { "Made " + Playa.Name + " SCP343!" };
Expand Down
79 changes: 54 additions & 25 deletions SCP-343/SCP_343EventLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,16 @@ public void OnRoundStart(RoundStartEvent ev)

SCP343.Active343AndBadgeDict.Clear();

if (!(randomNumber <= (float)plugin.GetConfigFloat("scp343_spawnchance")))
{
return;
}

foreach (Smod2.API.Player Playa in plugin.pluginManager.Server.GetPlayers())
{
if (randomNumber <= (float)plugin.GetConfigFloat("scp343_spawnchance"))
if (Playa.TeamRole.Role == Smod2.API.Role.CLASSD)
{
if (Playa.TeamRole.Role == Smod2.API.Role.CLASSD)
{
DClassList.Add(Playa);
}
DClassList.Add(Playa);
}
}

Expand All @@ -64,6 +66,13 @@ public void OnRoundStart(RoundStartEvent ev)
SCP343.Active343AndBadgeDict.Add(TheChosenOne.SteamId, new SCP343.PlayerInfo(TheChosenOne.GetUserGroup().BadgeText, TheChosenOne.GetUserGroup().Color));
}
TheChosenOne.GiveItem(ItemType.FLASHLIGHT);

if (EventLogic._343Config.SCP343_shouldbroadcast)
{
TheChosenOne.PersonalBroadcast(5, "You're SCP-343! Check your console for more information about SCP-343.", true);
TheChosenOne.SendConsoleMessage("----------------------------------------------------------- \n" + EventLogic._343Config.SCP343_broadcastinfo + "\n ---------------------------------------------------------- - ");
}

if (_343Config.SCP343_HP != -1)
{
TheChosenOne.SetHealth(_343Config.SCP343_HP);
Expand Down Expand Up @@ -96,21 +105,21 @@ public void OnPlayerPickupItem(PlayerPickupItemEvent ev)
//plugin.Info((int)ev.Item.ItemType + ":" + ev.Item.ItemType.ToString().Length + ":" + ((int)ev.Item.ItemType).ToString().Length);
if (SCP343.Active343AndBadgeDict.ContainsKey(ev.Player.SteamId))
{
if (_343Config.SCP343_ConvertItems)
if (_343Config.SCP343_convertitems)
{
if (_343Config.itemConvertList.Contains((int)ev.Item.ItemType))
if (_343Config.ItemConvertList.Contains((int)ev.Item.ItemType))
{
ev.ChangeTo = (ItemType)_343Config.convertedItemList[RNG.Next(_343Config.convertedItemList.Length - 1)];
ev.ChangeTo = (ItemType)_343Config.ConvertedItemList[RNG.Next(_343Config.ConvertedItemList.Length - 1)];
}
if (_343Config.itemBlackList.Contains((int)ev.Item.ItemType))
if (_343Config.ItemBlackList.Contains((int)ev.Item.ItemType))
{
ev.Item.Drop();//Idk how to not have it picked up
ev.Allow = false;// This deletes the item :(
}
}
else if (_343Config.SCP343_ConvertItems == false && PluginManager.Manager.Server.Round.Duration >= 3)
else if (_343Config.SCP343_convertitems == false && PluginManager.Manager.Server.Round.Duration >= 3)
{
if (_343Config.itemBlackList.Contains((int)ev.Item.ItemType) || _343Config.itemConvertList.Contains((int)ev.Item.ItemType))
if (_343Config.ItemBlackList.Contains((int)ev.Item.ItemType) || _343Config.ItemConvertList.Contains((int)ev.Item.ItemType))
{
ev.Item.Drop();//Idk how to not have it picked up
ev.Allow = false;// This deletes the item :(
Expand All @@ -126,7 +135,7 @@ public void OnPlayerPickupItem(PlayerPickupItemEvent ev)
/// </summary>
public void OnDoorAccess(PlayerDoorAccessEvent ev)
{
if (SCP343.Active343AndBadgeDict.ContainsKey(ev.Player.SteamId) && PluginManager.Manager.Server.Round.Duration >= _343Config.SCP343_OpenDoorTime)
if (SCP343.Active343AndBadgeDict.ContainsKey(ev.Player.SteamId) && PluginManager.Manager.Server.Round.Duration >= _343Config.SCP343_opendoortime)
{
ev.Allow = true;
}
Expand Down Expand Up @@ -224,7 +233,7 @@ public void OnCheckEscape(PlayerCheckEscapeEvent ev)
/// </summary>
public void OnCheckRoundEnd(CheckRoundEndEvent ev)
{
if (SCP343.Active343AndBadgeDict.Count >= 1 && !_343Config.scp343_debug)
if (SCP343.Active343AndBadgeDict.Count >= 1 && !_343Config.SCP343_debug)
{
SCP343.teamAliveCount.Clear();
foreach (Team team in Enum.GetValues(typeof(Team)))
Expand Down Expand Up @@ -392,24 +401,44 @@ public void OnRoundEnd(RoundEndEvent ev)
public class PluginOptions
{
public int SCP343_HP;
public int[] itemConvertList;
public int[] convertedItemList;
public int[] itemBlackList;
public int SCP343_OpenDoorTime;
public int[] ItemConvertList;
public int[] ConvertedItemList;
public int[] ItemBlackList;
public int SCP343_opendoortime;
public bool Nuke_Interact;
public bool SCP343_ConvertItems;
public bool scp343_debug;
public bool SCP343_convertitems;
public bool SCP343_debug;
public bool SCP343_shouldbroadcast;
public string SCP343_broadcastinfo;

public void UpdateValues()
{
SCP343_HP = SCP343.plugin.GetConfigInt("scp343_hp");
itemConvertList = SCP343.plugin.GetConfigIntList("scp343_itemstoconvert");
convertedItemList = SCP343.plugin.GetConfigIntList("scp343_converteditems");
itemBlackList = SCP343.plugin.GetConfigIntList("scp343_itemdroplist");
SCP343_OpenDoorTime = SCP343.plugin.GetConfigInt("scp343_opendoortime");
ItemConvertList = SCP343.plugin.GetConfigIntList("scp343_itemstoconvert");
ConvertedItemList = SCP343.plugin.GetConfigIntList("scp343_converteditems");
ItemBlackList = SCP343.plugin.GetConfigIntList("scp343_itemdroplist");
SCP343_opendoortime = SCP343.plugin.GetConfigInt("scp343_opendoortime");
Nuke_Interact = SCP343.plugin.GetConfigBool("scp343_nuke_interact");
SCP343_ConvertItems = SCP343.plugin.GetConfigBool("scp343_itemconverttoggle");
scp343_debug = SCP343.plugin.GetConfigBool("scp343_debug");
SCP343_convertitems = SCP343.plugin.GetConfigBool("scp343_itemconverttoggle");
SCP343_debug = SCP343.plugin.GetConfigBool("scp343_debug");

SCP343_shouldbroadcast = SCP343.plugin.GetConfigBool("scp343_broadcast");
SCP343_broadcastinfo = SCP343.plugin.GetConfigString("scp343_broadcastinfo");

string _343info;
if(SCP343_broadcastinfo.Length != 0)
{
_343info = SCP343_broadcastinfo.Replace("343DOORTIME", SCP343_opendoortime.ToString());
}
else if (SCP343_HP == -1)
{
_343info = "You are SCP-343, a passive SCP.\n(To be clear this isn't the correct wiki version SCP-343) \nAfter 343DOORTIME seconds you can open any door in the game \nAny weapon/grenade you pick up is morphed into a flashlight.\nYou are NOT counted towards ending the round (Example the round will end if its all NTF and you) \nYou cannot die to anything but lure (106 femur crusher), decontamination, crushed (jumping off at t intersections at heavy) and the nuke.".Replace("343DOORTIME",SCP343_opendoortime.ToString());
}
else
{
_343info = "You are SCP-343, a passive SCP.\n(To be clear this isn't the correct wiki version SCP-343) \nAfter 343DOORTIME seconds you can open any door in the game \nAny weapon/grenade you pick up is morphed into a flashlight.\nYou are counted towards ending the round (Example the round will not end if its all NTF and you, it needs to be all SCP and or CI)".Replace("343DOORTIME", SCP343_opendoortime.ToString());
}
SCP343_broadcastinfo = _343info;
}
}
#endregion
Expand Down

0 comments on commit 2d13948

Please sign in to comment.