Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Update Block
- function server_tools.update_node(name, param, x, y, z)
- -- variables
- local player = minetest.get_player_by_name(name) -- player name
- local item_string_type = minetest.registered_items[param].type -- item string type
- -- confirm node param
- if minetest.registered_items[param] == nil or minetest.registered_items[param] == "" then
- minetest.chat_send_player(name, "Invalid item string. Please try again.") --print to chat
- minetest.log("action", "[Server_Tools] "..name.." tried to update a node with invalid item string: "..param) --print to log
- else
- -- make sure item string is not a craftitem of tool
- if item_string_type == "tool" or item_string_type == "craftitem" then
- minetest.chat_send_player(name, "Item string cannot be a "..item_string_type) --print to chat
- minetest.log("action", "[Server_Tools] "..name.." tried to update a node to "..item_string_type) --print to log
- else
- -- confirm position params
- if x == "" or x == nil or y == "" or z == nil or z == "" or z == nil then
- -- print error to chat and log
- minetest.chat_send_player(name, "Invalid position coordinates. Please try again.") -- print to chat
- minetest.log("action", "[Server_Tools] "..name.." tried to update a node using invalid coordinates, "..x..", "..y..", "..z..".") --print to log
- else
- -- update node
- minetest.set_node(x y z, param)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement