Skip to content

Commit

Permalink
Remove spawned zombies when restarting the simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
ZehMatt committed Aug 25, 2024
1 parent bb28fac commit c1c9bbd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Mod/Mod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,15 @@ static string GetSimulationSaveFile()

static void ResetSimulation()
{
var world = GameManager.Instance.World;
var simulation = Simulation.Instance;

// Remove all active zombies as they will have no connection with the simulation anymore.
foreach (var kv in simulation.Active)
{
world.RemoveEntity(kv.Key, EnumRemoveEntityReason.Despawned);
}

var config = LoadConfiguration();
simulation.Reset(config);

Expand Down

0 comments on commit c1c9bbd

Please sign in to comment.