fish-station/Content.Client/Ligyb/DiseaseRoleSystem.cs
Lgibb18 ad39b4f298
Disease boowomp (#135)
* disease

* eula
2024-06-21 05:35:09 +03:00

42 lines
1.1 KiB
C#

// © SUNRISE, An EULA/CLA with a hosting restriction, full text: https://github.com/space-sunrise/space-station-14/blob/master/CLA.txt
using Content.Shared.Actions;
using Content.Shared.DoAfter;
using Content.Shared.Doors.Systems;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Map;
using Robust.Shared.Random;
using Robust.Shared.Serialization.Manager;
using Content.Shared.Humanoid;
using Content.Shared.Ligyb;
namespace Content.Client.Ligyb;
public sealed class DiseaseRoleSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeNetworkEvent<ClientInfectEvent>(OnInfect);
}
private void OnInfect(ClientInfectEvent ev)
{
var target = GetEntity(ev.Infected);
var performer = GetEntity(ev.Owner);
if (!TryComp<HumanoidAppearanceComponent>(target, out var body))
return;
var sick = EnsureComp<SickComponent>(target);
sick.owner = performer;
sick.Inited = true;
if(TryComp<DiseaseRoleComponent>(performer, out var comp))
{
comp.Infected.Add(target);
}
}
}