Skip to content
Snippets Groups Projects

Callback improvements

Merged Alex Ksandra requested to merge 0player/t-engine4:callback_improvements into master

Some touches on the callback system:

  • callback adding/removing is factored out so that the same loop isn't just written everywhere;
  • priorities can now be specified for callbacks (default 0), callbacks with lower priorities get called first. (By a popular IRC request.) Of course this involves sorting but measures are taken to do actual sorting as rarely as possible. (As a side-effect, callback-order is now well-defined, being sorted by type ("effect", "object", "talent") and implementing object (taking its .name or tostring()).)
  • sustained talents can now be made to behave like passive ones in terms of callbacks, by specifying passive_callbacks=true in talent definition.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Author Contributor

    Full forward & backward compatibility assured. (Older versions of the game will of course ignore priorities, and will try to call a talent callback with talent name "__priorities" or "__sorted"; luckily, nonexistent talent names fail silently there.)

  • Why not do the sorting when the callbacks are registered instead of when triggered ?

Please register or sign in to reply
Loading