[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
public ProtoId<ItemSizePrototype>? ActivatedSize = null;
+ /// <summary>
+ /// Item's shape when activated
+ /// </summary>
+ [ViewVariables(VVAccess.ReadWrite), DataField]
+ public List<Box2i>? ActivatedShape = null;
+
/// <summary>
/// Item's size when deactivated. If none is mentioned, it uses the item's default size instead.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
public ProtoId<ItemSizePrototype>? DeactivatedSize = null;
+
+ /// <summary>
+ /// Item's shape when deactivated. If none is mentioned, it uses the item's default shape instead.
+ /// </summary>
+ [ViewVariables(VVAccess.ReadWrite), DataField]
+ public List<Box2i>? DeactivatedShape = null;
}
Dirty(uid, component);
}
+ public void SetShape(EntityUid uid, List<Box2i>? shape, ItemComponent? component = null)
+ {
+ if (!Resolve(uid, ref component, false))
+ return;
+
+ component.Shape = shape;
+ Dirty(uid, component);
+ }
+
public void SetHeldPrefix(EntityUid uid, string? heldPrefix, bool force = false, ItemComponent? component = null)
{
if (!Resolve(uid, ref component, false))
if (args.Activated)
{
+ if (itemToggleSize.ActivatedShape != null)
+ {
+ // Set the deactivated shape to the default item's shape before it gets changed.
+ itemToggleSize.DeactivatedShape ??= new List<Box2i>(GetItemShape(item));
+ SetShape(uid, itemToggleSize.ActivatedShape, item);
+ }
+
if (itemToggleSize.ActivatedSize != null)
{
// Set the deactivated size to the default item's size before it gets changed.
}
else
{
+ if (itemToggleSize.DeactivatedShape != null)
+ {
+ SetShape(uid, itemToggleSize.DeactivatedShape, item);
+ }
+
if (itemToggleSize.DeactivatedSize != null)
{
SetSize(uid, (ProtoId<ItemSizePrototype>) itemToggleSize.DeactivatedSize, item);