Only disable delaying when the state is set to Ingame.
This commit is contained in:
parent
2f5bfd989a
commit
6b06745986
2 changed files with 6 additions and 4 deletions
|
@ -269,7 +269,7 @@ local function generic_hook(self, obj, method, handler, func_name)
|
||||||
if obj and not success then
|
if obj and not success then
|
||||||
if _delaying_enabled and type(obj) == "string" then
|
if _delaying_enabled and type(obj) == "string" then
|
||||||
-- Call this func at a later time, using upvalues.
|
-- Call this func at a later time, using upvalues.
|
||||||
vmf:info("(%s): [%s.%s] needs to be delayed.", func_name, obj, method)
|
self:info("(%s): [%s.%s] needs to be delayed.", func_name, obj, method)
|
||||||
table.insert(_delayed, function()
|
table.insert(_delayed, function()
|
||||||
generic_hook(self, obj, method, handler, func_name)
|
generic_hook(self, obj, method, handler, func_name)
|
||||||
end)
|
end)
|
||||||
|
@ -394,8 +394,10 @@ vmf.hooks_unload = function()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
vmf.apply_delayed_hooks = function()
|
vmf.apply_delayed_hooks = function(status, state)
|
||||||
|
if status == "enter" and state == "StateIngame" then
|
||||||
_delaying_enabled = false
|
_delaying_enabled = false
|
||||||
|
end
|
||||||
if #_delayed > 0 then
|
if #_delayed > 0 then
|
||||||
vmf:info("Attempt to hook %s delayed hooks", #_delayed)
|
vmf:info("Attempt to hook %s delayed hooks", #_delayed)
|
||||||
-- Go through the table in reverse so we don't get any issues removing entries inside the loop
|
-- Go through the table in reverse so we don't get any issues removing entries inside the loop
|
||||||
|
|
|
@ -98,7 +98,7 @@ function vmf_mod_object:on_game_state_changed(status, state)
|
||||||
print("VMF:ON_GAME_STATE_CHANGED(), status: " .. tostring(status) .. ", state: " .. tostring(state))
|
print("VMF:ON_GAME_STATE_CHANGED(), status: " .. tostring(status) .. ", state: " .. tostring(state))
|
||||||
vmf.mods_game_state_changed_event(status, state)
|
vmf.mods_game_state_changed_event(status, state)
|
||||||
vmf.save_unsaved_settings_to_file()
|
vmf.save_unsaved_settings_to_file()
|
||||||
vmf.apply_delayed_hooks()
|
vmf.apply_delayed_hooks(status, state)
|
||||||
|
|
||||||
if status == "enter" and state == "StateIngame" then
|
if status == "enter" and state == "StateIngame" then
|
||||||
vmf.initialize_keybinds()
|
vmf.initialize_keybinds()
|
||||||
|
|
Loading…
Add table
Reference in a new issue