Добавил отображение защиты от горения и подправил описание защиты от взрывов (#747)
* Добавил отображение защиты от горения * Update Content.Shared/Clothing/EntitySystems/FireProtectionSystem.cs Co-authored-by: ThereDrD <88589686+ThereDrD0@users.noreply.github.com> * Update Resources/Locale/ru-RU/_white/info/fire-protection.ftl Co-authored-by: ThereDrD <88589686+ThereDrD0@users.noreply.github.com> * Правки * негативный ноль с плавающей точкой --------- Co-authored-by: ThereDrD <88589686+ThereDrD0@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Clothing.Components;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Examine; // WD
|
||||
using Content.Shared.Verbs; // WD
|
||||
using Robust.Shared.Utility; // WD
|
||||
|
||||
namespace Content.Shared.Clothing.EntitySystems;
|
||||
|
||||
@@ -9,15 +12,41 @@ namespace Content.Shared.Clothing.EntitySystems;
|
||||
/// </summary>
|
||||
public sealed class FireProtectionSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly ExamineSystemShared _examine = default!; // WD
|
||||
|
||||
private const string IconTexture = "/Textures/Interface/VerbIcons/dot.svg.192dpi.png"; // WD
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<FireProtectionComponent, InventoryRelayedEvent<GetFireProtectionEvent>>(OnGetProtection);
|
||||
SubscribeLocalEvent<FireProtectionComponent, GetVerbsEvent<ExamineVerb>>(OnProtectionVerbExamine); // WD
|
||||
}
|
||||
|
||||
private void OnGetProtection(Entity<FireProtectionComponent> ent, ref InventoryRelayedEvent<GetFireProtectionEvent> args)
|
||||
{
|
||||
args.Args.Reduce(ent.Comp.Reduction);
|
||||
}
|
||||
|
||||
// WD EDIT START
|
||||
private void OnProtectionVerbExamine(Entity<FireProtectionComponent> entity, ref GetVerbsEvent<ExamineVerb> args)
|
||||
{
|
||||
if (!args.CanInteract || !args.CanAccess)
|
||||
return;
|
||||
|
||||
var modifierPercentage = MathF.Round(entity.Comp.Reduction * 100f, 1);
|
||||
|
||||
if (modifierPercentage == float.NegativeZero)
|
||||
return;
|
||||
|
||||
var msg = new FormattedMessage();
|
||||
|
||||
msg.AddMarkup(Loc.GetString("fire-protection-examine", ("modifier", modifierPercentage)));
|
||||
|
||||
_examine.AddDetailedExamineVerb(args, entity.Comp, msg,
|
||||
Loc.GetString("fire-protection-examinable-verb-text"), IconTexture,
|
||||
Loc.GetString("fire-protection-examinable-verb-message"));
|
||||
}
|
||||
// WD EDIT END
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace Content.Shared.Examine
|
||||
{
|
||||
"Armor",
|
||||
"ClothingSpeedModifier",
|
||||
"FireProtection" // WD
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
3
Resources/Locale/ru-RU/_white/info/fire-protection.ftl
Normal file
3
Resources/Locale/ru-RU/_white/info/fire-protection.ftl
Normal file
@@ -0,0 +1,3 @@
|
||||
fire-protection-examinable-verb-text = Защита
|
||||
fire-protection-examinable-verb-message = Изучить показатели защиты.
|
||||
fire-protection-examine = Обеспечивает защиту от огня на [color=yellow]{ $modifier }%[/color].
|
||||
@@ -1 +1,2 @@
|
||||
explosion-resistance-coefficient-value = - [color=orange]Взрывной[/color] урон снижен благодаря [color=lightblue]{ $value }%[/color].
|
||||
explosion-resistance-coefficient-value = - [color=orange]Взрывной[/color] урон снижается на [color=lightblue]{ $value }%[/color].
|
||||
explosion-resistance-contents-coefficient-value = - [color=orange]Взрывной[/color] урон [color=white]содержимому[/color] снижается на [color=lightblue]{$value}%[/color].
|
||||
|
||||
Reference in New Issue
Block a user