Files
space-station-14/Content.Shared/Body/BodySystem.Relay.cs
pathetic meowmeow 8cf744ec55 Visual nubody (humanoid appearance refactor) (#42476)
* initial visual nubody

* oops overlay

* im so pheeming rn

* conversion...

* tests

* comeback of the underwear

* oops eyes

* blabbl

* zeds

* yaml linted

* search and visible count constraints

* reordering

* preserve previously selected markings colors

* fix test

* some ui niceties

* ordering

* make DB changes backwards-compatible/downgrade-friendly

* fix things again

* fix migration

* vulpkanin markings limit increase

* wrapping

* code cleanup and more code cleanup and more code cleanup and more code cleanup and

* fix slop ports

* better sampling API

* make filter work + use the method i made for its intended purpose

* fix test fails real quick

* magic mirror cleanup, remove TODO

* don't 0-init the organ profile data

* remove deltastates

---------

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
2026-01-20 07:07:53 +00:00

56 lines
1.9 KiB
C#

using Content.Shared.Body.Events;
using Content.Shared.Gibbing;
using Content.Shared.Humanoid;
using Content.Shared.Medical;
namespace Content.Shared.Body;
public sealed partial class BodySystem
{
private void InitializeRelay()
{
SubscribeLocalEvent<BodyComponent, ApplyMetabolicMultiplierEvent>(RefRelayBodyEvent);
SubscribeLocalEvent<BodyComponent, TryVomitEvent>(RefRelayBodyEvent);
SubscribeLocalEvent<BodyComponent, BeingGibbedEvent>(RefRelayBodyEvent);
SubscribeLocalEvent<BodyComponent, ApplyOrganProfileDataEvent>(RefRelayBodyEvent);
SubscribeLocalEvent<BodyComponent, ApplyOrganMarkingsEvent>(RefRelayBodyEvent);
SubscribeLocalEvent<BodyComponent, OrganCopyAppearanceEvent>(RefRelayBodyEvent);
SubscribeLocalEvent<BodyComponent, HumanoidLayerVisibilityChangedEvent>(RefRelayBodyEvent);
}
private void RefRelayBodyEvent<T>(EntityUid uid, BodyComponent component, ref T args) where T : struct
{
RelayEvent((uid, component), ref args);
}
private void RelayBodyEvent<T>(EntityUid uid, BodyComponent component, T args) where T : class
{
RelayEvent((uid, component), args);
}
public void RelayEvent<T>(Entity<BodyComponent> ent, ref T args) where T : struct
{
var ev = new BodyRelayedEvent<T>(ent, args);
foreach (var organ in ent.Comp.Organs?.ContainedEntities ?? [])
{
RaiseLocalEvent(organ, ref ev);
}
args = ev.Args;
}
public void RelayEvent<T>(Entity<BodyComponent> ent, T args) where T : class
{
var ev = new BodyRelayedEvent<T>(ent, args);
foreach (var organ in ent.Comp.Organs?.ContainedEntities ?? [])
{
RaiseLocalEvent(organ, ref ev);
}
}
}
/// <summary>
/// Event wrapper for relayed events.
/// </summary>
[ByRefEvent]
public record struct BodyRelayedEvent<TEvent>(Entity<BodyComponent> Body, TEvent Args);