Storage fixes (#36533)
* Storage fixes - Add size event. - Fix reclaim not running always. * Block the toggles * Standardise and popup explaining * Disable item toggles in bags * Fix verb popping up even if we can't activate * Conflicts * Validate * Stop drags if source closes * Really fixes * Real fix * Revert this
This commit is contained in:
@@ -39,20 +39,24 @@ public abstract class SharedItemSystem : EntitySystem
|
||||
|
||||
public void SetSize(EntityUid uid, ProtoId<ItemSizePrototype> size, ItemComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component, false))
|
||||
if (!Resolve(uid, ref component, false) || component.Size == size)
|
||||
return;
|
||||
|
||||
component.Size = size;
|
||||
Dirty(uid, component);
|
||||
var ev = new ItemSizeChangedEvent(uid);
|
||||
RaiseLocalEvent(uid, ref ev, broadcast: true);
|
||||
}
|
||||
|
||||
public void SetShape(EntityUid uid, List<Box2i>? shape, ItemComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component, false))
|
||||
if (!Resolve(uid, ref component, false) || component.Shape == shape)
|
||||
return;
|
||||
|
||||
component.Shape = shape;
|
||||
Dirty(uid, component);
|
||||
var ev = new ItemSizeChangedEvent(uid);
|
||||
RaiseLocalEvent(uid, ref ev, broadcast: true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -236,6 +240,7 @@ public abstract class SharedItemSystem : EntitySystem
|
||||
{
|
||||
// Set the deactivated shape to the default item's shape before it gets changed.
|
||||
itemToggleSize.DeactivatedShape ??= new List<Box2i>(GetItemShape(item));
|
||||
Dirty(uid, itemToggleSize);
|
||||
SetShape(uid, itemToggleSize.ActivatedShape, item);
|
||||
}
|
||||
|
||||
@@ -243,6 +248,7 @@ public abstract class SharedItemSystem : EntitySystem
|
||||
{
|
||||
// Set the deactivated size to the default item's size before it gets changed.
|
||||
itemToggleSize.DeactivatedSize ??= item.Size;
|
||||
Dirty(uid, itemToggleSize);
|
||||
SetSize(uid, (ProtoId<ItemSizePrototype>) itemToggleSize.ActivatedSize, item);
|
||||
}
|
||||
}
|
||||
@@ -258,7 +264,5 @@ public abstract class SharedItemSystem : EntitySystem
|
||||
SetSize(uid, (ProtoId<ItemSizePrototype>) itemToggleSize.DeactivatedSize, item);
|
||||
}
|
||||
}
|
||||
|
||||
Dirty(uid, item);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user