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:
Alex Evgrashin
2022-09-14 10:42:14 +02:00
committed by GitHub
parent 54947c137c
commit 9ce3a18e3f
33 changed files with 868 additions and 29 deletions

View File

@@ -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]

View File

@@ -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)