Skip to content

Commit 329f3bb

Browse files
Jesus-QCbrayden-dowsonImBeryldavidsebesta1
authored
1.1.0 (#198)
* Adds throw propertly to Item EventsArgs (#246) * Added more properties to PlayerDeath event arg (#241) * Added OldRole to PlayerDeath event arg * docs * more properties * Apply suggestions from code review --------- Co-authored-by: Beryl <10091181+SebasCapo@users.noreply.github.com> * Adds attacker player to placed blood event (#239) * Playerscale + events (#244) * Scale * Added chaos and surface pass keycard to the keycard item register * Added CanOpen to UnlockingGenerator event Added Scp079Pinging/ed event Added RoundEndingConditionsCheck event Added permisisosn to the keycard wrapper * PingType to enum namespace * Ping to enum, comments * 1.1.0 Version Bump --------- Co-authored-by: brayden-dowson <88667957+brayden-dowson@users.noreply.github.com> Co-authored-by: Beryl <10091181+SebasCapo@users.noreply.github.com> Co-authored-by: David <david.sebesta@post.cz>
1 parent 2c88d2e commit 329f3bb

17 files changed

+295
-12
lines changed

LabApi/Events/Arguments/PlayerEvents/PlayerDeathEventArgs.cs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
using LabApi.Events.Arguments.Interfaces;
22
using LabApi.Features.Wrappers;
3+
using PlayerRoles;
34
using PlayerStatsSystem;
45
using System;
6+
using UnityEngine;
57

68
namespace LabApi.Events.Arguments.PlayerEvents;
79

@@ -16,11 +18,20 @@ public class PlayerDeathEventArgs : EventArgs, IPlayerEvent
1618
/// <param name="player">The player who died.</param>
1719
/// <param name="attacker">The player who caused the death.</param>
1820
/// <param name="damageHandler">The damage that caused the death.</param>
19-
public PlayerDeathEventArgs(ReferenceHub player, ReferenceHub? attacker, DamageHandlerBase damageHandler)
21+
/// <param name="oldRole">The previous role of the player before death.</param>
22+
/// <param name="oldPosition">The previous world position of the player before death.</param>
23+
/// <param name="oldVelocity">The previous velocity of the player before death.</param>
24+
/// <param name="oldCameraRotation">The previous world rotation of the players camera before death.</param>
25+
public PlayerDeathEventArgs(ReferenceHub player, ReferenceHub? attacker, DamageHandlerBase damageHandler,
26+
RoleTypeId oldRole, Vector3 oldPosition, Vector3 oldVelocity, Quaternion oldCameraRotation)
2027
{
2128
Player = Player.Get(player);
2229
Attacker = Player.Get(attacker);
2330
DamageHandler = damageHandler;
31+
OldRole = oldRole;
32+
OldPosition = oldPosition;
33+
OldVelocity = oldVelocity;
34+
OldCameraRotation = oldCameraRotation;
2435
}
2536

2637
/// <summary>
@@ -37,4 +48,24 @@ public PlayerDeathEventArgs(ReferenceHub player, ReferenceHub? attacker, DamageH
3748
/// Gets the damage that caused the death.
3849
/// </summary>
3950
public DamageHandlerBase DamageHandler { get; }
51+
52+
/// <summary>
53+
/// Gets the role of the <see cref="Player"/> before they had died.
54+
/// </summary>
55+
public RoleTypeId OldRole { get; }
56+
57+
/// <summary>
58+
/// Gets the player's position before they died.
59+
/// </summary>
60+
public Vector3 OldPosition { get; }
61+
62+
/// <summary>
63+
/// Gets the player's velocity before they died.
64+
/// </summary>
65+
public Vector3 OldVelocity { get; }
66+
67+
/// <summary>
68+
/// Gets the player's camera rotation before they died.
69+
/// </summary>
70+
public Quaternion OldCameraRotation { get; }
4071
}

LabApi/Events/Arguments/PlayerEvents/PlayerDroppedItemEventArgs.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ public class PlayerDroppedItemEventArgs : EventArgs, IPlayerEvent, IPickupEvent
1515
/// </summary>
1616
/// <param name="player">The player who dropped the item.</param>
1717
/// <param name="pickup">The item pickup.</param>
18-
public PlayerDroppedItemEventArgs(ReferenceHub player, ItemPickupBase pickup)
18+
/// <param name="isThrowing">Whether the item will be thrown.</param>
19+
public PlayerDroppedItemEventArgs(ReferenceHub player, ItemPickupBase pickup, bool isThrowing)
1920
{
2021
Player = Player.Get(player);
2122
Pickup = Pickup.Get(pickup);
23+
Throw = isThrowing;
2224
}
2325

2426
/// <summary>
@@ -30,4 +32,9 @@ public PlayerDroppedItemEventArgs(ReferenceHub player, ItemPickupBase pickup)
3032
/// Gets the item pickup.
3133
/// </summary>
3234
public Pickup Pickup { get; }
35+
36+
/// <summary>
37+
/// Gets or sets whether the <see cref="Pickup"/> will be thrown by the <see cref="Player"/>.
38+
/// </summary>
39+
public bool Throw { get; set; }
3340
}

LabApi/Events/Arguments/PlayerEvents/PlayerDroppingItemEventArgs.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ public class PlayerDroppingItemEventArgs : EventArgs, ICancellableEvent, IItemEv
1515
/// </summary>
1616
/// <param name="player">The player who is dropping the item.</param>
1717
/// <param name="item">The item being dropped.</param>
18-
public PlayerDroppingItemEventArgs(ReferenceHub player, ItemBase item)
18+
/// <param name="isThrowing">Whether the item will be thrown.</param>
19+
public PlayerDroppingItemEventArgs(ReferenceHub player, ItemBase item, bool isThrowing)
1920
{
2021
IsAllowed = true;
2122
Player = Player.Get(player);
2223
Item = Item.Get(item);
24+
Throw = isThrowing;
2325
}
2426

2527
/// <summary>
@@ -32,6 +34,11 @@ public PlayerDroppingItemEventArgs(ReferenceHub player, ItemBase item)
3234
/// </summary>
3335
public Item Item { get; }
3436

37+
/// <summary>
38+
/// Gets or sets whether the <see cref="Pickup"/> will be thrown by the <see cref="Player"/>.
39+
/// </summary>
40+
public bool Throw { get; set; }
41+
3542
/// <inheritdoc />
3643
public bool IsAllowed { get; set; }
3744
}

LabApi/Events/Arguments/PlayerEvents/PlayerPlacedBloodEventArgs.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ public class PlayerPlacedBloodEventArgs : EventArgs, IPlayerEvent
1414
/// Initializes a new instance of the <see cref="PlayerPlacedBloodEventArgs"/> class.
1515
/// </summary>
1616
/// <param name="player">The player whose blood it is.</param>
17+
/// <param name="attacker">The player that attacked.</param>
1718
/// <param name="hitPosition">Position at which blood has been spawned.</param>
1819
/// <param name="startRaycast">Position where the blood decal raycast will start for it to be properly attached to surface.</param>
19-
public PlayerPlacedBloodEventArgs(ReferenceHub player, Vector3 hitPosition, Vector3 startRaycast)
20+
public PlayerPlacedBloodEventArgs(ReferenceHub player, ReferenceHub attacker, Vector3 hitPosition, Vector3 startRaycast)
2021
{
2122
Player = Player.Get(player);
23+
Attacker = Player.Get(attacker);
2224
HitPosition = hitPosition;
2325
RaycastStart = startRaycast;
2426
}
@@ -28,6 +30,11 @@ public PlayerPlacedBloodEventArgs(ReferenceHub player, Vector3 hitPosition, Vect
2830
/// </summary>
2931
public Player Player { get; }
3032

33+
/// <summary>
34+
/// Gets the player that attacked the <see cref="Player"/>.
35+
/// </summary>
36+
public Player Attacker { get; }
37+
3138
/// <summary>
3239
/// Gets the position at which blood has been spawned.
3340
/// </summary>

LabApi/Events/Arguments/PlayerEvents/PlayerPlacingBloodEventArgs.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ public class PlayerPlacingBloodEventArgs : EventArgs, IPlayerEvent, ICancellable
1414
/// Initializes a new instance of the <see cref="PlayerPlacingBloodEventArgs"/> class.
1515
/// </summary>
1616
/// <param name="player">The player whose blood it is.</param>
17+
/// <param name="attacker">The player that attacked.</param>
1718
/// <param name="hitPosition">Position at which is blood being placed.</param>
1819
/// <param name="startRaycast">Position where the blood decal raycast will start for it to be properly attached to surface.</param>
19-
public PlayerPlacingBloodEventArgs(ReferenceHub player, Vector3 hitPosition, Vector3 startRaycast)
20+
public PlayerPlacingBloodEventArgs(ReferenceHub player, ReferenceHub attacker, Vector3 hitPosition, Vector3 startRaycast)
2021
{
2122
IsAllowed = true;
2223
Player = Player.Get(player);
24+
Attacker = Player.Get(attacker);
2325
HitPosition = hitPosition;
2426
RaycastStart = startRaycast;
2527
}
@@ -29,6 +31,11 @@ public PlayerPlacingBloodEventArgs(ReferenceHub player, Vector3 hitPosition, Vec
2931
/// </summary>
3032
public Player Player { get; }
3133

34+
/// <summary>
35+
/// Gets the player that attacked the <see cref="Player"/>.
36+
/// </summary>
37+
public Player Attacker { get; }
38+
3239
/// <summary>
3340
/// Gets the position at which is blood being placed.
3441
/// </summary>

LabApi/Events/Arguments/PlayerEvents/PlayerUnlockingGeneratorEventArgs.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ public class PlayerUnlockingGeneratorEventArgs : EventArgs, IPlayerEvent, IGener
1515
/// </summary>
1616
/// <param name="player">The player who is unlocking the generator.</param>
1717
/// <param name="generator">The generator that the player is unlocking.</param>
18-
public PlayerUnlockingGeneratorEventArgs(ReferenceHub player, Scp079Generator generator)
18+
/// <param name="canOpen">Whether the generator can be opened.</param>
19+
public PlayerUnlockingGeneratorEventArgs(ReferenceHub player, Scp079Generator generator, bool canOpen)
1920
{
2021
Player = Player.Get(player);
2122
Generator = Generator.Get(generator);
2223
IsAllowed = true;
24+
CanOpen = canOpen;
2325
}
2426

2527
/// <summary>
@@ -30,7 +32,14 @@ public PlayerUnlockingGeneratorEventArgs(ReferenceHub player, Scp079Generator ge
3032
/// <inheritdoc />
3133
public Generator Generator { get; }
3234

33-
/// <inheritdoc/>
35+
/// <summary>
36+
/// Gets whether the player can open the generator.
37+
/// </summary>
38+
public bool CanOpen { get; set; }
39+
40+
/// <summary>
41+
/// Gets whether this event is allowed. Not allowing this event will not unlock the generator and no denied animation is played.
42+
/// </summary>
3443
public bool IsAllowed { get; set; }
3544
}
3645

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
using LabApi.Events.Arguments.Interfaces;
2+
using LabApi.Features.Enums;
3+
using LabApi.Features.Wrappers;
4+
using System;
5+
using UnityEngine;
6+
7+
namespace LabApi.Events.Arguments.Scp079Events;
8+
9+
/// <summary>
10+
/// Represents the arguments for the <see cref="Handlers.Scp079Events.Pinged"/> event.
11+
/// </summary>
12+
public class Scp079PingedEventArgs : EventArgs, IPlayerEvent
13+
{
14+
/// <summary>
15+
/// Initializes a new instance of the <see cref="Scp079PingedEventArgs"/> class.
16+
/// </summary>
17+
/// <param name="player">The SCP-079 player instance.</param>
18+
/// <param name="position">The world position of the ping.</param>
19+
/// <param name="normal">Normal vector for the ping.</param>
20+
/// <param name="index">The index of the ping type.</param>
21+
public Scp079PingedEventArgs(ReferenceHub player, Vector3 position, Vector3 normal, byte index)
22+
{
23+
Player = Player.Get(player);
24+
Position = position;
25+
Normal = normal;
26+
PingType = (Scp079PingType)index;
27+
}
28+
29+
/// <summary>
30+
/// Gets the SCP-079 player instance.
31+
/// </summary>
32+
public Player Player { get; }
33+
34+
/// <summary>
35+
/// Gets the world ping position.
36+
/// </summary>
37+
public Vector3 Position { get; }
38+
39+
/// <summary>
40+
/// Gets the ping normal vector.
41+
/// </summary>
42+
public Vector3 Normal { get; }
43+
44+
/// <summary>
45+
/// Gets the type of the ping used the icon.
46+
/// </summary>
47+
public Scp079PingType PingType { get; }
48+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using LabApi.Events.Arguments.Interfaces;
2+
using LabApi.Features.Enums;
3+
using LabApi.Features.Wrappers;
4+
using System;
5+
using UnityEngine;
6+
7+
namespace LabApi.Events.Arguments.Scp079Events;
8+
9+
/// <summary>
10+
/// Represents the arguments for the <see cref="Handlers.Scp079Events.Pinging"/> event.
11+
/// </summary>
12+
public class Scp079PingingEventArgs : EventArgs, IPlayerEvent, ICancellableEvent
13+
{
14+
/// <summary>
15+
/// Initializes a new instance of the <see cref="Scp079PingingEventArgs"/> class.
16+
/// </summary>
17+
/// <param name="player">The SCP-079 player instance.</param>
18+
/// <param name="position">The world position of the ping.</param>
19+
/// <param name="normal">Normal vector for the ping.</param>
20+
/// <param name="index">The index of the ping type.</param>
21+
public Scp079PingingEventArgs(ReferenceHub player, Vector3 position, Vector3 normal, byte index)
22+
{
23+
Player = Player.Get(player);
24+
Position = position;
25+
Normal = normal;
26+
PingType = (Scp079PingType)index;
27+
IsAllowed = true;
28+
}
29+
30+
/// <summary>
31+
/// Gets the SCP-079 player instance.
32+
/// </summary>
33+
public Player Player { get; }
34+
35+
/// <summary>
36+
/// Gets or sets the world ping position.
37+
/// </summary>
38+
public Vector3 Position { get; set; }
39+
40+
/// <summary>
41+
/// Gets or sets the ping normal vector.
42+
/// </summary>
43+
public Vector3 Normal { get; set; }
44+
45+
/// <summary>
46+
/// Gets or sets the type of the ping used the icon.
47+
/// </summary>
48+
public Scp079PingType PingType { get; set; }
49+
50+
/// <inheritdoc/>
51+
public bool IsAllowed { get; set; }
52+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System;
2+
3+
namespace LabApi.Events.Arguments.ServerEvents;
4+
5+
/// <summary>
6+
/// Contains the arguments for the <see cref="Handlers.ServerEvents.RoundEnding"/> event.
7+
/// </summary>
8+
public class RoundEndingConditionsCheckEventArgs : EventArgs
9+
{
10+
/// <summary>
11+
/// Initializes a new instance of the <see cref="RoundEndingConditionsCheckEventArgs"/> class.
12+
/// </summary>
13+
/// <param name="canEnd">Whether the round end conditions are met</param>
14+
public RoundEndingConditionsCheckEventArgs(bool canEnd)
15+
{
16+
CanEnd = canEnd;
17+
}
18+
19+
/// <summary>
20+
/// Gets or sets whether the round end conditions are met.
21+
/// </summary>
22+
public bool CanEnd { get; set; }
23+
}

LabApi/Events/Handlers/Scp079Events.EventHandlers.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,14 @@ public static partial class Scp079Events
116116
/// Gets called when SCP-079 has used a tesla.
117117
/// </summary>
118118
public static event LabEventHandler<Scp079UsedTeslaEventArgs>? UsedTesla;
119+
120+
/// <summary>
121+
/// Gets called when SCP-079 is using ping ability.
122+
/// </summary>
123+
public static event LabEventHandler<Scp079PingingEventArgs>? Pinging;
124+
125+
/// <summary>
126+
/// Gets called when SCP-079 used ping ability.
127+
/// </summary>
128+
public static event LabEventHandler<Scp079PingedEventArgs>? Pinged;
119129
}

0 commit comments

Comments
 (0)