Changed readme
[protector.git] / admin.lua
1
2 protector.removal_names = ""
3
4 minetest.register_chatcommand("delprot", {
5 params = "",
6 description = "Remove Protectors near players with names provided (separate names with spaces)",
7 privs = {server = true},
8 func = function(name, param)
9
10 if not param or param == "" then
11
12 minetest.chat_send_player(name,
13 "Protector Names to remove: "
14 .. protector.removal_names)
15
16 return
17 end
18
19 if param == "-" then
20 minetest.chat_send_player(name,
21 "Name List Reset")
22
23 protector.removal_names = ""
24
25 return
26 end
27
28 protector.removal_names = param
29
30 end,
31 })
32
33 minetest.register_abm({
34 nodenames = {"protector:protect", "protector:protect2"},
35 interval = 8,
36 chance = 1,
37 catch_up = false,
38 action = function(pos, node)
39
40 if protector.removal_names == "" then
41 return
42 end
43
44 local meta = minetest.get_meta(pos)
45 local owner = meta:get_string("owner")
46 --local members = meta:get_string("members")
47
48 local names = protector.removal_names:split(" ")
49
50 for _, n in ipairs(names) do
51
52 if n == owner then
53 minetest.set_node(pos, {name = "air"})
54 end
55
56 end
57
58 end
59 })