@@ -24,7 +24,7 @@ public partial class InventorySystem
|
||||
SubscribeLocalEvent<InventoryComponent, ElectrocutionAttemptEvent>(RelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, SlipAttemptEvent>(RelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, RefreshMovementSpeedModifiersEvent>(RelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, GetExplosionResistanceEvent>(RelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, GetExplosionResistanceEvent>(RefRelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, BeforeStripEvent>(RelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, SeeIdentityAttemptEvent>(RelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, ModifyChangedTemperatureEvent>(RelayInventoryEvent);
|
||||
@@ -42,7 +42,22 @@ public partial class InventorySystem
|
||||
SubscribeLocalEvent<InventoryComponent, GetVerbsEvent<EquipmentVerb>>(OnGetStrippingVerbs);
|
||||
}
|
||||
|
||||
protected void RelayInventoryEvent<T>(EntityUid uid, InventoryComponent component, T args) where T : EntityEventArgs, IInventoryRelayEvent
|
||||
protected void RefRelayInventoryEvent<T>(EntityUid uid, InventoryComponent component, ref T args) where T : IInventoryRelayEvent
|
||||
{
|
||||
// Just so I don't have to update 20 morbillion events at once.
|
||||
if (args.TargetSlots == SlotFlags.NONE)
|
||||
return;
|
||||
|
||||
var containerEnumerator = new ContainerSlotEnumerator(uid, component.TemplateId, _prototypeManager, this, args.TargetSlots);
|
||||
var ev = new InventoryRelayedEvent<T>(args);
|
||||
while (containerEnumerator.MoveNext(out var container))
|
||||
{
|
||||
if (!container.ContainedEntity.HasValue) continue;
|
||||
RaiseLocalEvent(container.ContainedEntity.Value, ev, broadcast: false);
|
||||
}
|
||||
}
|
||||
|
||||
protected void RelayInventoryEvent<T>(EntityUid uid, InventoryComponent component, T args) where T : IInventoryRelayEvent
|
||||
{
|
||||
if (args.TargetSlots == SlotFlags.NONE)
|
||||
return;
|
||||
@@ -93,7 +108,7 @@ public partial class InventorySystem
|
||||
/// happens to be a dead mouse. Clothing that wishes to modify movement speed must subscribe to
|
||||
/// InventoryRelayedEvent<RefreshMovementSpeedModifiersEvent>
|
||||
/// </remarks>
|
||||
public sealed class InventoryRelayedEvent<TEvent> : EntityEventArgs where TEvent : EntityEventArgs
|
||||
public sealed class InventoryRelayedEvent<TEvent> : EntityEventArgs
|
||||
{
|
||||
public readonly TEvent Args;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user