]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Improve visibility of gun bolts (#23711)
authorI.K <45953835+notquitehadouken@users.noreply.github.com>
Mon, 8 Jan 2024 06:23:41 +0000 (00:23 -0600)
committerGitHub <noreply@github.com>
Mon, 8 Jan 2024 06:23:41 +0000 (23:23 -0700)
* add overlay

* ??????

Content.Client/CombatMode/CombatModeIndicatorsOverlay.cs
Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs
Resources/Textures/Interface/Misc/crosshair_pointers.rsi/gun_bolt_sight.png [new file with mode: 0644]
Resources/Textures/Interface/Misc/crosshair_pointers.rsi/meta.json

index 9732a677535fdea63f3fe65fdb2a5e9114336805..b2bdf2893df53d75adc33dc386fee60b02002985 100644 (file)
@@ -4,6 +4,7 @@ using Content.Shared.Weapons.Ranged.Components;
 using Robust.Client.GameObjects;
 using Robust.Client.Graphics;
 using Robust.Client.Input;
+using Robust.Client.Serialization;
 using Robust.Client.UserInterface;
 using Robust.Shared.Enums;
 using Robust.Shared.Graphics;
@@ -26,6 +27,7 @@ public sealed class CombatModeIndicatorsOverlay : Overlay
     private readonly HandsSystem _hands = default!;
 
     private readonly Texture _gunSight;
+    private readonly Texture _gunBoltSight;
     private readonly Texture _meleeSight;
 
     public override OverlaySpace Space => OverlaySpace.ScreenSpace;
@@ -46,6 +48,8 @@ public sealed class CombatModeIndicatorsOverlay : Overlay
         var spriteSys = _entMan.EntitySysManager.GetEntitySystem<SpriteSystem>();
         _gunSight = spriteSys.Frame0(new SpriteSpecifier.Rsi(new ResPath("/Textures/Interface/Misc/crosshair_pointers.rsi"),
             "gun_sight"));
+        _gunBoltSight = spriteSys.Frame0(new SpriteSpecifier.Rsi(new ResPath("/Textures/Interface/Misc/crosshair_pointers.rsi"),
+            "gun_bolt_sight"));
         _meleeSight = spriteSys.Frame0(new SpriteSpecifier.Rsi(new ResPath("/Textures/Interface/Misc/crosshair_pointers.rsi"),
              "melee_sight"));
     }
@@ -67,12 +71,16 @@ public sealed class CombatModeIndicatorsOverlay : Overlay
 
         var handEntity = _hands.GetActiveHandEntity();
         var isHandGunItem = _entMan.HasComponent<GunComponent>(handEntity);
+        var isGunBolted = true;
+        if (_entMan.TryGetComponent(handEntity, out ChamberMagazineAmmoProviderComponent? chamber))
+            isGunBolted = chamber.BoltClosed ?? true;
+
 
         var mousePos = mouseScreenPosition.Position;
         var uiScale = (args.ViewportControl as Control)?.UIScale ?? 1f;
         var limitedScale = uiScale > 1.25f ? 1.25f : uiScale;
 
-        var sight = isHandGunItem ? _gunSight : _meleeSight;
+        var sight = isHandGunItem ? (isGunBolted ? _gunSight : _gunBoltSight) : _meleeSight;
         DrawSight(sight, args.ScreenHandle, mousePos, limitedScale * Scale);
     }
 
index 06667857b35b52e9756d512e9169dbdf7727208a..45f4f2e6084e198419fe601f2084faf907274f5f 100644 (file)
@@ -323,7 +323,7 @@ public abstract partial class SharedGunSystem : EntitySystem
             {
                 if (ev.Reason != null)
                 {
-                    PopupSystem.PopupClient(ev.Reason, gunUid, user);
+                    PopupSystem.PopupCursor(ev.Reason);
                 }
 
                 // Don't spam safety sounds at gun fire rate, play it at a reduced rate.
diff --git a/Resources/Textures/Interface/Misc/crosshair_pointers.rsi/gun_bolt_sight.png b/Resources/Textures/Interface/Misc/crosshair_pointers.rsi/gun_bolt_sight.png
new file mode 100644 (file)
index 0000000..4badcc7
Binary files /dev/null and b/Resources/Textures/Interface/Misc/crosshair_pointers.rsi/gun_bolt_sight.png differ
index a9ef50c0dd3268d0171a97a45766c7e26cb37bc1..25fd92795ebd7c2893804e962cacc819d3d71694 100644 (file)
@@ -10,6 +10,9 @@
     {
       "name": "gun_sight"
     },
+    {
+      "name": "gun_bolt_sight"
+    },
     {
       "name": "melee_sight"
     }