Jump to content

Game tries to unregister a callback because sector is being generated


Rinart73

Recommended Posts

(I also sent you a mail about it)

 

There is an API-related problem that I is really confusing.

 

I'm trying to register Server callback in the script that is attached to a Sector object:

 

function ServerGuard.initialize()
    Server():registerCallback("onPlayerLogOff", "onPlayerLogOff")
end

 

But server instantly writes following message:

warning: tried unregistering a callback from server to script mods/ServerGuard/scripts/sector/serverguard.lua in sector (69:444), which is being generated

----

I tried to delay callback registration (so it would happen a bit later):

 

local lateInit = false

function ServerGuard.updateServer()
    if lateInit then return end
    lateInit = true
    Server():registerCallback("onPlayerLogOff", "onPlayerLogOff")
end

 

And half of the time this works. I'm confused, because I thought that all these functions should fire after the sector was generated. Is there any way to know when sector is ready? Unfortunately I can't spam with "registerCallback" function again and again, because I need to execute some other code, but only once.

 

UPD: Contacted the devs, it's not a bug, it's an intended behaviour.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...