2021-11-25 00:06:13 -06:00
|
|
|
using Content.Server.Electrocution;
|
|
|
|
|
using Content.Shared.Chemistry.Reagent;
|
2023-06-04 16:45:02 -04:00
|
|
|
using Robust.Shared.Prototypes;
|
2021-11-25 00:06:13 -06:00
|
|
|
|
|
|
|
|
namespace Content.Server.Chemistry.ReagentEffects;
|
|
|
|
|
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class Electrocute : ReagentEffect
|
2021-11-25 00:06:13 -06:00
|
|
|
{
|
2023-12-29 04:47:43 -08:00
|
|
|
[DataField] public int ElectrocuteTime = 2;
|
2021-11-25 00:06:13 -06:00
|
|
|
|
2023-12-29 04:47:43 -08:00
|
|
|
[DataField] public int ElectrocuteDamageScale = 5;
|
2021-11-25 00:06:13 -06:00
|
|
|
|
2021-12-07 09:18:07 +03:00
|
|
|
/// <remarks>
|
|
|
|
|
/// true - refresh electrocute time, false - accumulate electrocute time
|
|
|
|
|
/// </remarks>
|
2023-12-29 04:47:43 -08:00
|
|
|
[DataField] public bool Refresh = true;
|
2021-12-07 09:18:07 +03:00
|
|
|
|
2023-06-04 16:45:02 -04:00
|
|
|
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
|
|
|
|
|
=> Loc.GetString("reagent-effect-guidebook-electrocute", ("chance", Probability), ("time", ElectrocuteTime));
|
|
|
|
|
|
2021-11-27 00:31:56 -07:00
|
|
|
public override bool ShouldLog => true;
|
|
|
|
|
|
2021-11-25 00:06:13 -06:00
|
|
|
public override void Effect(ReagentEffectArgs args)
|
|
|
|
|
{
|
2023-05-13 15:10:32 +12:00
|
|
|
args.EntityManager.System<ElectrocutionSystem>().TryDoElectrocution(args.SolutionEntity, null,
|
2022-09-06 04:48:35 +02:00
|
|
|
Math.Max((args.Quantity * ElectrocuteDamageScale).Int(), 1), TimeSpan.FromSeconds(ElectrocuteTime), Refresh, ignoreInsulation: true);
|
2021-11-25 00:06:13 -06:00
|
|
|
|
2023-05-13 15:10:32 +12:00
|
|
|
if (args.Reagent != null)
|
|
|
|
|
args.Source?.RemoveReagent(args.Reagent.ID, args.Quantity);
|
2021-11-25 00:06:13 -06:00
|
|
|
}
|
|
|
|
|
}
|