Skip to content
Snippets Groups Projects
Commit 8d60fdba authored by DarkGod's avatar DarkGod
Browse files

Unless in developer mode, during betas the game will refuse to load most...

Unless in developer mode, during betas the game will refuse to load most addons; as they only mess up with the testing
parent 7097c978
No related branches found
No related tags found
No related merge requests found
......@@ -556,6 +556,7 @@ function _M:loadAddons(mod, saveuse)
if saveuse then saveuse = table.reverse(saveuse) end
local force_remove_addons = {}
local beta_removed = {}
-- Filter based on settings
for i = #adds, 1, -1 do
......@@ -585,6 +586,10 @@ function _M:loadAddons(mod, saveuse)
print("Removing addon "..add.short_name..": not allowed by config")
table.remove(adds, i) removed = true
end
elseif not config.settings.cheat and not engine.beta_allow_addon(add.short_name) then
print("Removing addon "..add.short_name..": game beta forbids")
table.remove(adds, i) removed = true
beta_removed[#beta_removed+1] = add.long_name
else
-- Forbidden by version
if not add.natural_compatible then
......@@ -627,6 +632,12 @@ You may try to force loading if you are sure the savefile does not use that addo
end
end
end
if #beta_removed > 0 then
mod.post_load_exec = mod.post_load_exec or {}
mod.post_load_exec[#mod.post_load_exec+1] = function()
require("engine.ui.Dialog"):simpleLongPopup(_t"Beta Addons Disabled", _t"This beta version is meant to be tested without addons, as such the following ones are currently disabled:\n#GREY#"..table.concat(beta_removed, '#LAST#, #GREY#').."#LAST#\n\n".._t"#{italic}##PINK#Addons developers can still test their addons by enabling developer mode.#{normal}#", 600)
end
end
-- Let addons disable addons!
for i = #adds, 1, -1 do
......@@ -1144,6 +1155,8 @@ function _M:instanciate(mod, name, new_game, no_reboot, extra_module_info)
core.display.resetAllFonts("normal")
if mod.short_name ~= "boot" then profile:noMoreAuthWait() end
if mod.post_load_exec then for _, fct in ipairs(mod.post_load_exec) do fct() end end
end
--- Setup write dir for a module
......
......@@ -110,6 +110,21 @@ end
--- Check if we are running as beta
function engine.version_hasbeta()
if fs.exists("/engine/version_beta.lua") then
return dofile("/engine/version_beta.lua")
local beta = dofile("/engine/version_beta.lua")
return beta
end
end
--- Check if we are running as beta
function engine.beta_allow_addon(name)
if fs.exists("/engine/version_beta.lua") then
local beta, allowed_addons = dofile("/engine/version_beta.lua")
if not beta or not allowed_addons then return true end
for _, test in ipairs(allowed_addons) do
if name == test then return true
elseif name:find(test) then return true end
end
else
return true
end
end
#!/bin/sh
if test $# -lt 1 ; then
echo "Usage: release.sh [version] [beta, if any]"
echo "Usage: release.sh [version] [beta, if any] [allowed addons, if beta]"
exit
fi
......@@ -69,8 +69,19 @@ find . -name '*~' -or -name '.svn' -or -name '.keep' | xargs rm -rf
echo "version_desc = '$ver'" >> game/engines/default/modules/boot/init.lua
echo "version_desc = '$ver'" >> game/modules/tome/init.lua
if test -n "$beta"; then
echo "return '$beta'" > game/engines/default/engine/version_beta.lua
if test $# -lt 3 ; then
echo "Usage: release.sh [version] [beta] [allowed addons or 'all']"
exit
fi
addons="$3"
if test "$addons" = "all"; then
echo "return '$beta'" > game/engines/default/engine/version_beta.lua
else
addons_check=`echo "$addons" | sed -e 's/\([^,]\+\)/"\1"/g' -e 's/^/{/' -e 's/$/}/'`
echo "return '$beta' '$addons_check'" > game/engines/default/engine/version_beta.lua
fi
fi
exit
# create teae/teams
cd game/engines
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment