Add copper, and the beginnings of a machine system.
This commit is contained in:
parent
30ba6e5385
commit
1e897665bb
69 changed files with 976 additions and 135 deletions
72
mods/rgt_achievements/init.lua
Normal file
72
mods/rgt_achievements/init.lua
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
local ns = rgt
|
||||
|
||||
local achievements = {}
|
||||
ns.achievements = achievements
|
||||
local root_achievements = {}
|
||||
|
||||
function ns.register_achievement(def)
|
||||
if not def.label then
|
||||
def.label = def.name:gsub("_", " "):gsub("%s%a", function(a) return " "..string.upper(a) end)
|
||||
end
|
||||
if not def.depends then
|
||||
table.insert(root_achievements, def.name)
|
||||
def.depends = {}
|
||||
end
|
||||
achievements[def.name] = def
|
||||
end
|
||||
|
||||
minetest.register_on_mods_loaded(function()
|
||||
table.sort(root_achievements)
|
||||
for id, def in pairs(achievements) do
|
||||
for _, dep in ipairs(def.depends) do
|
||||
local d_def = achievements[dep]
|
||||
if not d_def.children then d_def.children = {} end
|
||||
if d_def then
|
||||
table.insert(d_def.children, id)
|
||||
else
|
||||
minetest.log("error", "[rgt_achievements] Missing dependency '"..dep.."' for '"..id.."'")
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
|
||||
function ns.show_achievements(name)
|
||||
local fs = [[
|
||||
formspec_version[10]
|
||||
size[12.5,10.5]
|
||||
scroll_container[0.25,0.25;12,11;blah;horizontal;;]
|
||||
scroll_container[0.25,0.25;12,10;blah2;vertical;;]
|
||||
]]
|
||||
|
||||
for i, x in ipairs(root_achievements) do
|
||||
fs = fs.."image[0,"..(i *0.5)..";0.25,0.25;rgt_stone.png]"
|
||||
end
|
||||
|
||||
fs = fs..[[
|
||||
scroll_container_end[]
|
||||
scroll_container_end[]
|
||||
scrollbaroptions[min=0;max=256]
|
||||
scrollbar[0,0;-800,0;horizontal;blah;]
|
||||
scrollbar[0,0;-800,0;vertical;blah2;]
|
||||
]]
|
||||
|
||||
minetest.show_formspec(name, "achievements", fs)
|
||||
end
|
||||
|
||||
|
||||
|
||||
ns.register_achievement {
|
||||
name = "survival",
|
||||
}
|
||||
|
||||
ns.register_achievement {
|
||||
name = "machines",
|
||||
}
|
||||
|
||||
minetest.register_chatcommand("a", {
|
||||
func = function(name)
|
||||
ns.show_achievements(name)
|
||||
end
|
||||
})
|
||||
2
mods/rgt_achievements/mod.conf
Normal file
2
mods/rgt_achievements/mod.conf
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
name = rgt_achievements
|
||||
depnds = rgt_ui, rgt_base
|
||||
Loading…
Add table
Add a link
Reference in a new issue