Refactor actions to be entities with components (#19900)
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
using System.Linq;
|
||||
using Content.Shared.Spider;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Actions.ActionTypes;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Shared.Spider;
|
||||
@@ -10,7 +6,6 @@ namespace Content.Shared.Spider;
|
||||
public abstract class SharedSpiderSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedActionsSystem _action = default!;
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
|
||||
@@ -18,14 +13,13 @@ public abstract class SharedSpiderSystem : EntitySystem
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<SpiderComponent, MapInitEvent>(OnSpiderMapInit);
|
||||
SubscribeLocalEvent<SpiderWebObjectComponent, ComponentStartup>(OnWebStartup);
|
||||
SubscribeLocalEvent<SpiderComponent, ComponentStartup>(OnSpiderStartup);
|
||||
}
|
||||
|
||||
private void OnSpiderStartup(EntityUid uid, SpiderComponent component, ComponentStartup args)
|
||||
private void OnSpiderMapInit(EntityUid uid, SpiderComponent component, MapInitEvent args)
|
||||
{
|
||||
var netAction = new InstantAction(_proto.Index<InstantActionPrototype>(component.WebActionName));
|
||||
_action.AddAction(uid, netAction, null);
|
||||
_action.AddAction(uid, Spawn(component.WebAction), null);
|
||||
}
|
||||
|
||||
private void OnWebStartup(EntityUid uid, SpiderWebObjectComponent component, ComponentStartup args)
|
||||
|
||||
Reference in New Issue
Block a user