Make Licoxide bypass insulated gloves (#10949)
This commit is contained in:
@@ -248,7 +248,7 @@ public sealed partial class AdminVerbSystem
|
||||
}
|
||||
|
||||
_electrocutionSystem.TryDoElectrocution(args.Target, null, damageToDeal,
|
||||
TimeSpan.FromSeconds(30), true);
|
||||
TimeSpan.FromSeconds(30), refresh: true, ignoreInsulation: true);
|
||||
},
|
||||
Impact = LogImpact.Extreme,
|
||||
Message = Loc.GetString("admin-smite-electrocute-description")
|
||||
|
||||
@@ -19,7 +19,7 @@ public sealed class Electrocute : ReagentEffect
|
||||
public override void Effect(ReagentEffectArgs args)
|
||||
{
|
||||
EntitySystem.Get<ElectrocutionSystem>().TryDoElectrocution(args.SolutionEntity, null,
|
||||
Math.Max((args.Quantity * ElectrocuteDamageScale).Int(), 1), TimeSpan.FromSeconds(ElectrocuteTime), Refresh);
|
||||
Math.Max((args.Quantity * ElectrocuteDamageScale).Int(), 1), TimeSpan.FromSeconds(ElectrocuteTime), Refresh, ignoreInsulation: true);
|
||||
|
||||
args.Source?.RemoveReagent(args.Reagent.ID, args.Quantity);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Content.Server.Electrocution
|
||||
}
|
||||
|
||||
entityManager.EntitySysManager.GetEntitySystem<ElectrocutionSystem>()
|
||||
.TryDoElectrocution(uid, null, damage, TimeSpan.FromSeconds(seconds), true);
|
||||
.TryDoElectrocution(uid, null, damage, TimeSpan.FromSeconds(seconds), refresh: true, ignoreInsulation: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ using Content.Shared.Damage.Prototypes;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Electrocution;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Jittering;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared.Popups;
|
||||
@@ -252,18 +253,25 @@ namespace Content.Server.Electrocution
|
||||
}
|
||||
}
|
||||
|
||||
/// <param name="uid">Entity being electrocuted.</param>
|
||||
/// <param name="sourceUid">Source entity of the electrocution.</param>
|
||||
/// <param name="shockDamage">How much shock damage the entity takes.</param>
|
||||
/// <param name="time">How long the entity will be stunned.</param>
|
||||
/// <param name="refresh">Should <paramref>time</paramref> be refreshed (instead of accumilated) if the entity is already electrocuted?</param>
|
||||
/// <param name="siemensCoeffiecient">How insulated the entity is from the shock. 0 means completely insulated, and 1 means no insulation.</param>
|
||||
/// <param name="statusEffect">Status effect to apply to the entity.</param>
|
||||
/// <param name="ignoreInsulation">Should the electrocution bypass the Insulated component?</param>
|
||||
/// <returns>Whether the entity <see cref="uid"/> was stunned by the shock.</returns>
|
||||
public bool TryDoElectrocution(
|
||||
EntityUid uid, EntityUid? sourceUid, int shockDamage, TimeSpan time, bool refresh, float siemensCoefficient = 1f,
|
||||
StatusEffectsComponent? statusEffects = null)
|
||||
StatusEffectsComponent? statusEffects = null, bool ignoreInsulation = false)
|
||||
{
|
||||
if (!DoCommonElectrocutionAttempt(uid, sourceUid, ref siemensCoefficient)
|
||||
if (!DoCommonElectrocutionAttempt(uid, sourceUid, ref siemensCoefficient, ignoreInsulation)
|
||||
|| !DoCommonElectrocution(uid, sourceUid, shockDamage, time, refresh, siemensCoefficient, statusEffects))
|
||||
return false;
|
||||
|
||||
RaiseLocalEvent(uid, new ElectrocutedEvent(uid, sourceUid, siemensCoefficient), true);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
private bool TryDoElectrocutionPowered(
|
||||
@@ -311,9 +319,11 @@ namespace Content.Server.Electrocution
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool DoCommonElectrocutionAttempt(EntityUid uid, EntityUid? sourceUid, ref float siemensCoefficient)
|
||||
private bool DoCommonElectrocutionAttempt(EntityUid uid, EntityUid? sourceUid, ref float siemensCoefficient, bool ignoreInsulation = false)
|
||||
{
|
||||
var attemptEvent = new ElectrocutionAttemptEvent(uid, sourceUid, siemensCoefficient);
|
||||
|
||||
var attemptEvent = new ElectrocutionAttemptEvent(uid, sourceUid, siemensCoefficient,
|
||||
ignoreInsulation ? SlotFlags.NONE : ~SlotFlags.POCKET);
|
||||
RaiseLocalEvent(uid, attemptEvent, true);
|
||||
|
||||
// Cancel the electrocution early, so we don't recursively electrocute anything.
|
||||
|
||||
@@ -4,15 +4,16 @@ namespace Content.Shared.Electrocution
|
||||
{
|
||||
public sealed class ElectrocutionAttemptEvent : CancellableEntityEventArgs, IInventoryRelayEvent
|
||||
{
|
||||
public SlotFlags TargetSlots { get; } = ~SlotFlags.POCKET;
|
||||
public SlotFlags TargetSlots { get; }
|
||||
|
||||
public readonly EntityUid TargetUid;
|
||||
public readonly EntityUid? SourceUid;
|
||||
public float SiemensCoefficient = 1f;
|
||||
|
||||
public ElectrocutionAttemptEvent(EntityUid targetUid, EntityUid? sourceUid, float siemensCoefficient)
|
||||
public ElectrocutionAttemptEvent(EntityUid targetUid, EntityUid? sourceUid, float siemensCoefficient, SlotFlags targetSlots)
|
||||
{
|
||||
TargetUid = targetUid;
|
||||
TargetSlots = TargetSlots;
|
||||
SourceUid = sourceUid;
|
||||
SiemensCoefficient = siemensCoefficient;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user