Skip to content

Fixed handling of talent failures and log spam. Added log functionality.

Hachem_Muche requested to merge Hachem_Muche/t-engine4:TalentFailureFix into master

Added log rollback functionality to LogDisplay.

Fixed a significant issue with ActorTalents:useTalent preventing it from correctly returning the results of the talent action, activate, or deactivate code. It was returning the result of the coroutine (co_wrapper) result instead, which normally always returns true. The return value now correctly reflects talent success or failure, allowing AIs to try other actions when the talent code aborts. (AI changes not addressed in this commit.)

Enhanced error handling: engine.Game.tick will now save up to the last 10 lua errors (current tick only) in a table: game.errors (cycling index, retaining first-out and last-out errors) to make tracking down compound errors easier.

Added the LUA_CONSOLE key-bind to the ShowErrorStack dialog (requires config.settings.cheat).

Updated the onTalentLuaError function to provide more information (to stdout) on talent failures, and added extra calls to ensure it is invoked by talent use errors. Error info is saved to actor.talent_error (first error only) and each error is logged to ActorTalents._talent_errors. This makes it easier to identify both the talent and the talent user on errors.

useTalent will automatically rollback log messages (up to the last preUseTalent message) from aborted talents if ._silent_talent_failure is set. The previous behavior is the default, but for ToME, NPC's will rollback messages for failed talents (i.e. no more "Monster rushes out!" spam when the Rush talent is attempted but impossible), while all messages for the Player will remain.

Added a new logTalentMessage function to ActorTalents.lua (automatically called by useTalent unless silent) to handle basic talent use messages and overloaded this function for ToME's custom messages (code moved from preUseTalent). This permits useTalent to distinguish normal use messages from those generated by preUseTalent.

Fixed a bug that was allowing NPC's to bump attack without enough energy.

Added some on_pre_use functions to staff-combat talents.

Merge request reports

Loading