Bomb suit explosion resistance (#15732)
This commit is contained in:
@@ -79,6 +79,9 @@ namespace Content.Server.Armor
|
|||||||
|
|
||||||
var examineMarkup = GetArmorExamine(armorModifiers);
|
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"));
|
_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;
|
public float DamageCoefficient = 1;
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
[DataField("resistances", customTypeSerializer: typeof(PrototypeIdDictionarySerializer<float, ExplosionPrototype>))]
|
[DataField("modifiers", customTypeSerializer: typeof(PrototypeIdDictionarySerializer<float, ExplosionPrototype>))]
|
||||||
public Dictionary<string, float> Resistances = new();
|
public Dictionary<string, float> Modifiers = new();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,6 +80,8 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
|
|
||||||
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnReset);
|
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnReset);
|
||||||
|
|
||||||
|
SubscribeLocalEvent<ExplosionResistanceComponent, ArmorExamineEvent>(OnArmorExamine);
|
||||||
|
|
||||||
// Handled by ExplosionSystem.Processing.cs
|
// Handled by ExplosionSystem.Processing.cs
|
||||||
SubscribeLocalEvent<MapChangedEvent>(OnMapChanged);
|
SubscribeLocalEvent<MapChangedEvent>(OnMapChanged);
|
||||||
|
|
||||||
@@ -93,7 +95,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
private void OnReset(RoundRestartCleanupEvent ev)
|
private void OnReset(RoundRestartCleanupEvent ev)
|
||||||
{
|
{
|
||||||
_explosionQueue.Clear();
|
_explosionQueue.Clear();
|
||||||
if (_activeExplosion !=null)
|
if (_activeExplosion != null)
|
||||||
QueueDel(_activeExplosion.VisualEnt);
|
QueueDel(_activeExplosion.VisualEnt);
|
||||||
_activeExplosion = null;
|
_activeExplosion = null;
|
||||||
_nodeGroupSystem.PauseUpdating = false;
|
_nodeGroupSystem.PauseUpdating = false;
|
||||||
@@ -111,8 +113,8 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
private void OnGetResistance(EntityUid uid, ExplosionResistanceComponent component, GetExplosionResistanceEvent args)
|
private void OnGetResistance(EntityUid uid, ExplosionResistanceComponent component, GetExplosionResistanceEvent args)
|
||||||
{
|
{
|
||||||
args.DamageCoefficient *= component.DamageCoefficient;
|
args.DamageCoefficient *= component.DamageCoefficient;
|
||||||
if (component.Resistances.TryGetValue(args.ExplotionPrototype, out var resistance))
|
if (component.Modifiers.TryGetValue(args.ExplotionPrototype, out var modifier))
|
||||||
args.DamageCoefficient *= resistance;
|
args.DamageCoefficient *= modifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -204,7 +206,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
return MathF.Cbrt(3 * totalIntensity / (slope * MathF.PI));
|
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>
|
/// <summary>
|
||||||
@@ -348,4 +350,12 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
_recoilSystem.KickCamera(uid, -delta.Normalized * effect);
|
_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
|
sprite: Clothing/Head/Helmets/bombsuit.rsi
|
||||||
- type: IngestionBlocker
|
- type: IngestionBlocker
|
||||||
- type: ExplosionResistance
|
- type: ExplosionResistance
|
||||||
resistance: 0.25 # +0.65 from body -> 90%
|
damageCoefficient: 0.5
|
||||||
- type: Armor
|
- type: Armor
|
||||||
modifiers:
|
modifiers:
|
||||||
coefficients:
|
coefficients:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
sprite: Clothing/OuterClothing/Suits/bombsuit.rsi
|
sprite: Clothing/OuterClothing/Suits/bombsuit.rsi
|
||||||
- type: Clothing
|
- type: Clothing
|
||||||
sprite: Clothing/OuterClothing/Suits/bombsuit.rsi
|
sprite: Clothing/OuterClothing/Suits/bombsuit.rsi
|
||||||
- type: Armor #explosion damage ignores "normal" armor, see ExplosionResistance.
|
- type: Armor
|
||||||
modifiers:
|
modifiers:
|
||||||
coefficients:
|
coefficients:
|
||||||
Blunt: 0.5
|
Blunt: 0.5
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
Piercing: 0.9
|
Piercing: 0.9
|
||||||
Heat: 0.75
|
Heat: 0.75
|
||||||
- type: ExplosionResistance
|
- type: ExplosionResistance
|
||||||
damageCoefficient: 0.65
|
damageCoefficient: 0.2
|
||||||
- type: GroupExamine
|
- type: GroupExamine
|
||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
|
|||||||
Reference in New Issue
Block a user