Files
wwdpublic/Content.Client/_White/RenderOrderSystem/RenderOrderSystem.cs
RedFoxIV 6d4215b08d dollar store spookston (#258)
* initial sidestream port

* ru locale

* blyatison

* упс

* jannie qol (#6)

* initial sidestream port

* blyadison

* cs1.4 (#4)

* initial sidestream port
* blyatison

* antitryaska (#7)

* initial sidestream port (still fucked though)

* blyatison

* o fugg (#8) speedmerge

* o fugg

* fugg :-DDD

* attempt numero uno (#9)

* fix desword sound (#10)

* раз уж я тут сижу

* whoops

* shit

---------

Co-authored-by: Spatison <137375981+Spatison@users.noreply.github.com>
2025-03-03 14:29:21 +02:00

48 lines
1.6 KiB
C#

using Content.Shared.Hands.EntitySystems;
using Content.Shared._White.RenderOrderSystem;
using Robust.Client.GameObjects;
using Robust.Shared.GameStates;
using Robust.Shared.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Content.Client._White.RenderOrderSystem;
// TODO:
// Currently any clientside change to the render order can be invalidated by a
// RenderOrderComponent state update, even if the state update doesn't set a new value
// Probably will have to keep a separate list of clientside changes, but that's for later,
// there isn't many features that could yield problems with that, so it's low priority for now.
// I just want to get the sidestream done and go sleep.
public sealed class RenderOrderSystem : SharedRenderOrderSystem
{
public readonly uint DefaultRenderOrder = 0;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<RenderOrderComponent, AfterAutoHandleStateEvent>((uid, comp, args) => UpdateRenderOrder(uid, comp));
}
protected override void UpdateRenderOrder(EntityUid uid, RenderOrderComponent comp)
{
if (!TryComp<SpriteComponent>(uid, out var sprite))
return;
DebugTools.Assert(comp.ValueOrder.Count == comp.Values.Count, "comp.Values and comp.ValueOrder have different entry counts");
if(comp.ValueOrder.Count == 0)
{
sprite.RenderOrder = DefaultRenderOrder;
return;
}
sprite.RenderOrder = comp.Values[comp.ValueOrder.Last()];
}
}