-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
* disease * eula
- Loading branch information
There are no files selected for viewing
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); | ||
} | ||
} | ||
|
||
} |
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 GitHub Actions / YAML Linter
Check failure on line 39 in Content.Client/Ligyb/SickSystem.cs GitHub Actions / build (ubuntu-latest)
Check failure on line 39 in Content.Client/Ligyb/SickSystem.cs GitHub Actions / build (ubuntu-latest)
Check failure on line 39 in Content.Client/Ligyb/SickSystem.cs GitHub Actions / build (ubuntu-latest)
|
||
!_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 GitHub Actions / YAML Linter
Check failure on line 43 in Content.Client/Ligyb/SickSystem.cs GitHub Actions / build (ubuntu-latest)
Check failure on line 43 in Content.Client/Ligyb/SickSystem.cs GitHub Actions / build (ubuntu-latest)
Check failure on line 43 in Content.Client/Ligyb/SickSystem.cs GitHub Actions / build (ubuntu-latest)
Check failure on line 43 in Content.Client/Ligyb/SickSystem.cs GitHub Actions / build (ubuntu-latest)
Check failure on line 43 in Content.Client/Ligyb/SickSystem.cs GitHub Actions / build (ubuntu-latest)
|
||
{ | ||
args.StatusIcons.Add(_prototype.Index<StatusIconPrototype>(component.Icon)); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
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 | ||
{ | ||
|
||
} |
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); | ||
} | ||
} | ||
} | ||
} |
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", | ||
"Изучить показатели стерильности."); | ||
} | ||
|
||
} |