Add support for multi-layer in-hand and clothing sprites (#6252)

This commit is contained in:
Leon Friedrich
2022-02-07 16:37:57 +13:00
committed by GitHub
parent aad52dfd35
commit 470e4f8bdc
17 changed files with 529 additions and 262 deletions

View File

@@ -1,13 +1,67 @@
using System;
using System.Collections.Generic;
using Content.Shared.Hands.Components;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
using static Robust.Shared.GameObjects.SharedSpriteComponent;
namespace Content.Shared.Hands
{
/// <summary>
/// Raised directed at an item that needs to update its in-hand sprites/layers.
/// </summary>
public class GetInhandVisualsEvent : EntityEventArgs
{
/// <summary>
/// Entity that owns the hand holding the item.
/// </summary>
public readonly EntityUid User;
public readonly HandLocation Location;
/// <summary>
/// The layers that will be added to the entity that is holding this item.
/// </summary>
/// <remarks>
/// Note that the actual ordering of the layers depends on the order in which they are added to this list;
/// </remarks>
public List<(string, PrototypeLayerData)> Layers = new();
public GetInhandVisualsEvent(EntityUid user, HandLocation location)
{
User = user;
Location = location;
}
}
/// <summary>
/// Raised directed at an item after its visuals have been updated.
/// </summary>
/// <remarks>
/// Useful for systems/components that modify the visual layers that an item adds to a player. (e.g. RGB memes)
/// </remarks>
public class HeldVisualsUpdatedEvent : EntityEventArgs
{
/// <summary>
/// Entity that is holding the item.
/// </summary>
public readonly EntityUid User;
/// <summary>
/// The layers that this item is now revealing.
/// </summary>
public HashSet<string> RevealedLayers;
public HeldVisualsUpdatedEvent(EntityUid user, HashSet<string> revealedLayers)
{
User = user;
RevealedLayers = revealedLayers;
}
}
/// <summary>
/// Raised when an entity item in a hand is deselected.
/// </summary>