summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2016-08-15 21:54:35 -0700
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2016-08-15 21:54:35 -0700
commit674061e4d52d3525448784f5367bf856221e3eeb (patch)
tree0d64358f466f50dbb88e2200363d90349f55b720
parent5d228f0cda917b3d22cce43bdeebc5cf19662753 (diff)
Crude hack to kind of support all the other stuffHEADorigin/masterorigin/HEADmaster
-rw-r--r--init.lua53
1 files changed, 52 insertions, 1 deletions
diff --git a/init.lua b/init.lua
index 3371dfc..43ffdc2 100644
--- a/init.lua
+++ b/init.lua
@@ -1,7 +1,7 @@
-- This small mod transitions the protector_redo mod to the areas.
local r = 7
minetest.register_abm({
- nodenames = {"protector:protect", "protector:protect2", "protector:protect_sell"},
+ nodenames = {"protector:protect","protector:protect_sell"},
interval = 8,
chance = 1,
catch_up = false,
@@ -25,3 +25,54 @@ minetest.register_abm({
return true
end
})
+
+
+minetest.register_abm({
+ nodenames = {"protector:protect2"},
+ interval = 8,
+ chance = 1,
+ catch_up = false,
+ action = function(pos, node)
+ local meta = minetest.get_meta(pos)
+ local name = meta:get_string("owner")
+ local pos1 = {x = pos.x - r, y = pos.y - r, z = pos.z - r}
+ local pos2 = {x = pos.x + r, y = pos.y + r, z = pos.z + r}
+ if not (pos1 and pos2) then
+ return false, "You need to select an area first."
+ end
+
+ minetest.log("action", "/protect invoked, owner="..name..
+ " AreaName=".."Converted from protectors"..
+ " StartPos="..minetest.pos_to_string(pos1)..
+ " EndPos=" ..minetest.pos_to_string(pos2))
+ local id = areas:add(name, "Converted from Protectors", pos1, pos2, nil)
+ areas:save()
+ minetest.chat_send_all("Area protected. ID: "..id)
+ minetest.set_node(pos, {name = "air"})
+ return true
+ end
+})
+
+
+minetest.register_abm({
+ nodenames = {"protector:chest"},
+ interval = 8,
+ chance = 1,
+ catch_up = false,
+ action = function(pos, node)
+ minetest.set_node(pos, {name = "default:chest_locked"})
+ return true
+ end
+})
+
+minetest.register_abm({
+ nodenames = {"protector:door_wood", "protector:door_steel"},
+ interval = 8,
+ chance = 1,
+ catch_up = false,
+ action = function(pos, node)
+ minetest.set_node(pos, {name = "default:door_steel"})
+ return true
+ end
+})
+