Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.
Closed

14.0 #2802

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
15 changes: 15 additions & 0 deletions Exiled.API/Extensions/ItemExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace Exiled.API.Extensions

using Enums;
using Features.Items;
using Footprinting;
using InventorySystem;
using InventorySystem.Items;
using InventorySystem.Items.Firearms.Attachments;
Expand All @@ -28,6 +29,20 @@ namespace Exiled.API.Extensions
/// </summary>
public static class ItemExtensions
{
/// <summary>
/// Check if <see cref="Footprint"/> is equal to <see cref="ReferenceHub"/>.
/// </summary>
/// <param name="footprint">
/// Initiator of the event.
/// </param>
/// <param name="hub">
/// Hub to equals with initiator.
/// </param>
/// <returns>
/// A boolean value indicating whether the initiator is equal to the hub for comparison or not.
/// </returns>
public static bool SameLife(this Footprint footprint, ReferenceHub hub) => footprint.Hub.Equals(hub);

/// <summary>
/// Check if an <see cref="ItemType">item</see> is an ammo.
/// </summary>
Expand Down
9 changes: 0 additions & 9 deletions Exiled.CustomModules/API/Features/RespawnManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,22 +153,13 @@ protected override void UnsubscribeEvents()
{
base.UnsubscribeEvents();

Exiled.Events.Handlers.Server.RestartedRespawnSequence -= OnRestartedRespawnSequence;
Exiled.Events.Handlers.Server.SelectingRespawnTeam -= OnSelectingRespawnTeam;
Exiled.Events.Handlers.Server.PreRespawningTeam -= OnPreRespawningTeam;
Exiled.Events.Handlers.Server.RespawningTeam -= OnRespawningTeam;
Exiled.Events.Handlers.Server.DeployingTeamRole -= OnDeployingTeamRole;
Exiled.Events.Handlers.Server.RespawnedTeam -= OnRespawnedTeam;
}

private void OnRestartedRespawnSequence(RestartedRespawnSequenceEventArgs ev)
{
if (PreviousKnownTeam is not uint id || !CustomTeam.TryGet(id, out CustomTeam team))
return;

ev.TimeForNextSequence = team.NextSequenceTime;
}

private void OnSelectingRespawnTeam(SelectingRespawnTeamEventArgs ev)
{
NextKnownTeam = null;
Expand Down
30 changes: 7 additions & 23 deletions Exiled.Events/EventArgs/Item/ChangingAmmoEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ namespace Exiled.Events.EventArgs.Item
using Exiled.API.Features;
using Exiled.API.Features.Items;
using Exiled.Events.EventArgs.Interfaces;
using InventorySystem.Items.Firearms;

using BaseFirearm = InventorySystem.Items.Firearms.Firearm;
using Firearm = API.Features.Items.Firearm;

Expand All @@ -24,15 +22,15 @@ public class ChangingAmmoEventArgs : IPlayerEvent, IFirearmEvent, IDeniableEvent
/// Initializes a new instance of the <see cref="ChangingAmmoEventArgs"/> class.
/// </summary>
/// <param name="basefirearm"><inheritdoc cref="Firearm"/></param>
/// <param name="oldStatus"><inheritdoc cref="OldAmmo"/></param>
/// <param name="newStatus"><inheritdoc cref="NewAmmo"/></param>
/// <param name="oldAmmo"><inheritdoc cref="OldAmmo"/></param>
/// <param name="newAmmo"><inheritdoc cref="NewAmmo"/></param>
/// <param name="isAllowed"><inheritdoc cref="IsAllowed"/></param>
public ChangingAmmoEventArgs(BaseFirearm basefirearm, FirearmStatus oldStatus, FirearmStatus newStatus, bool isAllowed = true)
public ChangingAmmoEventArgs(BaseFirearm basefirearm, int oldAmmo, int newAmmo, bool isAllowed = true)
{
Firearm = Item.Get(basefirearm).As<Firearm>();
Player = Firearm.Owner;
OldStatus = oldStatus;
NewStatus = newStatus;
OldAmmo = oldAmmo;
NewAmmo = newAmmo;
IsAllowed = isAllowed;
}

Expand All @@ -49,29 +47,15 @@ public ChangingAmmoEventArgs(BaseFirearm basefirearm, FirearmStatus oldStatus, F
/// <inheritdoc/>
public Item Item => Firearm;

/// <summary>
/// Gets the old status.
/// </summary>
public FirearmStatus OldStatus { get; }

/// <summary>
/// Gets the old ammo.
/// </summary>
public byte OldAmmo => OldStatus.Ammo;

/// <summary>
/// Gets or sets the new status to be used by the firearm.
/// </summary>
public FirearmStatus NewStatus { get; set; }
public int OldAmmo { get; }

/// <summary>
/// Gets or sets the new ammo to be used by the firearm.
/// </summary>
public byte NewAmmo
{
get => NewStatus.Ammo;
set => NewStatus = new(value, NewStatus.Flags, NewStatus.Attachments);
}
public int NewAmmo { get; set; }

/// <summary>
/// Gets or sets a value indicating whether or not the ammo can be changed.
Expand Down
10 changes: 8 additions & 2 deletions Exiled.Events/EventArgs/Map/ElevatorArrivedEventArgs.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
// <copyright file="ElevatorArrivedEventArgs.cs" company="Exiled Team">
// Copyright (c) Exiled Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
Expand All @@ -22,9 +22,10 @@ public class ElevatorArrivedEventArgs : IExiledEvent
/// Initializes a new instance of the <see cref="ElevatorArrivedEventArgs"/> class.
/// </summary>
/// <param name="lift"><inheritdoc cref="Lift"/></param>
public ElevatorArrivedEventArgs(Lift lift)
public ElevatorArrivedEventArgs(Lift lift, Player pl)
{
Lift = lift;
Player = pl;
Players = Player.Get(x => x.Lift == Lift).ToList();
}

Expand All @@ -33,6 +34,11 @@ public ElevatorArrivedEventArgs(Lift lift)
/// </summary>
public Lift Lift { get; }

/// <summary>
/// Gets player who triggered the elevator.
/// </summary>
public Player Player { get; }

/// <summary>
/// Gets the players in the elevator.
/// </summary>
Expand Down
10 changes: 8 additions & 2 deletions Exiled.Events/EventArgs/Map/ElevatorMovingEventArgs.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
// <copyright file="ElevatorMovingEventArgs.cs" company="Exiled Team">
// Copyright (c) Exiled Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
Expand All @@ -23,9 +23,10 @@ public class ElevatorMovingEventArgs : IDeniableEvent
/// </summary>
/// <param name="lift"><inheritdoc cref="Lift"/></param>
/// <param name="isAllowed"><inheritdoc cref="IsAllowed"/></param>
public ElevatorMovingEventArgs(Lift lift, bool isAllowed = true)
public ElevatorMovingEventArgs(Lift lift, Player pl, bool isAllowed = true)
{
Lift = lift;
Player = pl;
Players = Player.Get(x => x.Lift == lift).ToList();
IsAllowed = isAllowed;
}
Expand All @@ -35,6 +36,11 @@ public ElevatorMovingEventArgs(Lift lift, bool isAllowed = true)
/// </summary>
public Lift Lift { get; }

/// <summary>
/// Gets the player who triggered the elevator.
/// </summary>
public Player Player { get; }

/// <summary>
/// Gets a list of all players in elevator.
/// </summary>
Expand Down
37 changes: 17 additions & 20 deletions Exiled.Events/EventArgs/Map/PlacingBloodEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,50 @@
namespace Exiled.Events.EventArgs.Map
{
using API.Features;

using Decals;
using Interfaces;

using UnityEngine;

/// <summary>
/// Contains all information before placing a blood decal.
/// </summary>
public class PlacingBloodEventArgs : IPlayerEvent, IDeniableEvent
public class PlacingBloodEventArgs : IDeniableEvent
{
/// <summary>
/// Initializes a new instance of the <see cref="PlacingBloodEventArgs" /> class.
/// </summary>
/// <param name="player">
/// <inheritdoc cref="Player" />
/// <param name="point">
/// <inheritdoc cref="Vector3" />
/// </param>
/// <param name="target">
/// <inheritdoc cref="Target" />
/// <param name="origin">
/// <inheritdoc cref="Vector3" />
/// </param>
/// <param name="hit">
/// <inheritdoc cref="RaycastHit" />
/// <param name="decalPoolType">
/// <inheritdoc cref="DecalPoolType" />
/// </param>
/// <param name="isAllowed">
/// <inheritdoc cref="IsAllowed" />
/// </param>
public PlacingBloodEventArgs(Player player, Player target, RaycastHit hit, bool isAllowed = true)
public PlacingBloodEventArgs(Vector3 point, Vector3 origin, DecalPoolType decalPoolType, bool isAllowed = true)
{
Player = player;
Target = target;
Position = hit.point;
Point = point;
Origin = origin;
DecalPoolType = decalPoolType;
IsAllowed = isAllowed;
}

/// <summary>
/// Gets the <see cref="Player"/> who's placing the blood.
/// Gets or sets the blood placing position.
/// </summary>
public Player Player { get; }
public Vector3 Point { get; set; }

/// <summary>
/// Gets the target's <see cref="Player"/> instance.
/// </summary>
public Player Target { get; }
public Vector3 Origin { get; set; }

/// <summary>
/// Gets or sets the blood placing position.
/// Gets the player who placed the blood.
/// </summary>
public Vector3 Position { get; set; }
public DecalPoolType DecalPoolType { get; }

/// <summary>
/// Gets or sets a value indicating whether or not the blood can be placed.
Expand Down
18 changes: 14 additions & 4 deletions Exiled.Events/EventArgs/Map/SpawningTeamVehicleEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Exiled.Events.EventArgs.Map
{
using Exiled.Events.EventArgs.Interfaces;
using Respawning;
using Respawning.Waves;

/// <summary>
/// Contains all information before the server spawns a team's respawn vehicle.
Expand All @@ -18,22 +19,31 @@ public class SpawningTeamVehicleEventArgs : IDeniableEvent
/// <summary>
/// Initializes a new instance of the <see cref="SpawningTeamVehicleEventArgs" /> class.
/// </summary>
/// <param name="team">
/// <param name="spawnableWaveBase">
/// The team who the vehicle belongs to.
/// </param>
/// <param name="updateMessageFlags">
/// The flags of the update message.
/// </param>
/// <param name="isAllowed">
/// <inheritdoc cref="IsAllowed" />
/// </param>
public SpawningTeamVehicleEventArgs(SpawnableTeamType team, bool isAllowed = true)
public SpawningTeamVehicleEventArgs(ref SpawnableWaveBase spawnableWaveBase, UpdateMessageFlags updateMessageFlags, bool isAllowed = true)
{
Team = team;
Wave = spawnableWaveBase;
Flags = updateMessageFlags;
IsAllowed = isAllowed;
}

/// <summary>
/// Gets or sets which vehicle should spawn.
/// </summary>
public SpawnableTeamType Team { get; set; }
public SpawnableWaveBase Wave { get; set; }

/// <summary>
/// Gets the flags of the update message.
/// </summary>
public UpdateMessageFlags Flags { get; }

/// <summary>
/// Gets or sets a value indicating whether or not the vehicle can be spawned.
Expand Down
Loading