Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix two zombie bugs #34472

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Content.Server/Zombies/ZombieSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ private void OnBeforeRemoveAnomalyOnDeath(Entity<PendingZombieComponent> ent, re
private void OnPendingMapInit(EntityUid uid, IncurableZombieComponent component, MapInitEvent args)
{
_actions.AddAction(uid, ref component.Action, component.ZombifySelfActionPrototype);

if (HasComp<ZombieComponent>(uid) || HasComp<ZombieImmuneComponent>(uid))
return;

EnsureComp<PendingZombieComponent>(uid, out PendingZombieComponent pendingComp);
Copy link
Member

@slarticodefast slarticodefast Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, adding a component in the initialization of another component is a little messy and afaik there are some integration tests that can fail due to this for certain prototypes.
And as far as I can see it should already be added where ever the IncurableZombieComponent is added.

Copy link
Contributor Author

@IProduceWidgets IProduceWidgets Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but that causes a race condition between the two. Its what caused the bug.

Well, partially, the original author also seemed to think the map init wouldn't get hit on new components added after the map was initialized, but that's not how that works.

Copy link
Contributor Author

@IProduceWidgets IProduceWidgets Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can admit that they should probably just be the same component, but tbh all of zombie system and its components and zombiesystem.transform needs a rewrite. Its a mess in there.
image


pendingComp.GracePeriod = _random.Next(pendingComp.MinInitialInfectedGrace, pendingComp.MaxInitialInfectedGrace);
}

private void OnPendingMapInit(EntityUid uid, PendingZombieComponent component, MapInitEvent args)
Expand All @@ -94,7 +101,6 @@ private void OnPendingMapInit(EntityUid uid, PendingZombieComponent component, M
}

component.NextTick = _timing.CurTime + TimeSpan.FromSeconds(1f);
component.GracePeriod = _random.Next(component.MinInitialInfectedGrace, component.MaxInitialInfectedGrace);
}

public override void Update(float frameTime)
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Zombies/PendingZombieComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public sealed partial class PendingZombieComponent : Component
{
DamageDict = new ()
{
{ "Poison", 0.2 },
{ "Poison", 0.4 },
}
};

Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Mobs/Species/vox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
damage:
types:
Heat: -0.07
Poison: -0.2
Poison: -0.2 # needs to be less than the PendingZombieComponent does or they never become zombies by the disease.
groups:
Brute: -0.07
- type: DamageVisuals
Expand Down
Loading