]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fire resist now can be examined. (#35183)
authorkosticia <kosticia46@gmail.com>
Thu, 27 Feb 2025 12:39:55 +0000 (15:39 +0300)
committerGitHub <noreply@github.com>
Thu, 27 Feb 2025 12:39:55 +0000 (23:39 +1100)
Content.Shared/Clothing/Components/FireProtectionComponent.cs
Content.Shared/Clothing/EntitySystems/FireProtectionSystem.cs
Resources/Locale/en-US/clothing/components/fire-protection-component.ftl [new file with mode: 0644]

index cafa6e5359e953f7f472696404d63d1d3dfbacd5..0aa196f1676cf3d98c105c8d66b7344c87936ec9 100644 (file)
@@ -14,4 +14,11 @@ public sealed partial class FireProtectionComponent : Component
     /// </summary>
     [DataField(required: true)]
     public float Reduction;
+
+    /// <summary>
+    /// LocId for message that will be shown on detailed examine.
+    /// Actually can be moved into system
+    /// </summary>
+    [DataField]
+    public LocId ExamineMessage = "fire-protection-reduction-value";
 }
index 6f80bc05882099e3b146d48831199e34f1336a42..b6c29b21ada3e7bc351cda99cc2dbef4c76156d6 100644 (file)
@@ -1,3 +1,4 @@
+using Content.Shared.Armor;
 using Content.Shared.Atmos;
 using Content.Shared.Clothing.Components;
 using Content.Shared.Inventory;
@@ -14,10 +15,22 @@ public sealed class FireProtectionSystem : EntitySystem
         base.Initialize();
 
         SubscribeLocalEvent<FireProtectionComponent, InventoryRelayedEvent<GetFireProtectionEvent>>(OnGetProtection);
+        SubscribeLocalEvent<FireProtectionComponent, ArmorExamineEvent>(OnArmorExamine);
     }
 
     private void OnGetProtection(Entity<FireProtectionComponent> ent, ref InventoryRelayedEvent<GetFireProtectionEvent> args)
     {
         args.Args.Reduce(ent.Comp.Reduction);
     }
+
+    private void OnArmorExamine(Entity<FireProtectionComponent> ent, ref ArmorExamineEvent args)
+    {
+        var value = MathF.Round((1f - ent.Comp.Reduction) * 100, 1);
+
+        if (value == 0)
+            return;
+
+        args.Msg.PushNewline();
+        args.Msg.AddMarkupOrThrow(Loc.GetString(ent.Comp.ExamineMessage, ("value", value)));
+    }
 }
diff --git a/Resources/Locale/en-US/clothing/components/fire-protection-component.ftl b/Resources/Locale/en-US/clothing/components/fire-protection-component.ftl
new file mode 100644 (file)
index 0000000..9f8c82d
--- /dev/null
@@ -0,0 +1 @@
+fire-protection-reduction-value = - [color=orange]Fire[/color] damage reduced by [color=lightblue]{$value}%[/color].