Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disease boowomp #135

Merged
merged 2 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions Content.Client/Ligyb/DiseaseRoleSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// © 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);
}
}

}
51 changes: 51 additions & 0 deletions Content.Client/Ligyb/SickSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// © 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.CCVar;
using Content.Shared.Mind.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.NPC;
using Content.Shared.StatusIcon;
using Content.Shared.StatusIcon.Components;
using Robust.Shared.Configuration;
using Robust.Client.Player;
using Robust.Shared.Prototypes;
using Content.Shared.Ligyb;
namespace Content.Client.Ligyb;
public sealed class SickSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<SickComponent, GetStatusIconsEvent>(OnGetStatusIcon);
SubscribeNetworkEvent<UpdateInfectionsEvent>(OnUpdateInfect);
}

private void OnUpdateInfect(UpdateInfectionsEvent args)
{
EnsureComp<SickComponent>(GetEntity(args.Uid)).Inited = true;
}

private void OnGetStatusIcon(EntityUid uid, SickComponent component, ref GetStatusIconsEvent args)
{
if (component.Inited)
{
if (_playerManager.LocalEntity != null)
{
if (HasComp<DiseaseRoleComponent>(_playerManager.LocalEntity.Value))
{
if (!args.InContainer &&

Check failure on line 39 in Content.Client/Ligyb/SickSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'GetStatusIconsEvent' does not contain a definition for 'InContainer' and no accessible extension method 'InContainer' accepting a first argument of type 'GetStatusIconsEvent' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 39 in Content.Client/Ligyb/SickSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'GetStatusIconsEvent' does not contain a definition for 'InContainer' and no accessible extension method 'InContainer' accepting a first argument of type 'GetStatusIconsEvent' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 39 in Content.Client/Ligyb/SickSystem.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

'GetStatusIconsEvent' does not contain a definition for 'InContainer' and no accessible extension method 'InContainer' accepting a first argument of type 'GetStatusIconsEvent' could be found (are you missing a using directive or an assembly reference?)
!_mobState.IsDead(uid) &&
!HasComp<ActiveNPCComponent>(uid) &&
TryComp<MindContainerComponent>(uid, out var mindContainer) &&
mindContainer.ShowExamineInfo)

Check failure on line 43 in Content.Client/Ligyb/SickSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Dereference of a possibly null reference.

Check failure on line 43 in Content.Client/Ligyb/SickSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Use of unassigned local variable 'mindContainer'

Check failure on line 43 in Content.Client/Ligyb/SickSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Dereference of a possibly null reference.

Check failure on line 43 in Content.Client/Ligyb/SickSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Use of unassigned local variable 'mindContainer'

Check failure on line 43 in Content.Client/Ligyb/SickSystem.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

Use of unassigned local variable 'mindContainer'
{
args.StatusIcons.Add(_prototype.Index<StatusIconPrototype>(component.Icon));
}
}
}
}
}
}
10 changes: 10 additions & 0 deletions Content.Client/Ligyb/VaccinatorSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// © 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.Chemistry.EntitySystems;

namespace Content.Client.Chemistry.EntitySystems;

/// <inheritdoc/>
public sealed class VaccinatorSystem : SharedVaccinatorSystem
{

}
35 changes: 35 additions & 0 deletions Content.Server/Ligyb/CureDiseaseInfection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// © SUNRISE, An EULA/CLA with a hosting restriction, full text: https://github.com/space-sunrise/space-station-14/blob/master/CLA.txt
using Content.Server.Zombies;
using Content.Shared.Chemistry.Reagent;
using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
using Content.Shared.Ligyb;
using Content.Server.Spawners.Components;
public sealed partial class CureDiseaseInfection : ReagentEffect
{
[DataField]
public bool Innoculate;

protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
{
if (Innoculate)
return "ок";

return "окей";
}

public override void Effect(ReagentEffectArgs args)
{
var entityManager = args.EntityManager;
if (!entityManager.HasComponent<SickComponent>(args.SolutionEntity)) return;
if (entityManager.TryGetComponent<SickComponent>(args.SolutionEntity, out var sick))
{
if (entityManager.TryGetComponent<DiseaseRoleComponent>(sick.owner, out var disease))
{
var comp = entityManager.EnsureComponent<DiseaseVaccineTimerComponent>(args.SolutionEntity);
comp.Immune = Innoculate;
comp.delay = TimeSpan.FromMinutes(2) + TimeSpan.FromSeconds(disease.Shield * 30);
}
}
}
}
59 changes: 59 additions & 0 deletions Content.Server/Ligyb/DiseaseImmuneClothingSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// © 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.Clothing.Components;
using Content.Shared.Inventory.Events;
using Content.Shared.Ligyb;
using Content.Shared.Examine;
using Content.Shared.Verbs;
using Robust.Shared.Utility;
namespace Content.Server.Ligyb;

public sealed class DiseaseImmuneClothingSystem : EntitySystem
{
[Dependency] private readonly ExamineSystemShared _examine = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<DiseaseImmuneClothingComponent, GotEquippedEvent>(OnGotEquipped);
SubscribeLocalEvent<DiseaseImmuneClothingComponent, GotUnequippedEvent>(OnGotUnequipped);
SubscribeLocalEvent<DiseaseImmuneClothingComponent, GetVerbsEvent<ExamineVerb>>(OnArmorVerbExamine);
}

private void OnGotEquipped(EntityUid uid, DiseaseImmuneClothingComponent component, GotEquippedEvent args)
{
if (!TryComp(uid, out ClothingComponent? clothing))
return;
var isCorrectSlot = clothing.Slots.HasFlag(args.SlotFlags);
if (!isCorrectSlot)
return;

EnsureComp<DiseaseTempImmuneComponent>(args.Equipee).Prob += component.prob;
if (Comp<DiseaseTempImmuneComponent>(args.Equipee).Prob > 1) Comp<DiseaseTempImmuneComponent>(args.Equipee).Prob = 1;

component.IsActive = true;
}

private void OnGotUnequipped(EntityUid uid, DiseaseImmuneClothingComponent component, GotUnequippedEvent args)
{
if (!component.IsActive)
return;

EnsureComp<DiseaseTempImmuneComponent>(args.Equipee).Prob -= component.prob;
if (Comp<DiseaseTempImmuneComponent>(args.Equipee).Prob < 0) Comp<DiseaseTempImmuneComponent>(args.Equipee).Prob = 0;

component.IsActive = false;
}

private void OnArmorVerbExamine(EntityUid uid, DiseaseImmuneClothingComponent component, GetVerbsEvent<ExamineVerb> args)
{
if (!args.CanInteract || !args.CanAccess)
return;

var examineMarkup = new FormattedMessage();
examineMarkup.AddMarkup($"Защищает от заражения на {Convert.ToInt32(component.prob*100)}%");

_examine.AddDetailedExamineVerb(args, component, examineMarkup,
"Стерильность", "/Textures/Interface/VerbIcons/dot.svg.192dpi.png",
"Изучить показатели стерильности.");
}

}
Loading
Loading