Reduce Triggers Boilerplate. (#41086)
* Push 1 * cleanup + master merge * launchontrigger * A crumb of cleanup --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
891f5a8f6b
commit
c01ec294d0
@@ -7,9 +7,8 @@ namespace Content.Shared.Trigger.Systems;
|
||||
/// <summary>
|
||||
/// System for creating triggers when entities are inserted into or removed from containers.
|
||||
/// </summary>
|
||||
public sealed class TriggerOnContainerInteractionSystem : EntitySystem
|
||||
public sealed class TriggerOnContainerInteractionSystem : TriggerOnXSystem
|
||||
{
|
||||
[Dependency] private readonly TriggerSystem _trigger = default!;
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
|
||||
public override void Initialize()
|
||||
@@ -31,7 +30,7 @@ public sealed class TriggerOnContainerInteractionSystem : EntitySystem
|
||||
if (ent.Comp.ContainerId != null && ent.Comp.ContainerId != args.Container.ID)
|
||||
return;
|
||||
|
||||
_trigger.Trigger(ent.Owner, args.Entity, ent.Comp.KeyOut);
|
||||
Trigger.Trigger(ent.Owner, args.Entity, ent.Comp.KeyOut);
|
||||
}
|
||||
|
||||
private void OnRemovedFromContainer(Entity<TriggerOnRemovedFromContainerComponent> ent, ref EntRemovedFromContainerMessage args)
|
||||
@@ -42,7 +41,7 @@ public sealed class TriggerOnContainerInteractionSystem : EntitySystem
|
||||
if (ent.Comp.ContainerId != null && ent.Comp.ContainerId != args.Container.ID)
|
||||
return;
|
||||
|
||||
_trigger.Trigger(ent.Owner, args.Entity, ent.Comp.KeyOut);
|
||||
Trigger.Trigger(ent.Owner, args.Entity, ent.Comp.KeyOut);
|
||||
}
|
||||
|
||||
// Used by entities to trigger when they are inserted into or removed from a container
|
||||
@@ -54,7 +53,7 @@ public sealed class TriggerOnContainerInteractionSystem : EntitySystem
|
||||
if (ent.Comp.ContainerId != null && ent.Comp.ContainerId != args.Container.ID)
|
||||
return;
|
||||
|
||||
_trigger.Trigger(ent.Owner, args.Container.Owner, ent.Comp.KeyOut);
|
||||
Trigger.Trigger(ent.Owner, args.Container.Owner, ent.Comp.KeyOut);
|
||||
}
|
||||
|
||||
private void OnGotRemovedFromContainer(Entity<TriggerOnGotRemovedFromContainerComponent> ent, ref EntGotRemovedFromContainerMessage args)
|
||||
@@ -65,6 +64,6 @@ public sealed class TriggerOnContainerInteractionSystem : EntitySystem
|
||||
if (ent.Comp.ContainerId != null && ent.Comp.ContainerId != args.Container.ID)
|
||||
return;
|
||||
|
||||
_trigger.Trigger(ent.Owner, args.Container.Owner, ent.Comp.KeyOut);
|
||||
Trigger.Trigger(ent.Owner, args.Container.Owner, ent.Comp.KeyOut);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user