-
-
Notifications
You must be signed in to change notification settings - Fork 494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run init-script only once after a sector has loaded #3011
base: master
Are you sure you want to change the base?
Conversation
This is a great option to have, especially for infinitely looping scripts that are only meant to trigger once, such as a loop that randomises the time between lightning strikes, however, I think there remains the need for scripts that are triggered every time on sector entry (such as my STAGE project, that needs to check for changes made in other sectors when a sector is entered). I have a few possible solutions in mind.
|
Basically you want an option that you can check to specify whether it's run every time. I think I need to also reset the flag when the sector is reset. |
Discussion question: Can I get some input on this? |
Yeah, I believe a script to run only on sector initialization should be a separate option. |
I agree, with both options available, the default should be the old behaviour to avoid needlessly breaking older levels. |
This is ready for review. I haven't tested the actual behaviour but to quote "I, Robot": "My logic is undeniable". |
Every time you load a sector it replaces all the instances with new instances. Is this also gone with this PR or is that untouched? |
What do you mean by "instances" in this case? |
Basically the exposed objects. (theyre referred to as instances by Squirrel) |
@@ -287,8 +289,10 @@ Sector::activate(const Vector& player_pos) | |||
} | |||
|
|||
// Run init script | |||
if (!m_init_script.empty() && !Editor::is_active()) { | |||
if (!m_init_script.empty() && !Editor::is_active() && | |||
((m_init_script_run_once && !m_init_script_run) || !m_init_script_run_once)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose second line could be replaced with (!m_init_script_run_once || !m_init_script_run)
.
What's the status on this PR? |
Nothing was done since the last comments. It's another PR I need to tackle. |
Fixes #698