DiD: added lua for faster cutscene skipping

This commit is contained in:
nemaara 2019-01-30 15:54:47 -05:00
parent 0ba2cefd9d
commit b2251cccc2
2 changed files with 30 additions and 1 deletions

View file

@ -66,7 +66,11 @@
[binary_path]
path=data/campaigns/Descent_Into_Darkness
[/binary_path]
[lua]
code = <<
wesnoth.dofile('campaigns/Descent_Into_Darkness/lua/' .. 'skip_animations.lua')
>>
[/lua]
{campaigns/Descent_Into_Darkness/utils}
{campaigns/Descent_Into_Darkness/scenarios}

View file

@ -0,0 +1,25 @@
---
-- Extends several animation actions so that they do not trigger when the user
-- is skipping messages.
---
local skippable_actions = {
"animate_unit",
"sound",
"delay"
}
local skip_actions = {}
for i, action_id in ipairs(skippable_actions) do
skip_actions[action_id] = wesnoth.wml_actions[action_id]
wesnoth.wml_actions[action_id] = function(cfg)
if wesnoth.is_skipping_messages() then
return
end
skip_actions[action_id](cfg)
end
end