2023-12-29 04:47:43 -08:00
|
|
|
using Content.Server.Zombies;
|
2024-06-30 05:43:43 +02:00
|
|
|
using Content.Shared.EntityEffects;
|
2023-12-29 04:47:43 -08:00
|
|
|
using Robust.Shared.Prototypes;
|
2024-05-26 00:07:18 +03:00
|
|
|
using Content.Shared.Zombies;
|
2023-07-06 19:55:00 -07:00
|
|
|
|
2024-06-30 05:43:43 +02:00
|
|
|
namespace Content.Server.EntityEffects.Effects;
|
2023-07-06 19:55:00 -07:00
|
|
|
|
2024-06-30 05:43:43 +02:00
|
|
|
public sealed partial class CureZombieInfection : EntityEffect
|
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
|
2024-06-30 05:43:43 +02:00
|
|
|
public override void Effect(EntityEffectBaseArgs args)
|
2023-07-06 19:55:00 -07:00
|
|
|
{
|
|
|
|
|
var entityManager = args.EntityManager;
|
2024-06-30 05:43:43 +02:00
|
|
|
if (entityManager.HasComponent<IncurableZombieComponent>(args.TargetEntity))
|
2023-07-25 17:31:35 -04:00
|
|
|
return;
|
|
|
|
|
|
2024-06-30 05:43:43 +02:00
|
|
|
entityManager.RemoveComponent<ZombifyOnDeathComponent>(args.TargetEntity);
|
|
|
|
|
entityManager.RemoveComponent<PendingZombieComponent>(args.TargetEntity);
|
2023-07-09 15:01:35 -07:00
|
|
|
|
2023-07-25 17:31:35 -04:00
|
|
|
if (Innoculate)
|
|
|
|
|
{
|
2024-06-30 05:43:43 +02:00
|
|
|
entityManager.EnsureComponent<ZombieImmuneComponent>(args.TargetEntity);
|
2023-07-09 15:01:35 -07:00
|
|
|
}
|
2023-07-06 19:55:00 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|