From 1292bdbbcec45613c95aff9f2ea88aa49af25011 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 11 Apr 2020 00:09:11 +0200 Subject: Various features and fixes --- clientmods/preview/init.lua | 40 +++++----------------------------------- 1 file changed, 5 insertions(+), 35 deletions(-) (limited to 'clientmods/preview') diff --git a/clientmods/preview/init.lua b/clientmods/preview/init.lua index 5777adcaf..d2440369a 100644 --- a/clientmods/preview/init.lua +++ b/clientmods/preview/init.lua @@ -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) -- cgit v1.2.3