Skip to content

Commit 7ebe899

Browse files
VALERA771louis1706
andauthored
feat: Item::Inspected Item::Inspecting & Scp939::PlacingMimicPoint (#473)
* feat: a bunch of new evs * revert Events.cs changes * docs: comments for transpilers * feat: support for all items * feat: mhid support * docs: fetch documentation * fix: fix InspectedItemEventArgs.cs and docs update --------- Co-authored-by: Yamato <[email protected]>
1 parent 76677ef commit 7ebe899

File tree

7 files changed

+560
-0
lines changed

7 files changed

+560
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// -----------------------------------------------------------------------
2+
// <copyright file="InspectedItemEventArgs.cs" company="ExMod Team">
3+
// Copyright (c) ExMod Team. All rights reserved.
4+
// Licensed under the CC BY-SA 3.0 license.
5+
// </copyright>
6+
// -----------------------------------------------------------------------
7+
8+
namespace Exiled.Events.EventArgs.Item
9+
{
10+
using Exiled.API.Features;
11+
using Exiled.API.Features.Items;
12+
using Exiled.Events.EventArgs.Interfaces;
13+
using InventorySystem.Items;
14+
15+
/// <summary>
16+
/// Contains all information before weapon is inspected.
17+
/// </summary>
18+
public class InspectedItemEventArgs : IItemEvent
19+
{
20+
/// <summary>
21+
/// Initializes a new instance of the <see cref="InspectedItemEventArgs"/> class.
22+
/// </summary>
23+
/// <param name="item"><inheritdoc cref="Item"/></param>
24+
public InspectedItemEventArgs(ItemBase item)
25+
{
26+
Item = Item.Get(item);
27+
}
28+
29+
/// <inheritdoc/>
30+
public Player Player => Item.Owner;
31+
32+
/// <inheritdoc/>
33+
public Item Item { get; }
34+
}
35+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// -----------------------------------------------------------------------
2+
// <copyright file="InspectingItemEventArgs.cs" company="ExMod Team">
3+
// Copyright (c) ExMod Team. All rights reserved.
4+
// Licensed under the CC BY-SA 3.0 license.
5+
// </copyright>
6+
// -----------------------------------------------------------------------
7+
8+
namespace Exiled.Events.EventArgs.Item
9+
{
10+
using Exiled.API.Features;
11+
using Exiled.API.Features.Items;
12+
using Exiled.Events.EventArgs.Interfaces;
13+
using InventorySystem.Items;
14+
15+
/// <summary>
16+
/// Contains all information before weapon is inspected.
17+
/// </summary>
18+
public class InspectingItemEventArgs : IItemEvent, IDeniableEvent
19+
{
20+
/// <summary>
21+
/// Initializes a new instance of the <see cref="InspectingItemEventArgs"/> class.
22+
/// </summary>
23+
/// <param name="item"><inheritdoc cref="Item"/></param>
24+
/// <param name="isAllowed"><inheritdoc cref="IsAllowed"/></param>
25+
public InspectingItemEventArgs(ItemBase item, bool isAllowed = true)
26+
{
27+
Item = Item.Get(item);
28+
IsAllowed = isAllowed;
29+
}
30+
31+
/// <inheritdoc/>
32+
public Player Player => Item.Owner;
33+
34+
/// <inheritdoc/>
35+
public Item Item { get; }
36+
37+
/// <inheritdoc/>
38+
/// <remarks>Setter will not work if inspected <see cref="Item"/> is a <see cref="Firearm"/> or a <see cref="Keycard"/>.</remarks>
39+
public bool IsAllowed { get; set; }
40+
}
41+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// -----------------------------------------------------------------------
2+
// <copyright file="PlacingMimicPointEventArgs.cs" company="ExMod Team">
3+
// Copyright (c) ExMod Team. All rights reserved.
4+
// Licensed under the CC BY-SA 3.0 license.
5+
// </copyright>
6+
// -----------------------------------------------------------------------
7+
8+
namespace Exiled.Events.EventArgs.Scp939
9+
{
10+
using Exiled.API.Features;
11+
using Exiled.API.Features.Roles;
12+
using Exiled.Events.EventArgs.Interfaces;
13+
using RelativePositioning;
14+
15+
/// <summary>
16+
/// Contains all information before mimicry point is placed.
17+
/// </summary>
18+
public class PlacingMimicPointEventArgs : IScp939Event, IDeniableEvent
19+
{
20+
/// <summary>
21+
/// Initializes a new instance of the <see cref="PlacingMimicPointEventArgs"/> class.
22+
/// </summary>
23+
/// <param name="player"><inheritdoc cref="Player"/></param>
24+
/// <param name="position"><inheritdoc cref="Position"/></param>
25+
/// <param name="isAllowed"><inheritdoc cref="IsAllowed"/></param>
26+
public PlacingMimicPointEventArgs(Player player, RelativePosition position, bool isAllowed = true)
27+
{
28+
Player = player;
29+
Scp939 = player.Role.As<Scp939Role>();
30+
Position = position;
31+
IsAllowed = isAllowed;
32+
}
33+
34+
/// <inheritdoc/>
35+
public Player Player { get; }
36+
37+
/// <inheritdoc/>
38+
public Scp939Role Scp939 { get; }
39+
40+
/// <inheritdoc/>
41+
public bool IsAllowed { get; set; }
42+
43+
/// <summary>
44+
/// Gets or sets a position of mimicry point.
45+
/// </summary>
46+
public RelativePosition Position { get; set; }
47+
}
48+
}

EXILED/Exiled.Events/Handlers/Item.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ public static class Item
5858
/// </summary>
5959
public static Event<ChangingMicroHIDPickupStateEventArgs> ChangingMicroHIDPickupState { get; set; } = new();
6060

61+
/// <summary>
62+
/// Invoked before item inspection is started.
63+
/// </summary>
64+
public static Event<InspectingItemEventArgs> InspectingItem { get; set; } = new();
65+
66+
/// <summary>
67+
/// Invoked after item inspection is started.
68+
/// </summary>
69+
public static Event<InspectedItemEventArgs> InspectedItem { get; set; } = new();
70+
6171
/// <summary>
6272
/// Invoked before a <see cref="ItemType.ParticleDisruptor"/> firing while on the ground.
6373
/// <remarks>The client will still see all effects, like sounds and shoot.</remarks>
@@ -118,5 +128,17 @@ public static class Item
118128
/// </summary>
119129
/// <param name="ev">The <see cref="ChangingMicroHIDPickupStateEventArgs"/> instance.</param>
120130
public static void OnChangingMicroHIDPickupState(ChangingMicroHIDPickupStateEventArgs ev) => ChangingMicroHIDPickupState.InvokeSafely(ev);
131+
132+
/// <summary>
133+
/// Called before item inspection is started.
134+
/// </summary>
135+
/// <param name="ev">The <see cref="InspectingItemEventArgs"/> instance.</param>
136+
public static void OnInspectingItem(InspectingItemEventArgs ev) => InspectingItem.InvokeSafely(ev);
137+
138+
/// <summary>
139+
/// Called before item inspection is started.
140+
/// </summary>
141+
/// <param name="ev">The <see cref="InspectedItemEventArgs"/> instance.</param>
142+
public static void OnInspectedItem(InspectedItemEventArgs ev) => InspectedItem.InvokeSafely(ev);
121143
}
122144
}

EXILED/Exiled.Events/Handlers/Scp939.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ public static class Scp939
7474
/// </summary>
7575
public static Event<ValidatingVisibilityEventArgs> ValidatingVisibility { get; set; } = new();
7676

77+
/// <summary>
78+
/// Invoked before mimicry point is placed.
79+
/// </summary>
80+
public static Event<PlacingMimicPointEventArgs> PlacingMimicPoint { get; set; } = new();
81+
7782
/// <summary>
7883
/// Called before SCP-939 changes its target focus.
7984
/// </summary>
@@ -139,5 +144,11 @@ public static class Scp939
139144
/// </summary>
140145
/// <param name="ev">The <see cref="ValidatingVisibilityEventArgs"/> instance.</param>
141146
public static void OnValidatingVisibility(ValidatingVisibilityEventArgs ev) => ValidatingVisibility.InvokeSafely(ev);
147+
148+
/// <summary>
149+
/// Called before mimicry point is placed.
150+
/// </summary>
151+
/// <param name="ev">The <see cref="PlacingMimicPointEventArgs"/> instance.</param>
152+
public static void OnPlacingMimicPoint(PlacingMimicPointEventArgs ev) => PlacingMimicPoint.InvokeSafely(ev);
142153
}
143154
}

0 commit comments

Comments
 (0)