1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Various features and fixes

This commit is contained in:
sfan5 2020-04-11 00:09:11 +02:00 committed by Loïc Blot
parent 5f3a17eb65
commit 1292bdbbce
5 changed files with 123 additions and 69 deletions

View file

@ -31,6 +31,7 @@ core.after(4, function()
end)
core.after(1, function()
print("armor: " .. dump(core.localplayer:get_armor_groups()))
id = core.localplayer:hud_add({
hud_elem_type = "text",
name = "example",
@ -125,19 +126,6 @@ core.register_chatcommand("dump", {
end,
})
core.register_chatcommand("colorize_test", {
func = function(param)
return true, core.colorize("red", param)
end,
})
core.register_chatcommand("test_node", {
func = function(param)
core.display_chat_message(dump(core.get_node({x=0, y=0, z=0})))
core.display_chat_message(dump(core.get_node_or_nil({x=0, y=0, z=0})))
end,
})
local function preview_minimap()
local minimap = core.ui.minimap
if not minimap then
@ -157,7 +145,7 @@ end
core.after(2, function()
print("[PREVIEW] loaded " .. modname .. " mod")
modstorage:set_string("current_mod", modname)
print(modstorage:get_string("current_mod"))
assert(modstorage:get_string("current_mod") == modname)
preview_minimap()
end)
@ -184,30 +172,12 @@ end)
core.register_on_punchnode(function(pos, node)
print("The local player punched a node!")
local itemstack = core.get_wielded_item()
--[[
-- getters
print(dump(itemstack:is_empty()))
print(dump(itemstack:get_name()))
print(dump(itemstack:get_count()))
print(dump(itemstack:get_wear()))
print(dump(itemstack:get_meta()))
print(dump(itemstack:get_metadata()
print(dump(itemstack:is_known()))
--print(dump(itemstack:get_definition()))
print(dump(itemstack:get_tool_capabilities()))
print(dump(itemstack:to_string()))
print(dump(itemstack:to_table()))
-- setters
print(dump(itemstack:set_name("default:dirt")))
print(dump(itemstack:set_count("95")))
print(dump(itemstack:set_wear(934)))
print(dump(itemstack:get_meta()))
print(dump(itemstack:get_metadata()))
--]]
local itemstack = core.localplayer:get_wielded_item()
print(dump(itemstack:to_table()))
print("pos:" .. dump(pos))
print("node:" .. dump(node))
local meta = core.get_meta(pos)
print("punched meta: " .. (meta and dump(meta:to_table()) or "(missing)"))
return false
end)