Chameleon clothing (#8444)
Co-authored-by: Moony <moonheart08@users.noreply.github.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -18,6 +18,7 @@ public sealed class ItemComponent : Component
|
||||
[Access(typeof(SharedItemSystem), Other = AccessPermissions.ReadExecute)]
|
||||
public int Size = 5;
|
||||
|
||||
[Access(typeof(SharedItemSystem))]
|
||||
[DataField("inhandVisuals")]
|
||||
public Dictionary<HandLocation, List<SharedSpriteComponent.PrototypeLayerData>> InhandVisuals = new();
|
||||
|
||||
@@ -29,9 +30,10 @@ public sealed class ItemComponent : Component
|
||||
/// <summary>
|
||||
/// Rsi of the sprite shown on the player when this item is in their hands. Used to generate a default entry for <see cref="InhandVisuals"/>
|
||||
/// </summary>
|
||||
[Access(typeof(SharedItemSystem))]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("sprite")]
|
||||
public readonly string? RsiPath;
|
||||
public string? RsiPath;
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
||||
@@ -49,6 +49,22 @@ public abstract class SharedItemSystem : EntitySystem
|
||||
VisualsChanged(uid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copy all item specific visuals from another item.
|
||||
/// </summary>
|
||||
public void CopyVisuals(EntityUid uid, ItemComponent otherItem, ItemComponent? item = null)
|
||||
{
|
||||
if (!Resolve(uid, ref item))
|
||||
return;
|
||||
|
||||
item.RsiPath = otherItem.RsiPath;
|
||||
item.InhandVisuals = otherItem.InhandVisuals;
|
||||
item.HeldPrefix = otherItem.HeldPrefix;
|
||||
|
||||
Dirty(item);
|
||||
VisualsChanged(uid);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void OnHandInteract(EntityUid uid, ItemComponent component, InteractHandEvent args)
|
||||
|
||||
Reference in New Issue
Block a user