Fix desword wielding

This commit is contained in:
Aviu00
2024-01-27 18:04:11 +03:00
parent 7b4c95ab37
commit 80eec0bdaa
3 changed files with 27 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
namespace Content.Shared.White.Wield;
[RegisterComponent]
public sealed partial class ToggleableWieldedComponent : Component
{
}

View File

@@ -0,0 +1,20 @@
using Content.Shared.Item.ItemToggle.Components;
using Content.Shared.Wieldable.Components;
namespace Content.Shared.White.Wield;
public sealed class ToggleableWieldedSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ToggleableWieldedComponent, ItemToggleActivateAttemptEvent>(AttemptActivate);
}
private void AttemptActivate(Entity<ToggleableWieldedComponent> ent, ref ItemToggleActivateAttemptEvent args)
{
if (TryComp(ent, out WieldableComponent? wieldable) && !wieldable.Wielded)
args.Cancelled = true;
}
}

View File

@@ -267,6 +267,7 @@
enabled: false
reflects:
- Energy
- type: ToggleableWielded
- type: Construction
deconstructionTarget: null
graph: EnergyDoubleSwordGraph