New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lua HUD #612
Lua HUD #612
Conversation
Some documentation would be nice. |
Yea, description is definetly needed here. |
Well, I used this to test the hud out: minetest.register_craftitem("test:test", {
inventory_image = "default_tool_steelaxe.png",
on_place = function(itemstack, placer, pointer)
local id1 = placer:hud_add(id1,
{type="I", text="default_tool_steelaxe.png",
position={x=0.5, y=0.5}, scale={x=5, y=5}})
local id2 = placer:hud_add(id2, {type="T", text="HELLO!",
scale={x=100, y=100}, position={x=0.5, y=0.25}})
local id3 = placer:hud_lock_next_bar()
placer:hud_change(id3, 3, "default_tool_steelaxe.png")
placer:hud_change(id3, 4, 5)
local id4 = placer:hud_add(id4, {type="i", text="main", number=5, item=2,
dir=2, position={x=0.25, y=0.5}})
minetest.after(1, function()
dump2(placer:hud_get(id1))
placer:hud_unlock_bar(id3)
placer:hud_rm(id1)
placer:hud_rm(id2)
placer:hud_rm(id3)
placer:hud_rm(id4)
end)
return itemstack
end,
}) For documentation, the players now have two extra methods: hud_add and hud_rm. The first arg of both of these is a string for identification. hud_add's second arg specifies the "drawform", a simple string specifying the type and specs of an object on the screen. Examples can be seen in above. |
Can you add documentation to doc/lua-api.txt? |
👍 This would be really great (if it works, haven't tested, but I guess it does) |
There's a typo on the third changed line - "completely". You might want to squash the commits too. Having Lua HUDs is pretty awesome, I can see a ton of potential uses for it. |
"but have a comletely different syntax. This may be changed later on." |
Arrrg. Pirates are baad spelllers. :) Anyway, if you like, I can rewrite the code to use the formspec syntax. |
I think you can keep this one, but don't say "it might be changed later"... Wait for PilzAdam's answer though ;) |
This comes rather out of the blue. We havent discussed it at the IRC or anything else. |
+1 hope it gets added |
Please make sure to have some kind of mechanism handling minetests possibilities: having a lot of mods. |
http://irc.minetest.ru/minetest-dev/2013-04-09#i_3004477 I'm adding this feature, but only so far for statbars. Maybe more will come soon. Moreover, this would prevent you from overlaying, e.g. some text over an image. A real estate request feature would be nice, but it would not be automatic. |
No description provided.