From 5cdec951c719f21a8ded1e53af276cf6ef584425 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Wed, 24 Aug 2022 00:04:50 +1000 Subject: [PATCH] Only show gun examines in detail range (#10697) The most important 2 are fire mode and how much ammo is left. --- .../Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs | 3 +++ .../Weapons/Ranged/Systems/SharedGunSystem.ChamberMagazine.cs | 3 +++ .../Weapons/Ranged/Systems/SharedGunSystem.Interactions.cs | 3 +++ .../Weapons/Ranged/Systems/SharedGunSystem.Magazine.cs | 3 +++ 4 files changed, 12 insertions(+) diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs index 11e863465b..34f2710044 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs @@ -64,6 +64,9 @@ public abstract partial class SharedGunSystem private void OnBallisticExamine(EntityUid uid, BallisticAmmoProviderComponent component, ExaminedEvent args) { + if (!args.IsInDetailsRange) + return; + args.PushMarkup(Loc.GetString("gun-magazine-examine", ("color", AmmoExamineColor), ("count", GetBallisticShots(component)))); } diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.ChamberMagazine.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.ChamberMagazine.cs index 4f74e44511..23a398f11a 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.ChamberMagazine.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.ChamberMagazine.cs @@ -25,6 +25,9 @@ public abstract partial class SharedGunSystem private void OnChamberMagazineExamine(EntityUid uid, ChamberMagazineAmmoProviderComponent component, ExaminedEvent args) { + if (!args.IsInDetailsRange) + return; + var (count, _) = GetChamberMagazineCountCapacity(component); args.PushMarkup(Loc.GetString("gun-magazine-examine", ("color", AmmoExamineColor), ("count", count))); } diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Interactions.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Interactions.cs index 56d3d31f53..e91f6fc1d6 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Interactions.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Interactions.cs @@ -12,6 +12,9 @@ public abstract partial class SharedGunSystem { private void OnExamine(EntityUid uid, GunComponent component, ExaminedEvent args) { + if (!args.IsInDetailsRange) + return; + args.PushMarkup(Loc.GetString("gun-selected-mode-examine", ("color", ModeExamineColor), ("mode", GetLocSelector(component.SelectedMode)))); args.PushMarkup(Loc.GetString("gun-fire-rate-examine", ("color", FireRateExamineColor), ("fireRate", component.FireRate))); } diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Magazine.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Magazine.cs index effffbc1a8..ab961c5fda 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Magazine.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Magazine.cs @@ -24,6 +24,9 @@ public abstract partial class SharedGunSystem private void OnMagazineExamine(EntityUid uid, MagazineAmmoProviderComponent component, ExaminedEvent args) { + if (!args.IsInDetailsRange) + return; + var (count, _) = GetMagazineCountCapacity(component); args.PushMarkup(Loc.GetString("gun-magazine-examine", ("color", AmmoExamineColor), ("count", count))); }