]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
show reflection prob on examine (#38199)
authorkosticia <kosticia46@gmail.com>
Wed, 18 Jun 2025 00:50:01 +0000 (03:50 +0300)
committerGitHub <noreply@github.com>
Wed, 18 Jun 2025 00:50:01 +0000 (02:50 +0200)
* goaaaaaaaal

* hmmmmmmmmmm... sorry aeshus, but thats sucks

* adwaswa

* reviev

* awdasdws

* redo

* should work

* mistake

* change
Co-authored-by: Tayrtahn Tayrtahn@users.noreply.github.com
* Update Resources/Locale/en-US/reflect/reflect-component.ftl

---------

Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
Content.Shared/Weapons/Reflect/ReflectSystem.cs
Resources/Locale/en-US/reflect/reflect-component.ftl [new file with mode: 0644]

index 1ca2cef4e453f4dfb2620d62012201f518c78068..31816d60234d74d25e5f498bd20825ea06f178d6 100644 (file)
@@ -15,6 +15,8 @@ using Robust.Shared.Network;
 using Robust.Shared.Physics.Components;
 using Robust.Shared.Physics.Systems;
 using Robust.Shared.Random;
+using Content.Shared.Examine;
+using Content.Shared.Localizations;
 
 namespace Content.Shared.Weapons.Reflect;
 
@@ -45,6 +47,7 @@ public sealed class ReflectSystem : EntitySystem
         SubscribeLocalEvent<ReflectComponent, GotUnequippedEvent>(OnReflectUnequipped);
         SubscribeLocalEvent<ReflectComponent, GotEquippedHandEvent>(OnReflectHandEquipped);
         SubscribeLocalEvent<ReflectComponent, GotUnequippedHandEvent>(OnReflectHandUnequipped);
+        SubscribeLocalEvent<ReflectComponent, ExaminedEvent>(OnExamine);
     }
 
     private void OnReflectUserCollide(Entity<ReflectComponent> ent, ref ProjectileReflectAttemptEvent args)
@@ -200,4 +203,30 @@ public sealed class ReflectSystem : EntitySystem
         ent.Comp.InRightPlace = false;
         Dirty(ent);
     }
+
+    #region Examine
+    private void OnExamine(Entity<ReflectComponent> ent, ref ExaminedEvent args)
+    {
+        // This isn't examine verb or something just because it looks too much bad.
+        // Trust me, universal verb for the potential weapons, armor and walls looks awful.
+        var value = MathF.Round(ent.Comp.ReflectProb * 100, 1);
+
+        if (!_toggle.IsActivated(ent.Owner) || value == 0 || ent.Comp.Reflects == ReflectType.None)
+            return;
+
+        var compTypes = ent.Comp.Reflects.ToString().Split(", ");
+
+        List<string> typeList = new(compTypes.Length);
+
+        for (var i = 0; i < compTypes.Length; i++)
+        {
+            var type = Loc.GetString(("reflect-component-" + compTypes[i]).ToLower());
+            typeList.Add(type);
+        }
+
+        var msg = ContentLocalizationManager.FormatList(typeList);
+
+        args.PushMarkup(Loc.GetString("reflect-component-examine", ("value", value), ("type", msg)));
+    }
+    #endregion
 }
diff --git a/Resources/Locale/en-US/reflect/reflect-component.ftl b/Resources/Locale/en-US/reflect/reflect-component.ftl
new file mode 100644 (file)
index 0000000..bf3f612
--- /dev/null
@@ -0,0 +1,3 @@
+reflect-component-examine = It has a [color=lightblue]{$value}%[/color] chance to [color=cyan]reflect[/color] {$type}.
+reflect-component-nonenergy = bullets
+reflect-component-energy = energy bolts