Borgs (#18136)
* Laws * positronic brain and PAI rewrite * MMI * MMI pt. 2 * borg brain transfer * Roleban support, Borg job (WIP), the end of mind shenaniganry * battery drain, item slot cleanup, alerts * visuals * fix this pt1 * fix this pt2 * Modules, Lingering Stacks, Better borg flashlight * Start on UI, fix battery alerts, expand activation/deactivation, low movement speed on no power. * sprotes * no zombie borgs * oh fuck yeah i love a good relay * charger * fix the tiniest of sprite issues * adjustable names * a functional UI???? * foobar * more modules * this shit for some reason * upstream * genericize selectable borg modules * upstream again * holy fucking shit * i love christ * proper construction * da job * AA borgs * and boom more shit * admin logs * laws redux * ok just do this rq * oh boy that looks like modules * oh shit research * testos passo * so much shit holy fuck * fuckit we SHIP * last minute snags * should've gotten me on a better day
This commit is contained in:
@@ -200,7 +200,7 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
if (!slot.InsertOnInteract)
|
||||
continue;
|
||||
|
||||
if (!CanInsert(uid, args.Used, slot, swap: slot.Swap, popup: args.User))
|
||||
if (!CanInsert(uid, args.Used, args.User, slot, swap: slot.Swap, popup: args.User))
|
||||
continue;
|
||||
|
||||
// Drop the held item onto the floor. Return if the user cannot drop.
|
||||
@@ -244,7 +244,7 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
/// If a popup entity is given, and if the item slot is set to generate a popup message when it fails to
|
||||
/// pass the whitelist, then this will generate a popup.
|
||||
/// </remarks>
|
||||
public bool CanInsert(EntityUid uid, EntityUid usedUid, ItemSlot slot, bool swap = false, EntityUid? popup = null)
|
||||
public bool CanInsert(EntityUid uid, EntityUid usedUid, EntityUid? user, ItemSlot slot, bool swap = false, EntityUid? popup = null)
|
||||
{
|
||||
if (slot.Locked)
|
||||
return false;
|
||||
@@ -259,6 +259,12 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
return false;
|
||||
}
|
||||
|
||||
var ev = new ItemSlotInsertAttemptEvent(uid, usedUid, user, slot);
|
||||
RaiseLocalEvent(uid, ref ev);
|
||||
RaiseLocalEvent(usedUid, ref ev);
|
||||
if (ev.Cancelled)
|
||||
return false;
|
||||
|
||||
return slot.ContainerSlot?.CanInsertIfEmpty(usedUid, EntityManager) ?? false;
|
||||
}
|
||||
|
||||
@@ -283,7 +289,7 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
/// <returns>False if failed to insert item</returns>
|
||||
public bool TryInsert(EntityUid uid, ItemSlot slot, EntityUid item, EntityUid? user)
|
||||
{
|
||||
if (!CanInsert(uid, item, slot))
|
||||
if (!CanInsert(uid, item, user, slot))
|
||||
return false;
|
||||
|
||||
Insert(uid, slot, item, user);
|
||||
@@ -303,7 +309,7 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
if (hands.ActiveHand?.HeldEntity is not EntityUid held)
|
||||
return false;
|
||||
|
||||
if (!CanInsert(uid, held, slot))
|
||||
if (!CanInsert(uid, held, user, slot))
|
||||
return false;
|
||||
|
||||
// hands.Drop(item) checks CanDrop action blocker
|
||||
@@ -317,11 +323,17 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
|
||||
#region Eject
|
||||
|
||||
public bool CanEject(ItemSlot slot)
|
||||
public bool CanEject(EntityUid uid, EntityUid? user, ItemSlot slot)
|
||||
{
|
||||
if (slot.Locked || slot.Item == null)
|
||||
return false;
|
||||
|
||||
var ev = new ItemSlotEjectAttemptEvent(uid, slot.Item.Value, user, slot);
|
||||
RaiseLocalEvent(uid, ref ev);
|
||||
RaiseLocalEvent(slot.Item.Value, ref ev);
|
||||
if (ev.Cancelled)
|
||||
return false;
|
||||
|
||||
return slot.ContainerSlot?.CanRemove(slot.Item.Value, EntityManager) ?? false;
|
||||
}
|
||||
|
||||
@@ -352,7 +364,7 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
item = null;
|
||||
|
||||
// This handles logic with the slot itself
|
||||
if (!CanEject(slot))
|
||||
if (!CanEject(uid, user, slot))
|
||||
return false;
|
||||
|
||||
item = slot.Item;
|
||||
@@ -418,7 +430,7 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
foreach (var slot in itemSlots.Slots.Values)
|
||||
{
|
||||
// Disable slot insert if InsertOnInteract is true
|
||||
if (slot.InsertOnInteract || !CanInsert(uid, args.Using.Value, slot))
|
||||
if (slot.InsertOnInteract || !CanInsert(uid, args.Using.Value, args.User, slot))
|
||||
continue;
|
||||
|
||||
var verbSubject = slot.Name != string.Empty
|
||||
@@ -467,7 +479,7 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
// alt-click verb, there will be a "Take item" primary interaction verb.
|
||||
continue;
|
||||
|
||||
if (!CanEject(slot))
|
||||
if (!CanEject(uid, args.User, slot))
|
||||
continue;
|
||||
|
||||
if (!_actionBlockerSystem.CanPickup(args.User, slot.Item!.Value))
|
||||
@@ -506,7 +518,7 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
// If there are any slots that eject on left-click, add a "Take <item>" verb.
|
||||
foreach (var slot in itemSlots.Slots.Values)
|
||||
{
|
||||
if (!slot.EjectOnInteract || !CanEject(slot))
|
||||
if (!slot.EjectOnInteract || !CanEject(uid, args.User, slot))
|
||||
continue;
|
||||
|
||||
if (!_actionBlockerSystem.CanPickup(args.User, slot.Item!.Value))
|
||||
@@ -514,7 +526,7 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
|
||||
var verbSubject = slot.Name != string.Empty
|
||||
? Loc.GetString(slot.Name)
|
||||
: EntityManager.GetComponent<MetaDataComponent>(slot.Item!.Value).EntityName ?? string.Empty;
|
||||
: Name(slot.Item!.Value);
|
||||
|
||||
InteractionVerb takeVerb = new();
|
||||
takeVerb.IconEntity = slot.Item;
|
||||
@@ -535,7 +547,7 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
|
||||
foreach (var slot in itemSlots.Slots.Values)
|
||||
{
|
||||
if (!slot.InsertOnInteract || !CanInsert(uid, args.Using.Value, slot))
|
||||
if (!slot.InsertOnInteract || !CanInsert(uid, args.Using.Value, args.User, slot))
|
||||
continue;
|
||||
|
||||
var verbSubject = slot.Name != string.Empty
|
||||
|
||||
Reference in New Issue
Block a user