master
crazyginger72 2014-08-05 01:27:43 -04:00
parent 36dfd11ca9
commit 04d1548efb
4 changed files with 57 additions and 46 deletions

View File

@ -5,6 +5,7 @@ minetest.register_on_newplayer(function(player)
player:get_inventory():add_item('main', 'default:axe_steel')
player:get_inventory():add_item('main', 'default:shovel_steel')
player:get_inventory():add_item('main', 'default:wood 99')
player:get_inventory():add_item('main', 'default:chest_locked 10')
--minetest.chat_send_player(name, 'You have been given tools and items to help you start playing!')
end)

View File

@ -189,7 +189,17 @@ minetest.register_tool("default:pick_admin_with_drops", {
------admin pick function-------------------------------
--------------------------------------------------------
minetest.register_privilege("admin","Your the shit now son :D")
minetest.register_on_punchnode(function(pos, node, puncher)
local plname = puncher:get_player_name()
local privs = minetest.get_player_privs(plname)
if not privs.admin then
minetest.chat_send_player(plname, "Your not an admin!!!!!")
minetest.log("action", puncher:get_player_name().." tried to use admin pick @"..minetest.pos_to_string(pos))
return
end
if puncher:get_wielded_item():get_name() == "default:pick_admin" or puncher:get_wielded_item():get_name() == "default:pick_admin_with_drops"
and minetest.env: get_node(pos).name ~= "air" then
if puncher:get_wielded_item():get_name() == "default:pick_admin" then

View File

@ -1068,7 +1068,7 @@ minetest.register_node("default:chest", {
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" takes stuff from chest at "..minetest.pos_to_string(pos))
" takes stuff from chest at "..minetest.pos_to_string(pos).."owned by "..meta:get_string("owner"))
end,
})
@ -1114,7 +1114,7 @@ minetest.register_node("default:super_chest", {
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" takes stuff from chest at "..minetest.pos_to_string(pos))
" takes stuff from chest at "..minetest.pos_to_string(pos).."owned by "..meta:get_string("owner"))
end,
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)

View File

@ -63,7 +63,7 @@ minetest.register_chatcommand("/about", {
minetest.register_chatcommand("/inspect", {
params = "on/off/1/0/true/false/yes/no/enable/disable/<blank>",
description = "Enable or disable node inspection",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
if param == "on" or param == "1" or param == "true" or param == "yes" or param == "enable" or param == "" then
worldedit.inspect[name] = true
@ -82,7 +82,7 @@ minetest.register_chatcommand("/inspect", {
minetest.register_on_punchnode(function(pos, node, puncher)
local name = puncher:get_player_name()
if worldedit.inspect[name] then
if minetest.check_player_privs(name, {worldedit=true}) then
if minetest.check_player_privs(name, {admin=true}) then
local axis, sign = worldedit.player_axis(name)
message = string.format("inspector: %s at %s (param1=%d, param2=%d) punched by %s facing the %s axis",
node.name, minetest.pos_to_string(pos), node.param1, node.param2, name, axis .. (sign > 0 and "+" or "-"))
@ -96,7 +96,7 @@ end)
minetest.register_chatcommand("/reset", {
params = "",
description = "Reset the region so that it is empty",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
worldedit.pos1[name] = nil
worldedit.pos2[name] = nil
@ -110,7 +110,7 @@ minetest.register_chatcommand("/reset", {
minetest.register_chatcommand("/mark", {
params = "",
description = "Show markers at the region positions",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
worldedit.mark_pos1(name)
worldedit.mark_pos2(name)
@ -121,7 +121,7 @@ minetest.register_chatcommand("/mark", {
minetest.register_chatcommand("/unmark", {
params = "",
description = "Hide markers if currently shown",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
worldedit.pos1[name] = nil
@ -137,7 +137,7 @@ minetest.register_chatcommand("/unmark", {
minetest.register_chatcommand("/pos1", {
params = "",
description = "Set WorldEdit region position 1 to the player's location",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos = minetest.get_player_by_name(name):getpos()
pos.x, pos.y, pos.z = math.floor(pos.x + 0.5), math.floor(pos.y + 0.5), math.floor(pos.z + 0.5)
@ -150,7 +150,7 @@ minetest.register_chatcommand("/pos1", {
minetest.register_chatcommand("/pos2", {
params = "",
description = "Set WorldEdit region position 2 to the player's location",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos = minetest.get_player_by_name(name):getpos()
pos.x, pos.y, pos.z = math.floor(pos.x + 0.5), math.floor(pos.y + 0.5), math.floor(pos.z + 0.5)
@ -163,7 +163,7 @@ minetest.register_chatcommand("/pos2", {
minetest.register_chatcommand("/p", {
params = "set/set1/set2/get",
description = "Set WorldEdit region, WorldEdit position 1, or WorldEdit position 2 by punching nodes, or display the current WorldEdit region",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
if param == "set" then --set both WorldEdit positions
worldedit.set_pos[name] = "pos1"
@ -194,7 +194,7 @@ minetest.register_chatcommand("/p", {
minetest.register_chatcommand("/fixedpos", {
params = "set1/set2 x y z",
description = "Set a WorldEdit region position to the position at (<x>, <y>, <z>)",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local found, _, flag, x, y, z = param:find("^(set[12])%s+([+-]?%d+)%s+([+-]?%d+)%s+([+-]?%d+)$")
if found == nil then
@ -242,7 +242,7 @@ end)
minetest.register_chatcommand("/volume", {
params = "",
description = "Display the volume of the current WorldEdit region",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then
@ -262,7 +262,7 @@ minetest.register_chatcommand("/volume", {
minetest.register_chatcommand("/set", {
params = "<node>",
description = "Set the current WorldEdit region to <node>",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then
@ -284,7 +284,7 @@ minetest.register_chatcommand("/set", {
minetest.register_chatcommand("/replace", {
params = "<search node> <replace node>",
description = "Replace all instances of <search node> with <replace node> in the current WorldEdit region",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then
@ -316,7 +316,7 @@ minetest.register_chatcommand("/replace", {
minetest.register_chatcommand("/replaceinverse", {
params = "<search node> <replace node>",
description = "Replace all nodes other than <search node> with <replace node> in the current WorldEdit region",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then
@ -348,7 +348,7 @@ minetest.register_chatcommand("/replaceinverse", {
minetest.register_chatcommand("/hollowsphere", {
params = "<radius> <node>",
description = "Add hollow sphere centered at WorldEdit position 1 with radius <radius>, composed of <node>",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos = worldedit.pos1[name]
if pos == nil then
@ -375,7 +375,7 @@ minetest.register_chatcommand("/hollowsphere", {
minetest.register_chatcommand("/sphere", {
params = "<radius> <node>",
description = "Add sphere centered at WorldEdit position 1 with radius <radius>, composed of <node>",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos = worldedit.pos1[name]
if pos == nil then
@ -402,7 +402,7 @@ minetest.register_chatcommand("/sphere", {
minetest.register_chatcommand("/hollowdome", {
params = "<radius> <node>",
description = "Add hollow dome centered at WorldEdit position 1 with radius <radius>, composed of <node>",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos = worldedit.pos1[name]
if pos == nil then
@ -429,7 +429,7 @@ minetest.register_chatcommand("/hollowdome", {
minetest.register_chatcommand("/dome", {
params = "<radius> <node>",
description = "Add dome centered at WorldEdit position 1 with radius <radius>, composed of <node>",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos = worldedit.pos1[name]
if pos == nil then
@ -456,7 +456,7 @@ minetest.register_chatcommand("/dome", {
minetest.register_chatcommand("/hollowcylinder", {
params = "x/y/z/? <length> <radius> <node>",
description = "Add hollow cylinder at WorldEdit position 1 along the x/y/z/? axis with length <length> and radius <radius>, composed of <node>",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos = worldedit.pos1[name]
if pos == nil then
@ -488,7 +488,7 @@ minetest.register_chatcommand("/hollowcylinder", {
minetest.register_chatcommand("/cylinder", {
params = "x/y/z/? <length> <radius> <node>",
description = "Add cylinder at WorldEdit position 1 along the x/y/z/? axis with length <length> and radius <radius>, composed of <node>",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos = worldedit.pos1[name]
if pos == nil then
@ -520,7 +520,7 @@ minetest.register_chatcommand("/cylinder", {
minetest.register_chatcommand("/pyramid", {
params = "x/y/z/? <height> <node>",
description = "Add pyramid centered at WorldEdit position 1 along the x/y/z/? axis with height <height>, composed of <node>",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos = worldedit.pos1[name]
if pos == nil then
@ -552,7 +552,7 @@ minetest.register_chatcommand("/pyramid", {
minetest.register_chatcommand("/spiral", {
params = "<length> <height> <space> <node>",
description = "Add spiral centered at WorldEdit position 1 with side length <length>, height <height>, space between walls <space>, composed of <node>",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos = worldedit.pos1[name]
if pos == nil then
@ -579,7 +579,7 @@ minetest.register_chatcommand("/spiral", {
minetest.register_chatcommand("/copy", {
params = "x/y/z/? <amount>",
description = "Copy the current WorldEdit region along the x/y/z/? axis by <amount> nodes",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then
@ -606,7 +606,7 @@ minetest.register_chatcommand("/copy", {
minetest.register_chatcommand("/move", {
params = "x/y/z/? <amount>",
description = "Move the current WorldEdit region along the x/y/z/? axis by <amount> nodes",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then
@ -638,7 +638,7 @@ minetest.register_chatcommand("/move", {
minetest.register_chatcommand("/stack", {
params = "x/y/z/? <count>",
description = "Stack the current WorldEdit region along the x/y/z/? axis <count> times",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then
@ -665,7 +665,7 @@ minetest.register_chatcommand("/stack", {
minetest.register_chatcommand("/stretch", {
params = "<stretchx> <stretchy> <stretchz>",
description = "Scale the current WorldEdit positions and region by a factor of <stretchx>, <stretchy>, <stretchz> along the X, Y, and Z axes, repectively, with position 1 as the origin",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then
@ -698,7 +698,7 @@ minetest.register_chatcommand("/stretch", {
minetest.register_chatcommand("/transpose", {
params = "x/y/z/? x/y/z/?",
description = "Transpose the current WorldEdit region along the x/y/z/? and x/y/z/? axes",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then
@ -737,7 +737,7 @@ minetest.register_chatcommand("/transpose", {
minetest.register_chatcommand("/flip", {
params = "x/y/z/?",
description = "Flip the current WorldEdit region along the x/y/z/? axis",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then
@ -761,7 +761,7 @@ minetest.register_chatcommand("/flip", {
minetest.register_chatcommand("/rotate", {
params = "<axis> <angle>",
description = "Rotate the current WorldEdit region around the axis <axis> by angle <angle> (90 degree increment)",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then
@ -797,7 +797,7 @@ minetest.register_chatcommand("/rotate", {
minetest.register_chatcommand("/orient", {
params = "<angle>",
description = "Rotate oriented nodes in the current WorldEdit region around the Y axis by angle <angle> (90 degree increment)",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then
@ -824,7 +824,7 @@ minetest.register_chatcommand("/orient", {
minetest.register_chatcommand("/fixlight", {
params = "",
description = "Fix the lighting in the current WorldEdit region",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then
@ -840,7 +840,7 @@ minetest.register_chatcommand("/fixlight", {
minetest.register_chatcommand("/hide", {
params = "",
description = "Hide all nodes in the current WorldEdit region non-destructively",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then
@ -856,7 +856,7 @@ minetest.register_chatcommand("/hide", {
minetest.register_chatcommand("/suppress", {
params = "<node>",
description = "Suppress all <node> in the current WorldEdit region non-destructively",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then
@ -878,7 +878,7 @@ minetest.register_chatcommand("/suppress", {
minetest.register_chatcommand("/highlight", {
params = "<node>",
description = "Highlight <node> in the current WorldEdit region by hiding everything else non-destructively",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then
@ -900,7 +900,7 @@ minetest.register_chatcommand("/highlight", {
minetest.register_chatcommand("/restore", {
params = "",
description = "Restores nodes hidden with WorldEdit in the current WorldEdit region",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then
@ -916,7 +916,7 @@ minetest.register_chatcommand("/restore", {
minetest.register_chatcommand("/save", {
params = "<file>",
description = "Save the current WorldEdit region to \"(world folder)/schems/<file>.we\"",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then
@ -954,7 +954,7 @@ minetest.register_chatcommand("/save", {
minetest.register_chatcommand("/allocate", {
params = "<file>",
description = "Set the region defined by nodes from \"(world folder)/schems/<file>.we\" as the current WorldEdit region",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1 = worldedit.pos1[name]
if pos1 == nil then
@ -998,7 +998,7 @@ minetest.register_chatcommand("/allocate", {
minetest.register_chatcommand("/load", {
params = "<file>",
description = "Load nodes from \"(world folder)/schems/<file>[.we[m]]\" with position 1 of the current WorldEdit region as the origin",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1 = worldedit.pos1[name]
if pos1 == nil then
@ -1049,7 +1049,7 @@ minetest.register_chatcommand("/load", {
minetest.register_chatcommand("/load", {
params = "<file>",
description = "Load nodes from the included schematics with position 1 of the current WorldEdit region as the origin",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1 = worldedit.pos1[name]
if pos1 == nil then
@ -1100,7 +1100,7 @@ minetest.register_chatcommand("/load", {
minetest.register_chatcommand("/lua", {
params = "<code>",
description = "Executes <code> as a Lua chunk in the global namespace",
privs = {worldedit=true, server=true},
privs = {admin=true, server=true},
func = function(name, param)
local admin = minetest.setting_get("name")
if not admin or not name == admin then
@ -1120,7 +1120,7 @@ minetest.register_chatcommand("/lua", {
minetest.register_chatcommand("/luatransform", {
params = "<code>",
description = "Executes <code> as a Lua chunk in the global namespace with the variable pos available, for each node in the current WorldEdit region",
privs = {worldedit=true, server=true},
privs = {admin=true, server=true},
func = function(name, param)
local admin = minetest.setting_get("name")
if not admin or not name == admin then
@ -1147,7 +1147,7 @@ if minetest.place_schematic then
minetest.register_chatcommand("/mtschemcreate", {
params = "<file>",
description = "Save the current WorldEdit region using the Minetest Schematic format to \"(world folder)/schems/<filename>.mts\"",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then
@ -1176,7 +1176,7 @@ minetest.register_chatcommand("/mtschemcreate", {
minetest.register_chatcommand("/mtschemplace", {
params = "<file>",
description = "Load nodes from \"(world folder)/schems/<file>.mts\" with position 1 of the current WorldEdit region as the origin",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos = worldedit.pos1[name]
if pos == nil then
@ -1201,7 +1201,7 @@ minetest.register_chatcommand("/mtschemplace", {
minetest.register_chatcommand("/mtschemprob", {
params = "start/finish/get",
description = "Begins node probability entry for Minetest schematics, gets the nodes that have probabilities set, or ends node probability entry",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
if param == "start" then --start probability setting
worldedit.set_pos[name] = "prob"
@ -1243,7 +1243,7 @@ end
minetest.register_chatcommand("/clearobjects", {
params = "",
description = "Clears all objects within the WorldEdit region",
privs = {worldedit=true},
privs = {admin=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then