Skip to content

Commit

Permalink
le funny fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal78900 committed Oct 27, 2021
1 parent 982119b commit 68e7944
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 25 deletions.
47 changes: 40 additions & 7 deletions WaitAndChillReborn/Handler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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<Rigidbody>().isKinematic = true;
unspawnedPickups.Add(pickup);
}
}
catch (System.Exception)
{
continue;
}
}
});
Expand Down Expand Up @@ -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<ThrownProjectile>())
{
if (throwable is Scp018Projectile scp018 && scp018.Rb.velocity.sqrMagnitude <= 1f)
if (throwable.Rb.velocity.sqrMagnitude <= 1f)
continue;

throwable.transform.position = Vector3.zero;
Expand Down Expand Up @@ -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<Rigidbody>().isKinematic = false;
}
catch (System.Exception)
{
continue;
}

unspawnedPickups.Clear();
}
unspawnedPickups.Clear();
}

#region Variables
Expand Down
4 changes: 2 additions & 2 deletions WaitAndChillReborn/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
33 changes: 18 additions & 15 deletions WaitAndChillReborn/WaitAndChillReborn.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,29 +46,32 @@
<Reference Include="CommandSystem.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\Desktop\Exiled\CommandSystem.Core.dll</HintPath>
</Reference>
<Reference Include="Exiled.API, Version=3.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.84\lib\net472\Exiled.API.dll</HintPath>
<Reference Include="Exiled.API, Version=3.2.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.2.1\lib\net472\Exiled.API.dll</HintPath>
</Reference>
<Reference Include="Exiled.Bootstrap, Version=3.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.84\lib\net472\Exiled.Bootstrap.dll</HintPath>
<Reference Include="Exiled.Bootstrap, Version=3.2.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.2.1\lib\net472\Exiled.Bootstrap.dll</HintPath>
</Reference>
<Reference Include="Exiled.CreditTags, Version=3.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.84\lib\net472\Exiled.CreditTags.dll</HintPath>
<Reference Include="Exiled.CreditTags, Version=3.2.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.2.1\lib\net472\Exiled.CreditTags.dll</HintPath>
</Reference>
<Reference Include="Exiled.CustomItems, Version=3.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.84\lib\net472\Exiled.CustomItems.dll</HintPath>
<Reference Include="Exiled.CustomItems, Version=3.2.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.2.1\lib\net472\Exiled.CustomItems.dll</HintPath>
</Reference>
<Reference Include="Exiled.Events, Version=3.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.84\lib\net472\Exiled.Events.dll</HintPath>
<Reference Include="Exiled.CustomRoles, Version=3.2.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.2.1\lib\net472\Exiled.CustomRoles.dll</HintPath>
</Reference>
<Reference Include="Exiled.Loader, Version=3.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.84\lib\net472\Exiled.Loader.dll</HintPath>
<Reference Include="Exiled.Events, Version=3.2.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.2.1\lib\net472\Exiled.Events.dll</HintPath>
</Reference>
<Reference Include="Exiled.Permissions, Version=3.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.84\lib\net472\Exiled.Permissions.dll</HintPath>
<Reference Include="Exiled.Loader, Version=3.2.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.2.1\lib\net472\Exiled.Loader.dll</HintPath>
</Reference>
<Reference Include="Exiled.Permissions, Version=3.2.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.2.1\lib\net472\Exiled.Permissions.dll</HintPath>
</Reference>
<Reference Include="Exiled.Updater, Version=3.1.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.84\lib\net472\Exiled.Updater.dll</HintPath>
<HintPath>..\packages\EXILED.3.2.1\lib\net472\Exiled.Updater.dll</HintPath>
</Reference>
<Reference Include="Mirror, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
2 changes: 1 addition & 1 deletion WaitAndChillReborn/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EXILED" version="3.0.0-alpha.84" targetFramework="net472" />
<package id="EXILED" version="3.2.1" targetFramework="net472" />
</packages>

0 comments on commit 68e7944

Please sign in to comment.