1 local modname = core.get_current_modname() or "??"
2 local modstorage = core.get_mod_storage()
4 -- This is an example function to ensure it's working properly, should be removed before merge
5 core.register_on_shutdown(function()
6 print("[PREVIEW] shutdown client")
9 -- This is an example function to ensure it's working properly, should be removed before merge
10 core.register_on_receiving_chat_messages(function(message)
11 print("[PREVIEW] Received message " .. message)
15 -- This is an example function to ensure it's working properly, should be removed before merge
16 core.register_on_sending_chat_messages(function(message)
17 print("[PREVIEW] Sending message " .. message)
21 -- This is an example function to ensure it's working properly, should be removed before merge
22 core.register_on_hp_modification(function(hp)
23 print("[PREVIEW] HP modified " .. hp)
26 -- This is an example function to ensure it's working properly, should be removed before merge
27 core.register_on_damage_taken(function(hp)
28 print("[PREVIEW] Damage taken " .. hp)
31 -- This is an example function to ensure it's working properly, should be removed before merge
32 core.register_globalstep(function(dtime)
33 -- print("[PREVIEW] globalstep " .. dtime)
36 -- This is an example function to ensure it's working properly, should be removed before merge
37 core.register_chatcommand("dump", {
38 func = function(param)
43 core.register_chatcommand("test_node", {
44 func = function(param)
45 core.display_chat_message(dump(core.get_node({x=0, y=0, z=0})))
46 core.display_chat_message(dump(core.get_node_or_nil({x=0, y=0, z=0})))
50 local function preview_minimap()
51 local minimap = core.ui.minimap
54 minimap:set_pos({x=5, y=50, z=5})
55 minimap:toggle_shape()
57 print("[PREVIEW] Minimap: mode => " .. dump(minimap:get_mode()) ..
58 " position => " .. dump(minimap:get_pos()) ..
59 " angle => " .. dump(minimap:get_angle()))
62 core.after(2, function()
63 print("[PREVIEW] loaded " .. modname .. " mod")
65 modstorage:set_string("current_mod", modname)
66 print(modstorage:get_string("current_mod"))
69 core.register_on_dignode(function(pos, node)
70 print("The local player dug a node!")
71 print("pos:" .. dump(pos))
72 print("node:" .. dump(node))
76 core.register_on_punchnode(function(pos, node)
77 print("The local player punched a node!")
78 local itemstack = core.get_wielded_item()
81 print(dump(itemstack:is_empty()))
82 print(dump(itemstack:get_name()))
83 print(dump(itemstack:get_count()))
84 print(dump(itemstack:get_wear()))
85 print(dump(itemstack:get_meta()))
86 print(dump(itemstack:get_metadata()))
87 print(dump(itemstack:is_known()))
88 --print(dump(itemstack:get_definition()))
89 print(dump(itemstack:get_tool_capabilities()))
90 print(dump(itemstack:to_string()))
91 print(dump(itemstack:to_table()))
93 print(dump(itemstack:set_name("default:dirt")))
94 print(dump(itemstack:set_count("95")))
95 print(dump(itemstack:set_wear(934)))
96 print(dump(itemstack:get_meta()))
97 print(dump(itemstack:get_metadata()))
99 print(dump(itemstack:to_table()))
100 print("pos:" .. dump(pos))
101 print("node:" .. dump(node))