Here's the entirety of the mod's control.lua:
Code: Select all
function testocc_interface()
print('testocc-interface')
end
remote.add_interface('testocc',{t_i=testocc_interface})
Code: Select all
function configuration_changed(ccdata)
print(serpent.block(ccdata or 'o-c-c from on-init'))
do local _=remote.interfaces.testocc or {}
global.use_testocc_ti = _.t_i or false
print(_.t_i or false)
end
end
function conditionalhooks()
if global.use_testocc_ti then
for x=1,#player do
remote.call('testocc','t_i'
,{player_index=x})
end
else
on('player_left_game')
end
end
for k,v in next,_G do npg[k]=true end
use_testocc_ti = {} -- placeholder
player={}
on('configuration_changed',configuration_changed)
on('load',function()
for k,v in next,global do
print('Global "'..k..'" restored')
_G[k]=v end
conditionalhooks()
end)
on('init',function(...)
for k,v in next,_G do if not npg[k] then
print('Global "'..k..'" persisted')
global[k]=v end end
configuration_changed()
-- don't know c-c changing the lua globals is ok so just reload from map globals
for k,v in next,global do _G[k]=v end
conditionalhooks()
end)