Skip to content
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

fix: enable transition to ESCRoom even if esc_script is not set #502

Merged
merged 1 commit into from
Feb 24, 2022

Conversation

bolinfest
Copy link
Contributor

When creating a new ESCRoom, there was a bug where it was not possible
to transition into the room if the room's esc_script was not set.
Apparently, _perform_script_events() would bail out early when
room.esc_script is falsy, which seems to be why the transition does
not happen.

Perhaps this defensive check was necessary at one time, but that does
not appear to be the case today because the only code that reads
room.esc_script in this file is within the _run_script_event()
function, which does its own defensive check for room.esc_script. As
such, it appears that we can let the rest of _perform_script_events()
do its thing even when room.esc_script is falsy (i.e., "").

When creating a new `ESCRoom`, there was a bug where it was not possible
to transition into the room if the room's `esc_script` was not set.
Apparently, `_perform_script_events()` would bail out early when
`room.esc_script` is falsy, which seems to be why the transition does
not happen.

Perhaps this defensive check was necessary at one time, but that does
not appear to be the case today because the only code that reads
`room.esc_script` in this file is within the `_run_script_event()`
function, which does its own defensive check for `room.esc_script`. As
such, it appears that we can let the rest of `_perform_script_events()`
do its thing even when `room.esc_script` is falsy (i.e., `""`).
@bolinfest bolinfest changed the title Fix bug where could not transition to ESCRoom with esc_script not set. fix: enable transition to ESCRoom even if esc_script is not set Feb 19, 2022
@StraToN
Copy link
Collaborator

StraToN commented Feb 20, 2022

This may be related to godot-escoria/escoria-issues#95 (fixed)

@StraToN
Copy link
Collaborator

StraToN commented Feb 20, 2022

This check was added by @BHSDuncan in 99dc1e0 (#485). Maybe he can give us some details on the reason why the check was re-introduced?

@BHSDuncan
Copy link
Collaborator

This check was added by @BHSDuncan in 99dc1e0 (#485). Maybe he can give us some details on the reason why the check was re-introduced?

I didn't actually reintroduce it: I factored it to a spot that (at the time) made more sense since where the places it was originally in could be reduced.

The ticket that commit was a part involved introducing no new functionality, and if code was moved around, it would've been for the purpose of maintaining the same functionality (no more, no less) but with what was supposed to be cleaner/more efficient code.

TL;DR: It wasn't really "re-introduced" per se; it was just factored, so if the check can safely be removed, then by all means.

Copy link
Collaborator

@dploeger dploeger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine by me. Thanks! 🎁

@bolinfest
Copy link
Contributor Author

We’re there any outstanding concerns with this one?

@StraToN StraToN merged commit 282ea24 into godot-escoria:develop Feb 24, 2022
@StraToN
Copy link
Collaborator

StraToN commented Feb 24, 2022

Thanks a lot !

@bolinfest bolinfest deleted the room-esc-script-not-set branch February 25, 2022 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants