Skip to content

Commit

Permalink
Updoot
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal78900 committed Nov 7, 2021
1 parent 68e7944 commit 96d76aa
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 64 deletions.
2 changes: 1 addition & 1 deletion WaitAndChillReborn/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class Config : IConfig
};

[Description("Allow dealing damage to other players, while in lobby.")]
public bool AllowDamage { get; private set; } = false;
public bool AllowDamage { get; private set; } = true;

[Description("Allow friendly fire, while in lobby.")]
public bool AllowFriendlyFire { get; private set; } = true;
Expand Down
40 changes: 22 additions & 18 deletions WaitAndChillReborn/Handler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ internal void OnWaitingForPlayers()
Scp173.TurnedPlayers.Clear();
Scp096.TurnedPlayers.Clear();

if (Config.AllowFriendlyFire)
{
ffPrevValue = Server.FriendlyFire;
Server.FriendlyFire = true;
}

GameObject.Find("StartRound").transform.localScale = Vector3.zero;

if (lobbyTimer.IsRunning)
Expand All @@ -50,11 +44,7 @@ internal void OnWaitingForPlayers()
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.Locked = true;
pickup.Base.GetComponent<Rigidbody>().isKinematic = true;
unspawnedPickups.Add(pickup);
}
Expand Down Expand Up @@ -201,6 +191,14 @@ internal void OnDroppingItem(DroppingItemEventArgs ev)
}
}

internal void OnDroppingAmmo(DroppingAmmoEventArgs ev)
{
if (IsLobby)
{
ev.IsAllowed = false;
}
}

internal void OnInteractingDoor(InteractingDoorEventArgs ev)
{
if (IsLobby)
Expand Down Expand Up @@ -241,6 +239,14 @@ internal void OnTeleporting(TeleportingEventArgs ev)
}
}

internal void OnChangingIntoGrenade(ChangingIntoGrenadeEventArgs ev)
{
if (IsLobby)
{
ev.IsAllowed = false;
}
}

#endregion

internal void OnRoundStarted()
Expand All @@ -249,7 +255,9 @@ internal void OnRoundStarted()
player.Role = RoleType.Spectator;

if (Config.AllowFriendlyFire)
Server.FriendlyFire = ffPrevValue;
{
Server.FriendlyFire = ffPrevValue.Value;
}

foreach (ThrownProjectile throwable in Object.FindObjectsOfType<ThrownProjectile>())
{
Expand Down Expand Up @@ -292,11 +300,7 @@ internal void OnRoundStarted()
{
try
{
//pickup.Locked = false;
PickupSyncInfo info = pickup.Base.Info;
info.Locked = false;
pickup.Base.NetworkInfo = info;

pickup.Locked = false;
pickup.Base.GetComponent<Rigidbody>().isKinematic = false;
}
catch (System.Exception)
Expand All @@ -312,7 +316,7 @@ internal void OnRoundStarted()

public static bool IsLobby => !Round.IsStarted && !RoundSummary.singleton.RoundEnded;

private bool ffPrevValue;
private bool? ffPrevValue = null;

private string text;

Expand Down
16 changes: 16 additions & 0 deletions WaitAndChillReborn/Methods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,22 @@ private IEnumerator<float> LobbyTimer()
Intercom.host.CustomContent = intercomText;
}


if (ffPrevValue == null)
{
ffPrevValue = Server.FriendlyFire;
}

if (Config.AllowFriendlyFire && !Server.FriendlyFire)
{
Server.FriendlyFire = true;
}

if (Config.AllowFriendlyFire && Player.List.Count() == 0 && !ffPrevValue.Value)
{
Server.FriendlyFire = false;
}

yield return Timing.WaitForSeconds(1f);
}
}
Expand Down
11 changes: 0 additions & 11 deletions WaitAndChillReborn/Patches/DroppingAmmoPatch.cs

This file was deleted.

12 changes: 0 additions & 12 deletions WaitAndChillReborn/Patches/GrenadeExplosionDetectedPatch.cs

This file was deleted.

8 changes: 6 additions & 2 deletions WaitAndChillReborn/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ public override void OnEnabled()
PlayerEvent.SpawningRagdoll += handler.OnSpawningRagdoll;
PlayerEvent.IntercomSpeaking += handler.OnIntercom;
PlayerEvent.DroppingItem += handler.OnDroppingItem;
PlayerEvent.DroppingAmmo += handler.OnDroppingAmmo;
PlayerEvent.InteractingDoor += handler.OnInteractingDoor;
PlayerEvent.InteractingElevator += handler.OnInteractingElevator;
PlayerEvent.InteractingLocker += handler.OnInteractingLocker;
MapEvent.ChangingIntoGrenade += handler.OnChangingIntoGrenade;

Scp106Event.CreatingPortal += handler.OnCreatingPortal;
Scp106Event.Teleporting += handler.OnTeleporting;
Expand All @@ -61,9 +63,11 @@ public override void OnDisabled()
PlayerEvent.SpawningRagdoll -= handler.OnSpawningRagdoll;
PlayerEvent.IntercomSpeaking -= handler.OnIntercom;
PlayerEvent.DroppingItem -= handler.OnDroppingItem;
PlayerEvent.DroppingAmmo -= handler.OnDroppingAmmo;
PlayerEvent.InteractingDoor -= handler.OnInteractingDoor;
PlayerEvent.InteractingElevator -= handler.OnInteractingElevator;
PlayerEvent.InteractingLocker -= handler.OnInteractingLocker;
MapEvent.ChangingIntoGrenade -= handler.OnChangingIntoGrenade;

Scp106Event.CreatingPortal -= handler.OnCreatingPortal;
Scp106Event.Teleporting -= handler.OnTeleporting;
Expand All @@ -78,7 +82,7 @@ public override void OnDisabled()

public override string Name => "WaitAndChillReborn";
public override string Author => "Michal78900";
public override Version Version => new Version(3, 1, 0);
public override Version RequiredExiledVersion => new Version(3, 2, 1);
public override Version Version => new Version(3, 1, 1);
public override Version RequiredExiledVersion => new Version(3, 6, 2);
}
}
36 changes: 17 additions & 19 deletions WaitAndChillReborn/WaitAndChillReborn.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,32 +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.2.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.2.1\lib\net472\Exiled.API.dll</HintPath>
<Reference Include="Exiled.API, Version=3.6.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.6.1\lib\net472\Exiled.API.dll</HintPath>
</Reference>
<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 Include="Exiled.Bootstrap, Version=3.6.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.6.1\lib\net472\Exiled.Bootstrap.dll</HintPath>
</Reference>
<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 Include="Exiled.CreditTags, Version=3.6.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.6.1\lib\net472\Exiled.CreditTags.dll</HintPath>
</Reference>
<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 Include="Exiled.CustomItems, Version=3.6.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.6.1\lib\net472\Exiled.CustomItems.dll</HintPath>
</Reference>
<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 Include="Exiled.CustomRoles, Version=3.6.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.6.1\lib\net472\Exiled.CustomRoles.dll</HintPath>
</Reference>
<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 Include="Exiled.Events, Version=3.6.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.6.1\lib\net472\Exiled.Events.dll</HintPath>
</Reference>
<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 Include="Exiled.Loader, Version=3.6.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.6.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 Include="Exiled.Permissions, Version=3.6.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.6.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.2.1\lib\net472\Exiled.Updater.dll</HintPath>
<HintPath>..\packages\EXILED.3.6.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 Expand Up @@ -104,8 +104,6 @@
<Compile Include="Patches\BreakableWindowPatch.cs" />
<Compile Include="Patches\BulletHolePatch.cs" />
<Compile Include="Patches\DoorDamagePatch.cs" />
<Compile Include="Patches\DroppingAmmoPatch.cs" />
<Compile Include="Patches\GrenadeExplosionDetectedPatch.cs" />
<Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Translation.cs" />
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.2.1" targetFramework="net472" />
<package id="EXILED" version="3.6.1" targetFramework="net472" />
</packages>

0 comments on commit 96d76aa

Please sign in to comment.