Initial commit.
This commit is contained in:
commit
b5c753ff4d
129 changed files with 4472 additions and 0 deletions
84
mods/imhud/init.lua
Normal file
84
mods/imhud/init.lua
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
|
||||
local contexts = {}
|
||||
|
||||
imhud = {
|
||||
_contexts = contexts
|
||||
}
|
||||
|
||||
local ctx
|
||||
|
||||
-- MARK: Helpers
|
||||
|
||||
local function new_id()
|
||||
return "_imhud_"..minetest.get_us_time().."_"..math.random(1, 100000)
|
||||
end
|
||||
|
||||
-- MARK: Elements
|
||||
|
||||
local hud_image = {
|
||||
add = function()
|
||||
|
||||
end,
|
||||
update = function()
|
||||
|
||||
end,
|
||||
remove = function()
|
||||
|
||||
end
|
||||
}
|
||||
setmetatable(hud_image, {
|
||||
__call = function(_, texture)
|
||||
local e = {text = texture}
|
||||
setmetatable(e, hud_image)
|
||||
return e
|
||||
end
|
||||
})
|
||||
|
||||
-- MARK: Building
|
||||
|
||||
local HUD = {
|
||||
|
||||
}
|
||||
HUD.__index = HUD
|
||||
|
||||
function imhud.begin()
|
||||
local e = {}
|
||||
setmetatable(e, HUD)
|
||||
ctx = e
|
||||
return e
|
||||
end
|
||||
|
||||
function imhud.end_()
|
||||
|
||||
end
|
||||
|
||||
local Context = {
|
||||
|
||||
}
|
||||
Context.__index = Context
|
||||
|
||||
function imhud.add(target, hud, name)
|
||||
local ctx = {
|
||||
target = type(target) == "string" and target or target:get_player_name(),
|
||||
elems = {}
|
||||
}
|
||||
setmetatable(ctx, Context)
|
||||
contexts[name or new_id()] = ctx
|
||||
end
|
||||
|
||||
function imhud.remove(name)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
local function hud()
|
||||
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("hud", {
|
||||
func = function(name)
|
||||
imhud.add()
|
||||
end
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue