world creation content menu
This commit is contained in:
@@ -7,6 +7,7 @@ rem_packs = {}
|
||||
|
||||
function apply()
|
||||
core.reconfig_packs(add_packs, rem_packs)
|
||||
menu:back()
|
||||
end
|
||||
|
||||
function refresh_changes()
|
||||
@@ -74,6 +75,7 @@ end
|
||||
function refresh()
|
||||
packs_installed = pack.get_installed()
|
||||
packs_available = pack.get_available()
|
||||
base_packs = pack.get_base_packs()
|
||||
packs_all = {unpack(packs_installed)}
|
||||
required = {}
|
||||
for i,k in ipairs(packs_available) do
|
||||
@@ -82,14 +84,13 @@ function refresh()
|
||||
|
||||
local packs_cur = document.packs_cur
|
||||
local packs_add = document.packs_add
|
||||
|
||||
packs_cur:clear()
|
||||
packs_add:clear()
|
||||
|
||||
for i,id in ipairs(packs_installed) do
|
||||
local packinfo = pack.get_info(id)
|
||||
packinfo.index = i
|
||||
callback = id ~= "base" and string.format('move_pack("%s")', id) or nil
|
||||
callback = not table.has(base_packs, id) and string.format('move_pack("%s")', id) or nil
|
||||
packinfo.error = check_dependencies(packinfo)
|
||||
place_pack(packs_cur, packinfo, callback)
|
||||
end
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<button onclick='save_state() menu.page="generators"' id='generator_btn'>
|
||||
@World generator
|
||||
</button>
|
||||
<button id='content_btn' onclick='save_state() menu.page="content"'/>
|
||||
<button onclick='create_world()' margin='1,20,1,1'>
|
||||
@Create World
|
||||
</button>
|
||||
|
||||
@@ -30,6 +30,9 @@ function create_world()
|
||||
end
|
||||
|
||||
function on_open()
|
||||
document.content_btn.text = string.format(
|
||||
"%s [%s]", gui.str("Content", "menu"), #pack.get_installed()
|
||||
)
|
||||
if settings.generator == nil then
|
||||
settings.generator = core.get_default_generator()
|
||||
end
|
||||
|
||||
@@ -263,6 +263,17 @@ function table.remove_value(t, x)
|
||||
end
|
||||
end
|
||||
|
||||
function table.tostring(t)
|
||||
local s = '['
|
||||
for i,v in ipairs(t) do
|
||||
s = s..tostring(v)
|
||||
if i < #t then
|
||||
s = s..', '
|
||||
end
|
||||
end
|
||||
return s..']'
|
||||
end
|
||||
|
||||
-- Deprecated functions
|
||||
block_index = block.index
|
||||
block_name = block.name
|
||||
|
||||
Reference in New Issue
Block a user