From c5fb50298af38c57a2030168caf486cd33e02b1a Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Fri, 14 Apr 2023 20:23:25 +0100 Subject: [PATCH] Prevent installing mods when there is no base game (#13429) --- builtin/mainmenu/dlg_contentstore.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/builtin/mainmenu/dlg_contentstore.lua b/builtin/mainmenu/dlg_contentstore.lua index 940eea172..ce91e74f0 100644 --- a/builtin/mainmenu/dlg_contentstore.lua +++ b/builtin/mainmenu/dlg_contentstore.lua @@ -200,6 +200,9 @@ local function queue_download(package, reason) end local function get_raw_dependencies(package) + if package.type ~= "mod" then + return {} + end if package.raw_deps then return package.raw_deps end @@ -999,7 +1002,13 @@ function store.handle_submit(this, fields) end end - if not package.path and core.is_dir(install_parent .. DIR_DELIM .. package.name) then + if package.type == "mod" and #pkgmgr.games == 0 then + local dlg = messagebox("install_game", + fgettext("You need to install a game before you can install a mod")) + dlg:set_parent(this) + this:hide() + dlg:show() + elseif not package.path and core.is_dir(install_parent .. DIR_DELIM .. package.name) then local dlg = confirm_overwrite.create(package, on_confirm) dlg:set_parent(this) this:hide()