From 40fc9e3f4f48429eaa5cf573928d7be291c82666 Mon Sep 17 00:00:00 2001 From: "0gb.us" <0gb.us@0gb.us> Date: Wed, 27 Mar 2013 23:36:43 -0700 Subject: [PATCH] Performed maintenance for ShadowNinja * Added .gitignore * Added compatibility with the IRC plugin In the process, one minetest.conf setting was renamed, and another removed altogether. Other than that, 0gb.us_game should behave exactly as before. --- .gitignore | 3 + 0gb.us_game/mods/added/build_0gb_us/chunk.lua | 3 + .../mods/added/build_0gb_us/cobble.lua | 3 + 0gb.us_game/mods/added/build_0gb_us/init.lua | 3 + .../init.lua | 103 +++++++++--------- 0gb.us_game/mods/added/drain_0gb_us/init.lua | 3 + .../mods/added/landclaim_0gb_us/commands.lua | 15 +++ .../mods/added/landclaim_0gb_us/debug.lua | 3 + .../mods/added/teleport_0gb_us/init.lua | 9 ++ 9 files changed, 92 insertions(+), 53 deletions(-) create mode 100644 .gitignore rename 0gb.us_game/mods/added/{sudo_0gb_us => chatcommands_0gb_us}/init.lua (65%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c5f9dcd --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*~ +Thumbs.db + diff --git a/0gb.us_game/mods/added/build_0gb_us/chunk.lua b/0gb.us_game/mods/added/build_0gb_us/chunk.lua index 0fa0297..d685722 100644 --- a/0gb.us_game/mods/added/build_0gb_us/chunk.lua +++ b/0gb.us_game/mods/added/build_0gb_us/chunk.lua @@ -1,6 +1,9 @@ if minetest.get_modpath("landclaim_0gb_us") then function build_0gb_us.chunk_select(name) local player = minetest.env:get_player_by_name(name) + if not player then + return + end local pos = landclaim_0gb_us.get_chunk_center(player:getpos()) if not build_0gb_us.pos[name] then build_0gb_us.pos[name] = {} diff --git a/0gb.us_game/mods/added/build_0gb_us/cobble.lua b/0gb.us_game/mods/added/build_0gb_us/cobble.lua index 49928a2..48bd7c2 100644 --- a/0gb.us_game/mods/added/build_0gb_us/cobble.lua +++ b/0gb.us_game/mods/added/build_0gb_us/cobble.lua @@ -25,6 +25,9 @@ function build_0gb_us.import_as_cobble(name, pos0, pos1, filename) local file = io.open(filename, "r") if file then local player = minetest.env:get_player_by_name(name) + if not player then + return + end local min, max = build_0gb_us.normalize(pos0, pos1) for line in file:lines() do local data = line:split(" ") diff --git a/0gb.us_game/mods/added/build_0gb_us/init.lua b/0gb.us_game/mods/added/build_0gb_us/init.lua index 1a9f1bd..725ddda 100644 --- a/0gb.us_game/mods/added/build_0gb_us/init.lua +++ b/0gb.us_game/mods/added/build_0gb_us/init.lua @@ -147,6 +147,9 @@ build_0gb_us = { local file = io.open(filename, "r") if file then local player = minetest.env:get_player_by_name(name) + if not player then + return + end local min, max = build_0gb_us.normalize(pos0, pos1) local update = {} for line in file:lines() do diff --git a/0gb.us_game/mods/added/sudo_0gb_us/init.lua b/0gb.us_game/mods/added/chatcommands_0gb_us/init.lua similarity index 65% rename from 0gb.us_game/mods/added/sudo_0gb_us/init.lua rename to 0gb.us_game/mods/added/chatcommands_0gb_us/init.lua index 8b37e74..ca8ef48 100644 --- a/0gb.us_game/mods/added/sudo_0gb_us/init.lua +++ b/0gb.us_game/mods/added/chatcommands_0gb_us/init.lua @@ -1,25 +1,9 @@ -if minetest.setting_getbool("sudo.0gb.us") then - minetest.chatcommands.sudo_grant = minetest.chatcommands.grant - minetest.chatcommands.sudo_grant.privs.sudo = true - - minetest.chatcommands.sudo_revoke = minetest.chatcommands.revoke - minetest.chatcommands.sudo_revoke.privs.sudo = true - - minetest.chatcommands.sudo_teleport = minetest.chatcommands.teleport - minetest.chatcommands.sudo_teleport.privs.sudo = true - - minetest.chatcommands.sudo_clearobjects = minetest.chatcommands.clearobjects - minetest.chatcommands.sudo_clearobjects.privs.sudo = true - - minetest.register_privilege("sudo", "Can override the safeguards placed on commands") - local privileges = minetest.setting_get("privileges.sudo.0gb.us") +local privileges = minetest.setting_get("privileges.chatcommands.0gb.us") +if privileges then local grantable = {} - if privileges then - for key, value in pairs(privileges:split(",")) do - grantable[value] = true - end + for key, value in pairs(privileges:split(",")) do + grantable[value] = true end - minetest.register_chatcommand("grant", { params = " |all", description = "Give privilege to player", @@ -105,39 +89,52 @@ if minetest.setting_getbool("sudo.0gb.us") then end end, }) - - minetest.register_chatcommand("teleport", { - params = "", - description = "teleport to given player", - privs = {teleport=true}, - func = function(name, param) - local location = minetest.env:get_player_by_name(param) - if location then - coords = location:getpos() - player = minetest.env:get_player_by_name(name) - player:setpos(coords) - minetest.chat_send_player(name, "Teleported to "..param..".") - else - minetest.chat_send_player(name, 'Player "'..param..'" not found.') - end - end, - }) - - minetest.register_chatcommand("clearobjects", { - params = "", - description = "clear all objects in loaded areas", - privs = {server=true}, - func = function(name, param) - local player = minetest.env:get_player_by_name(name) - for _, obj in pairs(minetest.env:get_objects_inside_radius({x=0,y=0,z=0}, 1000000)) do - if not obj:is_player() then - obj:punch(player,0, {}, nil) --- Do NOT replace this with obj:remove() - end - end - end, - }) end -minetest.debug("[sudo_0gb_us]: Plugin loaded from\n"..minetest.get_modpath("sudo_0gb_us")) +minetest.register_chatcommand("teleport", { + params = "", + description = "teleport to given player", + privs = {teleport=true}, + func = function(name, param) + local location = minetest.env:get_player_by_name(param) + if location then + coords = location:getpos() + player = minetest.env:get_player_by_name(name) + if not player then + return + end + player:setpos(coords) + minetest.chat_send_player(name, "Teleported to "..param..".") + else + minetest.chat_send_player(name, 'Player "'..param..'" not found.') + end + end, +}) + +minetest.chatcommands["give"] = nil +minetest.chatcommands["giveme"] = nil +minetest.chatcommands["spawnentity"] = nil + +if not minetest.get_modpath("logpulverize_0gb_us") then + minetest.chatcommands["pulverize"] = nil +end + +minetest.chatcommands["rollback"] = nil + +minetest.register_chatcommand("clearobjects", { + params = "", + description = "clear all objects in loaded areas", + privs = {server=true}, + func = function(name, param) + local player = minetest.env:get_player_by_name(name) + for _, obj in pairs(minetest.env:get_objects_inside_radius({x=0,y=0,z=0}, 1000000)) do + if not obj:is_player() then + obj:punch(player,0, {}, nil) +-- Do NOT replace this with obj:remove() + end + end + end, +}) + +minetest.debug("[chatcommands_0gb_us]: Plugin loaded from\n"..minetest.get_modpath("chatcommands_0gb_us")) diff --git a/0gb.us_game/mods/added/drain_0gb_us/init.lua b/0gb.us_game/mods/added/drain_0gb_us/init.lua index 6561b78..eb6bec8 100644 --- a/0gb.us_game/mods/added/drain_0gb_us/init.lua +++ b/0gb.us_game/mods/added/drain_0gb_us/init.lua @@ -6,6 +6,9 @@ minetest.register_chatcommand("drain", { privs = {drain=true}, func = function(name, param) local player = minetest.env:get_player_by_name(name) + if not player then + return + end local pos = player:getpos() if not landclaim_0gb_us.can_interact(name, pos) then diff --git a/0gb.us_game/mods/added/landclaim_0gb_us/commands.lua b/0gb.us_game/mods/added/landclaim_0gb_us/commands.lua index 814f9eb..ddaddde 100644 --- a/0gb.us_game/mods/added/landclaim_0gb_us/commands.lua +++ b/0gb.us_game/mods/added/landclaim_0gb_us/commands.lua @@ -29,6 +29,9 @@ minetest.register_chatcommand("claim", { privs = {interact=true}, func = function(name, param) local player = minetest.env:get_player_by_name(name) + if not player then + return + end local pos = player:getpos() pos.y = pos.y + .5 --compensated for Minetest's incorrect y coordinate for player objects local owner = landclaim_0gb_us.get_owner(pos) @@ -55,6 +58,9 @@ minetest.register_chatcommand("unclaim", { privs = {interact=true}, func = function(name, param) local player = minetest.env:get_player_by_name(name) + if not player then + return + end local pos = player:getpos() pos.y = pos.y + .5 --compensated for Minetest's incorrect y coordinate for player objects local owner = landclaim_0gb_us.get_owner(pos) @@ -84,6 +90,9 @@ minetest.register_chatcommand("sharearea", { privs = {interact=true}, func = function(name, param) local player = minetest.env:get_player_by_name(name) + if not player then + return + end local pos = player:getpos() pos.y = pos.y + .5 --compensated for Minetest's incorrect y coordinate for player objects local owner = landclaim_0gb_us.get_owner(pos) @@ -114,6 +123,9 @@ minetest.register_chatcommand("unsharearea", { privs = {interact=true}, func = function(name, param) local player = minetest.env:get_player_by_name(name) + if not player then + return + end local pos = player:getpos() pos.y = pos.y + .5 --compensated for Minetest's incorrect y coordinate for player objects local owner = landclaim_0gb_us.get_owner(pos) @@ -146,6 +158,9 @@ minetest.register_chatcommand("mayedit", { local pos = minetest.string_to_pos(param) if not pos then local player = minetest.env:get_player_by_name(name) + if not player then + return + end pos = player:getpos() pos.y = pos.y + .5 --compensated for Minetest's incorrect y coordinate for player objects end diff --git a/0gb.us_game/mods/added/landclaim_0gb_us/debug.lua b/0gb.us_game/mods/added/landclaim_0gb_us/debug.lua index 77699b6..123c0c4 100644 --- a/0gb.us_game/mods/added/landclaim_0gb_us/debug.lua +++ b/0gb.us_game/mods/added/landclaim_0gb_us/debug.lua @@ -3,6 +3,9 @@ minetest.register_chatcommand("claimdebug", { description = "debug command", privs = {interact=true}, func = function(name, param) + if not player then + return + end local player = minetest.env:get_player_by_name(name) local pos = player:getpos() pos.y = pos.y + .5 --compensated for Minetest's incorrect y coordinate for player objects diff --git a/0gb.us_game/mods/added/teleport_0gb_us/init.lua b/0gb.us_game/mods/added/teleport_0gb_us/init.lua index bd8eb7a..8a6e6d6 100644 --- a/0gb.us_game/mods/added/teleport_0gb_us/init.lua +++ b/0gb.us_game/mods/added/teleport_0gb_us/init.lua @@ -81,6 +81,9 @@ end) local function warp(name, warp) if teleport[name][warp] then local player = minetest.env:get_player_by_name(name) + if not player then + return + end player:setpos(teleport[name][warp]) minetest.chat_send_player(name, "Teleporting to "..warp) else @@ -113,6 +116,9 @@ local function setnewwarp(name, warp) points_0gb_us.add_points(name, price.ore, -price.number) points_0gb_us.save(name) local player = minetest.env:get_player_by_name(name) + if not player then + return + end teleport[name][warp] = player:getpos() save(name) minetest.chat_send_player(name, 'Warp point "'..warp..'" added at current location.') @@ -122,6 +128,9 @@ end local function setwarp(name, warp) if teleport[name][warp] then local player = minetest.env:get_player_by_name(name) + if not player then + return + end teleport[name][warp] = player:getpos() save(name) minetest.chat_send_player(name, 'Warp point "'..warp..'" moved to current location.')