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

@@ -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;
}