Gun refactor (#8301)
Co-authored-by: Kara <lunarautomaton6@gmail.com> Co-authored-by: T-Stalker <le0nel_1van@hotmail.com> Co-authored-by: T-Stalker <43253663+DogZeroX@users.noreply.github.com> Co-authored-by: ElectroJr <leonsfriedrich@gmail.com> Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -203,6 +203,8 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
// ContainerSlot automatically raises a directed EntInsertedIntoContainerMessage
|
||||
|
||||
PlaySound(uid, slot.InsertSound, slot.SoundOptions, excludeUserAudio ? user : null);
|
||||
var ev = new ItemSlotChangedEvent();
|
||||
RaiseLocalEvent(uid, ref ev);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -326,6 +328,8 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
// ContainerSlot automatically raises a directed EntRemovedFromContainerMessage
|
||||
|
||||
PlaySound(uid, slot.EjectSound, slot.SoundOptions, excludeUserAudio ? user : null);
|
||||
var ev = new ItemSlotChangedEvent();
|
||||
RaiseLocalEvent(uid, ref ev);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -336,13 +340,13 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
{
|
||||
item = null;
|
||||
|
||||
/// This handles logic with the slot itself
|
||||
// This handles logic with the slot itself
|
||||
if (!CanEject(slot))
|
||||
return false;
|
||||
|
||||
item = slot.Item;
|
||||
|
||||
/// This handles user logic
|
||||
// This handles user logic
|
||||
if (user != null && item != null && !_actionBlockerSystem.CanPickup(user.Value, item.Value))
|
||||
return false;
|
||||
|
||||
@@ -354,7 +358,7 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
/// Try to eject item from a slot.
|
||||
/// </summary>
|
||||
/// <returns>False if the id is not valid, the item slot is locked, or it has no item inserted</returns>
|
||||
public bool TryEject(EntityUid uid, string id, EntityUid user,
|
||||
public bool TryEject(EntityUid uid, string id, EntityUid? user,
|
||||
[NotNullWhen(true)] out EntityUid? item, ItemSlotsComponent? itemSlots = null, bool excludeUserAudio = false)
|
||||
{
|
||||
item = null;
|
||||
@@ -586,4 +590,10 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
args.State = new ItemSlotsComponentState(component.Slots);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raised directed on an entity when one of its item slots changes.
|
||||
/// </summary>
|
||||
[ByRefEvent]
|
||||
public readonly struct ItemSlotChangedEvent {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user