rain_gloom Posted September 5, 2015 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 My GitHub function brain() return nil end
Moderators Citizen Posted September 5, 2015 Moderators 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). The rEvolution is coming ...
rain_gloom Posted September 5, 2015 Author Posted September 5, 2015 Oooh, nifty! Thanks a bunch, it does work with a delay! My GitHub function brain() return nil end
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