Zombie Mode 𝓡𝓮𝓭𝓾𝔁 (#18199)

* zombie mode redux

* the great zombie changes

* fix this

* 65 down to 50

* empty

* Changes to address stalling

* make zombie nukies no longer nukies

* actually work
This commit is contained in:
Nemanja
2023-07-25 17:31:35 -04:00
committed by GitHub
parent 763156f6ec
commit d55cd23b0a
20 changed files with 604 additions and 493 deletions

View File

@@ -0,0 +1,10 @@
namespace Content.Server.Zombies;
/// <summary>
/// This is used for a zombie that cannot be cured by any methods.
/// </summary>
[RegisterComponent]
public sealed class IncurableZombieComponent : Component
{
}

View File

@@ -1,5 +1,4 @@
using Content.Shared.Damage;
using Content.Shared.FixedPoint;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.Zombies;
@@ -10,49 +9,46 @@ namespace Content.Server.Zombies;
[RegisterComponent]
public sealed class PendingZombieComponent : Component
{
/// <summary>
/// Damage dealt every second to infected individuals.
/// </summary>
[DataField("damage")] public DamageSpecifier Damage = new()
{
DamageDict = new ()
{
{ "Blunt", 0.8 },
{ "Toxin", 0.2 },
{ "Blunt", 0.25 },
{ "Poison", 0.1 },
}
};
/// <summary>
/// A multiplier for <see cref="Damage"/> applied when the entity is in critical condition.
/// </summary>
[DataField("critDamageMultiplier")]
public float CritDamageMultiplier = 10f;
[DataField("nextTick", customTypeSerializer:typeof(TimeOffsetSerializer))]
public TimeSpan NextTick;
/// <summary>
/// Scales damage over time.
/// The amount of time left before the infected begins to take damage.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("infectedSecs")]
public int InfectedSecs;
[DataField("gracePeriod"), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan GracePeriod = TimeSpan.Zero;
/// <summary>
/// Number of seconds that a typical infection will last before the player is totally overwhelmed with damage and
/// dies.
/// The chance each second that a warning will be shown.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("maxInfectionLength")]
public float MaxInfectionLength = 120f;
[DataField("infectionWarningChance")]
public float InfectionWarningChance = 0.0166f;
/// <summary>
/// Infection warnings are shown as popups, times are in seconds.
/// -ve times shown to initial zombies (once timer counts from -ve to 0 the infection starts)
/// +ve warnings are in seconds after being bitten
/// Infection warnings shown as popups
/// </summary>
[DataField("infectionWarnings")]
public Dictionary<int, string> InfectionWarnings = new()
public List<string> InfectionWarnings = new()
{
{-45, "zombie-infection-warning"},
{-30, "zombie-infection-warning"},
{10, "zombie-infection-underway"},
{25, "zombie-infection-underway"},
"zombie-infection-warning",
"zombie-infection-underway"
};
/// <summary>
/// A minimum multiplier applied to Damage once you are in crit to get you dead and ready for your next life
/// as fast as possible.
/// </summary>
[DataField("minimumCritMultiplier")]
public float MinimumCritMultiplier = 10;
}

View File

@@ -1,8 +1,8 @@
namespace Content.Server.Zombies
namespace Content.Server.Zombies;
[RegisterComponent]
public sealed class ZombieImmuneComponent : Component
{
[RegisterComponent]
public sealed class ZombieImmuneComponent : Component
{
//still no
}
//still no
}

View File

@@ -1,10 +1,7 @@
using Content.Server.Administration.Commands;
using Content.Server.Atmos.Components;
using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Server.Chat;
using Content.Server.Chat.Managers;
using Content.Server.Chat.Systems;
using Content.Server.Ghost.Roles.Components;
using Content.Server.Humanoid;
using Content.Server.IdentityManagement;
@@ -12,28 +9,33 @@ using Content.Server.Inventory;
using Content.Server.Mind.Commands;
using Content.Server.Mind.Components;
using Content.Server.Nutrition.Components;
using Content.Server.Popups;
using Content.Server.Roles;
using Content.Server.Speech.Components;
using Content.Server.Temperature.Components;
using Content.Server.Traitor;
using Content.Shared.CombatMode;
using Content.Shared.Damage;
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
using Content.Server.Mind;
using Content.Server.NPC;
using Content.Server.NPC.Components;
using Content.Server.NPC.HTN;
using Content.Server.NPC.Systems;
using Content.Server.RoundEnd;
using Content.Shared.Humanoid;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Systems;
using Content.Shared.Nutrition.Components;
using Content.Shared.Popups;
using Content.Shared.Roles;
using Content.Shared.Tools;
using Content.Shared.Tools.Components;
using Content.Shared.Weapons.Melee;
using Content.Shared.Zombies;
using Robust.Shared.Prototypes;
using Robust.Shared.Audio;
using Robust.Shared.Utility;
namespace Content.Server.Zombies
{
@@ -43,32 +45,20 @@ namespace Content.Server.Zombies
/// <remarks>
/// Don't Shitcode Open Inside
/// </remarks>
public sealed class ZombifyOnDeathSystem : EntitySystem
public sealed partial class ZombieSystem
{
[Dependency] private readonly SharedHandsSystem _sharedHands = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly BloodstreamSystem _bloodstream = default!;
[Dependency] private readonly ServerInventorySystem _serverInventory = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly HumanoidAppearanceSystem _sharedHuApp = default!;
[Dependency] private readonly SharedHandsSystem _hands = default!;
[Dependency] private readonly ServerInventorySystem _inventory = default!;
[Dependency] private readonly NpcFactionSystem _faction = default!;
[Dependency] private readonly NPCSystem _npc = default!;
[Dependency] private readonly HumanoidAppearanceSystem _humanoidAppearance = default!;
[Dependency] private readonly IdentitySystem _identity = default!;
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifier = default!;
[Dependency] private readonly AutoEmoteSystem _autoEmote = default!;
[Dependency] private readonly EmoteOnDamageSystem _emoteOnDamage = default!;
[Dependency] private readonly SharedCombatModeSystem _combat = default!;
[Dependency] private readonly IChatManager _chatMan = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly MindSystem _mind = default!;
[Dependency] private readonly MobThresholdSystem _mobThreshold = default!;
[Dependency] private readonly MindSystem _mindSystem = default!;
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ZombifyOnDeathComponent, MobStateChangedEvent>(OnDamageChanged);
}
[Dependency] private readonly SharedAudioSystem _audio = default!;
/// <summary>
/// Handles an entity turning into a zombie when they die or go into crit
@@ -86,6 +76,7 @@ namespace Content.Server.Zombies
/// It handles both humanoid and nonhumanoid transformation and everything should be called through it.
/// </summary>
/// <param name="target">the entity being zombified</param>
/// <param name="mobState"></param>
/// <remarks>
/// ALRIGHT BIG BOY. YOU'VE COME TO THE LAYER OF THE BEAST. THIS IS YOUR WARNING.
/// This function is the god function for zombie stuff, and it is cursed. I have
@@ -126,8 +117,7 @@ namespace Content.Server.Zombies
var melee = EnsureComp<MeleeWeaponComponent>(target);
melee.ClickAnimation = zombiecomp.AttackAnimation;
melee.WideAnimation = zombiecomp.AttackAnimation;
melee.Range = 1.5f;
Dirty(melee);
melee.Range = 1.2f;
if (mobState.CurrentState == MobState.Alive)
{
@@ -149,24 +139,38 @@ namespace Content.Server.Zombies
if (TryComp<BloodstreamComponent>(target, out var stream))
zombiecomp.BeforeZombifiedBloodReagent = stream.BloodReagent;
_sharedHuApp.SetSkinColor(target, zombiecomp.SkinColor, verify: false, humanoid: huApComp);
_sharedHuApp.SetBaseLayerColor(target, HumanoidVisualLayers.Eyes, zombiecomp.EyeColor, humanoid: huApComp);
_humanoidAppearance.SetSkinColor(target, zombiecomp.SkinColor, verify: false, humanoid: huApComp);
_humanoidAppearance.SetBaseLayerColor(target, HumanoidVisualLayers.Eyes, zombiecomp.EyeColor, humanoid: huApComp);
// this might not resync on clone?
_sharedHuApp.SetBaseLayerId(target, HumanoidVisualLayers.Tail, zombiecomp.BaseLayerExternal, humanoid: huApComp);
_sharedHuApp.SetBaseLayerId(target, HumanoidVisualLayers.HeadSide, zombiecomp.BaseLayerExternal, humanoid: huApComp);
_sharedHuApp.SetBaseLayerId(target, HumanoidVisualLayers.HeadTop, zombiecomp.BaseLayerExternal, humanoid: huApComp);
_sharedHuApp.SetBaseLayerId(target, HumanoidVisualLayers.Snout, zombiecomp.BaseLayerExternal, humanoid: huApComp);
_humanoidAppearance.SetBaseLayerId(target, HumanoidVisualLayers.Tail, zombiecomp.BaseLayerExternal, humanoid: huApComp);
_humanoidAppearance.SetBaseLayerId(target, HumanoidVisualLayers.HeadSide, zombiecomp.BaseLayerExternal, humanoid: huApComp);
_humanoidAppearance.SetBaseLayerId(target, HumanoidVisualLayers.HeadTop, zombiecomp.BaseLayerExternal, humanoid: huApComp);
_humanoidAppearance.SetBaseLayerId(target, HumanoidVisualLayers.Snout, zombiecomp.BaseLayerExternal, humanoid: huApComp);
//This is done here because non-humanoids shouldn't get baller damage
//lord forgive me for the hardcoded damage
DamageSpecifier dspec = new();
dspec.DamageDict.Add("Slash", 13);
dspec.DamageDict.Add("Piercing", 7);
dspec.DamageDict.Add("Structural", 10);
DamageSpecifier dspec = new()
{
DamageDict = new()
{
{ "Slash", 13 },
{ "Piercing", 7 },
{ "Structural", 10 }
}
};
melee.Damage = dspec;
// humanoid zombies get to pry open doors and shit
var tool = EnsureComp<ToolComponent>(target);
tool.SpeedModifier = 0.75f;
tool.Qualities = new ("Prying");
tool.UseSound = new SoundPathSpecifier("/Audio/Items/crowbar.ogg");
Dirty(tool);
}
Dirty(melee);
//The zombie gets the assigned damage weaknesses and strengths
_damageable.SetDamageModifierSetId(target, "Zombie");
@@ -177,51 +181,60 @@ namespace Content.Server.Zombies
_bloodstream.ChangeBloodReagent(target, zombiecomp.NewBloodReagent);
//This is specifically here to combat insuls, because frying zombies on grilles is funny as shit.
_serverInventory.TryUnequip(target, "gloves", true, true);
_inventory.TryUnequip(target, "gloves", true, true);
//Should prevent instances of zombies using comms for information they shouldnt be able to have.
_serverInventory.TryUnequip(target, "ears", true, true);
_inventory.TryUnequip(target, "ears", true, true);
//popup
_popupSystem.PopupEntity(Loc.GetString("zombie-transform", ("target", target)), target, PopupType.LargeCaution);
_popup.PopupEntity(Loc.GetString("zombie-transform", ("target", target)), target, PopupType.LargeCaution);
//Make it sentient if it's an animal or something
if (!HasComp<InputMoverComponent>(target)) //this component is cursed and fucks shit up
MakeSentientCommand.MakeSentient(target, EntityManager);
MakeSentientCommand.MakeSentient(target, EntityManager);
//Make the zombie not die in the cold. Good for space zombies
if (TryComp<TemperatureComponent>(target, out var tempComp))
tempComp.ColdDamage.ClampMax(0);
// Zombies can revive themselves
_mobThreshold.SetAllowRevives(target, true);
//Heals the zombie from all the damage it took while human
if (TryComp<DamageableComponent>(target, out var damageablecomp))
_damageable.SetAllDamage(target, damageablecomp, 0);
_mobState.ChangeMobState(target, MobState.Alive);
_mobThreshold.SetAllowRevives(target, false);
// Revive them now
if (TryComp<MobStateComponent>(target, out var mobstate) && mobstate.CurrentState==MobState.Dead)
_mobState.ChangeMobState(target, MobState.Alive, mobstate);
var factionComp = EnsureComp<NpcFactionMemberComponent>(target);
foreach (var id in new List<string>(factionComp.Factions))
{
_faction.RemoveFaction(target, id);
}
_faction.AddFaction(target, "Zombie");
//gives it the funny "Zombie ___" name.
var meta = MetaData(target);
zombiecomp.BeforeZombifiedEntityName = meta.EntityName;
meta.EntityName = Loc.GetString("zombie-name-prefix", ("target", meta.EntityName));
_metaData.SetEntityName(target, Loc.GetString("zombie-name-prefix", ("target", meta.EntityName)), meta);
_identity.QueueIdentityUpdate(target);
//He's gotta have a mind
var mindComp = EnsureComp<MindContainerComponent>(target);
if (_mindSystem.TryGetMind(target, out var mind, mindComp) && _mindSystem.TryGetSession(mind, out var session))
if (_mind.TryGetMind(target, out var mind, mindComp) && _mind.TryGetSession(mind, out var session))
{
//Zombie role for player manifest
_mindSystem.AddRole(mind, new ZombieRole(mind, _proto.Index<AntagPrototype>(zombiecomp.ZombieRoleId)));
_mind.AddRole(mind, new ZombieRole(mind, _protoManager.Index<AntagPrototype>(zombiecomp.ZombieRoleId)));
//Greeting message for new bebe zombers
_chatMan.DispatchServerMessage(session, Loc.GetString("zombie-infection-greeting"));
// Notificate player about new role assignment
_audioSystem.PlayGlobal(zombiecomp.GreetSoundNotification, session);
_audio.PlayGlobal(zombiecomp.GreetSoundNotification, session);
}
else
{
var htn = EnsureComp<HTNComponent>(target);
htn.RootTask = "SimpleHostileCompound";
htn.Blackboard.SetValue(NPCBlackboard.Owner, target);
_npc.WakeNPC(target, htn);
}
if (!HasComp<GhostRoleMobSpawnerComponent>(target) && !mindComp.HasMind) //this specific component gives build test trouble so pop off, ig
@@ -236,19 +249,25 @@ namespace Content.Server.Zombies
//Goes through every hand, drops the items in it, then removes the hand
//may become the source of various bugs.
foreach (var hand in _sharedHands.EnumerateHands(target))
if (TryComp<HandsComponent>(target, out var hands))
{
_sharedHands.SetActiveHand(target, hand);
_sharedHands.DoDrop(target, hand);
_sharedHands.RemoveHand(target, hand.Name);
foreach (var hand in _hands.EnumerateHands(target))
{
_hands.SetActiveHand(target, hand, hands);
_hands.DoDrop(target, hand, handsComp: hands);
_hands.RemoveHand(target, hand.Name, hands);
}
RemComp(target, hands);
}
RemComp<HandsComponent>(target);
// No longer waiting to become a zombie:
// Requires deferral because this is (probably) the event which called ZombifyEntity in the first place.
RemCompDeferred<PendingZombieComponent>(target);
//zombie gamemode stuff
RaiseLocalEvent(new EntityZombifiedEvent(target));
var ev = new EntityZombifiedEvent(target);
RaiseLocalEvent(target, ref ev, true);
//zombies get slowdown once they convert
_movementSpeedModifier.RefreshMovementSpeedModifiers(target);
}

View File

@@ -4,10 +4,8 @@ using Content.Server.Chat;
using Content.Server.Chat.Systems;
using Content.Server.Cloning;
using Content.Server.Drone.Components;
using Content.Server.Humanoid;
using Content.Server.Inventory;
using Content.Shared.Bed.Sleep;
using Content.Shared.Chemistry.Components;
using Content.Server.Emoting.Systems;
using Content.Server.Speech.EntitySystems;
using Content.Shared.Damage;
@@ -24,20 +22,18 @@ using Robust.Shared.Timing;
namespace Content.Server.Zombies
{
public sealed class ZombieSystem : SharedZombieSystem
public sealed partial class ZombieSystem : SharedZombieSystem
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IPrototypeManager _protoManager = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly BloodstreamSystem _bloodstream = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly ZombifyOnDeathSystem _zombify = default!;
[Dependency] private readonly ServerInventorySystem _inv = default!;
[Dependency] private readonly ChatSystem _chat = default!;
[Dependency] private readonly AutoEmoteSystem _autoEmote = default!;
[Dependency] private readonly EmoteOnDamageSystem _emoteOnDamage = default!;
[Dependency] private readonly HumanoidAppearanceSystem _humanoidSystem = default!;
[Dependency] private readonly MobThresholdSystem _mobThreshold = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
@@ -55,61 +51,46 @@ namespace Content.Server.Zombies
SubscribeLocalEvent<ZombieComponent, TryingToSleepEvent>(OnSleepAttempt);
SubscribeLocalEvent<PendingZombieComponent, MapInitEvent>(OnPendingMapInit);
SubscribeLocalEvent<PendingZombieComponent, MobStateChangedEvent>(OnPendingMobState);
SubscribeLocalEvent<ZombifyOnDeathComponent, MobStateChangedEvent>(OnDamageChanged);
}
private void OnPendingMapInit(EntityUid uid, PendingZombieComponent component, MapInitEvent args)
{
component.NextTick = _timing.CurTime;
component.NextTick = _timing.CurTime + TimeSpan.FromSeconds(1f);
}
public override void Update(float frameTime)
{
base.Update(frameTime);
var query = EntityQueryEnumerator<PendingZombieComponent, DamageableComponent, MobStateComponent>();
var curTime = _timing.CurTime;
var zombQuery = EntityQueryEnumerator<ZombieComponent, DamageableComponent, MobStateComponent>();
// Hurt the living infected
var query = EntityQueryEnumerator<PendingZombieComponent, DamageableComponent, MobStateComponent>();
while (query.MoveNext(out var uid, out var comp, out var damage, out var mobState))
{
// Process only once per second
if (comp.NextTick + TimeSpan.FromSeconds(1) > curTime)
if (comp.NextTick > curTime)
continue;
comp.NextTick = curTime;
comp.NextTick = curTime + TimeSpan.FromSeconds(1f);
comp.InfectedSecs += 1;
// See if there should be a warning popup for the player.
if (comp.InfectionWarnings.TryGetValue(comp.InfectedSecs, out var popupStr))
{
_popup.PopupEntity(Loc.GetString(popupStr), uid, uid);
}
if (comp.InfectedSecs < 0)
{
// This zombie has a latent virus, probably set up by ZombieRuleSystem. No damage yet.
comp.GracePeriod -= TimeSpan.FromSeconds(1f);
if (comp.GracePeriod > TimeSpan.Zero)
continue;
}
// Pain of becoming a zombie grows over time
// By scaling the number of seconds we have an accessible way to scale this exponential function.
// The function was hand tuned to 120 seconds, hence the 120 constant here.
var scaledSeconds = (120.0f / comp.MaxInfectionLength) * comp.InfectedSecs;
if (_random.Prob(comp.InfectionWarningChance))
_popup.PopupEntity(Loc.GetString(_random.Pick(comp.InfectionWarnings)), uid, uid);
// 1x at 30s, 3x at 60s, 6x at 90s, 10x at 120s. Limit at 20x so we don't gib you.
var painMultiple = Math.Min(20f, 0.1f + 0.02f * scaledSeconds + 0.0005f * scaledSeconds * scaledSeconds);
if (mobState.CurrentState == MobState.Critical)
{
// Speed up their transformation when they are (or have been) in crit by ensuring their damage
// multiplier is at least 10x
painMultiple = Math.Max(comp.MinimumCritMultiplier, painMultiple);
}
_damageable.TryChangeDamage(uid, comp.Damage * painMultiple, true, false, damage);
var multiplier = _mobState.IsCritical(uid, mobState)
? comp.CritDamageMultiplier
: 1f;
_damageable.TryChangeDamage(uid, comp.Damage * multiplier, true, false, damage);
}
// Heal the zombified
var zombQuery = EntityQueryEnumerator<ZombieComponent, DamageableComponent, MobStateComponent>();
while (zombQuery.MoveNext(out var uid, out var comp, out var damage, out var mobState))
{
// Process only once per second
@@ -118,22 +99,15 @@ namespace Content.Server.Zombies
comp.NextTick = curTime;
if (comp.Permadeath)
{
// No healing
if (_mobState.IsDead(uid, mobState))
continue;
}
if (mobState.CurrentState == MobState.Alive)
{
// Gradual healing for living zombies.
_damageable.TryChangeDamage(uid, comp.Damage, true, false, damage);
}
else if (_random.Prob(comp.ZombieReviveChance))
{
// There's a small chance to reverse all the zombie's damage (damage.Damage) in one go
_damageable.TryChangeDamage(uid, -damage.Damage, true, false, damage);
}
var multiplier = _mobState.IsCritical(uid, mobState)
? comp.PassiveHealingCritMultiplier
: 1f;
// Gradual healing for living zombies.
_damageable.TryChangeDamage(uid, comp.PassiveHealing * multiplier, true, false, damage);
}
}
@@ -176,28 +150,6 @@ namespace Content.Server.Zombies
// Stop random groaning
_autoEmote.RemoveEmote(uid, "ZombieGroan");
if (args.NewMobState == MobState.Dead)
{
// Roll to see if this zombie is not coming back.
// Note that due to damage reductions it takes a lot of hits to gib a zombie without this.
if (_random.Prob(component.ZombiePermadeathChance))
{
// You're dead! No reviving for you.
_mobThreshold.SetAllowRevives(uid, false);
component.Permadeath = true;
_popup.PopupEntity(Loc.GetString("zombie-permadeath"), uid, uid);
}
}
}
}
private void OnPendingMobState(EntityUid uid, PendingZombieComponent pending, MobStateChangedEvent args)
{
if (args.NewMobState == MobState.Critical)
{
// Immediately jump to an active virus when you crit
pending.InfectedSecs = Math.Max(0, pending.InfectedSecs);
}
}
@@ -238,7 +190,7 @@ namespace Content.Server.Zombies
private void OnMeleeHit(EntityUid uid, ZombieComponent component, MeleeHitEvent args)
{
if (!EntityManager.TryGetComponent<ZombieComponent>(args.User, out var zombieComp))
if (!TryComp<ZombieComponent>(args.User, out _))
return;
if (!args.HitEntities.Any())
@@ -254,29 +206,25 @@ namespace Content.Server.Zombies
if (HasComp<ZombieComponent>(entity))
{
args.BonusDamage = -args.BaseDamage * zombieComp.OtherZombieDamageCoefficient;
args.BonusDamage = -args.BaseDamage;
}
else
{
if (!HasComp<ZombieImmuneComponent>(entity) && _random.Prob(GetZombieInfectionChance(entity, component)))
{
var pending = EnsureComp<PendingZombieComponent>(entity);
pending.MaxInfectionLength = _random.NextFloat(0.25f, 1.0f) * component.ZombieInfectionTurnTime;
EnsureComp<PendingZombieComponent>(entity);
EnsureComp<ZombifyOnDeathComponent>(entity);
}
}
if ((mobState.CurrentState == MobState.Dead || mobState.CurrentState == MobState.Critical)
&& !HasComp<ZombieComponent>(entity))
if (_mobState.IsIncapacitated(entity, mobState) && !HasComp<ZombieComponent>(entity))
{
_zombify.ZombifyEntity(entity);
ZombifyEntity(entity);
args.BonusDamage = -args.BaseDamage;
}
else if (mobState.CurrentState == MobState.Alive) //heals when zombies bite live entities
{
var healingSolution = new Solution();
healingSolution.AddReagent("Bicaridine", 1.00); //if OP, reduce/change chem
_bloodstream.TryAddToChemicals(args.User, healingSolution);
_damageable.TryChangeDamage(uid, component.HealingOnBite, true, false);
}
}
}
@@ -286,9 +234,10 @@ namespace Content.Server.Zombies
/// </summary>
/// <param name="source">the entity having the ZombieComponent</param>
/// <param name="target">the entity you want to unzombify (different from source in case of cloning, for example)</param>
/// <param name="zombiecomp"></param>
/// <remarks>
/// this currently only restore the name and skin/eye color from before zombified
/// TODO: reverse everything else done in ZombifyEntity
/// TODO: completely rethink how zombies are done to allow reversal.
/// </remarks>
public bool UnZombify(EntityUid source, EntityUid target, ZombieComponent? zombiecomp)
{
@@ -297,13 +246,13 @@ namespace Content.Server.Zombies
foreach (var (layer, info) in zombiecomp.BeforeZombifiedCustomBaseLayers)
{
_humanoidSystem.SetBaseLayerColor(target, layer, info.Color);
_humanoidSystem.SetBaseLayerId(target, layer, info.ID);
_humanoidAppearance.SetBaseLayerColor(target, layer, info.Color);
_humanoidAppearance.SetBaseLayerId(target, layer, info.ID);
}
_humanoidSystem.SetSkinColor(target, zombiecomp.BeforeZombifiedSkinColor);
_humanoidAppearance.SetSkinColor(target, zombiecomp.BeforeZombifiedSkinColor);
_bloodstream.ChangeBloodReagent(target, zombiecomp.BeforeZombifiedBloodReagent);
MetaData(target).EntityName = zombiecomp.BeforeZombifiedEntityName;
_metaData.SetEntityName(target, zombiecomp.BeforeZombifiedEntityName);
return true;
}