From 802566f9ebf7e3201fdaa0325fb20a20d7db3213 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 10 Feb 2023 01:22:01 +0100 Subject: [PATCH 01/10] Trying to add better Coin spawn in Lockers. --- Plugin.cs | 25 +++++++++++++++++++++++-- coin-pocket-escape.csproj | 1 + 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Plugin.cs b/Plugin.cs index adf5ad2..fe5c778 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -1,14 +1,25 @@ using System; +using System.Collections.Generic; using System.Threading.Tasks; using Interactables.Interobjects; using InventorySystem; using MapGeneration; +using MapGeneration.Distributors; using PluginAPI.Core; using PluginAPI.Core.Attributes; using PluginAPI.Core.Zones; using PluginAPI.Enums; using UnityEngine; +using System.Collections.Generic; +using CommandSystem.Commands.RemoteAdmin.Cleanup; +using InventorySystem.Items; +using InventorySystem.Items.Coin; +using InventorySystem.Items.Keycards; +using InventorySystem.Items.Radio; +using PluginAPI.Core.Items; +using RelativePositioning; using FacilityZone = MapGeneration.FacilityZone; +using Object = UnityEngine.Object; using Random = System.Random; namespace coin_pocket_escape @@ -34,11 +45,21 @@ void LoadPlugin() [PluginEvent(ServerEventType.PlayerCoinFlip)] public async void OnPlayerCoinFlip(Player player, bool isTails) { + var spawnp = Object.FindObjectsOfType(); + var locklenght = Object.FindObjectsOfType().Length; + for (int i = 0; i < locklenght; i++) + { + int j = new Random().Next(locklenght); + Vector3 lockerposi = spawnp[j].transform.position; + ItemPickup coin = ItemPickup.Create(ItemType.Coin,lockerposi , Quaternion.identity); + coin.Spawn(); + + Log.Info($"&rLocker: &6{Object.FindObjectsOfType()[i].transform.position}&r"); + } + var playerInPocket = (player.Zone == FacilityZone.Other); - Log.Info($"&rPlayer &6{player.Nickname}&r (&6{player.UserId}&r) flipped the coin. Flip result: " + $"{(isTails ? "tails" : "heads")}. Player is {(playerInPocket ? "in" : "not in")} pocket."); - // If the player is not in the pocket, do nothing if (!playerInPocket) { diff --git a/coin-pocket-escape.csproj b/coin-pocket-escape.csproj index af2209a..f997a58 100644 --- a/coin-pocket-escape.csproj +++ b/coin-pocket-escape.csproj @@ -115,6 +115,7 @@ + From 5dbc65c85117aefeb3b5dcc6dab0af2100dfa97e Mon Sep 17 00:00:00 2001 From: david Date: Fri, 10 Feb 2023 15:51:39 +0100 Subject: [PATCH 02/10] Finished the random coin spawn mechanic, now Coins spawn randomly in Lockers around the map. The Coins spawn at the beginning of each round and the amount can be modified in the Config. The mechanic can be toggled in the Config. --- Config.cs | 6 ++++++ Plugin.cs | 46 +++++++++++++++++++++++++--------------------- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/Config.cs b/Config.cs index e18144a..05364c5 100644 --- a/Config.cs +++ b/Config.cs @@ -4,6 +4,12 @@ namespace coin_pocket_escape { public class Config { + [Description("Toggle forced coin spawns in the beginning of the Round")] + public bool ForcedCoins { get; set; } = true; + + [Description("Changes the number of coins that will spawn at the beginning of the match")] + public int ForcedCoinsNumber { get; set; } = 10; + [Description("Set the waiting time after the coin is flipped in ms")] public int WaitingTime { get; set; } = 2000; diff --git a/Plugin.cs b/Plugin.cs index fe5c778..9d11bb7 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.Threading.Tasks; -using Interactables.Interobjects; using InventorySystem; using MapGeneration; using MapGeneration.Distributors; @@ -10,14 +8,7 @@ using PluginAPI.Core.Zones; using PluginAPI.Enums; using UnityEngine; -using System.Collections.Generic; -using CommandSystem.Commands.RemoteAdmin.Cleanup; -using InventorySystem.Items; -using InventorySystem.Items.Coin; -using InventorySystem.Items.Keycards; -using InventorySystem.Items.Radio; using PluginAPI.Core.Items; -using RelativePositioning; using FacilityZone = MapGeneration.FacilityZone; using Object = UnityEngine.Object; using Random = System.Random; @@ -30,7 +21,7 @@ public class Plugin [PluginConfig] public Config Config; - public const string Version = "1.1.0"; + public const string Version = "1.2.0"; [PluginPriority(LoadPriority.Highest)] [PluginEntryPoint("Coin-Pocket-Escape", Version, @@ -41,21 +32,34 @@ void LoadPlugin() Singleton = this; PluginAPI.Events.EventManager.RegisterEvents(this); } + - [PluginEvent(ServerEventType.PlayerCoinFlip)] - public async void OnPlayerCoinFlip(Player player, bool isTails) + [PluginEvent(ServerEventType.RoundStart)] + private void OnRoundStart() { - var spawnp = Object.FindObjectsOfType(); - var locklenght = Object.FindObjectsOfType().Length; - for (int i = 0; i < locklenght; i++) + if (Config.ForcedCoins) { - int j = new Random().Next(locklenght); - Vector3 lockerposi = spawnp[j].transform.position; - ItemPickup coin = ItemPickup.Create(ItemType.Coin,lockerposi , Quaternion.identity); - coin.Spawn(); - - Log.Info($"&rLocker: &6{Object.FindObjectsOfType()[i].transform.position}&r"); + Random j = new Random(); + var chamberlenght = Object.FindObjectsOfType().Length; + var spawnp = Object.FindObjectsOfType(); + for (int i = 0; i < Config.ForcedCoinsNumber; i++) + { + int zwisch = j.Next(chamberlenght); + Vector3 lockerposi = spawnp[zwisch].transform.position; + //Creates the ItemPickup and Spawns the Coin in a random Locker Chamber + ItemPickup coin = ItemPickup.Create(ItemType.Coin, lockerposi, Quaternion.identity); + coin.Spawn(); + Log.Info($"&rLocker position: &6{spawnp[zwisch].transform.position}&r"); + } + + Log.Info($"&rAll coins spawned&r"); } + } + + + [PluginEvent(ServerEventType.PlayerCoinFlip)] + public async void OnPlayerCoinFlip(Player player, bool isTails) + { var playerInPocket = (player.Zone == FacilityZone.Other); Log.Info($"&rPlayer &6{player.Nickname}&r (&6{player.UserId}&r) flipped the coin. Flip result: " + From eda7862c5808e7e6052f7de39ecdbedea29d7189 Mon Sep 17 00:00:00 2001 From: david Date: Sun, 12 Feb 2023 16:49:05 +0100 Subject: [PATCH 03/10] changed variable names to "english" and "Camelcase". --- Plugin.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Plugin.cs b/Plugin.cs index 9d11bb7..bdf20e1 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -32,26 +32,24 @@ void LoadPlugin() Singleton = this; PluginAPI.Events.EventManager.RegisterEvents(this); } - [PluginEvent(ServerEventType.RoundStart)] - private void OnRoundStart() + public void OnRoundStart() { if (Config.ForcedCoins) { - Random j = new Random(); - var chamberlenght = Object.FindObjectsOfType().Length; - var spawnp = Object.FindObjectsOfType(); + Random rand = new Random(); + var chamberLenght = Object.FindObjectsOfType().Length; + var spawnPosition = Object.FindObjectsOfType(); for (int i = 0; i < Config.ForcedCoinsNumber; i++) { - int zwisch = j.Next(chamberlenght); - Vector3 lockerposi = spawnp[zwisch].transform.position; + int temp = rand.Next(chamberLenght); + Vector3 lockerPosition = spawnPosition[temp].transform.position; //Creates the ItemPickup and Spawns the Coin in a random Locker Chamber - ItemPickup coin = ItemPickup.Create(ItemType.Coin, lockerposi, Quaternion.identity); + ItemPickup coin = ItemPickup.Create(ItemType.Coin, lockerPosition, Quaternion.identity); coin.Spawn(); - Log.Info($"&rLocker position: &6{spawnp[zwisch].transform.position}&r"); + Log.Info($"&rLocker position: &6{spawnPosition[temp].transform.position}&r"); } - Log.Info($"&rAll coins spawned&r"); } } From 2d68e8e1b840306ab17a13365d3ed7044badd770 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 12 May 2023 16:28:35 +0200 Subject: [PATCH 04/10] version 1.3.0 coin_pocket_escape: feat: added a hint-message for the player of SCP-106; --- Plugin.cs | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/Plugin.cs b/Plugin.cs index bdf20e1..0cabd25 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -3,6 +3,7 @@ using InventorySystem; using MapGeneration; using MapGeneration.Distributors; +using PlayerRoles; using PluginAPI.Core; using PluginAPI.Core.Attributes; using PluginAPI.Core.Zones; @@ -21,7 +22,7 @@ public class Plugin [PluginConfig] public Config Config; - public const string Version = "1.2.0"; + public const string Version = "1.3.0"; [PluginPriority(LoadPriority.Highest)] [PluginEntryPoint("Coin-Pocket-Escape", Version, @@ -52,9 +53,26 @@ public void OnRoundStart() } Log.Info($"&rAll coins spawned&r"); } + } - +//Sends an Hint to player of SCP-106 + private static void HintToOldMen(Player tempPlayer) + { + for (int i = 0; i <= Player.GetPlayers().Count; i++) + { + //Checks who is Scp-106 + if (Player.GetPlayers()[i].Role == RoleTypeId.Scp106) + { + //The Hint itself + Player.GetPlayers()[i].ReceiveHint($"{tempPlayer.Nickname} slipped out of dimension!", 6F); + Log.Info($"&r Hint send to: &6{Player.GetPlayers()[i].Nickname}&r"); //debug may be removed! + } + Log.Info($"&r Hint cold not be send to: &6{Player.GetPlayers()[i].Nickname}&r"); //debug may be removed! + + } + } + [PluginEvent(ServerEventType.PlayerCoinFlip)] public async void OnPlayerCoinFlip(Player player, bool isTails) { @@ -102,12 +120,12 @@ Selecting a room in the HeavyZone to teleport the player. } Vector3 vector = HeavyZone.Rooms[i].Position; vector.y += 1; - Log.Info($"&rPlayer gets teleported to Room &6{HeavyZone.Rooms[i].Identifier.Name}&r, " + $"Position: &6{vector.x}&r, &6{vector.y}&r, &6{vector.z}&r."); player.Position = vector; player.ReceiveHint("You were lucky!", 2F); player.ReferenceHub.inventory.ServerRemoveItem(player.CurrentItem.ItemSerial, null); + HintToOldMen(player); } // If isTails and nuke detonated, the player gets teleported to surface zone and the coin gets removed @@ -127,7 +145,9 @@ Selecting a room in the HeavyZone to teleport the player. Log.Info($"&rPlayer gets teleported to Room &6{HeavyZone.Rooms[i].Identifier.Name}&r, " + $"Position: &6{vector.x}&r, &6{vector.y}&r, &6{vector.z}&r."); player.Position = vector; + player.ReceiveHint("You were lucky!", 2F); player.ReferenceHub.inventory.ServerRemoveItem(player.CurrentItem.ItemSerial, null); + HintToOldMen(player); } // If the coin is heads, the coin just gets removed and the player stays in the pocket. From 4277e1969230aad5ddd4e4a5b6fb9bec21df0efc Mon Sep 17 00:00:00 2001 From: David-Floy <123889521+David-Floy@users.noreply.github.com> Date: Fri, 12 May 2023 16:55:49 +0200 Subject: [PATCH 05/10] Update README.md added and changed some old and new things like the new coin spawns and some pictures --- README.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 88ad515..457f408 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,20 @@ A plugin using the NwPluginAPI that enables you to flip a coin to escape the poc # Information Gives players a possibility to flip a coin in the pocket dimension to get out of it. -Tails teleports the player to a room in the Heavy Containment Zone and deletes the coin, heads just deletes the coin. +If successful, the player of SCP-106 will receive a message that a player has escaped with a coin. +The player is teleported to a room in the Heavy Containment Zone and the coin is deleted. +After the Nuke explodes, the players spawn at the surface zone. +If it was not successful, the coin is simply deleted. +At the beginning of the round, additional coins will spawn in lockers all over the map. +It is still possible to escape the pocket dim the normal way. + +#Spawn locations for the Coins +![SCP_SL_Coin_Spawn_1](https://github.com/leo-ger/coin-pocket-escape/assets/123889521/86b0afbe-eb27-4cca-9cd5-06175e4f9766) + +![SCP_SL_Coin_Spawn_2](https://github.com/leo-ger/coin-pocket-escape/assets/123889521/ffb97bbc-98ce-49ae-b407-a1ae0961e5da) + +![SCP_SL_Coin_Spawn_4](https://github.com/leo-ger/coin-pocket-escape/assets/123889521/d59d0de4-6c0d-4e47-afd4-9663f3f040fe) + # Installation Place the `coin_pocket_escape.dll` in your plugin folder. @@ -13,6 +26,10 @@ Place the `coin_pocket_escape.dll` in your plugin folder. # Configuration You can set the time to wait after the coin is flipped (in ms). This lets the coin-flip animation play. +You can set if additionall coins should spwan. + +you can set the amount of additionall coins. + Also you can set if the result should be randomized. This means that it's randomized if heads or tails gets you out of the pocket dimension. # Contributors From 1b937a442fb8c8f098d840a888f24e5b03053007 Mon Sep 17 00:00:00 2001 From: David-Floy <123889521+David-Floy@users.noreply.github.com> Date: Fri, 12 May 2023 16:57:09 +0200 Subject: [PATCH 06/10] Update README.md small hiccups fixed --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 457f408..18439f7 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ If it was not successful, the coin is simply deleted. At the beginning of the round, additional coins will spawn in lockers all over the map. It is still possible to escape the pocket dim the normal way. -#Spawn locations for the Coins +# Spawn locations for the Coins ![SCP_SL_Coin_Spawn_1](https://github.com/leo-ger/coin-pocket-escape/assets/123889521/86b0afbe-eb27-4cca-9cd5-06175e4f9766) ![SCP_SL_Coin_Spawn_2](https://github.com/leo-ger/coin-pocket-escape/assets/123889521/ffb97bbc-98ce-49ae-b407-a1ae0961e5da) From b76141ee6ff9dcf474b8d6f2c83c631e0a48fd2e Mon Sep 17 00:00:00 2001 From: David-Floy <123889521+David-Floy@users.noreply.github.com> Date: Fri, 12 May 2023 16:58:15 +0200 Subject: [PATCH 07/10] Update README.md added another picture --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 18439f7..fbdf077 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,8 @@ It is still possible to escape the pocket dim the normal way. ![SCP_SL_Coin_Spawn_4](https://github.com/leo-ger/coin-pocket-escape/assets/123889521/d59d0de4-6c0d-4e47-afd4-9663f3f040fe) +![SCP_SL_Coin_Spawn_6](https://github.com/leo-ger/coin-pocket-escape/assets/123889521/c7264108-7a6b-41c1-b8df-830aa29cf88f) + # Installation Place the `coin_pocket_escape.dll` in your plugin folder. From 9db2a7583fa857934f595cde029d2efae0019a6a Mon Sep 17 00:00:00 2001 From: David-Floy <123889521+David-Floy@users.noreply.github.com> Date: Fri, 12 May 2023 16:59:00 +0200 Subject: [PATCH 08/10] Update README.md spelling error --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fbdf077..53cdb8a 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Place the `coin_pocket_escape.dll` in your plugin folder. # Configuration You can set the time to wait after the coin is flipped (in ms). This lets the coin-flip animation play. -You can set if additionall coins should spwan. +You can set if additionall coins should spawn. you can set the amount of additionall coins. From 3503149f58bf7b38740f83e04e9f09aa492bbfe8 Mon Sep 17 00:00:00 2001 From: David-Floy <123889521+David-Floy@users.noreply.github.com> Date: Sat, 13 May 2023 17:52:49 +0200 Subject: [PATCH 09/10] Update README.md *additional --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 53cdb8a..ed23cdd 100644 --- a/README.md +++ b/README.md @@ -28,9 +28,9 @@ Place the `coin_pocket_escape.dll` in your plugin folder. # Configuration You can set the time to wait after the coin is flipped (in ms). This lets the coin-flip animation play. -You can set if additionall coins should spawn. +You can set if additional coins should spawn. -you can set the amount of additionall coins. +you can set the amount of additional coins. Also you can set if the result should be randomized. This means that it's randomized if heads or tails gets you out of the pocket dimension. From 28434bb7a291950c30da51e14b2bfe8b6857c1d3 Mon Sep 17 00:00:00 2001 From: david Date: Sat, 13 May 2023 17:56:29 +0200 Subject: [PATCH 10/10] Fixed some minor spelling in Plugin.cs and Config.cs --- Config.cs | 2 +- Plugin.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Config.cs b/Config.cs index 05364c5..c77f93d 100644 --- a/Config.cs +++ b/Config.cs @@ -4,7 +4,7 @@ namespace coin_pocket_escape { public class Config { - [Description("Toggle forced coin spawns in the beginning of the Round")] + [Description("Toggle forced coin spawns in the beginning of the round")] public bool ForcedCoins { get; set; } = true; [Description("Changes the number of coins that will spawn at the beginning of the match")] diff --git a/Plugin.cs b/Plugin.cs index 0cabd25..78442c0 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -55,8 +55,8 @@ public void OnRoundStart() } } - -//Sends an Hint to player of SCP-106 + + //Sends an hint to player of SCP-106 private static void HintToOldMen(Player tempPlayer) { for (int i = 0; i <= Player.GetPlayers().Count; i++)