Make wires only electrocute when cut or attacked (#6047)
This commit is contained in:
@@ -123,7 +123,7 @@ namespace Content.Server.Electrocution
|
|||||||
if (!electrified.OnBump)
|
if (!electrified.OnBump)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TryDoElectrifiedAct(uid, args.OtherFixture.Body.Owner, electrified);
|
TryDoElectrifiedAct(uid, args.OtherFixture.Body.Owner, 1, electrified);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnElectrifiedAttacked(EntityUid uid, ElectrifiedComponent electrified, AttackedEvent args)
|
private void OnElectrifiedAttacked(EntityUid uid, ElectrifiedComponent electrified, AttackedEvent args)
|
||||||
@@ -131,7 +131,7 @@ namespace Content.Server.Electrocution
|
|||||||
if (!electrified.OnAttacked)
|
if (!electrified.OnAttacked)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TryDoElectrifiedAct(uid, args.User, electrified);
|
TryDoElectrifiedAct(uid, args.User, 1, electrified);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnElectrifiedHandInteract(EntityUid uid, ElectrifiedComponent electrified, InteractHandEvent args)
|
private void OnElectrifiedHandInteract(EntityUid uid, ElectrifiedComponent electrified, InteractHandEvent args)
|
||||||
@@ -139,7 +139,7 @@ namespace Content.Server.Electrocution
|
|||||||
if (!electrified.OnHandInteract)
|
if (!electrified.OnHandInteract)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TryDoElectrifiedAct(uid, args.User, electrified);
|
TryDoElectrifiedAct(uid, args.User, 1, electrified);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnElectrifiedInteractUsing(EntityUid uid, ElectrifiedComponent electrified, InteractUsingEvent args)
|
private void OnElectrifiedInteractUsing(EntityUid uid, ElectrifiedComponent electrified, InteractUsingEvent args)
|
||||||
@@ -147,10 +147,15 @@ namespace Content.Server.Electrocution
|
|||||||
if (!electrified.OnInteractUsing)
|
if (!electrified.OnInteractUsing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TryDoElectrifiedAct(uid, args.User, electrified);
|
var siemens = TryComp(args.Used, out InsulatedComponent? insulation)
|
||||||
|
? insulation.SiemensCoefficient
|
||||||
|
: 1;
|
||||||
|
|
||||||
|
TryDoElectrifiedAct(uid, args.User, siemens, electrified);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryDoElectrifiedAct(EntityUid uid, EntityUid targetUid,
|
public bool TryDoElectrifiedAct(EntityUid uid, EntityUid targetUid,
|
||||||
|
float siemens = 1,
|
||||||
ElectrifiedComponent? electrified = null,
|
ElectrifiedComponent? electrified = null,
|
||||||
NodeContainerComponent? nodeContainer = null,
|
NodeContainerComponent? nodeContainer = null,
|
||||||
TransformComponent? transform = null)
|
TransformComponent? transform = null)
|
||||||
@@ -171,7 +176,7 @@ namespace Content.Server.Electrocution
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var siemens = electrified.SiemensCoefficient;
|
siemens *= electrified.SiemensCoefficient;
|
||||||
if (!DoCommonElectrocutionAttempt(targetUid, uid, ref siemens) || siemens <= 0)
|
if (!DoCommonElectrocutionAttempt(targetUid, uid, ref siemens) || siemens <= 0)
|
||||||
return false; // If electrocution would fail, do nothing.
|
return false; // If electrocution would fail, do nothing.
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
- type: SubFloorHide
|
- type: SubFloorHide
|
||||||
- type: Electrified
|
- type: Electrified
|
||||||
onHandInteract: false
|
onHandInteract: false
|
||||||
|
onInteractUsing: false # wire-cutting handled separately.
|
||||||
onBump: false
|
onBump: false
|
||||||
requirePower: true
|
requirePower: true
|
||||||
highVoltageNode: power
|
highVoltageNode: power
|
||||||
|
|||||||
Reference in New Issue
Block a user