Bomb suit explosion resistance (#15732)
This commit is contained in:
parent
372871c333
commit
2ab41e0f8c
|
|
@ -79,6 +79,9 @@ namespace Content.Server.Armor
|
|||
|
||||
var examineMarkup = GetArmorExamine(armorModifiers);
|
||||
|
||||
var ev = new ArmorExamineEvent(examineMarkup);
|
||||
RaiseLocalEvent(uid, ref ev);
|
||||
|
||||
_examine.AddDetailedExamineVerb(args, component, examineMarkup, Loc.GetString("armor-examinable-verb-text"), "/Textures/Interface/VerbIcons/dot.svg.192dpi.png", Loc.GetString("armor-examinable-verb-message"));
|
||||
}
|
||||
|
||||
|
|
@ -110,3 +113,6 @@ namespace Content.Server.Armor
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
[ByRefEvent]
|
||||
public record struct ArmorExamineEvent(FormattedMessage Msg);
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ public sealed class ExplosionResistanceComponent : Component
|
|||
public float DamageCoefficient = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Like <see cref="GlobalResistance"/>, but specified specific to each explosion type for more customizability.
|
||||
/// Modifiers specific to each explosion type for more customizability.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("resistances", customTypeSerializer: typeof(PrototypeIdDictionarySerializer<float, ExplosionPrototype>))]
|
||||
public Dictionary<string, float> Resistances = new();
|
||||
[DataField("modifiers", customTypeSerializer: typeof(PrototypeIdDictionarySerializer<float, ExplosionPrototype>))]
|
||||
public Dictionary<string, float> Modifiers = new();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,6 +80,8 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||
|
||||
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnReset);
|
||||
|
||||
SubscribeLocalEvent<ExplosionResistanceComponent, ArmorExamineEvent>(OnArmorExamine);
|
||||
|
||||
// Handled by ExplosionSystem.Processing.cs
|
||||
SubscribeLocalEvent<MapChangedEvent>(OnMapChanged);
|
||||
|
||||
|
|
@ -93,7 +95,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||
private void OnReset(RoundRestartCleanupEvent ev)
|
||||
{
|
||||
_explosionQueue.Clear();
|
||||
if (_activeExplosion !=null)
|
||||
if (_activeExplosion != null)
|
||||
QueueDel(_activeExplosion.VisualEnt);
|
||||
_activeExplosion = null;
|
||||
_nodeGroupSystem.PauseUpdating = false;
|
||||
|
|
@ -111,8 +113,8 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||
private void OnGetResistance(EntityUid uid, ExplosionResistanceComponent component, GetExplosionResistanceEvent args)
|
||||
{
|
||||
args.DamageCoefficient *= component.DamageCoefficient;
|
||||
if (component.Resistances.TryGetValue(args.ExplotionPrototype, out var resistance))
|
||||
args.DamageCoefficient *= resistance;
|
||||
if (component.Modifiers.TryGetValue(args.ExplotionPrototype, out var modifier))
|
||||
args.DamageCoefficient *= modifier;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -204,7 +206,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||
return MathF.Cbrt(3 * totalIntensity / (slope * MathF.PI));
|
||||
}
|
||||
|
||||
return r0 * (MathF.Sqrt(12 * totalIntensity/ v0 - 3) / 6 + 0.5f);
|
||||
return r0 * (MathF.Sqrt(12 * totalIntensity / v0 - 3) / 6 + 0.5f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -348,4 +350,12 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||
_recoilSystem.KickCamera(uid, -delta.Normalized * effect);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnArmorExamine(EntityUid uid, ExplosionResistanceComponent component, ref ArmorExamineEvent args)
|
||||
{
|
||||
args.Msg.PushNewline();
|
||||
args.Msg.AddMarkup(Loc.GetString("explosion-resistance-coefficient-value",
|
||||
("value", MathF.Round((1f - component.DamageCoefficient) * 100, 1))
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
explosion-resistance-coefficient-value = - [color=orange]Explosion[/color] damage reduced by [color=lightblue]{$value}%[/color].
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
sprite: Clothing/Head/Helmets/bombsuit.rsi
|
||||
- type: IngestionBlocker
|
||||
- type: ExplosionResistance
|
||||
resistance: 0.25 # +0.65 from body -> 90%
|
||||
damageCoefficient: 0.5
|
||||
- type: Armor
|
||||
modifiers:
|
||||
coefficients:
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
sprite: Clothing/OuterClothing/Suits/bombsuit.rsi
|
||||
- type: Clothing
|
||||
sprite: Clothing/OuterClothing/Suits/bombsuit.rsi
|
||||
- type: Armor #explosion damage ignores "normal" armor, see ExplosionResistance.
|
||||
- type: Armor
|
||||
modifiers:
|
||||
coefficients:
|
||||
Blunt: 0.5
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
Piercing: 0.9
|
||||
Heat: 0.75
|
||||
- type: ExplosionResistance
|
||||
damageCoefficient: 0.65
|
||||
damageCoefficient: 0.2
|
||||
- type: GroupExamine
|
||||
- type: Tag
|
||||
tags:
|
||||
|
|
|
|||
Loading…
Reference in New Issue