Refactor actions to be entities with components (#19900)
This commit is contained in:
@@ -1,35 +1,33 @@
|
||||
using System.Numerics;
|
||||
using Content.Server.Actions;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Shared.Stunnable;
|
||||
using Content.Shared.Revenant;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Random;
|
||||
using Content.Shared.StatusEffect;
|
||||
using Content.Server.Visible;
|
||||
using Content.Shared.Examine;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Content.Shared.Actions.ActionTypes;
|
||||
using Content.Shared.Tag;
|
||||
using Content.Server.Store.Components;
|
||||
using Content.Server.Store.Systems;
|
||||
using Content.Server.Visible;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Physics;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Revenant;
|
||||
using Content.Shared.Revenant.Components;
|
||||
using Content.Shared.StatusEffect;
|
||||
using Content.Shared.Stunnable;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.Revenant.EntitySystems;
|
||||
|
||||
public sealed partial class RevenantSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
[Dependency] private readonly ActionsSystem _action = default!;
|
||||
[Dependency] private readonly AlertsSystem _alerts = default!;
|
||||
[Dependency] private readonly DamageableSystem _damage = default!;
|
||||
@@ -46,11 +44,15 @@ public sealed partial class RevenantSystem : EntitySystem
|
||||
[Dependency] private readonly VisibilitySystem _visibility = default!;
|
||||
[Dependency] private readonly GameTicker _ticker = default!;
|
||||
|
||||
[ValidatePrototypeId<EntityPrototype>]
|
||||
private const string RevenantShopId = "ActionRevenantShop";
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<RevenantComponent, ComponentStartup>(OnStartup);
|
||||
SubscribeLocalEvent<RevenantComponent, MapInitEvent>(OnMapInit);
|
||||
|
||||
SubscribeLocalEvent<RevenantComponent, RevenantShopActionEvent>(OnShop);
|
||||
SubscribeLocalEvent<RevenantComponent, DamageChangedEvent>(OnDamage);
|
||||
@@ -82,9 +84,11 @@ public sealed partial class RevenantSystem : EntitySystem
|
||||
//ghost vision
|
||||
if (TryComp(uid, out EyeComponent? eye))
|
||||
eye.VisibilityMask |= (uint) (VisibilityFlags.Ghost);
|
||||
}
|
||||
|
||||
var shopaction = new InstantAction(_proto.Index<InstantActionPrototype>("RevenantShop"));
|
||||
_action.AddAction(uid, shopaction, null);
|
||||
private void OnMapInit(EntityUid uid, RevenantComponent component, MapInitEvent args)
|
||||
{
|
||||
_action.AddAction(uid, Spawn(RevenantShopId), null);
|
||||
}
|
||||
|
||||
private void OnStatusAdded(EntityUid uid, RevenantComponent component, StatusEffectAddedEvent args)
|
||||
|
||||
Reference in New Issue
Block a user