Add tag to let entity not fire guns (#9293)
This commit is contained in:
@@ -12,6 +12,7 @@ using Content.Shared.Throwing;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Weapons.Ranged.Components;
|
||||
using Content.Shared.Weapons.Ranged.Events;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameStates;
|
||||
@@ -42,6 +43,7 @@ public abstract partial class SharedGunSystem : EntitySystem
|
||||
[Dependency] protected readonly SharedPhysicsSystem Physics = default!;
|
||||
[Dependency] protected readonly SharedPopupSystem PopupSystem = default!;
|
||||
[Dependency] protected readonly ThrowingSystem ThrowingSystem = default!;
|
||||
[Dependency] protected readonly TagSystem _tagSystem = default!;
|
||||
|
||||
protected ISawmill Sawmill = default!;
|
||||
|
||||
@@ -86,6 +88,9 @@ public abstract partial class SharedGunSystem : EntitySystem
|
||||
|
||||
private void OnGunMeleeAttempt(EntityUid uid, GunComponent component, ref MeleeAttackAttemptEvent args)
|
||||
{
|
||||
if (_tagSystem.HasTag(args.User, "GunsDisabled"))
|
||||
return;
|
||||
|
||||
args.Cancelled = true;
|
||||
}
|
||||
|
||||
@@ -181,6 +186,12 @@ public abstract partial class SharedGunSystem : EntitySystem
|
||||
|
||||
if (toCoordinates == null) return;
|
||||
|
||||
if (_tagSystem.HasTag(user, "GunsDisabled"))
|
||||
{
|
||||
Popup(Loc.GetString("gun-disabled"), user, user);
|
||||
return;
|
||||
}
|
||||
|
||||
var curTime = Timing.CurTime;
|
||||
|
||||
// Need to do this to play the clicking sound for empty automatic weapons
|
||||
|
||||
@@ -3,6 +3,7 @@ gun-selected-mode-examine = Current selected fire mode is [color={$color}]{$mode
|
||||
gun-fire-rate-examine = Fire rate is [color={$color}]{$fireRate}[/color] per second.
|
||||
gun-selector-verb = Change to {$mode}
|
||||
gun-selected-mode = Selected {$mode}
|
||||
gun-disabled = You can't use guns!
|
||||
|
||||
# SelectiveFire
|
||||
gun-SemiAuto = semi-auto
|
||||
|
||||
@@ -207,6 +207,9 @@
|
||||
- type: Tag
|
||||
id: Grenade
|
||||
|
||||
- type: Tag
|
||||
id: GunsDisabled # Allow certain entities to not use guns without complicating the system with an event
|
||||
|
||||
- type: Tag
|
||||
id: Handcuffs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user