Skip to content

Commit

Permalink
fix last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Bauumm committed Sep 17, 2023
1 parent f4f5c8a commit 910e611
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions compat/game192/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function EventList:execute(time)
end

-- initalize the events defined in the level json
function events.init(game)
function events.init(game, public)
level_events = EventList:new(game.level_data.events == 0 and {} or game.level_data.events)
executing_events = {}
queued_events = {}
Expand All @@ -71,8 +71,8 @@ function events.init(game)
game.restart_first_time = true
end,
menu = function()
-- TODO: actually go to menu instead of closing the game
love.event.push("quit")
public.death_callback()
require("game_handler").stop()
end,
message_add = function(event)
game.lua_runtime.env.messageAdd(event.message, event.duration)
Expand Down
2 changes: 1 addition & 1 deletion compat/game192/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public.start = async(function(pack_folder, level_id, level_options)
game.vfs.load_files(files)

game.message_text = ""
game.events.init(game)
game.events.init(game, public)
game.status.reset()
game.restart_id = level_id
game.restart_first_time = false
Expand Down
1 change: 1 addition & 0 deletions compat/game192/lua_runtime.lua
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ function lua_runtime.run_fn_if_exists(name, ...)
key_count = 0
if env[name] ~= nil then
xpcall(run_fn, lua_runtime.error, name, ...)
debug.sethook()
end
if key_count > block_threshold then
lua_runtime.reset_timings = true
Expand Down
11 changes: 5 additions & 6 deletions ui/screens/game.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ local timer = quad:new({

local death_overlay_index

local function back_to_menu(no_resume)
local function back_to_menu(_, no_resume)
if death_overlay_index then
keyboard_navigation.set_screen()
overlays.remove_overlay(death_overlay_index)
death_overlay_index = nil
end
local ui = require("ui")
if no_resume then
if not no_resume then
game_handler.preview_start("", "", {}, false, true)
end
ui.open_screen("levelselect")
Expand Down Expand Up @@ -80,10 +80,9 @@ game_handler.onupdate = function()
death_overlay_index = overlays.add_overlay(death_overlay)
keyboard_navigation.set_screen(death_overlay)
end
end
-- execution aborted from somewhere else (not due to player death)
if not game_handler.is_running() then
back_to_menu(true)
elseif not game_handler.is_running() then
-- execution aborted from somewhere else (not due to player death)
back_to_menu(nil, true)
end
end

Expand Down

0 comments on commit 910e611

Please sign in to comment.