Advertisement
Guest User

csm mod

a guest
Feb 5th, 2021
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. --Find node part
  2. minetest.register_chatcommand("findnode", {
  3.     params = "<node>",
  4.     description = "Search for nodes in radius 100",
  5.     func = function(name, param)
  6.         local player = minetest.localplayer
  7.         if not player and not minetest.localplayer then
  8.             return
  9.         end
  10.         local pos = player:get_pos()
  11.        
  12.         local node_name = param
  13.         local node_pos = minetest.find_node_near(pos, 100, node_name, true)
  14.         if not isBlank(node_pos) then
  15.             if not disabled_message then
  16.                 minetest.display_chat_message("Node found at: " .. dump(node_pos))
  17.             else
  18.                 huds["findnode"] = player:hud_add({
  19.                     hud_elem_type = "text",
  20.                     position = {x = 0.5, y = 0},
  21.                     offset = {x = -180, y = 0},
  22.                     text = dump(node_pos),
  23.                     alignment = 0,
  24.                     scale = {x = 50, y = 10},
  25.                     number = 0xFFFFFF,
  26.                 })
  27.                 minetest.after(6, function()
  28.                     player:hud_remove(huds["findnode"])
  29.                 end)
  30.             end
  31.         else
  32.             if not disabled_message then
  33.                 minetest.display_chat_message("Node NOT found.")
  34.             end
  35.         end
  36.     end,
  37. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement