2023-12-29 04:47:43 -08:00
|
|
|
using Content.Server.Zombies;
|
2023-07-06 19:55:00 -07:00
|
|
|
using Content.Shared.Chemistry.Reagent;
|
2023-12-28 20:45:42 -07:00
|
|
|
using Robust.Shared.Configuration;
|
2023-12-29 04:47:43 -08:00
|
|
|
using Robust.Shared.Prototypes;
|
2023-07-06 19:55:00 -07:00
|
|
|
|
|
|
|
|
namespace Content.Server.Chemistry.ReagentEffects;
|
|
|
|
|
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class CureZombieInfection : ReagentEffect
|
2023-07-06 19:55:00 -07:00
|
|
|
{
|
2023-12-29 04:47:43 -08:00
|
|
|
[DataField]
|
2023-07-25 17:31:35 -04:00
|
|
|
public bool Innoculate;
|
2023-07-09 15:01:35 -07:00
|
|
|
|
2023-07-06 19:55:00 -07:00
|
|
|
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
|
2023-07-09 15:01:35 -07:00
|
|
|
{
|
2023-07-25 17:31:35 -04:00
|
|
|
if(Innoculate)
|
|
|
|
|
return Loc.GetString("reagent-effect-guidebook-innoculate-zombie-infection", ("chance", Probability));
|
|
|
|
|
|
|
|
|
|
return Loc.GetString("reagent-effect-guidebook-cure-zombie-infection", ("chance", Probability));
|
2023-07-09 15:01:35 -07:00
|
|
|
}
|
2023-07-06 19:55:00 -07:00
|
|
|
|
|
|
|
|
// Removes the Zombie Infection Components
|
|
|
|
|
public override void Effect(ReagentEffectArgs args)
|
|
|
|
|
{
|
|
|
|
|
var entityManager = args.EntityManager;
|
2023-07-25 17:31:35 -04:00
|
|
|
if (entityManager.HasComponent<IncurableZombieComponent>(args.SolutionEntity))
|
|
|
|
|
return;
|
|
|
|
|
|
2023-07-06 19:55:00 -07:00
|
|
|
entityManager.RemoveComponent<ZombifyOnDeathComponent>(args.SolutionEntity);
|
|
|
|
|
entityManager.RemoveComponent<PendingZombieComponent>(args.SolutionEntity);
|
2023-07-09 15:01:35 -07:00
|
|
|
|
2023-07-25 17:31:35 -04:00
|
|
|
if (Innoculate)
|
|
|
|
|
{
|
2023-07-09 15:01:35 -07:00
|
|
|
entityManager.EnsureComponent<ZombieImmuneComponent>(args.SolutionEntity);
|
|
|
|
|
}
|
2023-07-06 19:55:00 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|