From 68e7944761238879d0eccec0ef297685b185b252 Mon Sep 17 00:00:00 2001 From: Michal78900 Date: Wed, 27 Oct 2021 22:47:44 +0200 Subject: [PATCH] le funny fix --- WaitAndChillReborn/Handler.cs | 47 +++++++++++++++++--- WaitAndChillReborn/Plugin.cs | 4 +- WaitAndChillReborn/WaitAndChillReborn.csproj | 33 +++++++------- WaitAndChillReborn/packages.config | 2 +- 4 files changed, 61 insertions(+), 25 deletions(-) diff --git a/WaitAndChillReborn/Handler.cs b/WaitAndChillReborn/Handler.cs index 4b98ef2..a911a5d 100644 --- a/WaitAndChillReborn/Handler.cs +++ b/WaitAndChillReborn/Handler.cs @@ -11,6 +11,8 @@ using Mirror; using InventorySystem.Items.ThrowableProjectiles; using Exiled.API.Extensions; + using System.Linq; + using InventorySystem.Items.Pickups; public partial class Handler { @@ -41,10 +43,25 @@ internal void OnWaitingForPlayers() { foreach (Pickup pickup in Map.Pickups) { - if (!pickup.Spawned) + try { - NetworkServer.UnSpawn(pickup.Base.gameObject); - unspawnedPickups.Add(pickup); + if (!pickup.Spawned) + { + if (pickup.Base.transform.parent != null && pickup.Base.transform.parent.name.Contains("CustomSchematic")) + continue; + + //pickup.Locked = true; + PickupSyncInfo info = pickup.Base.Info; + info.Locked = true; + pickup.Base.NetworkInfo = info; + + pickup.Base.GetComponent().isKinematic = true; + unspawnedPickups.Add(pickup); + } + } + catch (System.Exception) + { + continue; } } }); @@ -228,12 +245,15 @@ internal void OnTeleporting(TeleportingEventArgs ev) internal void OnRoundStarted() { + foreach (Player player in Player.List) + player.Role = RoleType.Spectator; + if (Config.AllowFriendlyFire) Server.FriendlyFire = ffPrevValue; foreach (ThrownProjectile throwable in Object.FindObjectsOfType()) { - if (throwable is Scp018Projectile scp018 && scp018.Rb.velocity.sqrMagnitude <= 1f) + if (throwable.Rb.velocity.sqrMagnitude <= 1f) continue; throwable.transform.position = Vector3.zero; @@ -268,11 +288,24 @@ internal void OnRoundStarted() Timing.KillCoroutines(lobbyTimer); } - foreach (Pickup pickup in unspawnedPickups) + foreach (Pickup pickup in unspawnedPickups.ToList()) { - NetworkServer.Spawn(pickup.Base.gameObject); + try + { + //pickup.Locked = false; + PickupSyncInfo info = pickup.Base.Info; + info.Locked = false; + pickup.Base.NetworkInfo = info; + + pickup.Base.GetComponent().isKinematic = false; + } + catch (System.Exception) + { + continue; + } + + unspawnedPickups.Clear(); } - unspawnedPickups.Clear(); } #region Variables diff --git a/WaitAndChillReborn/Plugin.cs b/WaitAndChillReborn/Plugin.cs index bac6340..7f5d9a0 100644 --- a/WaitAndChillReborn/Plugin.cs +++ b/WaitAndChillReborn/Plugin.cs @@ -78,7 +78,7 @@ public override void OnDisabled() public override string Name => "WaitAndChillReborn"; public override string Author => "Michal78900"; - public override Version Version => new Version(3, 0, 4); - public override Version RequiredExiledVersion => new Version(3, 0, 0); + public override Version Version => new Version(3, 1, 0); + public override Version RequiredExiledVersion => new Version(3, 2, 1); } } diff --git a/WaitAndChillReborn/WaitAndChillReborn.csproj b/WaitAndChillReborn/WaitAndChillReborn.csproj index d7e2fc1..f9c7eae 100644 --- a/WaitAndChillReborn/WaitAndChillReborn.csproj +++ b/WaitAndChillReborn/WaitAndChillReborn.csproj @@ -46,29 +46,32 @@ ..\..\..\Desktop\Exiled\CommandSystem.Core.dll - - ..\packages\EXILED.3.0.0-alpha.84\lib\net472\Exiled.API.dll + + ..\packages\EXILED.3.2.1\lib\net472\Exiled.API.dll - - ..\packages\EXILED.3.0.0-alpha.84\lib\net472\Exiled.Bootstrap.dll + + ..\packages\EXILED.3.2.1\lib\net472\Exiled.Bootstrap.dll - - ..\packages\EXILED.3.0.0-alpha.84\lib\net472\Exiled.CreditTags.dll + + ..\packages\EXILED.3.2.1\lib\net472\Exiled.CreditTags.dll - - ..\packages\EXILED.3.0.0-alpha.84\lib\net472\Exiled.CustomItems.dll + + ..\packages\EXILED.3.2.1\lib\net472\Exiled.CustomItems.dll - - ..\packages\EXILED.3.0.0-alpha.84\lib\net472\Exiled.Events.dll + + ..\packages\EXILED.3.2.1\lib\net472\Exiled.CustomRoles.dll - - ..\packages\EXILED.3.0.0-alpha.84\lib\net472\Exiled.Loader.dll + + ..\packages\EXILED.3.2.1\lib\net472\Exiled.Events.dll - - ..\packages\EXILED.3.0.0-alpha.84\lib\net472\Exiled.Permissions.dll + + ..\packages\EXILED.3.2.1\lib\net472\Exiled.Loader.dll + + + ..\packages\EXILED.3.2.1\lib\net472\Exiled.Permissions.dll - ..\packages\EXILED.3.0.0-alpha.84\lib\net472\Exiled.Updater.dll + ..\packages\EXILED.3.2.1\lib\net472\Exiled.Updater.dll False diff --git a/WaitAndChillReborn/packages.config b/WaitAndChillReborn/packages.config index c8b8dcc..70ddc68 100644 --- a/WaitAndChillReborn/packages.config +++ b/WaitAndChillReborn/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file