mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-29 23:57:29 +00:00
* Nubody * fix test fails * gibbing * lung test returns * doc comment * hand organ test * giblet test * yaml formatting * returning * relocate * trimming * re-smite * oops thusd tweak * arachnids have slower metabolism i guess * never mind the old behaviour is bad actually * rider whyyy * style changes and allat * fix collision --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> # Conflicts: # Resources/Prototypes/Entities/Mobs/Species/diona.yml # Conflicts: # Resources/Prototypes/Body/species_base.yml # Conflicts: # Resources/Prototypes/Entities/Mobs/Species/moth.yml # Conflicts: # Resources/Prototypes/Entities/Mobs/NPCs/animals.yml # Resources/Prototypes/Entities/Mobs/NPCs/regalrat.yml # Resources/Prototypes/Entities/Mobs/NPCs/slimes.yml
51 lines
1.5 KiB
C#
51 lines
1.5 KiB
C#
using Content.Shared.Body.Events;
|
|
using Content.Shared.Gibbing;
|
|
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);
|
|
}
|
|
|
|
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);
|