Add miniMAXIme to a game where it wasn't before
OK, I've figured it out: If the mod is added to an existing game, script.on_init() will be run for it. There we create first the surfaces for the preview characters and then one preview character per player on each surface.
After script.on_init() is finished, the migrations are run. The last version fixed that there was not enough space between the preview characters of the individual players if the scaling factor was >=300%. I solved this with migrations/01_01_19.lua, where I simply deleted all preview surfaces (including the preview characters) because they would be restored at the correct position when script.on_configuration_changed would be triggered. However, I didn't consider that game.delete_surface() doesn't delete the surface immediately, but on a tick in the future. So when the migration script has finished and script.on_configuration_changed is run, preview surfaces and characters still exist. But once the game resumes, they will be removed and there's nothing left for the cameras to show.
The fix is not to try to delete the preview surfaces, but just the entities on these surfaces. Replacing lines 7-18 of migrations/01_01_19.lua with the following will fix the problem:
for s, surface in pairs(game.surfaces) do
if surface.name:match("minime%-preview%-.+") or
surface.name:match(minime.preview_surface_name_prefix) then
for e, entity in pairs(surface.find_entities()) do
if entity.valid then
entity.destroy()
end
end
end
end