rain_gloom Posted September 5, 2015 Share Posted September 5, 2015 (edited) I'm not sure if this is intended behavior or just me messing things up. I have a resource that stops any resource being started, does a few modifications on it then starts it again, but the new resource does not actually start. All I see in the server log is: start: Resource "test" start was requested () here is the relevant code: local startSet = {} local function procd ( resource ) if startSet [ resource ] then startSet [ resource ] = nil else cancelEvent () processResource ( resource.name ) startSet [ resource ] = true startResource ( resource ) end end addEventHandler ( 'onResourcePreStart', root, procd ) If I manually start it after that message, it works as expected and the processing is not run. Edited September 5, 2015 by Guest Link to comment
Moderators Citizen Posted September 5, 2015 Moderators Share Posted September 5, 2015 Maybe the new modified resource now contains errors that prevents it to start, or maybe you should delay the start of the modified resource to let the onResourcePreStart and the cancelEvent finish what they are supposed to do. I would go for a setTimer of 500ms or 1sec to call the startResource (don't forget to send the resource as an argument with the setTimer). Link to comment
rain_gloom Posted September 5, 2015 Author Share Posted September 5, 2015 Oooh, nifty! Thanks a bunch, it does work with a delay! Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now