]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
tweak(GunRequiresWield): State the requirement for gun wielding in the description...
authorBrandon Hu <103440971+Brandon-Huu@users.noreply.github.com>
Wed, 24 Jul 2024 12:33:14 +0000 (12:33 +0000)
committerGitHub <noreply@github.com>
Wed, 24 Jul 2024 12:33:14 +0000 (08:33 -0400)
* https://en.wikipedia.org/wiki/List_of_LASD_deputy_gangs

* https://knock-la.com/tradition-of-violence-lasd-gang-history/

* https://coc.lacounty.gov/deputy-gangs/

Content.Shared/Weapons/Ranged/Components/GunRequiresWieldComponent.cs
Content.Shared/Wieldable/WieldableSystem.cs
Resources/Locale/en-US/wieldable/wieldable-component.ftl

index fa3732209f5223c87b7fa8a12d9807cd74869e94..2016459b9d59f09185dd11eef5b047cef8d4257b 100644 (file)
@@ -15,4 +15,7 @@ public sealed partial class GunRequiresWieldComponent : Component
 
     [DataField, AutoNetworkedField]
     public TimeSpan PopupCooldown = TimeSpan.FromSeconds(1);
+
+    [DataField]
+    public LocId? WieldRequiresExamineMessage  = "gunrequireswield-component-examine";
 }
index a0c9d04ff7b67dfa9e847577da2eb460204e0992..d76876c0cffad64c263f7bb32ea4cd67d67c53d1 100644 (file)
@@ -47,6 +47,7 @@ public sealed class WieldableSystem : EntitySystem
         SubscribeLocalEvent<WieldableComponent, HandDeselectedEvent>(OnDeselectWieldable);
 
         SubscribeLocalEvent<MeleeRequiresWieldComponent, AttemptMeleeEvent>(OnMeleeAttempt);
+        SubscribeLocalEvent<GunRequiresWieldComponent, ExaminedEvent>(OnExamineRequires);
         SubscribeLocalEvent<GunRequiresWieldComponent, ShotAttemptedEvent>(OnShootAttempt);
         SubscribeLocalEvent<GunWieldBonusComponent, ItemWieldedEvent>(OnGunWielded);
         SubscribeLocalEvent<GunWieldBonusComponent, ItemUnwieldedEvent>(OnGunUnwielded);
@@ -116,8 +117,17 @@ public sealed class WieldableSystem : EntitySystem
         }
     }
 
+    private void OnExamineRequires(Entity<GunRequiresWieldComponent> entity, ref ExaminedEvent args)
+    {
+        if(entity.Comp.WieldRequiresExamineMessage != null)
+            args.PushText(Loc.GetString(entity.Comp.WieldRequiresExamineMessage));
+    }
+
     private void OnExamine(EntityUid uid, GunWieldBonusComponent component, ref ExaminedEvent args)
     {
+        if (HasComp<GunRequiresWieldComponent>(uid)) 
+            return;
+
         if (component.WieldBonusExamineMessage != null)
             args.PushText(Loc.GetString(component.WieldBonusExamineMessage));
     }
index 84b58224a774666a510839c5138ccbf1e24af0a3..585d611016417454c148a71d7f88cf63c7f2ed89 100644 (file)
@@ -18,3 +18,5 @@ wieldable-component-not-in-hands = { CAPITALIZE(THE($item)) } isn't in your hand
 wieldable-component-requires = { CAPITALIZE(THE($item))} must be wielded!
 
 gunwieldbonus-component-examine = This weapon has improved accuracy when wielded.
+
+gunrequireswield-component-examine = This weapon can only be fired when wielded.