[Tasks] Add rule to update multiple task elements (#2427)

On live if a task update would affect multiple elements, only the first
one gets updated. This was added as part of the changes in 7482cfc0.

Setting `UpdateOneElementPerTask` to false will restore the old behavior
that increments all active elements matching the task update criteria.
This commit is contained in:
hg 2022-09-06 12:42:45 -04:00 committed by GitHub
parent 78223b7ebf
commit 2c9fe4f2b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -557,6 +557,7 @@ RULE_BOOL(TaskSystem, EnableTaskProximity, true, "Enable task proximity system")
RULE_INT(TaskSystem, RequestCooldownTimerSeconds, 15, "Seconds between allowing characters to request tasks (live-like default: 15 seconds)")
RULE_INT(TaskSystem, SharedTasksWorldProcessRate, 6000, "Timer interval (milliseconds) that shared tasks are processed in world")
RULE_INT(TaskSystem, SharedTasksTerminateTimerMS, 120000, "Delay (milliseconds) until a shared task is terminated if requirements are no longer met after member removal (default: 2 minutes)")
RULE_BOOL(TaskSystem, UpdateOneElementPerTask, true, "If true (live-like) task updates only increment the first matching activity. If false all matching elements will be incremented.")
RULE_CATEGORY_END()
RULE_CATEGORY(Range)

View File

@ -592,7 +592,11 @@ int ClientTaskState::UpdateTasks(Client* client, const TaskUpdateFilter& filter,
int updated = IncrementDoneCount(client, task, client_task.slot, client_activity.activity_id, count);
max_updated = std::max(max_updated, updated);
break; // only one element updated per task, move to next task
if (RuleB(TaskSystem, UpdateOneElementPerTask))
{
break; // only one element updated per task, move to next task
}
}
}
}