Fire resist now can be examined. (#35183)
This commit is contained in:
@@ -14,4 +14,11 @@ public sealed partial class FireProtectionComponent : Component
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField(required: true)]
|
[DataField(required: true)]
|
||||||
public float Reduction;
|
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";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Content.Shared.Armor;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Content.Shared.Clothing.Components;
|
using Content.Shared.Clothing.Components;
|
||||||
using Content.Shared.Inventory;
|
using Content.Shared.Inventory;
|
||||||
@@ -14,10 +15,22 @@ public sealed class FireProtectionSystem : EntitySystem
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeLocalEvent<FireProtectionComponent, InventoryRelayedEvent<GetFireProtectionEvent>>(OnGetProtection);
|
SubscribeLocalEvent<FireProtectionComponent, InventoryRelayedEvent<GetFireProtectionEvent>>(OnGetProtection);
|
||||||
|
SubscribeLocalEvent<FireProtectionComponent, ArmorExamineEvent>(OnArmorExamine);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGetProtection(Entity<FireProtectionComponent> ent, ref InventoryRelayedEvent<GetFireProtectionEvent> args)
|
private void OnGetProtection(Entity<FireProtectionComponent> ent, ref InventoryRelayedEvent<GetFireProtectionEvent> args)
|
||||||
{
|
{
|
||||||
args.Args.Reduce(ent.Comp.Reduction);
|
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)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
fire-protection-reduction-value = - [color=orange]Fire[/color] damage reduced by [color=lightblue]{$value}%[/color].
|
||||||
Reference in New Issue
Block a user