add commands to add/del member names from local protection.
This commit is contained in:
parent
b800cd2e89
commit
4b133302dc
3 changed files with 109 additions and 17 deletions
17
README.md
17
README.md
|
|
@ -62,6 +62,7 @@ Change log:
|
||||||
- 3.2 - Defaults to Minetest translation if found, otherwise intllib fallback if loaded, locale files updated for both. Added 'protector_msg' setting for player text.
|
- 3.2 - Defaults to Minetest translation if found, otherwise intllib fallback if loaded, locale files updated for both. Added 'protector_msg' setting for player text.
|
||||||
- 3.3 - Added support for playerfactions new api (thanks louisroyer), added limiter to protection radius of 22.
|
- 3.3 - Added support for playerfactions new api (thanks louisroyer), added limiter to protection radius of 22.
|
||||||
- 3.4 - Player flip and hurt functions moved to minetest.register_protection_violation function (thanks hlqkj), added 'protector_crafts' setting, changed wood doors n chests to immediate_dig for mineclone2 fix. Upped protector radius limit to 30.
|
- 3.4 - Player flip and hurt functions moved to minetest.register_protection_violation function (thanks hlqkj), added 'protector_crafts' setting, changed wood doors n chests to immediate_dig for mineclone2 fix. Upped protector radius limit to 30.
|
||||||
|
- 3.5 - Store settings in global, reduce screenshot, tweak door sounds, use node template, add name check to commands, add commands to add and remove member names, tweak & tidy code.
|
||||||
|
|
||||||
Lucky Blocks: 10
|
Lucky Blocks: 10
|
||||||
|
|
||||||
|
|
@ -76,7 +77,7 @@ remove specific user names
|
||||||
|
|
||||||
/protector_remove name1 name2
|
/protector_remove name1 name2
|
||||||
|
|
||||||
remove all names from list
|
reset names on remove list
|
||||||
|
|
||||||
/protector_remove -
|
/protector_remove -
|
||||||
|
|
||||||
|
|
@ -92,19 +93,27 @@ replace owner with new name
|
||||||
|
|
||||||
/protector_replace owner new_owner
|
/protector_replace owner new_owner
|
||||||
|
|
||||||
reset name list
|
reset names on replace list
|
||||||
|
|
||||||
/protector_replace -
|
/protector_replace -
|
||||||
|
|
||||||
|
|
||||||
show protected areas of your nearby protectors (max of 5)
|
show protected areas of your nearby protectors (max of 5)
|
||||||
|
|
||||||
/protector_show_area
|
/protector_show_area
|
||||||
|
|
||||||
|
|
||||||
A players own protection blocks can be hidden and shown using the following:
|
A players own protection blocks can be hidden and shown using the following:
|
||||||
|
|
||||||
/protector_hide
|
/protector_hide
|
||||||
/protector_show
|
/protector_show
|
||||||
|
|
||||||
|
Adding members to local protection can be done by using
|
||||||
|
|
||||||
|
/protector_add_member
|
||||||
|
|
||||||
|
Removing members from local protection can be done by using
|
||||||
|
|
||||||
|
/protector_del_member
|
||||||
|
|
||||||
|
|
||||||
The following lines can be added to your minetest.conf file to configure specific features of the mod:
|
The following lines can be added to your minetest.conf file to configure specific features of the mod:
|
||||||
|
|
||||||
|
|
|
||||||
97
init.lua
97
init.lua
|
|
@ -674,7 +674,7 @@ minetest.register_entity("protector:display", {
|
||||||
-- Display-zone node, Do NOT place the display as a node,
|
-- Display-zone node, Do NOT place the display as a node,
|
||||||
-- it is made to be used as an entity (see above)
|
-- it is made to be used as an entity (see above)
|
||||||
|
|
||||||
local x = protector.radius
|
local r = protector.radius
|
||||||
|
|
||||||
minetest.register_node("protector:display_node", {
|
minetest.register_node("protector:display_node", {
|
||||||
tiles = {"protector_display.png"},
|
tiles = {"protector_display.png"},
|
||||||
|
|
@ -684,12 +684,12 @@ minetest.register_node("protector:display_node", {
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-(x+.55), -(x+.55), -(x+.55), -(x+.45), (x+.55), (x+.55)}, -- sides
|
{-(r+.55), -(r+.55), -(r+.55), -(r+.45), (r+.55), (r+.55)}, -- sides
|
||||||
{-(x+.55), -(x+.55), (x+.45), (x+.55), (x+.55), (x+.55)},
|
{-(r+.55), -(r+.55), (r+.45), (r+.55), (r+.55), (r+.55)},
|
||||||
{(x+.45), -(x+.55), -(x+.55), (x+.55), (x+.55), (x+.55)},
|
{(r+.45), -(r+.55), -(r+.55), (r+.55), (r+.55), (r+.55)},
|
||||||
{-(x+.55), -(x+.55), -(x+.55), (x+.55), (x+.55), -(x+.45)},
|
{-(r+.55), -(r+.55), -(r+.55), (r+.55), (r+.55), -(r+.45)},
|
||||||
{-(x+.55), (x+.45), -(x+.55), (x+.55), (x+.55), (x+.55)}, -- top
|
{-(r+.55), (r+.45), -(r+.55), (r+.55), (r+.55), (r+.55)}, -- top
|
||||||
{-(x+.55), -(x+.55), -(x+.55), (x+.55), -(x+.45), (x+.55)}, -- bottom
|
{-(r+.55), -(r+.55), -(r+.55), (r+.55), -(r+.45), (r+.55)}, -- bottom
|
||||||
{-.55,-.55,-.55, .55,.55,.55} -- middle (surrounding protector)
|
{-.55,-.55,-.55, .55,.55,.55} -- middle (surrounding protector)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -722,4 +722,87 @@ if minetest.get_modpath("mesecons_mvps") then
|
||||||
mesecon.register_mvps_stopper("protector:chest")
|
mesecon.register_mvps_stopper("protector:chest")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- player command to add member names to local protection
|
||||||
|
|
||||||
|
minetest.register_chatcommand("protector_add_member", {
|
||||||
|
params = "",
|
||||||
|
description = S("Add member names to local protection"),
|
||||||
|
privs = {interact = true},
|
||||||
|
|
||||||
|
func = function(name, param)
|
||||||
|
|
||||||
|
if param == "" then return end
|
||||||
|
|
||||||
|
local to_add = param:split(" ")
|
||||||
|
local player = minetest.get_player_by_name(name)
|
||||||
|
local pos = player:get_pos()
|
||||||
|
|
||||||
|
-- find the protector nodes
|
||||||
|
local pos = minetest.find_nodes_in_area(
|
||||||
|
{x = pos.x - r, y = pos.y - r, z = pos.z - r},
|
||||||
|
{x = pos.x + r, y = pos.y + r, z = pos.z + r},
|
||||||
|
{"protector:protect", "protector:protect2", "protector:protect_hidden"})
|
||||||
|
|
||||||
|
local meta, owner
|
||||||
|
|
||||||
|
for n = 1, #pos do
|
||||||
|
|
||||||
|
meta = minetest.get_meta(pos[n])
|
||||||
|
owner = meta:get_string("owner") or ""
|
||||||
|
|
||||||
|
if owner == name
|
||||||
|
or minetest.check_player_privs(name, {protection_bypass = true}) then
|
||||||
|
|
||||||
|
for m = 1, #to_add do
|
||||||
|
add_member(meta, to_add[m])
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.add_entity(pos[n], "protector:display")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- player command to remove member names from local protection
|
||||||
|
|
||||||
|
minetest.register_chatcommand("protector_del_member", {
|
||||||
|
params = "",
|
||||||
|
description = S("Remove member names from local protection"),
|
||||||
|
privs = {interact = true},
|
||||||
|
|
||||||
|
func = function(name, param)
|
||||||
|
|
||||||
|
if param == "" then return end
|
||||||
|
|
||||||
|
local to_del = param:split(" ")
|
||||||
|
local player = minetest.get_player_by_name(name)
|
||||||
|
local pos = player:get_pos()
|
||||||
|
|
||||||
|
-- find the protector nodes
|
||||||
|
local pos = minetest.find_nodes_in_area(
|
||||||
|
{x = pos.x - r, y = pos.y - r, z = pos.z - r},
|
||||||
|
{x = pos.x + r, y = pos.y + r, z = pos.z + r},
|
||||||
|
{"protector:protect", "protector:protect2", "protector:protect_hidden"})
|
||||||
|
|
||||||
|
local meta, owner
|
||||||
|
|
||||||
|
for n = 1, #pos do
|
||||||
|
|
||||||
|
meta = minetest.get_meta(pos[n])
|
||||||
|
owner = meta:get_string("owner") or ""
|
||||||
|
|
||||||
|
if owner == name
|
||||||
|
or minetest.check_player_privs(name, {protection_bypass = true}) then
|
||||||
|
|
||||||
|
for m = 1, #to_del do
|
||||||
|
del_member(meta, to_del[m])
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.add_entity(pos[n], "protector:display")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
print ("[MOD] Protector Redo loaded")
|
print ("[MOD] Protector Redo loaded")
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
-- add lucky blocks
|
-- add lucky blocks
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
{"dro", {"protector:protect"}, 3},
|
{"dro", {"protector:protect"}, 2},
|
||||||
{"dro", {"protector:protect2"}, 3},
|
{"dro", {"protector:protect2"}, 2},
|
||||||
{"dro", {"protector:door_wood"}, 1},
|
{"dro", {"protector:door_wood"}, 2},
|
||||||
{"dro", {"protector:door_steel"}, 1},
|
{"dro", {"protector:door_steel"}, 2},
|
||||||
{"exp", 5, true},
|
{"exp", 5, true},
|
||||||
{"dro", {"protector:trapdoor"}, 1},
|
{"dro", {"protector:trapdoor"}, 2},
|
||||||
{"dro", {"protector:trapdoor_steel"}, 1},
|
{"dro", {"protector:trapdoor_steel"}, 2},
|
||||||
{"dro", {"protector:tool"}, 1},
|
{"dro", {"protector:tool"}, 1},
|
||||||
{"dro", {"protector:chest"}, 1},
|
{"dro", {"protector:chest"}, 1},
|
||||||
{"exp"}
|
{"exp"}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue