[Custom Views] More checks for transition handling
This commit is contained in:
parent
199a174a57
commit
f3443dc32e
2 changed files with 17 additions and 13 deletions
|
@ -215,7 +215,7 @@ local function perform_keybind_action(data, is_pressed)
|
||||||
call_function(data.mod, data.function_name, is_pressed)
|
call_function(data.mod, data.function_name, is_pressed)
|
||||||
return true
|
return true
|
||||||
elseif data.type == "view_toggle" and data.mod:is_enabled() then
|
elseif data.type == "view_toggle" and data.mod:is_enabled() then
|
||||||
vmf.keybind_toggle_view(data.view_name, can_perform_action)
|
vmf.keybind_toggle_view(data.view_name, can_perform_action, is_pressed)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -101,12 +101,13 @@ end
|
||||||
-- ##### VMFMod ########################################################################################################
|
-- ##### VMFMod ########################################################################################################
|
||||||
-- #####################################################################################################################
|
-- #####################################################################################################################
|
||||||
|
|
||||||
function VMFMod:handle_transition(transition_name, transition_params, fade)
|
function VMFMod:handle_transition(transition_name, transition_params, fade, ignore_active_menu)
|
||||||
if _ingame_ui
|
if _ingame_ui
|
||||||
and not _ingame_ui:pending_transition()
|
and not _ingame_ui:pending_transition()
|
||||||
and not _ingame_ui:end_screen_active()
|
and not _ingame_ui:end_screen_active()
|
||||||
and not _ingame_ui.menu_active
|
and (not _ingame_ui.menu_active or ignore_active_menu)
|
||||||
and not _ingame_ui.leave_game
|
and not _ingame_ui.leave_game
|
||||||
|
and not _ingame_ui.menu_suspended
|
||||||
and not _ingame_ui.return_to_title_screen
|
and not _ingame_ui.return_to_title_screen
|
||||||
and (
|
and (
|
||||||
VT1
|
VT1
|
||||||
|
@ -178,21 +179,24 @@ function vmf.remove_custom_views()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function vmf.keybind_toggle_view(view_name, can_be_opened)
|
function vmf.keybind_toggle_view(view_name, can_be_opened, is_keybind_pressed)
|
||||||
--@TODO: check if there's the custom view at all. If not, show error.
|
--@TODO: check if there's the custom view at all. If not, show error.
|
||||||
|
|
||||||
if _ingame_ui then
|
if _ingame_ui then
|
||||||
local mod = _views_data[view_name].mod
|
local mod = _views_data[view_name].mod
|
||||||
local keybind_transitions = _views_data[view_name].view_settings.keybind_transitions
|
local keybind_transitions = _views_data[view_name].view_settings.keybind_transitions
|
||||||
if not _ingame_ui.menu_suspended then
|
if _ingame_ui.current_view == view_name then
|
||||||
if _ingame_ui.current_view == view_name then
|
if keybind_transitions.close_view_transition then
|
||||||
if keybind_transitions.close_view_transition then
|
mod:handle_transition(keybind_transitions.close_view_transition,
|
||||||
mod:handle_transition(keybind_transitions.close_view_transition, keybind_transitions.close_view_transition_params, keybind_transitions.transition_fade)
|
keybind_transitions.close_view_transition_params,
|
||||||
end
|
keybind_transitions.transition_fade, true)
|
||||||
elseif can_be_opened then
|
end
|
||||||
if keybind_transitions.open_view_transition then
|
-- Can open views only when keybind is pressed.
|
||||||
mod:handle_transition(keybind_transitions.open_view_transition, keybind_transitions.close_view_transition_params, keybind_transitions.transition_fade)
|
elseif can_be_opened and is_keybind_pressed then
|
||||||
end
|
if keybind_transitions.open_view_transition then
|
||||||
|
mod:handle_transition(keybind_transitions.open_view_transition,
|
||||||
|
keybind_transitions.close_view_transition_params,
|
||||||
|
keybind_transitions.transition_fade, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue