-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
70 changed files
with
2,591 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
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); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
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 && | ||
!_mobState.IsDead(uid) && | ||
!HasComp<ActiveNPCComponent>(uid) && | ||
TryComp<MindContainerComponent>(uid, out var mindContainer) && | ||
mindContainer.ShowExamineInfo) | ||
{ | ||
args.StatusIcons.Add(_prototype.Index<StatusIconPrototype>(component.Icon)); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using Content.Shared.Chemistry.EntitySystems; | ||
|
||
namespace Content.Client.Chemistry.EntitySystems; | ||
|
||
/// <inheritdoc/> | ||
public sealed class VaccinatorSystem : SharedVaccinatorSystem | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
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); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
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", | ||
"Изучить показатели стерильности."); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
using Content.Server.Body.Systems; | ||
using Content.Server.Chat.Systems; | ||
using Content.Server.Doors.Systems; | ||
using Content.Server.Weapons.Ranged.Systems; | ||
using Content.Shared.Actions; | ||
using Content.Shared.DoAfter; | ||
using Content.Shared.Doors.Systems; | ||
using Robust.Server.GameObjects; | ||
using Robust.Shared.Audio.Systems; | ||
using Robust.Shared.Map; | ||
using Robust.Shared.Random; | ||
using Robust.Shared.Serialization.Manager; | ||
using Content.Shared.Ligyb; | ||
using Content.Server.Actions; | ||
using Content.Server.Store.Components; | ||
using Content.Server.Store.Systems; | ||
using Robust.Shared.Prototypes; | ||
using Content.Server.Zombies; | ||
using Content.Shared.FixedPoint; | ||
using Content.Shared.Zombies; | ||
namespace Content.Server.Ligyb; | ||
|
||
public sealed class DiseaseRoleSystem : SharedDiseaseRoleSystem | ||
{ | ||
[Dependency] private readonly IRobustRandom _random = default!; | ||
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!; | ||
[Dependency] private readonly ActionsSystem _action = default!; | ||
[Dependency] private readonly StoreSystem _store = default!; | ||
|
||
[ValidatePrototypeId<EntityPrototype>] | ||
private const string DiseaseShopId = "ActionDiseaseShop"; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<DiseaseRoleComponent, ComponentInit>(OnInit); | ||
SubscribeLocalEvent<DiseaseRoleComponent, MapInitEvent>(OnMapInit); | ||
SubscribeLocalEvent<DiseaseRoleComponent, DiseaseShopActionEvent>(OnShop); | ||
SubscribeLocalEvent<DiseaseRoleComponent, DiseaseStartCoughEvent>(OnCough); | ||
SubscribeLocalEvent<DiseaseRoleComponent, DiseaseStartSneezeEvent>(OnSneeze); | ||
SubscribeLocalEvent<DiseaseRoleComponent, DiseaseStartVomitEvent>(OnVomit); | ||
SubscribeLocalEvent<DiseaseRoleComponent, DiseaseStartCryingEvent>(OnCrying); | ||
SubscribeLocalEvent<DiseaseRoleComponent, DiseaseZombieEvent>(OnZombie); | ||
SubscribeLocalEvent<DiseaseRoleComponent, DiseaseNarcolepsyEvent>(OnNarcolepsy); | ||
SubscribeLocalEvent<DiseaseRoleComponent, DiseaseMutedEvent>(OnMuted); | ||
SubscribeLocalEvent<DiseaseRoleComponent, DiseaseSlownessEvent>(OnSlowness); | ||
SubscribeLocalEvent<DiseaseRoleComponent, DiseaseBleedEvent>(OnBleed); | ||
SubscribeLocalEvent<DiseaseRoleComponent, DiseaseBlindnessEvent>(OnBlindness); | ||
SubscribeLocalEvent<DiseaseRoleComponent, DiseaseInsultEvent>(OnInsult); | ||
SubscribeLocalEvent<InfectEvent>(OnInfects); | ||
|
||
} | ||
|
||
|
||
private void OnInfects(InfectEvent args) | ||
{ | ||
if (TryComp<DiseaseRoleComponent>(args.Performer, out var component)) | ||
{ | ||
if(component.FreeInfects > 0) | ||
{ | ||
component.FreeInfects--; | ||
OnInfect(args); | ||
return; | ||
} | ||
if (TryRemoveMoney(args.Performer, component.InfectCost)) | ||
{ | ||
OnInfect(args); | ||
} | ||
} | ||
} | ||
|
||
private void OnInit(EntityUid uid, DiseaseRoleComponent component, ComponentInit args) | ||
{ | ||
|
||
foreach (var (id, charges) in component.Actions) | ||
{ | ||
EntityUid? actionId = null; | ||
if (_actionsSystem.AddAction(uid, ref actionId, id)) | ||
_actionsSystem.SetCharges(actionId, charges < 0 ? null : charges); | ||
} | ||
component.NewBloodReagent = _random.Pick(new List<string>() { "DiseaseBloodFirst", "DiseaseBloodSecond", "DiseaseBloodThird" }); | ||
component.Symptoms.Add("Headache", (1, 4)); | ||
} | ||
|
||
private void OnMapInit(EntityUid uid, DiseaseRoleComponent component, MapInitEvent args) | ||
{ | ||
_action.AddAction(uid, ref component.Action, DiseaseShopId); | ||
} | ||
|
||
private void OnShop(EntityUid uid, DiseaseRoleComponent component, DiseaseShopActionEvent args) | ||
{ | ||
if (!TryComp<StoreComponent>(uid, out var store)) | ||
return; | ||
_store.ToggleUi(uid, uid, store); | ||
} | ||
|
||
void AddMoney(EntityUid uid, FixedPoint2 value) | ||
{ | ||
if (TryComp<DiseaseRoleComponent>(uid, out var diseaseComp)) | ||
{ | ||
if (TryComp<StoreComponent>(uid, out var store)) | ||
{ | ||
bool f = _store.TryAddCurrency(new Dictionary<string, FixedPoint2> | ||
{ | ||
{diseaseComp.CurrencyPrototype, value} | ||
}, uid); | ||
_store.UpdateUserInterface(uid, uid, store); | ||
} | ||
} | ||
} | ||
|
||
bool TryRemoveMoney(EntityUid uid, FixedPoint2 value) | ||
{ | ||
if (TryComp<DiseaseRoleComponent>(uid, out var diseaseComp)) | ||
{ | ||
if (TryComp<StoreComponent>(uid, out var store)) | ||
{ | ||
if (store.Balance[diseaseComp.CurrencyPrototype] >= value) | ||
{ | ||
bool f = _store.TryAddCurrency(new Dictionary<string, FixedPoint2> | ||
{ | ||
{diseaseComp.CurrencyPrototype, -value} | ||
}, uid); | ||
_store.UpdateUserInterface(uid, uid, store); | ||
return true; | ||
} else | ||
{ | ||
return false; | ||
} | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
private void OnCough(EntityUid uid, DiseaseRoleComponent component, DiseaseStartCoughEvent args) | ||
{ | ||
component.Symptoms.Add("Cough", (2, 9999)); | ||
} | ||
|
||
private void OnSneeze(EntityUid uid, DiseaseRoleComponent component, DiseaseStartSneezeEvent args) | ||
{ | ||
//component.Sneeze = true; | ||
component.Symptoms.Add("Sneeze", (3, 9999)); | ||
} | ||
|
||
private void OnVomit(EntityUid uid, DiseaseRoleComponent component, DiseaseStartVomitEvent args) | ||
{ | ||
component.Symptoms.Add("Vomit", (3, 9999)); | ||
} | ||
|
||
private void OnCrying(EntityUid uid, DiseaseRoleComponent component, DiseaseStartCryingEvent args) | ||
{ | ||
component.Symptoms.Add("Crying", (0, 9999)); | ||
} | ||
|
||
private void OnNarcolepsy(EntityUid uid, DiseaseRoleComponent component, DiseaseNarcolepsyEvent args) | ||
{ | ||
component.Symptoms.Add("Narcolepsy", (3, 9999)); | ||
} | ||
|
||
private void OnMuted(EntityUid uid, DiseaseRoleComponent component, DiseaseMutedEvent args) | ||
{ | ||
component.Symptoms.Add("Muted", (4, 9999)); | ||
} | ||
|
||
private void OnSlowness(EntityUid uid, DiseaseRoleComponent component, DiseaseSlownessEvent args) | ||
{ | ||
component.Symptoms.Add("Slowness", (2, 9999)); | ||
} | ||
private void OnBleed(EntityUid uid, DiseaseRoleComponent component, DiseaseBleedEvent args) | ||
{ | ||
component.Symptoms.Add("Bleed", (3, 9999)); | ||
} | ||
private void OnBlindness(EntityUid uid, DiseaseRoleComponent component, DiseaseBlindnessEvent args) | ||
{ | ||
component.Symptoms.Add("Blindness", (4, 9999)); | ||
} | ||
private void OnInsult(EntityUid uid, DiseaseRoleComponent component, DiseaseInsultEvent args) | ||
{ | ||
component.Symptoms.Add("Insult", (2, 9999)); | ||
} | ||
|
||
|
||
|
||
private void OnZombie(EntityUid uid, DiseaseRoleComponent component, DiseaseZombieEvent args) | ||
{ | ||
var inf = component.Infected.ToArray(); | ||
foreach(EntityUid infected in inf) | ||
{ | ||
if (_random.Prob(0.8f)) { | ||
RemComp<SickComponent>(infected); | ||
component.Infected.Remove(infected); | ||
EnsureComp<ZombifyOnDeathComponent>(infected); | ||
EnsureComp<PendingZombieComponent>(infected); | ||
} | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.