Skip to content

Commit

Permalink
Merge pull request #988 from SimonFlapse/diggy_cutscene
Browse files Browse the repository at this point in the history
[Diggy] Cutscene Fixes
  • Loading branch information
theorangeangle authored Dec 3, 2019
2 parents 0e52cb3 + d812c71 commit c1359be
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
12 changes: 12 additions & 0 deletions features/cutscene/cutscene_controller.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ local toggle_gui_delayed =
Token.register(
function(params)
local player = params.player
if (not valid(player)) then
return
end
if not waypoint_still_active(params.tick, player.index) then
debug_print('Cutscene is no longer active. Skipping toggle_gui')
return
Expand All @@ -77,13 +80,19 @@ function Public.toggle_gui(tick, player, gui, initial_delay, clear)
debug_print('Provided GUI is invalid.')
return
end]]
if (not valid(player)) then
return
end
set_timeout_in_ticks(initial_delay, toggle_gui_delayed, {tick = tick, player = player, gui = gui, clear = clear})
end

local play_sound_delayed =
Token.register(
function(params)
local player = params.player
if (not valid(player)) then
return
end
if not waypoint_still_active(params.tick, player.index) then
debug_print('Cutscene is no longer active. Skipping play_sound')
return
Expand All @@ -93,6 +102,9 @@ local play_sound_delayed =
)

function Public.play_sound(tick, player, path, times, delay, initial_delay)
if (not valid(player)) then
return
end
if not game.is_valid_sound_path(path) then
debug_print('Provided SoundPath is invalid. Try opening /radio and browse for a valid path')
return
Expand Down
2 changes: 1 addition & 1 deletion map_gen/maps/diggy/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ local Config = {
{level = 10, price = 85, name = 'shotgun'},
{level = 10, price = 4, name = 'shotgun-shell'},
{level = 12, price = 200, name = 'heavy-armor'},
{level = 14, price = 35, name = 'landfill'},
{level = 14, price = 25, name = 'landfill'}, --Decreased to 25 from 35
{level = 15, price = 85, name = 'submachine-gun'},
{level = 18, price = 10, name = 'piercing-rounds-magazine'},
{level = 18, price = 8, name = 'piercing-shotgun-shell'},
Expand Down
23 changes: 20 additions & 3 deletions map_gen/maps/diggy/feature/cutscene.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,18 @@ local Rendering = require 'utils.rendering'

local DiggyCutscene = {}

local function valid(entity)
return entity and entity.valid
end

local delayed_draw_text =
Token.register(
function(params)
local tick = params.tick
local player = params.player
if (not valid(player)) then
return
end
local tick = params.tick
if params.play_sound > 1 then
play_sound(tick, player, 'utility/list_box_click', 1)
end
Expand All @@ -48,6 +55,9 @@ local delayed_draw_arrow =
Token.register(
function(params)
local player = params.player
if (not valid(player)) then
return
end
local tick = params.tick
params = params.params
local rendering_parmas = params.params
Expand All @@ -58,15 +68,22 @@ local delayed_draw_arrow =
)

local function delayed_function(func, player, tick, params, offset_time)
if (not valid(player)) then
return
end
Task.set_timeout_in_ticks(offset_time, func, {player = player, tick = tick, params = params})
end

local delayed_fade_blackout =
Token.register(
function(params)
local player = params.player
if (not valid(player)) then
return
end
local render_params = params.params
local id = CS_Rendering.blackout(params.player, render_params.zoom, render_params.time_to_live, render_params.color)
register_rendering(params.player.index, params.tick, id)
local id = CS_Rendering.blackout(player, render_params.zoom, render_params.time_to_live, render_params.color)
register_rendering(player.index, params.tick, id)
Rendering.fade(id, render_params.time_to_live - 1, 10)
end
)
Expand Down

0 comments on commit c1359be

Please sign in to comment.