Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion EXILED/Exiled.API/Features/Items/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public static T Get<T>(ushort serial)
BodyArmor => new Armor(type),
AmmoItem => new Ammo(type),
ToggleableLightItemBase => new Flashlight(type),
JailbirdItem jailbird => new Jailbird(jailbird),
JailbirdItem => new Jailbird(),
ThrowableItem throwable => throwable.Projectile switch
{
FlashbangGrenade => new FlashGrenade(owner),
Expand Down
4 changes: 2 additions & 2 deletions EXILED/Exiled.API/Features/Pickups/Pickup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -495,12 +495,12 @@ public static IEnumerable<T> Get<T>(IEnumerable<GameObject> gameObjects)
ThrownProjectile thrownProjectile => thrownProjectile switch
{
BaseScp018Projectile => new Projectiles.Scp018Projectile(),
ExplosionGrenade explosionGrenade => new ExplosionGrenadeProjectile(explosionGrenade),
ExplosionGrenade explosionGrenade => new ExplosionGrenadeProjectile(type),
FlashbangGrenade => new FlashbangProjectile(),
BaseScp2176Projectile => new Projectiles.Scp2176Projectile(),
EffectGrenade => new EffectGrenadeProjectile(type),
TimeGrenade => new TimeGrenadeProjectile(type),
_ => new Projectile(thrownProjectile),
_ => new Projectile(type),
},
_ => new Pickup(type),
};
Expand Down
5 changes: 5 additions & 0 deletions EXILED/Exiled.API/Features/Roles/Scp3114Role.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ public float WarningTime
set => Identity._warningTimeSeconds = value;
}

/// <summary>
/// Gets or sets the next bound dance.
/// </summary>
public DanceType? NextDanceType { get; set; }

/// <summary>
/// Gets or sets the bound dance.
/// </summary>
Expand Down
3 changes: 2 additions & 1 deletion EXILED/Exiled.Events/EventArgs/Scp3114/DancingEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public DancingEventArgs(bool newState, Player player, bool isAllowed = true)
Player = player;
Scp3114 = player.Role.As<Scp3114Role>();
IsDancing = newState;
DanceType = (DanceType)(newState ? UnityEngine.Random.Range(0, Scp3114.Dance._danceVariants) : byte.MaxValue);
DanceType = newState ? (Scp3114.NextDanceType ?? (DanceType)UnityEngine.Random.Range(0, Scp3114.Dance._danceVariants)) : (DanceType)byte.MaxValue;
Scp3114.NextDanceType = null;
IsAllowed = isAllowed;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Exiled.Events.EventArgs.Server
{
using System;
using System.Collections.Generic;

using Exiled.API.Features;
Expand Down Expand Up @@ -39,7 +40,7 @@ public RespawningTeamEventArgs(List<Player> players, int maxRespawn, SpawnableWa
{
Players = players;
MaximumRespawnAmount = maxRespawn;
SpawnQueue = WaveSpawner.SpawnQueue;
Wave.PopulateQueue(SpawnQueue, MaximumRespawnAmount);
Wave = new TimedWave((TimeBasedWave)wave);
IsAllowed = true;
}
Expand Down
19 changes: 12 additions & 7 deletions EXILED/Exiled.Events/Patches/Events/Server/RespawningTeam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
new CodeInstruction(OpCodes.Ldloc_S, ev.LocalIndex).WithLabels(continueLabel),
new(OpCodes.Dup),
new(OpCodes.Dup),
new(OpCodes.Dup),

// num = ev.MaximumRespawnAmount
new(OpCodes.Callvirt, PropertyGetter(typeof(RespawningTeamEventArgs), nameof(RespawningTeamEventArgs.MaximumRespawnAmount))),
Expand All @@ -98,8 +99,19 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
new(OpCodes.Callvirt, PropertyGetter(typeof(RespawningTeamEventArgs), nameof(RespawningTeamEventArgs.Wave))),
new(OpCodes.Callvirt, PropertyGetter(typeof(TimedWave), nameof(TimedWave.Base))),
new(OpCodes.Starg_S, 0),

// WaveSpawner.SpawnQueue = ev.SpawnQueue;
new(OpCodes.Callvirt, PropertyGetter(typeof(RespawningTeamEventArgs), nameof(RespawningTeamEventArgs.SpawnQueue))),
new(OpCodes.Stsfld, Field(typeof(WaveSpawner), nameof(WaveSpawner.SpawnQueue))),
});

// remove "wave.PopulateQueue(WaveSpawner.SpawnQueue, num);"
offset = -3;
index = newInstructions.FindIndex(instruction => instruction.Calls(Method(typeof(SpawnableWaveBase), nameof(SpawnableWaveBase.PopulateQueue)))) + offset;
List<Label> extractLabels = newInstructions[index].ExtractLabels();
newInstructions.RemoveRange(index, 4);
newInstructions[index].WithLabels(extractLabels);

for (int z = 0; z < newInstructions.Count; z++)
yield return newInstructions[z];

Expand All @@ -109,12 +121,5 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
private static List<Player> GetPlayers(List<ReferenceHub> hubs) => hubs.Select(Player.Get).ToList();

private static List<ReferenceHub> GetHubs(List<Player> players) => players.Select(player => player.ReferenceHub).ToList();

private static void RefillQueue(Queue<RoleTypeId> newQueue)
{
WaveSpawner.SpawnQueue.Clear();
foreach (RoleTypeId role in newQueue)
WaveSpawner.SpawnQueue.Enqueue(role);
}
}
}
72 changes: 0 additions & 72 deletions EXILED/Exiled.Events/Patches/Fixes/ServerSideDancesPatch.cs

This file was deleted.