Refactor actions to be entities with components (#19900)
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
using Content.Server.Inventory;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Body.Systems;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Guardian;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
@@ -16,7 +16,6 @@ using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Utility;
|
||||
using Content.Shared.Hands.Components;
|
||||
|
||||
namespace Content.Server.Guardian
|
||||
{
|
||||
@@ -47,6 +46,7 @@ namespace Content.Server.Guardian
|
||||
SubscribeLocalEvent<GuardianComponent, PlayerDetachedEvent>(OnGuardianUnplayer);
|
||||
|
||||
SubscribeLocalEvent<GuardianHostComponent, ComponentInit>(OnHostInit);
|
||||
SubscribeLocalEvent<GuardianHostComponent, MapInitEvent>(OnHostMapInit);
|
||||
SubscribeLocalEvent<GuardianHostComponent, MoveEvent>(OnHostMove);
|
||||
SubscribeLocalEvent<GuardianHostComponent, MobStateChangedEvent>(OnHostStateChange);
|
||||
SubscribeLocalEvent<GuardianHostComponent, ComponentShutdown>(OnHostShutdown);
|
||||
@@ -90,7 +90,11 @@ namespace Content.Server.Guardian
|
||||
private void OnHostInit(EntityUid uid, GuardianHostComponent component, ComponentInit args)
|
||||
{
|
||||
component.GuardianContainer = uid.EnsureContainer<ContainerSlot>("GuardianContainer");
|
||||
_actionSystem.AddAction(uid, component.Action, null);
|
||||
}
|
||||
|
||||
private void OnHostMapInit(EntityUid uid, GuardianHostComponent component, MapInitEvent args)
|
||||
{
|
||||
_actionSystem.AddAction(uid, ref component.ActionEntity, component.Action);
|
||||
}
|
||||
|
||||
private void OnHostShutdown(EntityUid uid, GuardianHostComponent component, ComponentShutdown args)
|
||||
@@ -102,7 +106,7 @@ namespace Content.Server.Guardian
|
||||
_bodySystem.GibBody(component.HostedGuardian.Value);
|
||||
|
||||
EntityManager.QueueDeleteEntity(component.HostedGuardian.Value);
|
||||
_actionSystem.RemoveAction(uid, component.Action);
|
||||
_actionSystem.RemoveAction(uid, component.ActionEntity);
|
||||
}
|
||||
|
||||
private void OnGuardianAttackAttempt(EntityUid uid, GuardianComponent component, AttackAttemptEvent args)
|
||||
|
||||
Reference in New Issue
Block a user