Fix lumera actions (#1446)

* ZLevelMover

* fix

* Update CP14ReligionSystem.cs
This commit is contained in:
Red
2025-06-21 02:46:01 +03:00
committed by GitHub
parent a1656c0c88
commit f4abe1cf35
12 changed files with 78 additions and 53 deletions

View File

@@ -1,20 +1,33 @@
using Content.Shared._CP14.ZLevel;
using Content.Shared.Ghost;
using Content.Shared.Actions;
using Robust.Shared.Map;
namespace Content.Server._CP14.ZLevels.EntitySystems;
public sealed partial class CP14StationZLevelsSystem
{
[Dependency] private readonly SharedActionsSystem _actions = default!;
private void InitActions()
{
SubscribeLocalEvent<GhostComponent, CP14ZLevelActionUp>(OnZLevelUpGhost);
SubscribeLocalEvent<GhostComponent, CP14ZLevelActionDown>(OnZLevelDownGhost);
SubscribeLocalEvent<SpectralComponent, CP14ZLevelActionUp>(OnZLevelUp);
SubscribeLocalEvent<SpectralComponent, CP14ZLevelActionDown>(OnZLevelDown);
SubscribeLocalEvent<CP14ZLevelMoverComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<CP14ZLevelMoverComponent, ComponentRemove>(OnRemove);
SubscribeLocalEvent<CP14ZLevelMoverComponent, CP14ZLevelActionUp>(OnZLevelUpGhost);
SubscribeLocalEvent<CP14ZLevelMoverComponent, CP14ZLevelActionDown>(OnZLevelDownGhost);
}
private void OnZLevelDownGhost(Entity<GhostComponent> ent, ref CP14ZLevelActionDown args)
private void OnMapInit(Entity<CP14ZLevelMoverComponent> ent, ref MapInitEvent args)
{
_actions.AddAction(ent, ref ent.Comp.CP14ZLevelUpActionEntity, ent.Comp.UpActionProto);
_actions.AddAction(ent, ref ent.Comp.CP14ZLevelDownActionEntity, ent.Comp.DownActionProto);
}
private void OnRemove(Entity<CP14ZLevelMoverComponent> ent, ref ComponentRemove args)
{
_actions.RemoveAction(ent.Comp.CP14ZLevelUpActionEntity);
_actions.RemoveAction(ent.Comp.CP14ZLevelDownActionEntity);
}
private void OnZLevelDownGhost(Entity<CP14ZLevelMoverComponent> ent, ref CP14ZLevelActionDown args)
{
if (args.Handled)
return;
@@ -24,27 +37,7 @@ public sealed partial class CP14StationZLevelsSystem
args.Handled = true;
}
private void OnZLevelUpGhost(Entity<GhostComponent> ent, ref CP14ZLevelActionUp args)
{
if (args.Handled)
return;
ZLevelMove(ent, 1);
args.Handled = true;
}
private void OnZLevelDown(Entity<SpectralComponent> ent, ref CP14ZLevelActionDown args)
{
if (args.Handled)
return;
ZLevelMove(ent, -1);
args.Handled = true;
}
private void OnZLevelUp(Entity<SpectralComponent> ent, ref CP14ZLevelActionUp args)
private void OnZLevelUpGhost(Entity<CP14ZLevelMoverComponent> ent, ref CP14ZLevelActionUp args)
{
if (args.Handled)
return;