Files
tbd-station-14/Content.Shared/Fax/Systems/FaxecuteSystem.cs
brainfood1183 c0ce5fba2a Rodents can be Faxecuted (executed via Fax machine) (#21461)
* Rodents can be Faxecuted (executed via Fax machine)

* use brute instead of new group.

* fax visuals now use tags for mouse and hamster instead of comps

* fix for ubuntu, damn ubuntu bane of my life

* cant copy hamlet, can now faxecute mothroaches.

* fix

* fix

* fixes

* removed ifs now using switch, removed hastag now using string.

* fixes and no more switch

* cleanup

* more cleanup

* fix

* cleanup

* moved damage out of faxmachine and into own system and component.

* changes

* fixes and done i think.

* tidy

* Fixes

---------

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2024-04-27 23:50:57 +10:00

35 lines
1.1 KiB
C#

using Content.Shared.Damage;
using Content.Shared.Popups;
using Content.Shared.Fax.Components;
namespace Content.Shared.Fax.Systems;
/// <summary>
/// System for handling execution of a mob within fax when copy or send attempt is made.
/// </summary>
public sealed class FaxecuteSystem : EntitySystem
{
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
public override void Initialize()
{
base.Initialize();
}
public void Faxecute(EntityUid uid, FaxMachineComponent component, DamageOnFaxecuteEvent? args = null)
{
var sendEntity = component.PaperSlot.Item;
if (sendEntity == null)
return;
if (!TryComp<FaxecuteComponent>(uid, out var faxecute))
return;
var damageSpec = faxecute.Damage;
_damageable.TryChangeDamage(sendEntity, damageSpec);
_popupSystem.PopupEntity(Loc.GetString("fax-machine-popup-error", ("target", uid)), uid, PopupType.LargeCaution);
return;
}
}