Please see the attached (test) mod
Code: Select all
require "defines"
-----------------------------------------------------------
-- utility functions
-----------------------------------------------------------
function print(s)
for index, player in pairs(game.players) do
if(player.valid) then
player.print(s);
end;
end
end
game.on_init(function(event)
print("oninit()");
end);
game.on_load(function(event)
print("onload()");
end);
game.on_event(defines.events.on_tick, function(event)
print("initial tick");
game.on_event(defines.events.on_tick, nil);
end);
This represents a problem whenever mods want to initialize data on game loading. Workaround: perform on-load tasks during the initial tick.