diff options
author | the lemons <citrons@mondecitronne.com> | 2022-02-12 20:23:19 -0600 |
---|---|---|
committer | the lemons <citrons@mondecitronne.com> | 2022-02-12 20:23:19 -0600 |
commit | 33881de2abe4fafaee665d4ae218457a1b111d01 (patch) | |
tree | 5595fa9517304e1d5c66f86364b906cea2705a92 | |
parent | bbd687ab8eb1d19177bcd2e46beb9cc1449bd03e (diff) |
debug commands
-rw-r--r-- | mods/vzxv/commands.lua | 23 | ||||
-rw-r--r-- | mods/vzxv/init.lua | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/mods/vzxv/commands.lua b/mods/vzxv/commands.lua new file mode 100644 index 0000000..e39827a --- /dev/null +++ b/mods/vzxv/commands.lua @@ -0,0 +1,23 @@ + +minetest.register_chatcommand("drop", { + params = "<item>", + privs = {debug = true}, + func = function(name, tile) + local p = minetest.get_player_by_name(name) + vzxv.drop(p:get_pos(), ItemStack(tile)) + return true, "dropped "..tile + end, +}) + +minetest.register_chatcommand("node", { + params = "<node>", + privs = {debug = true}, + func = function(name, node) + if not node then return end + local p = minetest.get_player_by_name(name) + pos = p:get_pos() + local ok, err = pcall(minetest.add_node, pos, {name = node}) + if not ok then return false, err end + return true, "placed node at your location" + end, +}) diff --git a/mods/vzxv/init.lua b/mods/vzxv/init.lua index 626c583..98795c5 100644 --- a/mods/vzxv/init.lua +++ b/mods/vzxv/init.lua @@ -38,4 +38,5 @@ end vzxv.include("nodes.lua") vzxv.include("tools.lua") vzxv.include("abms.lua") +vzxv.include("commands.lua") |