From f4abe1cf35c04e354020de26a16cff2abe1224fb Mon Sep 17 00:00:00 2001 From: Red <96445749+TheShuEd@users.noreply.github.com> Date: Sat, 21 Jun 2025 02:46:01 +0300 Subject: [PATCH] Fix lumera actions (#1446) * ZLevelMover * fix * Update CP14ReligionSystem.cs --- Content.Client/Ghost/GhostSystem.cs | 2 - Content.Server/Ghost/GhostSystem.cs | 2 - .../_CP14/Religion/CP14ReligionSystem.cs | 8 ++++ .../CP14StationZLevelsSystem.Actions.cs | 47 ++++++++----------- Content.Shared/Ghost/GhostComponent.cs | 12 ----- .../CP14SpellStorageSystem.cs | 13 ++++- .../_CP14/Skill/Effects/AddAction.cs | 15 +++++- .../_CP14/ZLevel/CP14ZlevelMoverComponent.cs | 23 +++++++++ .../Entities/Mobs/Player/admin_ghost.yml | 1 + .../Spells/Demigods/Lumera/mind_degrade.yml | 1 - .../Spells/Demigods/Lumera/mind_upgrade.yml | 1 - .../Entities/Mobs/Player/Patrons/gods.yml | 6 +-- 12 files changed, 78 insertions(+), 53 deletions(-) create mode 100644 Content.Shared/_CP14/ZLevel/CP14ZlevelMoverComponent.cs diff --git a/Content.Client/Ghost/GhostSystem.cs b/Content.Client/Ghost/GhostSystem.cs index 42f0cf769c..ee80470807 100644 --- a/Content.Client/Ghost/GhostSystem.cs +++ b/Content.Client/Ghost/GhostSystem.cs @@ -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 diff --git a/Content.Server/Ghost/GhostSystem.cs b/Content.Server/Ghost/GhostSystem.cs index 764b2f736e..0708bd054f 100644 --- a/Content.Server/Ghost/GhostSystem.cs +++ b/Content.Server/Ghost/GhostSystem.cs @@ -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 } diff --git a/Content.Server/_CP14/Religion/CP14ReligionSystem.cs b/Content.Server/_CP14/Religion/CP14ReligionSystem.cs index 7a0e95c5b0..aa3f830a1f 100644 --- a/Content.Server/_CP14/Religion/CP14ReligionSystem.cs +++ b/Content.Server/_CP14/Religion/CP14ReligionSystem.cs @@ -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(OnExpandRecipients); SubscribeLocalEvent(OnListen); + SubscribeLocalEvent(OnGetVis); + } + + private void OnGetVis(Entity ent, ref GetVisMaskEvent args) + { + args.VisibilityMask |= (int)VisibilityFlags.Ghost; } private void OnExpandRecipients(ExpandICChatRecipientsEvent ev) diff --git a/Content.Server/_CP14/ZLevels/EntitySystems/CP14StationZLevelsSystem.Actions.cs b/Content.Server/_CP14/ZLevels/EntitySystems/CP14StationZLevelsSystem.Actions.cs index b083cb61f8..633694723f 100644 --- a/Content.Server/_CP14/ZLevels/EntitySystems/CP14StationZLevelsSystem.Actions.cs +++ b/Content.Server/_CP14/ZLevels/EntitySystems/CP14StationZLevelsSystem.Actions.cs @@ -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(OnZLevelUpGhost); - SubscribeLocalEvent(OnZLevelDownGhost); - SubscribeLocalEvent(OnZLevelUp); - SubscribeLocalEvent(OnZLevelDown); + SubscribeLocalEvent(OnMapInit); + SubscribeLocalEvent(OnRemove); + SubscribeLocalEvent(OnZLevelUpGhost); + SubscribeLocalEvent(OnZLevelDownGhost); } - private void OnZLevelDownGhost(Entity ent, ref CP14ZLevelActionDown args) + private void OnMapInit(Entity 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 ent, ref ComponentRemove args) + { + _actions.RemoveAction(ent.Comp.CP14ZLevelUpActionEntity); + _actions.RemoveAction(ent.Comp.CP14ZLevelDownActionEntity); + } + + private void OnZLevelDownGhost(Entity ent, ref CP14ZLevelActionDown args) { if (args.Handled) return; @@ -24,27 +37,7 @@ public sealed partial class CP14StationZLevelsSystem args.Handled = true; } - private void OnZLevelUpGhost(Entity ent, ref CP14ZLevelActionUp args) - { - if (args.Handled) - return; - - ZLevelMove(ent, 1); - - args.Handled = true; - } - - private void OnZLevelDown(Entity ent, ref CP14ZLevelActionDown args) - { - if (args.Handled) - return; - - ZLevelMove(ent, -1); - - args.Handled = true; - } - - private void OnZLevelUp(Entity ent, ref CP14ZLevelActionUp args) + private void OnZLevelUpGhost(Entity ent, ref CP14ZLevelActionUp args) { if (args.Handled) return; diff --git a/Content.Shared/Ghost/GhostComponent.cs b/Content.Shared/Ghost/GhostComponent.cs index 3f8d7c9caa..c0a287af0d 100644 --- a/Content.Shared/Ghost/GhostComponent.cs +++ b/Content.Shared/Ghost/GhostComponent.cs @@ -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"; diff --git a/Content.Shared/_CP14/MagicSpellStorage/CP14SpellStorageSystem.cs b/Content.Shared/_CP14/MagicSpellStorage/CP14SpellStorageSystem.cs index d9b5709278..a0951c64a2 100644 --- a/Content.Shared/_CP14/MagicSpellStorage/CP14SpellStorageSystem.cs +++ b/Content.Shared/_CP14/MagicSpellStorage/CP14SpellStorageSystem.cs @@ -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 mStorage, ref ComponentShutdown args) diff --git a/Content.Shared/_CP14/Skill/Effects/AddAction.cs b/Content.Shared/_CP14/Skill/Effects/AddAction.cs index 76aaec59cb..319a3f2419 100644 --- a/Content.Shared/_CP14/Skill/Effects/AddAction.cs +++ b/Content.Shared/_CP14/Skill/Effects/AddAction.cs @@ -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(); + var actionsContainerSys = entManager.System(); + var mindSys = entManager.System(); - 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(); + var actionsContainerSys = entManager.System(); + var mindSys = entManager.System(); 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); } } diff --git a/Content.Shared/_CP14/ZLevel/CP14ZlevelMoverComponent.cs b/Content.Shared/_CP14/ZLevel/CP14ZlevelMoverComponent.cs new file mode 100644 index 0000000000..e04fd40285 --- /dev/null +++ b/Content.Shared/_CP14/ZLevel/CP14ZlevelMoverComponent.cs @@ -0,0 +1,23 @@ +using Robust.Shared.GameStates; +using Robust.Shared.Prototypes; + +namespace Content.Shared._CP14.ZLevel; + +/// +/// component that allows you to quickly move between Z levels +/// +[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; +} diff --git a/Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml b/Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml index 247d13ecda..002bc99f42 100644 --- a/Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml +++ b/Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml @@ -89,6 +89,7 @@ # range: 500 #- type: StationLimitedNetwork - type: CP14SkillScanner + - type: CP14ZLevelMover - type: Thieving stripTimeReduction: 9999 stealthy: true diff --git a/Resources/Prototypes/_CP14/Entities/Actions/Spells/Demigods/Lumera/mind_degrade.yml b/Resources/Prototypes/_CP14/Entities/Actions/Spells/Demigods/Lumera/mind_degrade.yml index b00d1b048c..82667a6777 100644 --- a/Resources/Prototypes/_CP14/Entities/Actions/Spells/Demigods/Lumera/mind_degrade.yml +++ b/Resources/Prototypes/_CP14/Entities/Actions/Spells/Demigods/Lumera/mind_degrade.yml @@ -55,7 +55,6 @@ sprite: _CP14/Actions/DemigodSpells/lumera.rsi state: wrath - type: TargetAction - checkCanAccess: false range: 100 - type: EntityTargetAction blacklist: diff --git a/Resources/Prototypes/_CP14/Entities/Actions/Spells/Demigods/Lumera/mind_upgrade.yml b/Resources/Prototypes/_CP14/Entities/Actions/Spells/Demigods/Lumera/mind_upgrade.yml index 50d93185cd..bbdfb2ff14 100644 --- a/Resources/Prototypes/_CP14/Entities/Actions/Spells/Demigods/Lumera/mind_upgrade.yml +++ b/Resources/Prototypes/_CP14/Entities/Actions/Spells/Demigods/Lumera/mind_upgrade.yml @@ -56,7 +56,6 @@ sprite: _CP14/Actions/DemigodSpells/lumera.rsi state: mind_upgrade - type: TargetAction - checkCanAccess: false range: 100 - type: EntityTargetAction blacklist: diff --git a/Resources/Prototypes/_CP14/Entities/Mobs/Player/Patrons/gods.yml b/Resources/Prototypes/_CP14/Entities/Mobs/Player/Patrons/gods.yml index 4ea2ea3b26..163fa15d8f 100644 --- a/Resources/Prototypes/_CP14/Entities/Mobs/Player/Patrons/gods.yml +++ b/Resources/Prototypes/_CP14/Entities/Mobs/Player/Patrons/gods.yml @@ -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