Fix some sequence progress bugs

console-destruction
Sven Eberhardt 2016-08-28 00:16:58 -04:00
parent 96842e2961
commit 5da1a0d5c1
2 changed files with 5 additions and 9 deletions

View File

@ -566,15 +566,10 @@ private func CountContainedObjectsTimer()
public func OnTrigger(object triggering_clonk, int triggering_player, bool is_editor_test)
{
// Editor test: Triggered by first player
if (is_editor_test)
{
if (GetPlayerCount(C4PT_User)) triggering_player = GetPlayerByIndex();
}
// Check condition
if (condition && !UserAction->EvaluateCondition(condition, this, triggering_clonk, triggering_player)) return false;
// Only one action at the time
if (!action_allow_parallel) StopTrigger();
if (!action_allow_parallel && !action_progress_mode) StopTrigger();
// Execute action
return UserAction->EvaluateAction(action, this, triggering_clonk, triggering_player, action_progress_mode, action_allow_parallel, this.OnActionFinished);
}

View File

@ -523,8 +523,7 @@ public func EvaluateAction(proplist props, object action_object, object triggeri
else if (progress_mode == "player")
{
if (!props._contexts) props._contexts = [];
var plr_id;
if (action_object) plr_id = GetPlayerID(action_object->GetOwner());
var plr_id = GetPlayerID(triggering_player);
if (!(context = props._contexts[plr_id]))
props._contexts[plr_id] = context = CreateObject(UserAction);
}
@ -765,7 +764,9 @@ private func EvalAct_Goto(proplist props, proplist context)
// Apply goto by jumping in most recently executed sequence
if (context.last_sequence)
{
context.sequence_progress[context.last_sequence._sequence_id] = props.Index;
var index = props.Index;
if (GetType(index) != C4V_Int) index = EvaluateValue("Integer", index, context); // compatibility
context.sequence_progress[context.last_sequence._sequence_id] = index;
context.sequence_had_goto[context.last_sequence._sequence_id] = true;
}
}