diff --git a/Content.Server/Electrocution/Components/ElectrifiedComponent.cs b/Content.Server/Electrocution/Components/ElectrifiedComponent.cs
index 2f3def6e06..65a539eb08 100644
--- a/Content.Server/Electrocution/Components/ElectrifiedComponent.cs
+++ b/Content.Server/Electrocution/Components/ElectrifiedComponent.cs
@@ -41,8 +41,32 @@ public sealed partial class ElectrifiedComponent : Component
[DataField("lowVoltageNode")]
public string? LowVoltageNode;
+ ///
+ /// Damage multiplier for HV electrocution
+ ///
+ [DataField]
+ public float HighVoltageDamageMultiplier = 3f;
+
+ ///
+ /// Shock time multiplier for HV electrocution
+ ///
+ [DataField]
+ public float HighVoltageTimeMultiplier = 1.5f;
+
+ ///
+ /// Damage multiplier for MV electrocution
+ ///
+ [DataField]
+ public float MediumVoltageDamageMultiplier = 2f;
+
+ ///
+ /// Shock time multiplier for MV electrocution
+ ///
+ [DataField]
+ public float MediumVoltageTimeMultiplier = 1.25f;
+
[DataField("shockDamage")]
- public int ShockDamage = 20;
+ public float ShockDamage = 7.5f;
///
/// Shock time, in seconds.
diff --git a/Content.Server/Electrocution/Components/ElectrocutionComponent.cs b/Content.Server/Electrocution/Components/ElectrocutionComponent.cs
index 9da78c9134..7badc85257 100644
--- a/Content.Server/Electrocution/Components/ElectrocutionComponent.cs
+++ b/Content.Server/Electrocution/Components/ElectrocutionComponent.cs
@@ -15,10 +15,4 @@ public sealed partial class ElectrocutionComponent : Component
[DataField("timeLeft")]
public float TimeLeft;
-
- [DataField("accumDamage")]
- public float AccumulatedDamage;
-
- [DataField("baseDamage")]
- public float BaseDamage = 20f;
}
diff --git a/Content.Server/Electrocution/ElectrocutionSystem.cs b/Content.Server/Electrocution/ElectrocutionSystem.cs
index d967013f65..1163306282 100644
--- a/Content.Server/Electrocution/ElectrocutionSystem.cs
+++ b/Content.Server/Electrocution/ElectrocutionSystem.cs
@@ -17,7 +17,6 @@ using Content.Shared.Interaction;
using Content.Shared.Inventory;
using Content.Shared.Jittering;
using Content.Shared.Maps;
-using Content.Shared.Mobs;
using Content.Shared.Popups;
using Content.Shared.Speech.EntitySystems;
using Content.Shared.StatusEffect;
@@ -98,29 +97,18 @@ public sealed class ElectrocutionSystem : SharedElectrocutionSystem
private void UpdateElectrocutions(float frameTime)
{
var query = EntityQueryEnumerator();
- while (query.MoveNext(out var uid, out var electrocution, out var consumer))
+ while (query.MoveNext(out var uid, out var electrocution, out _))
{
var timePassed = Math.Min(frameTime, electrocution.TimeLeft);
electrocution.TimeLeft -= timePassed;
- electrocution.AccumulatedDamage += electrocution.BaseDamage * (consumer.ReceivedPower / consumer.DrawRate) * timePassed;
if (!MathHelper.CloseTo(electrocution.TimeLeft, 0))
continue;
- if (EntityManager.EntityExists(electrocution.Electrocuting))
- {
- // TODO: damage should be scaled by shock damage multiplier
- // TODO: better paralyze/jitter timing
- var damage = new DamageSpecifier(_prototypeManager.Index(DamageType), (int) electrocution.AccumulatedDamage);
+ // We tried damage scaling based on power in the past and it really wasn't good.
+ // Various scaling types didn't fix tiders and HV grilles instantly critting players.
- var actual = _damageable.TryChangeDamage(electrocution.Electrocuting, damage, origin: electrocution.Source);
- if (actual != null)
- {
- _adminLogger.Add(LogType.Electrocution,
- $"{ToPrettyString(electrocution.Electrocuting):entity} received {actual.GetTotal():damage} powered electrocution damage from {ToPrettyString(electrocution.Source):source}");
- }
- }
QueueDel(uid);
}
}
@@ -198,7 +186,7 @@ public sealed class ElectrocutionSystem : SharedElectrocutionSystem
if (!_meleeWeapon.GetDamage(args.Used, args.User).Any())
return;
- DoCommonElectrocution(args.User, uid, component.UnarmedHitShock, component.UnarmedHitStun, false, 1);
+ DoCommonElectrocution(args.User, uid, component.UnarmedHitShock, component.UnarmedHitStun, false);
}
private void OnElectrifiedInteractUsing(EntityUid uid, ElectrifiedComponent electrified, InteractUsingEvent args)
@@ -213,16 +201,6 @@ public sealed class ElectrocutionSystem : SharedElectrocutionSystem
TryDoElectrifiedAct(uid, args.User, siemens, electrified);
}
- private float CalculateElectrifiedDamageScale(float power)
- {
- // A logarithm allows a curve of damage that grows quickly, but slows down dramatically past a value. This keeps the damage to a reasonable range.
- const float DamageShift = 1.67f; // Shifts the curve for an overall higher or lower damage baseline
- const float CeilingCoefficent = 1.35f; // Adjusts the approach to maximum damage, higher = Higher top damage
- const float LogGrowth = 0.00001f; // Adjusts the growth speed of the curve
-
- return DamageShift + MathF.Log(power * LogGrowth) * CeilingCoefficent;
- }
-
public bool TryDoElectrifiedAct(EntityUid uid, EntityUid targetUid,
float siemens = 1,
ElectrifiedComponent? electrified = null,
@@ -263,19 +241,15 @@ public sealed class ElectrocutionSystem : SharedElectrocutionSystem
}
var node = PoweredNode(uid, electrified, nodeContainer);
- if (node?.NodeGroup is not IBasePowerNet powerNet)
+ if (node?.NodeGroup is not IBasePowerNet)
return false;
- var net = powerNet.NetworkNode;
- var supp = net.LastCombinedMaxSupply;
-
- if (supp <= 0f)
- return false;
-
- // Initial damage scales off of the available supply on the principle that the victim has shorted the entire powernet through their body.
- var damageScale = CalculateElectrifiedDamageScale(supp);
- if (damageScale <= 0f)
- return false;
+ var (damageScalar, timeScalar) = node.NodeGroupID switch
+ {
+ NodeGroupID.HVPower => (electrified.HighVoltageDamageMultiplier, electrified.HighVoltageTimeMultiplier),
+ NodeGroupID.MVPower => (electrified.MediumVoltageDamageMultiplier, electrified.MediumVoltageTimeMultiplier),
+ _ => (1f, 1f)
+ };
{
var lastRet = true;
@@ -286,8 +260,8 @@ public sealed class ElectrocutionSystem : SharedElectrocutionSystem
entity,
uid,
node,
- (int) MathF.Ceiling(electrified.ShockDamage * damageScale * MathF.Pow(RecursiveDamageMultiplier, depth)),
- TimeSpan.FromSeconds(electrified.ShockTime * MathF.Min(1f + MathF.Log2(1f + damageScale), 3f) * MathF.Pow(RecursiveTimeMultiplier, depth)),
+ (int) (electrified.ShockDamage * MathF.Pow(RecursiveDamageMultiplier, depth) * damageScalar),
+ TimeSpan.FromSeconds(electrified.ShockTime * MathF.Pow(RecursiveTimeMultiplier, depth) * timeScalar),
true,
electrified.SiemensCoefficient);
}