2020-11-28 22:31:57 +08:00
--[[ Copyright (c) 2020 npc_strider
* For direct use of code or graphics , credit is appreciated . See LICENSE.txt for more information .
* This mod may contain modified code sourced from base / core Factorio
*
* control / init.lua
* Runs when installed / config changes . Incorporate intermod compatibility here .
--]]
2020-11-28 01:37:34 +08:00
2020-11-28 22:31:57 +08:00
function Initialize ( )
game.print ( " Create tables for spidertron control mod " )
if global.spidercontrol_linked_s == nil then
2020-11-28 01:37:34 +08:00
global.spidercontrol_linked_s = { }
2020-11-28 22:31:57 +08:00
end
if global.spidercontrol_player_s == nil then
2020-11-28 01:37:34 +08:00
global.spidercontrol_player_s = { }
for _ , player in pairs ( game.players ) do
global.spidercontrol_player_s [ player.index ] = { active = { } , inactive = { } } -- Some future-proofing here
end
end
2020-11-28 22:31:57 +08:00
if global.spidercontrol_spidertronwaypoints_patrol == nil then
global.spidercontrol_spidertronwaypoints_patrol = { }
end
2020-11-28 01:37:34 +08:00
SpidertronWaypointsCompatibility ( )
end
2020-11-28 22:31:57 +08:00
script.on_init ( Initialize )
script.on_configuration_changed ( Initialize )
-- commands.add_command("spiderbot_Initialize_variables", "debug: ensure that all global tables are not nil (should not happen in a normal game)", Initialize)
script.on_event ( defines.events . on_player_created , function ( event )
if global.spidercontrol_player_s == nil then
Initialize ( )
end
global.spidercontrol_player_s [ event.player_index ] = { active = { } , inactive = { } }
end )