Electrocution. (#4958)

Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
This commit is contained in:
Vera Aguilera Puerto
2021-10-25 16:21:56 +02:00
committed by GitHub
parent 66a3d5bf29
commit ed3bf94a3b
37 changed files with 934 additions and 30 deletions

View File

@@ -4,6 +4,7 @@ using Content.Server.Items;
using Content.Shared.Inventory;
using Content.Shared.Slippery;
using Content.Shared.Damage;
using Content.Shared.Electrocution;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
@@ -20,6 +21,7 @@ namespace Content.Server.Inventory
SubscribeLocalEvent<InventoryComponent, HighPressureEvent>(OnHighPressureEvent);
SubscribeLocalEvent<InventoryComponent, LowPressureEvent>(OnLowPressureEvent);
SubscribeLocalEvent<InventoryComponent, DamageModifyEvent>(OnDamageModify);
SubscribeLocalEvent<InventoryComponent, ElectrocutionAttemptEvent>(OnElectrocutionAttempt);
SubscribeLocalEvent<InventoryComponent, SlipAttemptEvent>(OnSlipAttemptEvent);
}
@@ -51,6 +53,14 @@ namespace Content.Server.Inventory
RelayPressureEvent(component, args);
}
private void OnElectrocutionAttempt(EntityUid uid, InventoryComponent component, ElectrocutionAttemptEvent args)
{
foreach (var equipped in component.GetAllHeldItems())
{
RaiseLocalEvent(equipped.Uid, args, false);
}
}
private void OnDamageModify(EntityUid uid, InventoryComponent component, DamageModifyEvent args)
{
foreach (var equipped in component.GetAllHeldItems())