Skip to content

Commit

Permalink
DiD: added lua for faster cutscene skipping
Browse files Browse the repository at this point in the history
  • Loading branch information
nemaara committed Mar 6, 2019
1 parent 73fbaae commit bdaffdf
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
6 changes: 5 additions & 1 deletion data/campaigns/Descent_Into_Darkness/_main.cfg
Expand Up @@ -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}

Expand Down
25 changes: 25 additions & 0 deletions data/campaigns/Descent_Into_Darkness/lua/skip_animations.lua
@@ -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

0 comments on commit bdaffdf

Please sign in to comment.