[solved]remote reference available in on_load? (0.12.29)

Place to get help with not working mods / modding interface.
Post Reply
User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 883
Joined: Sun Mar 20, 2016 2:51 am
Contact:

[solved]remote reference available in on_load? (0.12.29)

Post by Impatient »

hi!

i tested registering an interface to remote in the on_load handler. when calling upon that interface later in the on_tick handler it errors "interface unknown".

Code: Select all

function handleOnLoad()
	if not global.initializedOnLoad then
		initGlobals()
	else
	end
	-- migration needed?
	
	-- test registering remote interface in on_load -> does not work
	-- it seems the remote reference can not be used in the on_load handler
	remote.add_interface("DVM",
		{
			testOnLoad = remoteTestOnLoad
		}
	)
end
is the observation correct, that interface registration can not be done, when handling the on_load event?

thanks!
Last edited by Impatient on Sun Apr 03, 2016 10:53 pm, edited 1 time in total.

User avatar
Impatient
Filter Inserter
Filter Inserter
Posts: 883
Joined: Sun Mar 20, 2016 2:51 am
Contact:

Re: remote reference available in on_load handler? (0.12.29)

Post by Impatient »

some sort of answer:
The interfaces are not serialised. Therefore it is a good idea to put them into the global scope of the script. In that way they are run everytime the script file is loaded (no matter whether it is the first run or game being loaded).
from:
https://wiki.factorio.com/index.php?tit ... interfaces

Post Reply

Return to “Modding help”