From: Princess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com> Date: Mon, 20 Oct 2025 17:55:34 +0000 (-0700) Subject: Zombies can't hurt II. (#41007) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=43e6c524a4b938192cc8faf0df95c36c57cccd8e;p=space-station-14.git Zombies can't hurt II. (#41007) * Make zombie system not fard * Actually who cares if our owner is not a zombie, let melee weapons be zombies that's funny as fuck --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> --- diff --git a/Content.Server/Zombies/ZombieSystem.cs b/Content.Server/Zombies/ZombieSystem.cs index b8f2bd56ed..d4f86fa96c 100644 --- a/Content.Server/Zombies/ZombieSystem.cs +++ b/Content.Server/Zombies/ZombieSystem.cs @@ -236,43 +236,47 @@ namespace Content.Server.Zombies return MathF.Max(chance, zombieComponent.MinZombieInfectionChance); } - private void OnMeleeHit(EntityUid uid, ZombieComponent component, MeleeHitEvent args) + private void OnMeleeHit(Entity entity, ref MeleeHitEvent args) { - if (!TryComp(args.User, out _)) + if (!args.IsHit) return; - if (!args.HitEntities.Any()) - return; + var cannotSpread = HasComp(args.User); - foreach (var entity in args.HitEntities) + foreach (var uid in args.HitEntities) { - if (args.User == entity) + if (args.User == uid) continue; - if (!TryComp(entity, out var mobState)) + if (!TryComp(uid, out var mobState)) continue; - if (HasComp(entity)) + if (HasComp(uid) || HasComp(uid)) { - args.BonusDamage = -args.BaseDamage; - } - else - { - if (!HasComp(entity) && !HasComp(args.User) && _random.Prob(GetZombieInfectionChance(entity, component))) - { - EnsureComp(entity); - EnsureComp(entity); - } + // Don't infect, don't deal damage, do not heal from bites, don't pass go! + args.Handled = true; + continue; } - if (_mobState.IsIncapacitated(entity, mobState) && !HasComp(entity) && !HasComp(entity) && !HasComp(args.User)) + if (_mobState.IsAlive(uid, mobState)) { - ZombifyEntity(entity); - args.BonusDamage = -args.BaseDamage; + _damageable.TryChangeDamage(args.User, entity.Comp.HealingOnBite, true, false); + + // If we cannot infect the living target, the zed will just heal itself. + if (HasComp(uid) || cannotSpread || _random.Prob(GetZombieInfectionChance(uid, entity.Comp))) + continue; + + EnsureComp(uid); + EnsureComp(uid); } - else if (mobState.CurrentState == MobState.Alive) //heals when zombies bite live entities + else { - _damageable.TryChangeDamage(uid, component.HealingOnBite, true, false); + if (HasComp(uid) || cannotSpread) + continue; + + // If the target is dead and can be infected, infect. + ZombifyEntity(uid); + args.Handled = true; } } }