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

@@ -135,8 +135,6 @@ namespace Content.Client.Ghost
_actions.RemoveAction(uid, component.ToggleGhostsActionEntity);
//_actions.RemoveAction(uid, component.ToggleGhostHearingActionEntity); //Dont need in CP14
//CP14
_actions.RemoveAction(uid, component.CP14ZLevelUpActionEntity);
_actions.RemoveAction(uid, component.CP14ZLevelDownActionEntity);
_actions.RemoveAction(uid, component.CP14ToggleRoofActionEntity);
//CP14 end

View File

@@ -234,8 +234,6 @@ namespace Content.Server.Ghost
_actions.AddAction(uid, ref component.ToggleFoVActionEntity, component.ToggleFoVAction);
_actions.AddAction(uid, ref component.ToggleGhostsActionEntity, component.ToggleGhostsAction);
//CP14
_actions.AddAction(uid, ref component.CP14ZLevelUpActionEntity, component.CP14ZLevelUpAction);
_actions.AddAction(uid, ref component.CP14ZLevelDownActionEntity, component.CP14ZLevelDownAction);
_actions.AddAction(uid, ref component.CP14ToggleRoofActionEntity, component.CP14ToggleRoofAction);
//CP14 end
}

View File

@@ -7,7 +7,9 @@ using Content.Shared._CP14.Religion.Components;
using Content.Shared._CP14.Religion.Prototypes;
using Content.Shared._CP14.Religion.Systems;
using Content.Shared.Chat;
using Content.Shared.Eye;
using Content.Shared.FixedPoint;
using Robust.Server.GameObjects;
using Robust.Server.GameStates;
using Robust.Shared.Network;
using Robust.Shared.Player;
@@ -51,6 +53,12 @@ public sealed partial class CP14ReligionGodSystem : CP14SharedReligionGodSystem
SubscribeLocalEvent<ExpandICChatRecipientsEvent>(OnExpandRecipients);
SubscribeLocalEvent<CP14ReligionAltarComponent, ListenEvent>(OnListen);
SubscribeLocalEvent<CP14ReligionEntityComponent, GetVisMaskEvent>(OnGetVis);
}
private void OnGetVis(Entity<CP14ReligionEntityComponent> ent, ref GetVisMaskEvent args)
{
args.VisibilityMask |= (int)VisibilityFlags.Ghost;
}
private void OnExpandRecipients(ExpandICChatRecipientsEvent ev)

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;

View File

@@ -44,18 +44,6 @@ public sealed partial class GhostComponent : Component
public EntityUid? BooActionEntity;
//CP14 Ghost abilities
[DataField]
public EntProtoId CP14ZLevelUpAction = "CP14ActionZLevelUp";
[DataField, AutoNetworkedField]
public EntityUid? CP14ZLevelUpActionEntity;
[DataField]
public EntProtoId CP14ZLevelDownAction = "CP14ActionZLevelDown";
[DataField, AutoNetworkedField]
public EntityUid? CP14ZLevelDownActionEntity;
[DataField]
public EntProtoId CP14ToggleRoofAction = "CP14ActionToggleRoofs";

View File

@@ -55,8 +55,19 @@ public sealed partial class CP14SpellStorageSystem : EntitySystem
storage.Comp.SpellEntities.Add(spellEnt.Value);
}
if (storage.Comp.GrantAccessToSelf)
_actions.GrantActions(storage.Owner, storage.Comp.SpellEntities, storage.Owner);
{
if (!_mind.TryGetMind(storage.Owner, out var mind, out _))
_actions.GrantActions(storage.Owner, storage.Comp.SpellEntities, storage.Owner);
else
{
foreach (var spell in storage.Comp.SpellEntities)
{
_actionContainer.AddAction(mind, spell);
}
}
}
}
private void OnMagicStorageShutdown(Entity<CP14SpellStorageComponent> mStorage, ref ComponentShutdown args)

View File

@@ -1,5 +1,6 @@
using Content.Shared._CP14.Skill.Prototypes;
using Content.Shared.Actions;
using Content.Shared.Mind;
using Robust.Shared.Prototypes;
namespace Content.Shared._CP14.Skill.Effects;
@@ -12,13 +13,20 @@ public sealed partial class AddAction : CP14SkillEffect
public override void AddSkill(IEntityManager entManager, EntityUid target)
{
var actionsSystem = entManager.System<SharedActionsSystem>();
var actionsContainerSys = entManager.System<ActionContainerSystem>();
var mindSys = entManager.System<SharedMindSystem>();
actionsSystem.AddAction(target, Action);
if (!mindSys.TryGetMind(target, out var mind, out _))
actionsSystem.AddAction(target, Action);
else
actionsContainerSys.AddAction(mind, Action);
}
public override void RemoveSkill(IEntityManager entManager, EntityUid target)
{
var actionsSystem = entManager.System<SharedActionsSystem>();
var actionsContainerSys = entManager.System<ActionContainerSystem>();
var mindSys = entManager.System<SharedMindSystem>();
foreach (var (uid, _) in actionsSystem.GetActions(target))
{
@@ -31,7 +39,10 @@ public sealed partial class AddAction : CP14SkillEffect
if (metaData.EntityPrototype != Action)
continue;
actionsSystem.RemoveAction(target, uid);
if (!mindSys.TryGetMind(target, out var mind, out _))
actionsSystem.RemoveAction(target, uid);
else
actionsContainerSys.RemoveAction(uid);
}
}

View File

@@ -0,0 +1,23 @@
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
namespace Content.Shared._CP14.ZLevel;
/// <summary>
/// component that allows you to quickly move between Z levels
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class CP14ZLevelMoverComponent : Component
{
[DataField]
public EntProtoId UpActionProto = "CP14ActionZLevelUp";
[DataField, AutoNetworkedField]
public EntityUid? CP14ZLevelUpActionEntity;
[DataField]
public EntProtoId DownActionProto = "CP14ActionZLevelDown";
[DataField, AutoNetworkedField]
public EntityUid? CP14ZLevelDownActionEntity;
}

View File

@@ -89,6 +89,7 @@
# range: 500
#- type: StationLimitedNetwork
- type: CP14SkillScanner
- type: CP14ZLevelMover
- type: Thieving
stripTimeReduction: 9999
stealthy: true

View File

@@ -55,7 +55,6 @@
sprite: _CP14/Actions/DemigodSpells/lumera.rsi
state: wrath
- type: TargetAction
checkCanAccess: false
range: 100
- type: EntityTargetAction
blacklist:

View File

@@ -56,7 +56,6 @@
sprite: _CP14/Actions/DemigodSpells/lumera.rsi
state: mind_upgrade
- type: TargetAction
checkCanAccess: false
range: 100
- type: EntityTargetAction
blacklist:

View File

@@ -66,11 +66,7 @@
damagePerEnergy:
types:
CP14ManaDepletion: 1
- type: CP14SpellStorage
grantAccessToSelf: true
spells:
- CP14ActionZLevelUp
- CP14ActionZLevelDown
- type: CP14ZLevelMover
- type: CP14DemiplaneStabilizer # teleports gods outside when the demiplane closes
enabled: false
- type: UserInterface