Skip to content

Commit

Permalink
Fix godotengine#6583, Condition + Wait nodes freezing the game
Browse files Browse the repository at this point in the history
Make sure that only the first node after VS resume gets resumed
  • Loading branch information
bojidar-bg committed Aug 19, 2017
1 parent 5d85108 commit 4a0b441
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions modules/visual_script/visual_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1578,12 +1578,15 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p

VisualScriptNodeInstance::StartMode start_mode;
{
if (p_resuming_yield)
if (p_resuming_yield) {
start_mode = VisualScriptNodeInstance::START_MODE_RESUME_YIELD;
else if (!flow_stack || !(flow_stack[flow_stack_pos] & VisualScriptNodeInstance::FLOW_STACK_PUSHED_BIT)) //if there is a push bit, it means we are continuing a sequence
start_mode = VisualScriptNodeInstance::START_MODE_BEGIN_SEQUENCE;
else
p_resuming_yield = false; // should resume only the first time
} else if (flow_stack && (flow_stack[flow_stack_pos] & VisualScriptNodeInstance::FLOW_STACK_PUSHED_BIT)) {
//if there is a push bit, it means we are continuing a sequence
start_mode = VisualScriptNodeInstance::START_MODE_CONTINUE_SEQUENCE;
} else {
start_mode = VisualScriptNodeInstance::START_MODE_BEGIN_SEQUENCE;
}
}

VSDEBUG("STEP - STARTSEQ: " + itos(start_mode));
Expand Down

0 comments on commit 4a0b441

Please sign in to comment.