Files
OldThink/Content.Client/White/Crossbow/DrawableVisualizerSystem.cs
Aviu00 d0431ee61e Crossbow (#327)
* Add powered crossbow

* Add spear embedding (#18578)

* Add spear embedding

* fuck this copy-paste

* Juicier

* the river

* Add crossbow embedding

* Fix crossbow construction

* Finish crossbow

* Remove unused

---------

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2024-01-21 07:04:30 +03:00

22 lines
772 B
C#

using Content.Shared.Weapons.Ranged.Systems;
using Content.Shared.White.Crossbow;
using Robust.Client.GameObjects;
namespace Content.Client.White.Crossbow;
public sealed class DrawableSystem : VisualizerSystem<DrawableComponent>
{
protected override void OnAppearanceChange(EntityUid uid, DrawableComponent component, ref AppearanceChangeEvent args)
{
if (args.Sprite == null)
return;
var drawn = args.AppearanceData.TryGetValue(DrawableVisuals.Drawn, out var drawnObj) && drawnObj is true;
var hasAmmo = args.AppearanceData.TryGetValue(AmmoVisuals.AmmoCount, out var ammoCount) && (int) ammoCount > 0;
var state = drawn ? "drawn" : hasAmmo ? "loaded" : "base";
args.Sprite.LayerSetState(0, state);
}
}