Initial commit

This commit is contained in:
2026-07-07 13:12:56 -04:00
parent cfbf56ef38
commit 31f92fba9c
21 changed files with 3009 additions and 2988 deletions
+152 -152
View File
@@ -1,152 +1,152 @@
Protector Redo mod [protect]
Protector redo for minetest is a mod that protects a players builds by placing
a block that stops other players from digging or placing blocks in that area.
based on glomie's mod, remade by Zeg9 and rewritten by TenPlus1.
https://forum.minetest.net/viewtopic.php?f=11&t=9376
Change log:
- 0.1 - Initial release
- 0.2 - Texture update
- 0.3 - Added Protection Logo to blend in with player builds
- 0.4 - Code tweak for 0.4.10+
- 0.5 - Added protector.radius variable in init.lua (default: 5)
- 0.6 - Added Protected Doors (wood and steel) and Protected Chest
- 0.7 - Protected Chests now have "To Chest" and "To Inventory" buttons to copy
contents across, also chests can be named
- 0.8 - Updated to work with Minetest 0.4.12, simplified textures
- 0.9 - Tweaked code
- 1.0 - Only owner can remove protector
- 1.1 - Set 'protector_pvp = true' in minetest.conf to disable pvp in protected
areas except your own, also setting protector_pvp_spawn higher than 0 will
disable pvp around spawn area with the radius you entered
- 1.2 - Shift and click support added with Minetest 0.4.13 to quickly copy stacks
to and from protected chest
- 1.3 - Moved protector on_place into node itself, protector zone display changed
from 10 to 5 seconds, general code tidy
- 1.4 - Changed protector recipes to give single item instead of 4, added + button
to interface, tweaked and tidied code, added admin command /delprot to remove
protectors in bulk from banned/old players
- 1.5 - Added much requested protected trapdoor
- 1.6 - Added protector_drop (true or false) and protector_hurt (hurt by this num)
variables to minetest.conf settings to stop players breaking protected
areas by dropping tools and hurting player.
- 1.7 - Included an edited version of WTFPL doors mod since protected doors didn't
work with the doors mod in the latest daily build... Now it's fine :)
added support for "protection_bypass" privelage.
- 1.8 - Added 'protector_flip' setting to stop players using lag to grief into
another players house, it flips them around to stop them digging.
- 1.9 - Renamed 'protector_pvp_spawn' setting to 'protector_spawn' which protects
an area around static spawnpoint and disables pvp if active.
(note: previous name can still be used)
- 2.0 - Added protector placement tool (thanks to Shara) so that players can easily
stand on a protector, face in a direction and it places a new one at a set
distance to cover protection radius. Added /protector_show command (thanks agaran)
Protectors and chest cannot be moved by mesecon pistons or machines.
- 2.1 - Added 'protector_night_pvp' setting so night-time becomes a free for all and
players can hurt one another even inside protected areas (not spawn protected)
- 2.2 - Updated protector tool so that player only needs to stand nearby (2 block radius)
It can also place vertically (up and down) as well. New protector recipe added.
- 2.3 - Localise many of the protector functions and tidy code.
- 2.4 - Update to newer functions, Minetest 0.4.16 needed to run now.
- 2.5 - Added HUD text to show when player is inside a protected area (updates every 5 seconds)
- 2.6 - Add protection against CSM tampering, updated Intllib support (thanks codexp), tweaked block textures
- 2.7 - Remove protection field entity when protector has been dug
- 2.8 - Added 'protector_show_interval' setting to minetest.conf [default is 5], make protection field glow in dark.
- 2.9 - Added MineClone2 recipes for protection block but no official support as yet
- 3.0 - Added PlayerFactions support, 'protector_hud_interval' setting and listing in advanced settings for mod values.
- 3.1 - Ability to hide protection blocks using /protector_hide and /protector_show , italian local added (thanks Hamlet)
- 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.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
Usage: (requires server privelage)
list names to remove
/protector_remove
remove specific user names
/protector_remove name1 name2
reset names on remove list
/protector_remove -
Whenever a player is near any protectors with name1 or name2 then it will be
replaced by an air block.
show owner name to replace
/protector_replace
replace owner with new name
/protector_replace owner new_owner
reset names on replace list
/protector_replace -
show protected areas of your nearby protectors (max of 5)
/protector_show_area
A players own protection blocks can be hidden and shown using the following:
/protector_hide
/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:
protector_radius = 5
- Sets the area around each protection node so that other players cannot dig, place or enter through protected doors or chests.
protector_pvp = true
- true or false this setting disabled pvp inside of protected areas for all players apart from those listed on the protector node.
protector_night_pvp = false
- when true this setting enables pvp at night time only, even inside protected areas, requires protector_pvp to be active to work.
protector_spawn = 10
- Sets an area 10 nodes around static spawnpoint that is protected.
protector_hurt = 2
- When set to above 0, players digging in protected areas will be hurt by 2 health points (or whichever number it's set to)
protector_flip = true
- When true players who dig inside a protected area will flipped around to stop them using lag to grief into someone else's build
protector_show_interval
- Number of seconds the protection field is visible, defaults to 5 seconds.
protector_recipe = true
- When true allows players to craft protection blocks
protector_msg = true
- When true shows protection messages in players chat when trying to interact in someone else's area
Protector Tool
Can be crafted with a protector surrounded by steel ingots and is used to place new protectors at a set distance of protector.radius in all directions including up and down simply by looking in a direction.
Use by standing near an existing protector, looking in a direction and using as a tool, hold sneak/shift to place new protector containing member list from inside nearest one.
Protector Redo mod [protect]
Protector redo for minetest is a mod that protects a players builds by placing
a block that stops other players from digging or placing blocks in that area.
based on glomie's mod, remade by Zeg9 and rewritten by TenPlus1.
https://forum.minetest.net/viewtopic.php?f=11&t=9376
Change log:
- 0.1 - Initial release
- 0.2 - Texture update
- 0.3 - Added Protection Logo to blend in with player builds
- 0.4 - Code tweak for 0.4.10+
- 0.5 - Added protector.radius variable in init.lua (default: 5)
- 0.6 - Added Protected Doors (wood and steel) and Protected Chest
- 0.7 - Protected Chests now have "To Chest" and "To Inventory" buttons to copy
contents across, also chests can be named
- 0.8 - Updated to work with Minetest 0.4.12, simplified textures
- 0.9 - Tweaked code
- 1.0 - Only owner can remove protector
- 1.1 - Set 'protector_pvp = true' in minetest.conf to disable pvp in protected
areas except your own, also setting protector_pvp_spawn higher than 0 will
disable pvp around spawn area with the radius you entered
- 1.2 - Shift and click support added with Minetest 0.4.13 to quickly copy stacks
to and from protected chest
- 1.3 - Moved protector on_place into node itself, protector zone display changed
from 10 to 5 seconds, general code tidy
- 1.4 - Changed protector recipes to give single item instead of 4, added + button
to interface, tweaked and tidied code, added admin command /delprot to remove
protectors in bulk from banned/old players
- 1.5 - Added much requested protected trapdoor
- 1.6 - Added protector_drop (true or false) and protector_hurt (hurt by this num)
variables to minetest.conf settings to stop players breaking protected
areas by dropping tools and hurting player.
- 1.7 - Included an edited version of WTFPL doors mod since protected doors didn't
work with the doors mod in the latest daily build... Now it's fine :)
added support for "protection_bypass" privelage.
- 1.8 - Added 'protector_flip' setting to stop players using lag to grief into
another players house, it flips them around to stop them digging.
- 1.9 - Renamed 'protector_pvp_spawn' setting to 'protector_spawn' which protects
an area around static spawnpoint and disables pvp if active.
(note: previous name can still be used)
- 2.0 - Added protector placement tool (thanks to Shara) so that players can easily
stand on a protector, face in a direction and it places a new one at a set
distance to cover protection radius. Added /protector_show command (thanks agaran)
Protectors and chest cannot be moved by mesecon pistons or machines.
- 2.1 - Added 'protector_night_pvp' setting so night-time becomes a free for all and
players can hurt one another even inside protected areas (not spawn protected)
- 2.2 - Updated protector tool so that player only needs to stand nearby (2 block radius)
It can also place vertically (up and down) as well. New protector recipe added.
- 2.3 - Localise many of the protector functions and tidy code.
- 2.4 - Update to newer functions, Minetest 0.4.16 needed to run now.
- 2.5 - Added HUD text to show when player is inside a protected area (updates every 5 seconds)
- 2.6 - Add protection against CSM tampering, updated Intllib support (thanks codexp), tweaked block textures
- 2.7 - Remove protection field entity when protector has been dug
- 2.8 - Added 'protector_show_interval' setting to minetest.conf [default is 5], make protection field glow in dark.
- 2.9 - Added MineClone2 recipes for protection block but no official support as yet
- 3.0 - Added PlayerFactions support, 'protector_hud_interval' setting and listing in advanced settings for mod values.
- 3.1 - Ability to hide protection blocks using /protector_hide and /protector_show , italian local added (thanks Hamlet)
- 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.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
Usage: (requires server privelage)
list names to remove
/protector_remove
remove specific user names
/protector_remove name1 name2
reset names on remove list
/protector_remove -
Whenever a player is near any protectors with name1 or name2 then it will be
replaced by an air block.
show owner name to replace
/protector_replace
replace owner with new name
/protector_replace owner new_owner
reset names on replace list
/protector_replace -
show protected areas of your nearby protectors (max of 5)
/protector_show_area
A players own protection blocks can be hidden and shown using the following:
/protector_hide
/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:
protector_length = 15
- Sets the area around each protection node so that other players cannot dig, place or enter through protected doors or chests.
protector_pvp = true
- true or false this setting disabled pvp inside of protected areas for all players apart from those listed on the protector node.
protector_night_pvp = false
- when true this setting enables pvp at night time only, even inside protected areas, requires protector_pvp to be active to work.
protector_spawn = 10
- Sets an area 10 nodes around static spawnpoint that is protected.
protector_hurt = 2
- When set to above 0, players digging in protected areas will be hurt by 2 health points (or whichever number it's set to)
protector_flip = true
- When true players who dig inside a protected area will flipped around to stop them using lag to grief into someone else's build
protector_show_interval
- Number of seconds the protection field is visible, defaults to 5 seconds.
protector_recipe = true
- When true allows players to craft protection blocks
protector_msg = true
- When true shows protection messages in players chat when trying to interact in someone else's area
Protector Tool
Can be crafted with a protector surrounded by steel ingots and is used to place new protectors at a set distance of protector.radius in all directions including up and down simply by looking in a direction.
Use by standing near an existing protector, looking in a direction and using as a tool, hold sneak/shift to place new protector containing member list from inside nearest one.
+249 -249
View File
@@ -1,249 +1,249 @@
-- translation and default name vars
local S = core.get_translator("protector")
local removal_names = ""
local replace_names = ""
-- remove protection command
core.register_chatcommand("protector_remove", {
params = S("<names list>"),
description = S("Remove Protectors around players (separate names with spaces)"),
privs = {server = true},
func = function(name, param)
if param == "-" then
core.chat_send_player(name, S("Name List Reset"))
removal_names = "" ; return
end
if param ~= "" then
removal_names = param
end
core.chat_send_player(name,
S("Protector Names to remove: @1", removal_names))
end
})
-- replace protection command
core.register_chatcommand("protector_replace", {
params = S("<owner name> <name to replace with>"),
description = S("Replace Protector Owner with name provided"),
privs = {server = true},
func = function(name, param)
-- reset list to empty
if param == "-" then
core.chat_send_player(name, S("Name List Reset"))
replace_names = "" ; return
end
-- check and set replacement name
if param ~= "" then
local names = param:split(" ") ; if not names[2] then return end
if names[2] ~= string.match(names[2], "[%w_-]+") then
core.chat_send_player(name, S("Invalid player name!")) ; return
end
if names[2]:len() > 25 then
core.chat_send_player(name, S("Player name too long")) ; return
end
replace_names = param
end
-- show name info
if replace_names ~= "" then
local names = replace_names:split(" ")
core.chat_send_player(name, S("Replacing Protector name @1 with @2",
names[1] or "", names[2] or ""))
end
end
})
-- Abm to remove or replace protectors within active player area
core.register_abm({
nodenames = {"protector:protect", "protector:protect2", "protector:protect_hidden"},
interval = 5,
chance = 1,
catch_up = false,
action = function(pos, node)
if removal_names == "" and replace_names == "" then return end
local meta = core.get_meta(pos) ; if not meta then return end
local owner = meta:get_string("owner")
if removal_names ~= "" then
local names = removal_names:split(" ")
for _, n in pairs(names) do
if n == owner then
core.set_node(pos, {name = "air"}) ; return
end
end
end
if replace_names ~= "" then
local names = replace_names:split(" ")
if names[1] and names[2] and owner == names[1] then
meta:set_string("owner", names[2])
meta:set_string("infotext", S("Protection (owned by @1)", names[2]))
end
end
end
})
-- show protection areas of nearby protectors owned by you (thanks agaran)
local r = protector.radius
core.register_chatcommand("protector_show_area", {
params = "",
description = S("Show protected areas of your nearby protectors"),
privs = {},
func = function(name, param)
local player = core.get_player_by_name(name)
local pos = player:get_pos()
-- find the protector nodes
local pos = core.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
-- show a maximum of 5 protected areas only
for n = 1, math.min(#pos, 5) do
meta = core.get_meta(pos[n])
owner = meta:get_string("owner") or ""
if owner == name
or core.check_player_privs(name, {protection_bypass = true}) then
core.add_entity(pos[n], "protector:display")
end
end
end
})
-- ability to hide protection blocks (borrowed from doors mod :)
core.register_node("protector:protect_hidden", {
description = "Hidden Protector",
drawtype = "airlike",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
-- has to be walkable for falling nodes to stop falling
walkable = true,
pointable = false,
diggable = false,
buildable_to = false,
floodable = false,
drop = "",
groups = {not_in_creative_inventory = 1, unbreakable = 1},
is_ground_content = false,
on_blast = function() end,
-- 1px block to stop falling nodes replacing protector
collision_box = {
type = "fixed", fixed = {-15/32, 13/32, -15/32, -13/32, 1/2, -13/32}
}
})
-- make own protectors visible in area
core.register_chatcommand("protector_show", {
params = "",
description = S("Show your nearby protection blocks"),
privs = {interact = true},
func = function(name, param)
local player = core.get_player_by_name(name)
if not player then
return false, S("Player not found.")
end
local pos = player:get_pos()
local a = core.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_hidden"})
local meta, owner
for _, row in pairs(a) do
meta = core.get_meta(row)
owner = meta:get_string("owner") or ""
if owner == name
or core.check_player_privs(name, {protection_bypass = true}) then
core.swap_node(row, {name = "protector:protect"})
end
end
end
})
-- make own protectors invisible in area
core.register_chatcommand("protector_hide", {
params = "",
description = S("Hide your nearby protection blocks"),
privs = {interact = true},
func = function(name, param)
local player = core.get_player_by_name(name)
if not player then
return false, S("Player not found.")
end
local pos = player:get_pos()
local a = core.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"})
local meta, owner
for _, row in pairs(a) do
meta = core.get_meta(row)
owner = meta:get_string("owner") or ""
if owner == name
or core.check_player_privs(name, {protection_bypass = true}) then
core.swap_node(row, {name = "protector:protect_hidden"})
end
end
end
})
-- translation and default name vars
local S = core.get_translator("protector")
local removal_names = ""
local replace_names = ""
-- remove protection command
core.register_chatcommand("protector_remove", {
params = S("<names list>"),
description = S("Remove Protectors around players (separate names with spaces)"),
privs = {server = true},
func = function(name, param)
if param == "-" then
core.chat_send_player(name, S("Name List Reset"))
removal_names = "" ; return
end
if param ~= "" then
removal_names = param
end
core.chat_send_player(name,
S("Protector Names to remove: @1", removal_names))
end
})
-- replace protection command
core.register_chatcommand("protector_replace", {
params = S("<owner name> <name to replace with>"),
description = S("Replace Protector Owner with name provided"),
privs = {server = true},
func = function(name, param)
-- reset list to empty
if param == "-" then
core.chat_send_player(name, S("Name List Reset"))
replace_names = "" ; return
end
-- check and set replacement name
if param ~= "" then
local names = param:split(" ") ; if not names[2] then return end
if names[2] ~= string.match(names[2], "[%w_-]+") then
core.chat_send_player(name, S("Invalid player name!")) ; return
end
if names[2]:len() > 25 then
core.chat_send_player(name, S("Player name too long")) ; return
end
replace_names = param
end
-- show name info
if replace_names ~= "" then
local names = replace_names:split(" ")
core.chat_send_player(name, S("Replacing Protector name @1 with @2",
names[1] or "", names[2] or ""))
end
end
})
-- Abm to remove or replace protectors within active player area
core.register_abm({
nodenames = {"protector:protect", "protector:protect2", "protector:protect_hidden"},
interval = 5,
chance = 1,
catch_up = false,
action = function(pos, node)
if removal_names == "" and replace_names == "" then return end
local meta = core.get_meta(pos) ; if not meta then return end
local owner = meta:get_string("owner")
if removal_names ~= "" then
local names = removal_names:split(" ")
for _, n in pairs(names) do
if n == owner then
core.set_node(pos, {name = "air"}) ; return
end
end
end
if replace_names ~= "" then
local names = replace_names:split(" ")
if names[1] and names[2] and owner == names[1] then
meta:set_string("owner", names[2])
meta:set_string("infotext", S("Protection (owned by @1)", names[2]))
end
end
end
})
-- show protection areas of nearby protectors owned by you (thanks agaran)
local r = protector.length
core.register_chatcommand("protector_show_area", {
params = "",
description = S("Show protected areas of your nearby protectors"),
privs = {},
func = function(name, param)
local player = core.get_player_by_name(name)
local pos = player:get_pos()
-- find the protector nodes
local pos = core.find_nodes_in_area(
{x = pos.x - r, y = pos.y - r, z = pos.z - r},
{x = pos.x, y = pos.y, z = pos.z},
{"protector:protect", "protector:protect2", "protector:protect_hidden"})
local meta, owner
-- show a maximum of 5 protected areas only
for n = 1, math.min(#pos, 5) do
meta = core.get_meta(pos[n])
owner = meta:get_string("owner") or ""
if owner == name
or core.check_player_privs(name, {protection_bypass = true}) then
core.add_entity({x=pos[n].x+r, y=pos[n].y+r, z=pos[n].z+r}, "protector:display")
end
end
end
})
-- ability to hide protection blocks (borrowed from doors mod :)
core.register_node("protector:protect_hidden", {
description = "Hidden Protector",
drawtype = "airlike",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
-- has to be walkable for falling nodes to stop falling
walkable = true,
pointable = false,
diggable = false,
buildable_to = false,
floodable = false,
drop = "",
groups = {not_in_creative_inventory = 1, unbreakable = 1},
is_ground_content = false,
on_blast = function() end,
-- 1px block to stop falling nodes replacing protector
collision_box = {
type = "fixed", fixed = {-15/32, 13/32, -15/32, -13/32, 1/2, -13/32}
}
})
-- make own protectors visible in area
core.register_chatcommand("protector_show", {
params = "",
description = S("Show your nearby protection blocks"),
privs = {interact = true},
func = function(name, param)
local player = core.get_player_by_name(name)
if not player then
return false, S("Player not found.")
end
local pos = player:get_pos()
local a = core.find_nodes_in_area(
{x = pos.x - r, y = pos.y - r, z = pos.z - r},
{x = pos.x, y = pos.y, z = pos.z},
{"protector:protect_hidden"})
local meta, owner
for _, row in pairs(a) do
meta = core.get_meta(row)
owner = meta:get_string("owner") or ""
if owner == name
or core.check_player_privs(name, {protection_bypass = true}) then
core.swap_node(row, {name = "protector:protect"})
end
end
end
})
-- make own protectors invisible in area
core.register_chatcommand("protector_hide", {
params = "",
description = S("Hide your nearby protection blocks"),
privs = {interact = true},
func = function(name, param)
local player = core.get_player_by_name(name)
if not player then
return false, S("Player not found.")
end
local pos = player:get_pos()
local a = core.find_nodes_in_area(
{x = pos.x - r, y = pos.y - r, z = pos.z - r},
{x = pos.x, y = pos.y, z = pos.z},
{"protector:protect", "protector:protect2"})
local meta, owner
for _, row in pairs(a) do
meta = core.get_meta(row)
owner = meta:get_string("owner") or ""
if owner == name
or core.check_player_privs(name, {protection_bypass = true}) then
core.swap_node(row, {name = "protector:protect_hidden"})
end
end
end
})
+260 -260
View File
@@ -1,260 +1,260 @@
-- translation
local S = core.get_translator("protector")
local F = core.formspec_escape
-- MineClone support
local mcl = core.get_modpath("mcl_core")
local mcf = core.get_modpath("mcl_formspec")
-- Are crafts enabled?
local protector_crafts = core.settings:get_bool("protector_crafts") ~= false
-- Protected Chest
local chest_size = mcl and (9 * 3) or (8 * 4)
core.register_node("protector:chest", {
description = S("Protected Chest"),
tiles = {
"default_chest_top.png", "default_chest_top.png",
"default_chest_side.png", "default_chest_side.png",
"default_chest_side.png", "default_chest_front.png^protector_logo.png"
},
paramtype2 = "facedir",
groups = {dig_immediate = 2, unbreakable = 1},
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = core.get_meta(pos)
local inv = meta:get_inventory()
meta:set_string("infotext", S("Protected Chest"))
meta:set_string("name", S("Protected Chest"))
inv:set_size("main", chest_size)
end,
can_dig = function(pos,player)
local meta = core.get_meta(pos)
local inv = meta:get_inventory()
if inv:is_empty("main") then
if not core.is_protected(pos, player:get_player_name()) then
return true
end
end
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
core.log("action", player:get_player_name()
.. " moves stuff to protected chest at " .. core.pos_to_string(pos))
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
core.log("action", player:get_player_name()
.. " takes stuff from protected chest at " .. core.pos_to_string(pos))
end,
on_metadata_inventory_move = function(
pos, from_list, from_index, to_list, to_index, count, player)
core.log("action", player:get_player_name()
.. " moves stuff inside protected chest at " .. core.pos_to_string(pos))
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
if core.is_protected(pos, player:get_player_name()) then
return 0
end
return stack:get_count()
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
if core.is_protected(pos, player:get_player_name()) then
return 0
end
return stack:get_count()
end,
allow_metadata_inventory_move = function(
pos, from_list, from_index, to_list, to_index, count, player)
if core.is_protected(pos, player:get_player_name()) then
return 0
end
return count
end,
on_rightclick = function(pos, node, clicker)
if core.is_protected(pos, clicker:get_player_name()) then return end
local meta = core.get_meta(pos) ; if not meta then return end
local spos = pos.x .. "," .. pos.y .. "," ..pos.z
local formspec
-- mineclone support
if mcl and mcf then
formspec = "size[9,8.75]"
.. "label[0,0;" .. core.formspec_escape(
core.colorize("#313131", "Protected Chest")) .. "]"
.. "list[nodemeta:" .. spos .. ";main;0,0.5;9,3;]"
.. mcl_formspec.get_itemslot_bg(0,0.5,9,3)
.. "image_button[3.0,3.5;1.05,0.8;protector_up_icon.png;protect_up;]"
.. "image_button[4.0,3.5;1.05,0.8;protector_down_icon.png;protect_down;]"
.. "label[0,4.0;" .. core.formspec_escape(
core.colorize("#313131", "Inventory")) .. "]"
.. "list[current_player;main;0,4.5;9,3;9]"
.. mcl_formspec.get_itemslot_bg(0,4.5,9,3)
.. "list[current_player;main;0,7.74;9,1;]"
.. mcl_formspec.get_itemslot_bg(0,7.74,9,1)
.. "listring[nodemeta:" .. spos .. ";main]"
.. "listring[current_player;main]"
else -- default formspec
formspec = "size[8,9]"
.. "list[nodemeta:".. spos .. ";main;0,0.3;8,4;]"
.. "image_button[-0.01,4.26;1.05,0.8;protector_up_icon.png;protect_up;]"
.. "image_button[0.98,4.26;1.05,0.8;protector_down_icon.png;protect_down;]"
.. "tooltip[protect_up;" .. S("To Chest") .. "]"
.. "tooltip[protect_down;" .. S("To Inventory") .. "]"
.. "field[2.3,4.8;4,0.25;protect_name;;"
.. meta:get_string("name") .. "]"
.. "button[5.99,4.5;2.05,0.25;protect_rename;" .. S("Rename") .. "]"
.. "list[current_player;main;0,5;8,1;]"
.. "list[current_player;main;0,6.08;8,3;8]"
.. "listring[nodemeta:" .. spos .. ";main]"
.. "listring[current_player;main]"
end
core.sound_play("default_chest_open", {
gain = 0.3, pos = pos, max_hear_distance = 10}, true)
core.show_formspec(clicker:get_player_name(),
"protector:chest_" .. core.pos_to_string(pos), formspec)
end,
on_blast = function() end
})
-- Container transfer helper
local function to_from(src, dst)
local stack, item, leftover
local size = dst:get_size("main")
for i = 1, size do
stack = src:get_stack("main", i)
item = stack:get_name()
if item ~= "" and dst:room_for_item("main", item) then
leftover = dst:add_item("main", stack)
if leftover and not leftover:is_empty() then
src:set_stack("main", i, leftover)
else
src:set_stack("main", i, nil)
end
end
end
end
-- Protected Chest formspec buttons
core.register_on_player_receive_fields(function(player, formname, fields)
if string.sub(formname, 0, 16) ~= "protector:chest_" then return end
local pos_s = string.sub(formname, 17)
local pos = core.string_to_pos(pos_s)
if core.is_protected(pos, player:get_player_name()) then return end
local meta = core.get_meta(pos) ; if not meta then return end
local chest_inv = meta:get_inventory() ; if not chest_inv then return end
local player_inv = player:get_inventory()
-- copy contents of player inventory to chest
if fields.protect_up then
to_from(player_inv, chest_inv)
-- copy contents of chest to player inventory
elseif fields.protect_down then
to_from(chest_inv, player_inv)
elseif fields.protect_name or fields.protect_rename then
-- change chest infotext to display name
if fields.protect_name ~= "" then
if fields.protect_name ~= string.match(fields.protect_name, "[%w%s_-]+")
or fields.protect_name:len() > 35 then
return
end
meta:set_string("name", fields.protect_name)
meta:set_string("infotext", fields.protect_name)
else
meta:set_string("name", S("Protected Chest"))
meta:set_string("infotext", S("Protected Chest"))
end
elseif fields.quit then
core.sound_play("default_chest_close", {
gain = 0.3, pos = pos, max_hear_distance = 10}, true)
end
end)
-- Protected Chest recipes
if protector_crafts then
if mcl then
core.register_craft({
output = "protector:chest",
recipe = { {"mcl_chests:chest", "mcl_core:gold_ingot"} }
})
else
core.register_craft({
output = "protector:chest",
recipe = {
{"group:wood", "group:wood", "group:wood"},
{"group:wood", "default:copper_ingot", "group:wood"},
{"group:wood", "group:wood", "group:wood"}
}
})
core.register_craft({
output = "protector:chest",
recipe = { {"default:chest", "default:copper_ingot"} }
})
end
end
-- translation
local S = core.get_translator("protector")
local F = core.formspec_escape
-- MineClone support
local mcl = core.get_modpath("mcl_core")
local mcf = core.get_modpath("mcl_formspec")
-- Are crafts enabled?
local protector_crafts = core.settings:get_bool("protector_crafts") ~= false
-- Protected Chest
local chest_size = mcl and (9 * 3) or (8 * 4)
core.register_node("protector:chest", {
description = S("Protected Chest"),
tiles = {
"default_chest_top.png", "default_chest_top.png",
"default_chest_side.png", "default_chest_side.png",
"default_chest_side.png", "default_chest_front.png^protector_logo.png"
},
paramtype2 = "facedir",
groups = {dig_immediate = 2, unbreakable = 1},
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = core.get_meta(pos)
local inv = meta:get_inventory()
meta:set_string("infotext", S("Protected Chest"))
meta:set_string("name", S("Protected Chest"))
inv:set_size("main", chest_size)
end,
can_dig = function(pos,player)
local meta = core.get_meta(pos)
local inv = meta:get_inventory()
if inv:is_empty("main") then
if not core.is_protected(pos, player:get_player_name()) then
return true
end
end
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
core.log("action", player:get_player_name()
.. " moves stuff to protected chest at " .. core.pos_to_string(pos))
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
core.log("action", player:get_player_name()
.. " takes stuff from protected chest at " .. core.pos_to_string(pos))
end,
on_metadata_inventory_move = function(
pos, from_list, from_index, to_list, to_index, count, player)
core.log("action", player:get_player_name()
.. " moves stuff inside protected chest at " .. core.pos_to_string(pos))
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
if core.is_protected(pos, player:get_player_name()) then
return 0
end
return stack:get_count()
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
if core.is_protected(pos, player:get_player_name()) then
return 0
end
return stack:get_count()
end,
allow_metadata_inventory_move = function(
pos, from_list, from_index, to_list, to_index, count, player)
if core.is_protected(pos, player:get_player_name()) then
return 0
end
return count
end,
on_rightclick = function(pos, node, clicker)
if core.is_protected(pos, clicker:get_player_name()) then return end
local meta = core.get_meta(pos) ; if not meta then return end
local spos = pos.x .. "," .. pos.y .. "," ..pos.z
local formspec
-- mineclone support
if mcl and mcf then
formspec = "size[9,8.75]"
.. "label[0,0;" .. core.formspec_escape(
core.colorize("#313131", "Protected Chest")) .. "]"
.. "list[nodemeta:" .. spos .. ";main;0,0.5;9,3;]"
.. mcl_formspec.get_itemslot_bg(0,0.5,9,3)
.. "image_button[3.0,3.5;1.05,0.8;protector_up_icon.png;protect_up;]"
.. "image_button[4.0,3.5;1.05,0.8;protector_down_icon.png;protect_down;]"
.. "label[0,4.0;" .. core.formspec_escape(
core.colorize("#313131", "Inventory")) .. "]"
.. "list[current_player;main;0,4.5;9,3;9]"
.. mcl_formspec.get_itemslot_bg(0,4.5,9,3)
.. "list[current_player;main;0,7.74;9,1;]"
.. mcl_formspec.get_itemslot_bg(0,7.74,9,1)
.. "listring[nodemeta:" .. spos .. ";main]"
.. "listring[current_player;main]"
else -- default formspec
formspec = "size[8,9]"
.. "list[nodemeta:".. spos .. ";main;0,0.3;8,4;]"
.. "image_button[-0.01,4.26;1.05,0.8;protector_up_icon.png;protect_up;]"
.. "image_button[0.98,4.26;1.05,0.8;protector_down_icon.png;protect_down;]"
.. "tooltip[protect_up;" .. S("To Chest") .. "]"
.. "tooltip[protect_down;" .. S("To Inventory") .. "]"
.. "field[2.3,4.8;4,0.25;protect_name;;"
.. meta:get_string("name") .. "]"
.. "button[5.99,4.5;2.05,0.25;protect_rename;" .. S("Rename") .. "]"
.. "list[current_player;main;0,5;8,1;]"
.. "list[current_player;main;0,6.08;8,3;8]"
.. "listring[nodemeta:" .. spos .. ";main]"
.. "listring[current_player;main]"
end
core.sound_play("default_chest_open", {
gain = 0.3, pos = pos, max_hear_distance = 10}, true)
core.show_formspec(clicker:get_player_name(),
"protector:chest_" .. core.pos_to_string(pos), formspec)
end,
on_blast = function() end
})
-- Container transfer helper
local function to_from(src, dst)
local stack, item, leftover
local size = dst:get_size("main")
for i = 1, size do
stack = src:get_stack("main", i)
item = stack:get_name()
if item ~= "" and dst:room_for_item("main", item) then
leftover = dst:add_item("main", stack)
if leftover and not leftover:is_empty() then
src:set_stack("main", i, leftover)
else
src:set_stack("main", i, nil)
end
end
end
end
-- Protected Chest formspec buttons
core.register_on_player_receive_fields(function(player, formname, fields)
if string.sub(formname, 0, 16) ~= "protector:chest_" then return end
local pos_s = string.sub(formname, 17)
local pos = core.string_to_pos(pos_s)
if core.is_protected(pos, player:get_player_name()) then return end
local meta = core.get_meta(pos) ; if not meta then return end
local chest_inv = meta:get_inventory() ; if not chest_inv then return end
local player_inv = player:get_inventory()
-- copy contents of player inventory to chest
if fields.protect_up then
to_from(player_inv, chest_inv)
-- copy contents of chest to player inventory
elseif fields.protect_down then
to_from(chest_inv, player_inv)
elseif fields.protect_name or fields.protect_rename then
-- change chest infotext to display name
if fields.protect_name ~= "" then
if fields.protect_name ~= string.match(fields.protect_name, "[%w%s_-]+")
or fields.protect_name:len() > 35 then
return
end
meta:set_string("name", fields.protect_name)
meta:set_string("infotext", fields.protect_name)
else
meta:set_string("name", S("Protected Chest"))
meta:set_string("infotext", S("Protected Chest"))
end
elseif fields.quit then
core.sound_play("default_chest_close", {
gain = 0.3, pos = pos, max_hear_distance = 10}, true)
end
end)
-- Protected Chest recipes
if protector_crafts then
if mcl then
core.register_craft({
output = "protector:chest",
recipe = { {"mcl_chests:chest", "mcl_core:gold_ingot"} }
})
else
core.register_craft({
output = "protector:chest",
recipe = {
{"group:wood", "group:wood", "group:wood"},
{"group:wood", "default:copper_ingot", "group:wood"},
{"group:wood", "group:wood", "group:wood"}
}
})
core.register_craft({
output = "protector:chest",
recipe = { {"default:chest", "default:copper_ingot"} }
})
end
end
+521 -521
View File
File diff suppressed because it is too large Load Diff
+82 -82
View File
@@ -1,82 +1,82 @@
-- translation and protector radius
local S = core.get_translator("protector")
local radius = protector.radius
-- hud settings
local hud = {}
local hud_timer = 0
local hud_interval = (tonumber(core.settings:get("protector_hud_interval")) or 4)
local hud_style = core.has_feature("hud_def_type_field")
if hud_interval > 0 then
core.register_globalstep(function(dtime)
hud_timer = hud_timer + dtime
if hud_timer < hud_interval then return end
hud_timer = 0
for _, player in pairs(core.get_connected_players()) do
local name = player:get_player_name()
local pos = vector.round(player:get_pos())
local hud_text = ""
local protectors = core.find_nodes_in_area(
{x = pos.x - radius , y = pos.y - radius , z = pos.z - radius},
{x = pos.x + radius , y = pos.y + radius , z = pos.z + radius},
{"protector:protect","protector:protect2", "protector:protect_hidden"})
if #protectors > 0 then
local npos = protectors[1]
local meta = core.get_meta(npos)
local nodeowner = meta:get_string("owner")
local members = meta:get_string("members"):split(" ")
hud_text = S("Owner: @1", nodeowner)
if #members > 0 then
hud_text = hud_text .. " [" .. #members .. "]"
end
end
if not hud[name] then
hud[name] = {}
local hud_tab = {
name = "Protector Area",
number = 0xFFFF22,
position = {x = 0, y = 0.95},
offset = {x = 8, y = -8},
text = hud_text,
scale = {x = 200, y = 60},
alignment = {x = 1, y = -1},
}
if hud_style then
hud_tab["type"] = "text"
else
hud_tab["hud_elem_type"] = "text"
end
hud[name].id = player:hud_add(hud_tab)
return
else
player:hud_change(hud[name].id, "text", hud_text)
end
end
end)
core.register_on_leaveplayer(function(player)
hud[player:get_player_name()] = nil
end)
end -- END hud_interval > 0
-- translation and protector length
local S = core.get_translator("protector")
local length = protector.length
-- hud settings
local hud = {}
local hud_timer = 0
local hud_interval = (tonumber(core.settings:get("protector_hud_interval")) or 4)
local hud_style = core.has_feature("hud_def_type_field")
if hud_interval > 0 then
core.register_globalstep(function(dtime)
hud_timer = hud_timer + dtime
if hud_timer < hud_interval then return end
hud_timer = 0
for _, player in pairs(core.get_connected_players()) do
local name = player:get_player_name()
local pos = vector.round(player:get_pos())
local hud_text = ""
local protectors = core.find_nodes_in_area(
{x = pos.x - length, y = pos.y - length, z = pos.z - length},
{x = pos.x, y = pos.y, z = pos.z},
{"protector:protect","protector:protect2", "protector:protect_hidden"})
if #protectors > 0 then
local npos = protectors[1]
local meta = core.get_meta(npos)
local nodeowner = meta:get_string("owner")
local members = meta:get_string("members"):split(" ")
hud_text = S("Owner: @1", nodeowner)
if #members > 0 then
hud_text = hud_text .. " [" .. #members .. "]"
end
end
if not hud[name] then
hud[name] = {}
local hud_tab = {
name = "Protector Area",
number = 0xFFFF22,
position = {x = 0, y = 0.95},
offset = {x = 8, y = -8},
text = hud_text,
scale = {x = 200, y = 60},
alignment = {x = 1, y = -1},
}
if hud_style then
hud_tab["type"] = "text"
else
hud_tab["hud_elem_type"] = "text"
end
hud[name].id = player:hud_add(hud_tab)
return
else
player:hud_change(hud[name].id, "text", hud_text)
end
end
end)
core.register_on_leaveplayer(function(player)
hud[player:get_player_name()] = nil
end)
end -- END hud_interval > 0
+923 -907
View File
File diff suppressed because it is too large Load Diff
+33 -33
View File
@@ -1,33 +1,33 @@
The MIT License (MIT)
Copyright (c) 2025 TenPlus1
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Original doors mod code (WTFPL license)
Textures by TenPlus1 (CC0) unless mentioned below
Textures from original Minetest doors mod (CC-BY-SA 3.0)
doors_*.png
..default_chest*.png
Textures by Sirrobzeroone (CC0)
protector_tool.png
The MIT License (MIT)
Copyright (c) 2025 TenPlus1
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Original doors mod code (WTFPL license)
Textures by TenPlus1 (CC0) unless mentioned below
Textures from original Minetest doors mod (CC-BY-SA 3.0)
doors_*.png
..default_chest*.png
Textures by Sirrobzeroone (CC0)
protector_tool.png
+56 -56
View File
@@ -1,57 +1,57 @@
# textdomain: protector
# author: Xanthin and CodeXP
# last update: 2020/Jul/12
### admin.lua ###
Remove Protectors around players (separate names with spaces)=Entferne Störschützer von bestimmten Namen in der Nähe von Spielern (trenne Namen durch Leerzeichen)
<names list>=<Namensliste der Spieler>
Replace Protector Owner with name provided=Ersetze Besitzer der Störschützer mit neuem Besitzer
<owner name> <name to replace with>=<Name des Besitzers> <Name des neuen Besitzers>
Replacing Protector name '@1' with '@2'=Ersetze Besitzer der Störschützer von '@1' mit '@2'
Show protected areas of your nearby protectors=Zeige geschützte Bereiche der Störschützer in der Nähe
Protector Names to remove: @1=Störschutznamen zum Entfernen: @1
Name List Reset=Namensliste zurückgesetzt
Invalid player name!=
Player name too long=
Player not found.=
### doors_chest.lua ###
Protected Wooden Door=Geschützte Holztür
Protected Steel Door=Geschützte Stahltür
Protected Trapdoor=Geschützte Falltür
Protected Steel Trapdoor=Geschützte Stahlfalltür
Protected Chest=Geschützte Truhe
To Chest=Zur Truhe
To Inventory=Zum Inventar
Protected Chest (@1)=Geschützte Truhe (@1)
### init.lua ###
-- Protector interface --=-- Störschutz-Interface --
PUNCH node to show protected area=SCHLAGE Node, um geschützten Bereich anzuzeigen oder
USE for area check=BENUTZE für Bereichsprüfung
Members:=Mitglieder:
Close=Schließen
Protection located at: @1=Störschutz befindet sich bei: @1
Members: @1.=Mitglieder: @1.
Allow faction access=
This area is not protected.=Dieser Bereich ist nicht geschützt.
You can build here.=Du kannst hier bauen.
Overlaps into above players protected area=Überlappung im geschützen Bereich eines Spielers
Protection Block=Störschutzblock
Protection (owned by @1)=Störschutz (gehört @1)
Protection Logo=Störschutzlogo
[MOD] Protector Redo loaded=[MOD] Protector Redo geladen
Spawn @1 has been protected up to a @2 block radius.=Spawn @1 ist geschützt mit einem Radius von @2 Blöcke.
This area is owned by @1=Dieser Bereich gehört @1
### hud.lua ###
Owner: @1=Besitzer: @1
### tool.lua ###
Protector Placer Tool (stand near protector, face direction and use)=Störschutz Platzier-Werkzeug (stehe neben Störschutz, schaue in die gewünschte Richtung und anwenden)
Protector already in place!=Störschutz is bereits platziert!
No protectors available to place!=Keine Störschützer mehr im Inventar!
"Protector placed at @1"=Störschutz befindet sich bei: @1
Out of bounds!=
Cannot place protector, already protected at @1=
# textdomain: protector
# author: Xanthin and CodeXP
# last update: 2020/Jul/12
### admin.lua ###
Remove Protectors around players (separate names with spaces)=Entferne Störschützer von bestimmten Namen in der Nähe von Spielern (trenne Namen durch Leerzeichen)
<names list>=<Namensliste der Spieler>
Replace Protector Owner with name provided=Ersetze Besitzer der Störschützer mit neuem Besitzer
<owner name> <name to replace with>=<Name des Besitzers> <Name des neuen Besitzers>
Replacing Protector name '@1' with '@2'=Ersetze Besitzer der Störschützer von '@1' mit '@2'
Show protected areas of your nearby protectors=Zeige geschützte Bereiche der Störschützer in der Nähe
Protector Names to remove: @1=Störschutznamen zum Entfernen: @1
Name List Reset=Namensliste zurückgesetzt
Invalid player name!=
Player name too long=
Player not found.=
### doors_chest.lua ###
Protected Wooden Door=Geschützte Holztür
Protected Steel Door=Geschützte Stahltür
Protected Trapdoor=Geschützte Falltür
Protected Steel Trapdoor=Geschützte Stahlfalltür
Protected Chest=Geschützte Truhe
To Chest=Zur Truhe
To Inventory=Zum Inventar
Protected Chest (@1)=Geschützte Truhe (@1)
### init.lua ###
-- Protector interface --=-- Störschutz-Interface --
PUNCH node to show protected area=SCHLAGE Node, um geschützten Bereich anzuzeigen oder
USE for area check=BENUTZE für Bereichsprüfung
Members:=Mitglieder:
Close=Schließen
Protection located at: @1=Störschutz befindet sich bei: @1
Members: @1.=Mitglieder: @1.
Allow faction access=
This area is not protected.=Dieser Bereich ist nicht geschützt.
You can build here.=Du kannst hier bauen.
Overlaps into above players protected area=Überlappung im geschützen Bereich eines Spielers
Protection Block=Störschutzblock
Protection (owned by @1)=Störschutz (gehört @1)
Protection Logo=Störschutzlogo
[MOD] Protector Redo loaded=[MOD] Protector Redo geladen
Spawn @1 has been protected up to a @2 block radius.=Spawn @1 ist geschützt mit einem Radius von @2 Blöcke.
This area is owned by @1=Dieser Bereich gehört @1
### hud.lua ###
Owner: @1=Besitzer: @1
### tool.lua ###
Protector Placer Tool (stand near protector, face direction and use)=Störschutz Platzier-Werkzeug (stehe neben Störschutz, schaue in die gewünschte Richtung und anwenden)
Protector already in place!=Störschutz is bereits platziert!
No protectors available to place!=Keine Störschützer mehr im Inventar!
"Protector placed at @1"=Störschutz befindet sich bei: @1
Out of bounds!=
Cannot place protector, already protected at @1=
Cannot place protector, container at @1=
+57 -57
View File
@@ -1,57 +1,57 @@
# textdomain: protector
# author: universales
# last update: 2020-02-27
### admin.lua ###
Remove Protectors around players (separate names with spaces)=Eliminar protectores alrededor de los jugadores (nombres separados con espacios)
<names list>=<Lista de nombres>
Replace Protector Owner with name provided=Reemplace el propietario del protector con el nombre proporcionado
<owner name> <name to replace with>=<Nombre del propietario> <Nombre del nuevo propietario>
Replacing Protector name '@1' with '@2'=Reemplazando el nombre del protector '@1' a '@2'
Show protected areas of your nearby protectors=Mostrar áreas protegidas de sus protectores cercanos
Protector Names to remove: @1=Nombres de protectores para eliminar: @1
Name List Reset=Restablecer lista de nombres
Invalid player name!=
Player name too long=
Player not found.=
### doors_chest.lua ###
Protected Wooden Door=Puerta de madera protegida
Protected Steel Door=Puerta de hierro protegida
Protected Trapdoor=Trampilla Protegida
Protected Steel Trapdoor=Trampilla de hierro protegida
Protected Chest=Cofre protegido
To Chest=Al cofre
To Inventory=Al inventario
Protected Chest (@1)=Cofre protegido (@1)
### init.lua ###
-- Protector interface --=-- Interfaz del protector --
PUNCH node to show protected area=nodo de perforación para mostrar el área protegida
USE for area check=Usar para chequeo del área
Members:=Miembros:
Close=Cerrar
Protection located at: @1=Protección ubicada en: @1
Members: @1.=Miembros: @1.
This area is not protected.=Esta área no está protegida.
You can build here.=Puedes construir aquí.
Overlaps into above players protected area=Se superpone en el área protegida de los jugadores anteriores
Protection Block=Bloque de protección
Protection (owned by @1)=Protegido (Propiedad de @1)
Protection Logo=Logotipo de la protección
[MOD] Protector Redo loaded=[MOD] Protector recargado
Spawn @1 has been protected up to a @2 block radius.=Spawn @1 ha sido protegido hasta un radio de bloque @2.
This area is owned by @1=Esta área es propiedad de @1
Factions: (use * to allow any of your factions)=Facciones: (utiliza * para autorizar todas tus facciones)
### hud.lua ###
Owner: @1=Propietario: @1
### tool.lua ###
Protector Placer Tool (stand near protector, face direction and use)=Herramienta de colocación del protector (pararse cerca del protector, dirección de la cara y uso)
Protector already in place!=¡El protector ya está en este lugar!
No protectors available to place!=¡No hay protectores disponibles para colocar!
Protector placed at @1=Protector colocado en @1
Out of bounds!=
Cannot place protector, already protected at @1=
Cannot place protector, container at @1=
# textdomain: protector
# author: universales
# last update: 2020-02-27
### admin.lua ###
Remove Protectors around players (separate names with spaces)=Eliminar protectores alrededor de los jugadores (nombres separados con espacios)
<names list>=<Lista de nombres>
Replace Protector Owner with name provided=Reemplace el propietario del protector con el nombre proporcionado
<owner name> <name to replace with>=<Nombre del propietario> <Nombre del nuevo propietario>
Replacing Protector name '@1' with '@2'=Reemplazando el nombre del protector '@1' a '@2'
Show protected areas of your nearby protectors=Mostrar áreas protegidas de sus protectores cercanos
Protector Names to remove: @1=Nombres de protectores para eliminar: @1
Name List Reset=Restablecer lista de nombres
Invalid player name!=
Player name too long=
Player not found.=
### doors_chest.lua ###
Protected Wooden Door=Puerta de madera protegida
Protected Steel Door=Puerta de hierro protegida
Protected Trapdoor=Trampilla Protegida
Protected Steel Trapdoor=Trampilla de hierro protegida
Protected Chest=Cofre protegido
To Chest=Al cofre
To Inventory=Al inventario
Protected Chest (@1)=Cofre protegido (@1)
### init.lua ###
-- Protector interface --=-- Interfaz del protector --
PUNCH node to show protected area=nodo de perforación para mostrar el área protegida
USE for area check=Usar para chequeo del área
Members:=Miembros:
Close=Cerrar
Protection located at: @1=Protección ubicada en: @1
Members: @1.=Miembros: @1.
This area is not protected.=Esta área no está protegida.
You can build here.=Puedes construir aquí.
Overlaps into above players protected area=Se superpone en el área protegida de los jugadores anteriores
Protection Block=Bloque de protección
Protection (owned by @1)=Protegido (Propiedad de @1)
Protection Logo=Logotipo de la protección
[MOD] Protector Redo loaded=[MOD] Protector recargado
Spawn @1 has been protected up to a @2 block radius.=Spawn @1 ha sido protegido hasta un radio de bloque @2.
This area is owned by @1=Esta área es propiedad de @1
Factions: (use * to allow any of your factions)=Facciones: (utiliza * para autorizar todas tus facciones)
### hud.lua ###
Owner: @1=Propietario: @1
### tool.lua ###
Protector Placer Tool (stand near protector, face direction and use)=Herramienta de colocación del protector (pararse cerca del protector, dirección de la cara y uso)
Protector already in place!=¡El protector ya está en este lugar!
No protectors available to place!=¡No hay protectores disponibles para colocar!
Protector placed at @1=Protector colocado en @1
Out of bounds!=
Cannot place protector, already protected at @1=
Cannot place protector, container at @1=
+57 -57
View File
@@ -1,57 +1,57 @@
# textdomain: protector
# author: CodeXP and TenPlus1
# last update: 2020/Jul/12
### admin.lua ###
Remove Protectors around players (separate names with spaces)=Retirer les protecteurs près des joueurs avec les noms fournis (noms séparés avec des espaces)
<names list>=<liste de noms>
Replace Protector Owner with name provided=Remplacer le propriétaire du protecteur par le nom fourni
<owner name> <name to replace with>=<nom du propriétaire> <nouveau nom>
Replacing Protector name '@1' with '@2'=Remplacement du nom du protecteur '@1' par '@2'
Show protected areas of your nearby protectors=Afficher les zones protégées de vos protecteurs à proximité
Protector Names to remove: @1=Noms de protecteurs à supprimer : @1
Name List Reset=Liste de noms réinitialisée
Invalid player name!=Nom de joueur invalide !
Player name too long=Nom de joueur trop long
Player not found.=Joueur inconnu.
### doors_chest.lua ###
Protected Wooden Door=Porte en bois protégée
Protected Steel Door=Porte en acier protégée
Protected Trapdoor=Trappe protégée
Protected Steel Trapdoor=Trappe en acier protégée
Protected Chest=Coffre protégé
To Chest=Vers le coffre
To Inventory=Vers l'inventaire
Protected Chest (@1)=Coffre protégé (@1)
### init.lua ###
-- Protector interface --=-- Interface Protector --
PUNCH node to show protected area=TAPER le bloc pour afficher la zone protégée
USE for area check=UTILISER pour vérifier la zone
Members:=Membres :
Close=Fermer
Protection located at: @1=Protection située à : @1
Members: @1.=Membres : @1.
This area is not protected.=msgstr "Cette zone n'est pas protégée.
You can build here.=Vous pouvez construire ici.
Overlaps into above players protected area=La zone chevauche une autre zone protégée.
Protection Block=Bloc de protection
Protection (owned by @1)=Protection (détenue par @1)
Protection Logo=Logo de protection
[MOD] Protector Redo loaded=[MOD] Protector Redo chargé
Spawn @1 has been protected up to a @2 block radius.=Le spawn @1 est protégé dans un rayon de @2 blocs.
This area is owned by @1=Cette zone appartient à @1 !
Factions: (use * to allow any of your factions)=Factions : (taper * pour autoriser toutes vos factions)
### hud.lua ###
Owner: @1=Propriétaire : @1
### tool.lua ###
Protector Placer Tool (stand near protector, face direction and use)=Outil de placement du protecteur (se tenir près du protecteur, dans la bonne direction et utiliser)
Protector already in place!=Protecteur déjà en place !
No protectors available to place!=Aucun protecteur disponible à placer !
Protector placed at @1=Protection située à : @1
Out of bounds!=Hors limites !
Cannot place protector, already protected at @1=Le protecteur ne peut être placé, déjà protégé à @1
Cannot place protector, container at @1=Le protecteur ne peut être placé, conteneur à @1
# textdomain: protector
# author: CodeXP and TenPlus1
# last update: 2020/Jul/12
### admin.lua ###
Remove Protectors around players (separate names with spaces)=Retirer les protecteurs près des joueurs avec les noms fournis (noms séparés avec des espaces)
<names list>=<liste de noms>
Replace Protector Owner with name provided=Remplacer le propriétaire du protecteur par le nom fourni
<owner name> <name to replace with>=<nom du propriétaire> <nouveau nom>
Replacing Protector name '@1' with '@2'=Remplacement du nom du protecteur '@1' par '@2'
Show protected areas of your nearby protectors=Afficher les zones protégées de vos protecteurs à proximité
Protector Names to remove: @1=Noms de protecteurs à supprimer : @1
Name List Reset=Liste de noms réinitialisée
Invalid player name!=Nom de joueur invalide !
Player name too long=Nom de joueur trop long
Player not found.=Joueur inconnu.
### doors_chest.lua ###
Protected Wooden Door=Porte en bois protégée
Protected Steel Door=Porte en acier protégée
Protected Trapdoor=Trappe protégée
Protected Steel Trapdoor=Trappe en acier protégée
Protected Chest=Coffre protégé
To Chest=Vers le coffre
To Inventory=Vers l'inventaire
Protected Chest (@1)=Coffre protégé (@1)
### init.lua ###
-- Protector interface --=-- Interface Protector --
PUNCH node to show protected area=TAPER le bloc pour afficher la zone protégée
USE for area check=UTILISER pour vérifier la zone
Members:=Membres :
Close=Fermer
Protection located at: @1=Protection située à : @1
Members: @1.=Membres : @1.
This area is not protected.=msgstr "Cette zone n'est pas protégée.
You can build here.=Vous pouvez construire ici.
Overlaps into above players protected area=La zone chevauche une autre zone protégée.
Protection Block=Bloc de protection
Protection (owned by @1)=Protection (détenue par @1)
Protection Logo=Logo de protection
[MOD] Protector Redo loaded=[MOD] Protector Redo chargé
Spawn @1 has been protected up to a @2 block radius.=Le spawn @1 est protégé dans un rayon de @2 blocs.
This area is owned by @1=Cette zone appartient à @1 !
Factions: (use * to allow any of your factions)=Factions : (taper * pour autoriser toutes vos factions)
### hud.lua ###
Owner: @1=Propriétaire : @1
### tool.lua ###
Protector Placer Tool (stand near protector, face direction and use)=Outil de placement du protecteur (se tenir près du protecteur, dans la bonne direction et utiliser)
Protector already in place!=Protecteur déjà en place !
No protectors available to place!=Aucun protecteur disponible à placer !
Protector placed at @1=Protection située à : @1
Out of bounds!=Hors limites !
Cannot place protector, already protected at @1=Le protecteur ne peut être placé, déjà protégé à @1
Cannot place protector, container at @1=Le protecteur ne peut être placé, conteneur à @1
+56 -56
View File
@@ -1,57 +1,57 @@
# textdomain: protector
# author: Xanthin and CodeXP
# last update: 2018/Jul/10
### admin.lua ###
Remove Protectors around players (separate names with spaces)=Elimina i protettori attorno ai giocatori (separa i nomi con gli spazi)
<names list>=<elenco nomi>
Replace Protector Owner with name provided=Sostituisci il proprietario del protettore col nome fornito
<owner name> <name to replace with>=<nome proprietario> <nome con cui sostituirlo>
Replacing Protector name '@1' with '@2'=Sostituzione del nome del protettore '@1' con '@2'
Show protected areas of your nearby protectors=Mostra le aree protette dei protettori vicino a te
Protector Names to remove: @1=Nomi dei protettori da eliminare: @1
Name List Reset=Azzera l'elenco dei nomi
Invalid player name!=
Player name too long=
Player not found.=
### doors_chest.lua ###
Protected Wooden Door=Porta di legno protetta
Protected Steel Door=Porta d'acciaio protetta
Protected Trapdoor=Botola protetta
Protected Steel Trapdoor=Botola d'acciaio protetta
Protected Chest=Baule protetto
To Chest=Al baule
To Inventory=All'inventario
Protected Chest (@1)=Baule protetto (@1)
### init.lua ###
-- Protector interface --=-- Interfaccia protettore --
PUNCH node to show protected area=COLPISCI il nodo per mostrare l'area protetta
USE for area check=USA per controllare l'area
Members:=Membri:
Close=Chiudi
Protection located at: @1=Protezione collocata a: @1
Members: @1.=Membri: @1.
Allow faction access=
This area is not protected.=Quest'area non è protetta.
You can build here.=Qui puoi costruire.
Overlaps into above players protected area=Si sovrappone ad un'area sovrastante protetta dai giocatori
Protection Block=Blocco di protezione
Protection (owned by @1)=Protezione (di proprietà di @1)
Protection Logo=Logo di protezione
[MOD] Protector Redo loaded=[MOD] Protector Redo caricato
Spawn @1 has been protected up to a @2 block radius.=Lo spawn @1 è stato protetto fino a un raggio di @2 blocchi.
This area is owned by @1=Quest'area è di proprietà di @1
### hud.lua ###
Owner: @1=Proprietario: @1
### tool.lua ###
Protector Placer Tool (stand near protector, face direction and use)=Strumento di posizionamento protettore (stai vicino al protettore, guarda la direzione e usa)
Protector already in place!=Protettore già presente!
No protectors available to place!=Nessun protettore disponibile da posizionare!
Protector placed at @1=Protettore posizionato a @1
Out of bounds!=
Cannot place protector, already protected at @1=
# textdomain: protector
# author: Xanthin and CodeXP
# last update: 2018/Jul/10
### admin.lua ###
Remove Protectors around players (separate names with spaces)=Elimina i protettori attorno ai giocatori (separa i nomi con gli spazi)
<names list>=<elenco nomi>
Replace Protector Owner with name provided=Sostituisci il proprietario del protettore col nome fornito
<owner name> <name to replace with>=<nome proprietario> <nome con cui sostituirlo>
Replacing Protector name '@1' with '@2'=Sostituzione del nome del protettore '@1' con '@2'
Show protected areas of your nearby protectors=Mostra le aree protette dei protettori vicino a te
Protector Names to remove: @1=Nomi dei protettori da eliminare: @1
Name List Reset=Azzera l'elenco dei nomi
Invalid player name!=
Player name too long=
Player not found.=
### doors_chest.lua ###
Protected Wooden Door=Porta di legno protetta
Protected Steel Door=Porta d'acciaio protetta
Protected Trapdoor=Botola protetta
Protected Steel Trapdoor=Botola d'acciaio protetta
Protected Chest=Baule protetto
To Chest=Al baule
To Inventory=All'inventario
Protected Chest (@1)=Baule protetto (@1)
### init.lua ###
-- Protector interface --=-- Interfaccia protettore --
PUNCH node to show protected area=COLPISCI il nodo per mostrare l'area protetta
USE for area check=USA per controllare l'area
Members:=Membri:
Close=Chiudi
Protection located at: @1=Protezione collocata a: @1
Members: @1.=Membri: @1.
Allow faction access=
This area is not protected.=Quest'area non è protetta.
You can build here.=Qui puoi costruire.
Overlaps into above players protected area=Si sovrappone ad un'area sovrastante protetta dai giocatori
Protection Block=Blocco di protezione
Protection (owned by @1)=Protezione (di proprietà di @1)
Protection Logo=Logo di protezione
[MOD] Protector Redo loaded=[MOD] Protector Redo caricato
Spawn @1 has been protected up to a @2 block radius.=Lo spawn @1 è stato protetto fino a un raggio di @2 blocchi.
This area is owned by @1=Quest'area è di proprietà di @1
### hud.lua ###
Owner: @1=Proprietario: @1
### tool.lua ###
Protector Placer Tool (stand near protector, face direction and use)=Strumento di posizionamento protettore (stai vicino al protettore, guarda la direzione e usa)
Protector already in place!=Protettore già presente!
No protectors available to place!=Nessun protettore disponibile da posizionare!
Protector placed at @1=Protettore posizionato a @1
Out of bounds!=
Cannot place protector, already protected at @1=
Cannot place protector, container at @1=
+61 -61
View File
@@ -1,62 +1,62 @@
# textdomain: protector
# author: SkyBuilder1717
# last update: 2025/Jan/27
### admin.lua ###
Remove Protectors around players (separate names with spaces)=Удалить Защитников вокруг игроков (отделяйте имена с помощью пробела)
<names list>=<игроки>
Replace Protector Owner with name provided=Заменить Владельца Защитника с доставленным именем
<owner name> <name to replace with>=<владелец> <новый владелец>
Replacing Protector name '@1' with '@2'=Замена Имени Защитника '@1' с '@2'
Show protected areas of your nearby protectors=Показать защищённые зоны Защитниками с вами неподалёку
Protector Names to remove: @1=Имена Защитников чтобы удалить: @1
Name List Reset=Сброс Список Имён
Invalid player name!=Неправильное имя игрока!
Player name too long=Имя игрока слишком длинное
Player not found.=Игрок не найден.
### doors_chest.lua ###
Protected Wooden Door=Защищённая Деревянная Дверь
Protected Steel Door=Защищённая Стальная Дверь
Protected Trapdoor=Защищённый Люк
Protected Steel Trapdoor=Защищённый Стальной Люк
Protected Chest=Защищённый Сундук
To Chest=В Сундук
To Inventory=В Инвентарь
Protected Chest (@1)=Защищённый Сундук (@1)
### init.lua ###
-- Protector interface --=-- Интерфейс Защитника --
PUNCH node to show protected area=УДАРЬТЕ по блоку чтобы показать защищённую зону
USE for area check=ИСПОЛЬЗУЙТЕ для проверки зоны
Members:=Участники:
Close=Закрыть
Allow faction access=Разрешить частичный доступ
Protection located at: @1=Защитник расположен на: @1
Members: @1.=Участники: @1.
This area is not protected.=Эта зона не защищена.
You can build here.=Вы можете здесь строить.
Overlaps into above players protected area=Перекрывает защищенную зону вышеперечисленных игроков
Protection Block=Блок Защиты
Protection (owned by @1)=Защита (владелец: @1)
Protection Logo=Логотип Защиты
[MOD] Protector Redo loaded=[MOD] Protector Redo загружен
Spawn @1 has been protected up to a @2 block radius.=Спавн @1 был защищён радиусом в блоках @2.
This area is owned by @1=Эта зона принадлежит @1.
### pvp.lua ###
[Protector] on_punchplayer called with nil objects=on_punchplayer вызван на нулевом объекте
[Protector] pvp_protect not active, update your version of Luanti=[Protector] pvp_protect не активен, обновите версию Luanti
[Protector] pvp_protect is disabled=[Protector] pvp_protect выключен
### hud.lua ###
Owner: @1=Владелец: @1
### tool.lua ###
Protector Placer Tool (stand near protector, face direction and use)=Инструмент Размещения Защитника (встаньте рядом с Защитником, повернитесь к нему и используйте предмет)
Protector already in place!=Защитник уже стоит на этом месте!
No protectors available to place!=Нет доступных Защитников чтобы поставить!
Out of bounds!=За пределами!
Protector placed at @1=Защитник размещён на @1
Cannot place protector, already protected at @1=Нельзя поставить Защитник, другой Защитник уже на @1
# textdomain: protector
# author: SkyBuilder1717
# last update: 2025/Jan/27
### admin.lua ###
Remove Protectors around players (separate names with spaces)=Удалить Защитников вокруг игроков (отделяйте имена с помощью пробела)
<names list>=<игроки>
Replace Protector Owner with name provided=Заменить Владельца Защитника с доставленным именем
<owner name> <name to replace with>=<владелец> <новый владелец>
Replacing Protector name '@1' with '@2'=Замена Имени Защитника '@1' с '@2'
Show protected areas of your nearby protectors=Показать защищённые зоны Защитниками с вами неподалёку
Protector Names to remove: @1=Имена Защитников чтобы удалить: @1
Name List Reset=Сброс Список Имён
Invalid player name!=Неправильное имя игрока!
Player name too long=Имя игрока слишком длинное
Player not found.=Игрок не найден.
### doors_chest.lua ###
Protected Wooden Door=Защищённая Деревянная Дверь
Protected Steel Door=Защищённая Стальная Дверь
Protected Trapdoor=Защищённый Люк
Protected Steel Trapdoor=Защищённый Стальной Люк
Protected Chest=Защищённый Сундук
To Chest=В Сундук
To Inventory=В Инвентарь
Protected Chest (@1)=Защищённый Сундук (@1)
### init.lua ###
-- Protector interface --=-- Интерфейс Защитника --
PUNCH node to show protected area=УДАРЬТЕ по блоку чтобы показать защищённую зону
USE for area check=ИСПОЛЬЗУЙТЕ для проверки зоны
Members:=Участники:
Close=Закрыть
Allow faction access=Разрешить частичный доступ
Protection located at: @1=Защитник расположен на: @1
Members: @1.=Участники: @1.
This area is not protected.=Эта зона не защищена.
You can build here.=Вы можете здесь строить.
Overlaps into above players protected area=Перекрывает защищенную зону вышеперечисленных игроков
Protection Block=Блок Защиты
Protection (owned by @1)=Защита (владелец: @1)
Protection Logo=Логотип Защиты
[MOD] Protector Redo loaded=[MOD] Protector Redo загружен
Spawn @1 has been protected up to a @2 block radius.=Спавн @1 был защищён радиусом в блоках @2.
This area is owned by @1=Эта зона принадлежит @1.
### pvp.lua ###
[Protector] on_punchplayer called with nil objects=on_punchplayer вызван на нулевом объекте
[Protector] pvp_protect not active, update your version of Luanti=[Protector] pvp_protect не активен, обновите версию Luanti
[Protector] pvp_protect is disabled=[Protector] pvp_protect выключен
### hud.lua ###
Owner: @1=Владелец: @1
### tool.lua ###
Protector Placer Tool (stand near protector, face direction and use)=Инструмент Размещения Защитника (встаньте рядом с Защитником, повернитесь к нему и используйте предмет)
Protector already in place!=Защитник уже стоит на этом месте!
No protectors available to place!=Нет доступных Защитников чтобы поставить!
Out of bounds!=За пределами!
Protector placed at @1=Защитник размещён на @1
Cannot place protector, already protected at @1=Нельзя поставить Защитник, другой Защитник уже на @1
Cannot place protector, container at @1=Нельзя поставить Защитник, контейнер на @1
+56 -56
View File
@@ -1,57 +1,57 @@
# textdomain: protector
# author: CodeXP and TenPlus1
# last update: 2020/Jul/12
### admin.lua ###
Remove Protectors around players (separate names with spaces)=Ismi verilen oyuncuların yanındaki korumaları kaldır. (İsimleri boşlukla ayır)
<names list>=<isim listesi>
Replace Protector Owner with name provided=Koruyucu Sahibini belirtilen adla değiştirin
<owner name> <name to replace with>=<sahip adı> <değiştirilecek ad>
Replacing Protector name '@1' with '@2'='@1' Koruyucu adını '@2' ile değiştirin
Show protected areas of your nearby protectors=Yakındaki koruyucuların korunan alanlarını göster
Protector Names to remove: @1=Silinecek korumaların isimleri: @1
Name List Reset=İsim listesini sıfırla
Invalid player name!=
Player name too long=
Player not found.=
### doors_chest.lua ###
Protected Wooden Door=Korumalı ahşap kapı
Protected Steel Door=Korumalı çelik kapı
Protected Trapdoor=Korumalı tuzak kapısı
Protected Steel Trapdoor=Korumalı çelik tuzak kapısı
Protected Chest=Korumalı sandık
To Chest=Sandığa
To Inventory=Envantere
Protected Chest (@1)=Korumalı sandık (@1)
### init.lua ###
-- Protector interface --=-- Koruyucu arayüz --
PUNCH node to show protected area=Korunan alanı göstermek için yumruk
USE for area check=Bölge kontrolü için kullan
Members:=Üyeler
Close=Kapat
Protection located at: @1=Korumanın bulunduğu yer @1
Members: @1.=Üyeler @1.
Allow faction access=
This area is not protected.=Bu alan korumalı değildir.
You can build here.=Buraya inşaa edebilirsiniz.
Overlaps into above players protected area=Yukarıdaki oyuncuların koruma alanı ile çakışıyor
Protection Block=Koruma kutusu
Protection (owned by @1)=Koruma (@1 sahibidir)
Protection Logo=Koruma arması
[MOD] Protector Redo loaded=[MOD] Protector Redo yüklendi
Spawn @1 has been protected up to a @2 block radius.=Spawn @1, @2 blok yarıçapa kadar korunur.
This area is owned by @1=Burasının sahibi @1!
### hud.lua ###
Owner: @1=Sahip: @1
### tool.lua ###
Protector Placer Tool (stand near protector, face direction and use)=Koruyucu Yerleştirme Aleti (koruyucunun yanında durun, yüz yönü ve kullanım)
Protector already in place!=Koruyucu zaten yerinde!
No protectors available to place!=Yerleştirilecek koruyucu yok!
Protector placed at @1=Korumanın bulunduğu yer @1
Out of bounds!=
Cannot place protector, already protected at @1=
# textdomain: protector
# author: CodeXP and TenPlus1
# last update: 2020/Jul/12
### admin.lua ###
Remove Protectors around players (separate names with spaces)=Ismi verilen oyuncuların yanındaki korumaları kaldır. (İsimleri boşlukla ayır)
<names list>=<isim listesi>
Replace Protector Owner with name provided=Koruyucu Sahibini belirtilen adla değiştirin
<owner name> <name to replace with>=<sahip adı> <değiştirilecek ad>
Replacing Protector name '@1' with '@2'='@1' Koruyucu adını '@2' ile değiştirin
Show protected areas of your nearby protectors=Yakındaki koruyucuların korunan alanlarını göster
Protector Names to remove: @1=Silinecek korumaların isimleri: @1
Name List Reset=İsim listesini sıfırla
Invalid player name!=
Player name too long=
Player not found.=
### doors_chest.lua ###
Protected Wooden Door=Korumalı ahşap kapı
Protected Steel Door=Korumalı çelik kapı
Protected Trapdoor=Korumalı tuzak kapısı
Protected Steel Trapdoor=Korumalı çelik tuzak kapısı
Protected Chest=Korumalı sandık
To Chest=Sandığa
To Inventory=Envantere
Protected Chest (@1)=Korumalı sandık (@1)
### init.lua ###
-- Protector interface --=-- Koruyucu arayüz --
PUNCH node to show protected area=Korunan alanı göstermek için yumruk
USE for area check=Bölge kontrolü için kullan
Members:=Üyeler
Close=Kapat
Protection located at: @1=Korumanın bulunduğu yer @1
Members: @1.=Üyeler @1.
Allow faction access=
This area is not protected.=Bu alan korumalı değildir.
You can build here.=Buraya inşaa edebilirsiniz.
Overlaps into above players protected area=Yukarıdaki oyuncuların koruma alanı ile çakışıyor
Protection Block=Koruma kutusu
Protection (owned by @1)=Koruma (@1 sahibidir)
Protection Logo=Koruma arması
[MOD] Protector Redo loaded=[MOD] Protector Redo yüklendi
Spawn @1 has been protected up to a @2 block radius.=Spawn @1, @2 blok yarıçapa kadar korunur.
This area is owned by @1=Burasının sahibi @1!
### hud.lua ###
Owner: @1=Sahip: @1
### tool.lua ###
Protector Placer Tool (stand near protector, face direction and use)=Koruyucu Yerleştirme Aleti (koruyucunun yanında durun, yüz yönü ve kullanım)
Protector already in place!=Koruyucu zaten yerinde!
No protectors available to place!=Yerleştirilecek koruyucu yok!
Protector placed at @1=Korumanın bulunduğu yer @1
Out of bounds!=
Cannot place protector, already protected at @1=
Cannot place protector, container at @1=
+56 -56
View File
@@ -1,56 +1,56 @@
# textdomain: protector
Protector Redo=Захист
Lets players craft special blocks to protect their builds or disable PVP in areas.=Дозволяє гравцям створювати спеціальні блоки для захисту їхніх споруд або вимкнення PVP на певних територіях.
### admin.lua ###
Remove Protectors around players (separate names with spaces)=Видалити захист поряд із гравцями (перечислити імена, розділяючи пробілами)
<names list>=<список імен>
Replace Protector Owner with name provided=Замінити власника захисту новим власником
<owner name> <name to replace with>=<ім'я власника> <ім'я нового власника>
Replacing Protector name '@1' with '@2'=Заміняється власник захисту із '@1' на '@2'
Show protected areas of your nearby protectors=Показати найближчі захищені території
Protector Names to remove: @1=Імена, які будуть видалені: @1
Name List Reset=Очистити список імен
### doors_chest.lua ###
Protected Wooden Door=Захищені дерев'яні двері
Protected Steel Door=Захищені сталеві двері
Protected Trapdoor=Захищений дерев'яний люк
Protected Steel Trapdoor=Захищений сталевий люк
Protected Chest=Захищена скриня
To Chest=В скриню
To Inventory=В інвентар
Protected Chest (@1)=Захищена скриня (@1)
### init.lua ###
-- Protector interface --=-- Налаштування захисту --
PUNCH node to show protected area=ВДАРИТИ блок для підсвітки захищеної території
USE for area check=ЛКМ для перевірки захищеної території
Members:=Учасники:
Close=Закрити
Protection located at: @1=Захист знаходиться на координатах: @1
Members: @1.=Учасники: @1.
This area is not protected.=Територія вільна.
You can build here.=Тут можна будувати.
Overlaps into above players protected area=Блок захисту не може бути встановлений тут, десь поруч є територія іншого гравця
Protection Block=Блок захисту території
Protection (owned by @1)=Захист території гравця @1
Protection Logo=Захисний знак
[MOD] Protector Redo loaded=[МОД] Protector Redo завантажено
Spawn @1 has been protected up to a @2 block radius.=Спавн @1 захищений у радіусі @2 блока.
This area is owned by @1=Ця територія належить гравцю @1
### pvp.lua ###
[Protector] on_punchplayer called with nil objects=[Захист] on_punchplayer викликана із нульовими об'єктами
[Protector] pvp_protect not active, update your version of Minetest=[Захист] pvp_protect неактивний, оновіть версію Luanti
[Protector] pvp_protect is disabled=[Защита] pvp_protect вимкнений
### hud.lua ###
Owner: @1=Територія належить @1
### tool.lua ###
Protector Placer Tool (stand near protector, face direction and use)=Інструмент встановлення захисту (встаньте поруч із захистом, поверніться в потрібному напрямку і використайте)
Protector already in place!=Захист уже встановлено!
No protectors available to place!=У вас немає блоків захисту території в інвентарю!
Protector placed at @1=Захист знаходиться на координатах @1
# textdomain: protector
Protector Redo=Захист
Lets players craft special blocks to protect their builds or disable PVP in areas.=Дозволяє гравцям створювати спеціальні блоки для захисту їхніх споруд або вимкнення PVP на певних територіях.
### admin.lua ###
Remove Protectors around players (separate names with spaces)=Видалити захист поряд із гравцями (перечислити імена, розділяючи пробілами)
<names list>=<список імен>
Replace Protector Owner with name provided=Замінити власника захисту новим власником
<owner name> <name to replace with>=<ім'я власника> <ім'я нового власника>
Replacing Protector name '@1' with '@2'=Заміняється власник захисту із '@1' на '@2'
Show protected areas of your nearby protectors=Показати найближчі захищені території
Protector Names to remove: @1=Імена, які будуть видалені: @1
Name List Reset=Очистити список імен
### doors_chest.lua ###
Protected Wooden Door=Захищені дерев'яні двері
Protected Steel Door=Захищені сталеві двері
Protected Trapdoor=Захищений дерев'яний люк
Protected Steel Trapdoor=Захищений сталевий люк
Protected Chest=Захищена скриня
To Chest=В скриню
To Inventory=В інвентар
Protected Chest (@1)=Захищена скриня (@1)
### init.lua ###
-- Protector interface --=-- Налаштування захисту --
PUNCH node to show protected area=ВДАРИТИ блок для підсвітки захищеної території
USE for area check=ЛКМ для перевірки захищеної території
Members:=Учасники:
Close=Закрити
Protection located at: @1=Захист знаходиться на координатах: @1
Members: @1.=Учасники: @1.
This area is not protected.=Територія вільна.
You can build here.=Тут можна будувати.
Overlaps into above players protected area=Блок захисту не може бути встановлений тут, десь поруч є територія іншого гравця
Protection Block=Блок захисту території
Protection (owned by @1)=Захист території гравця @1
Protection Logo=Захисний знак
[MOD] Protector Redo loaded=[МОД] Protector Redo завантажено
Spawn @1 has been protected up to a @2 block radius.=Спавн @1 захищений у радіусі @2 блока.
This area is owned by @1=Ця територія належить гравцю @1
### pvp.lua ###
[Protector] on_punchplayer called with nil objects=[Захист] on_punchplayer викликана із нульовими об'єктами
[Protector] pvp_protect not active, update your version of Minetest=[Захист] pvp_protect неактивний, оновіть версію Luanti
[Protector] pvp_protect is disabled=[Защита] pvp_protect вимкнений
### hud.lua ###
Owner: @1=Територія належить @1
### tool.lua ###
Protector Placer Tool (stand near protector, face direction and use)=Інструмент встановлення захисту (встаньте поруч із захистом, поверніться в потрібному напрямку і використайте)
Protector already in place!=Захист уже встановлено!
No protectors available to place!=У вас немає блоків захисту території в інвентарю!
Protector placed at @1=Захист знаходиться на координатах @1
+59 -59
View File
@@ -1,59 +1,59 @@
# textdomain: protector
# author: ?
# last update: 2020/Jul/12
### admin.lua ###
Remove Protectors around players (separate names with spaces)=
<names list>=
Replace Protector Owner with name provided=
<owner name> <name to replace with>=
Replacing Protector name '@1' with '@2'=
Show protected areas of your nearby protectors=
Protector Names to remove: @1=
Name List Reset=
Invalid player name!=
Player name too long=
Player not found.=
### doors_chest.lua ###
Protected Wooden Door=
Protected Steel Door=
Protected Trapdoor=
Protected Steel Trapdoor=
Protected Chest=
To Chest=
To Inventory=
Protected Chest (@1)=
### init.lua ###
-- Protector interface --=
PUNCH node to show protected area=
USE for area check=
Members:=
Close=
Protection located at: @1=
Members: @1.=
Allow faction access=
This area is not protected.=
You can build here.=
Overlaps into above players protected area=
Protection Block=
Protection (owned by @1)=
Protection Logo=
[MOD] Protector Redo loaded=
Spawn @1 has been protected up to a @2 block radius.=
This area is owned by @1=
Add member names to local protection
Remove member names from local protection
### hud.lua ###
Owner: @1=
### tool.lua ###
Protector Placer Tool (stand near protector, face direction and use)=
Protector already in place!=
Out of bounds!=
No protectors available to place!=
Protector placed at @1=
Cannot place protector, already protected at @1=
Cannot place protector, container at @1=
# textdomain: protector
# author: ?
# last update: 2020/Jul/12
### admin.lua ###
Remove Protectors around players (separate names with spaces)=
<names list>=
Replace Protector Owner with name provided=
<owner name> <name to replace with>=
Replacing Protector name '@1' with '@2'=
Show protected areas of your nearby protectors=
Protector Names to remove: @1=
Name List Reset=
Invalid player name!=
Player name too long=
Player not found.=
### doors_chest.lua ###
Protected Wooden Door=
Protected Steel Door=
Protected Trapdoor=
Protected Steel Trapdoor=
Protected Chest=
To Chest=
To Inventory=
Protected Chest (@1)=
### init.lua ###
-- Protector interface --=
PUNCH node to show protected area=
USE for area check=
Members:=
Close=
Protection located at: @1=
Members: @1.=
Allow faction access=
This area is not protected.=
You can build here.=
Overlaps into above players protected area=
Protection Block=
Protection (owned by @1)=
Protection Logo=
[MOD] Protector Redo loaded=
Spawn @1 has been protected up to a @2 block radius.=
This area is owned by @1=
Add member names to local protection
Remove member names from local protection
### hud.lua ###
Owner: @1=
### tool.lua ###
Protector Placer Tool (stand near protector, face direction and use)=
Protector already in place!=
Out of bounds!=
No protectors available to place!=
Protector placed at @1=
Cannot place protector, already protected at @1=
Cannot place protector, container at @1=
+15 -15
View File
@@ -1,15 +1,15 @@
-- add lucky blocks
lucky_block:add_blocks({
{"dro", {"protector:protect"}, 2},
{"dro", {"protector:protect2"}, 2},
{"dro", {"protector:door_wood"}, 2},
{"dro", {"protector:door_steel"}, 2},
{"exp", 5, true},
{"dro", {"protector:trapdoor"}, 2},
{"dro", {"protector:trapdoor_steel"}, 2},
{"dro", {"protector:tool"}, 1},
{"dro", {"protector:chest"}, 1},
{"exp"}
})
-- add lucky blocks
lucky_block:add_blocks({
{"dro", {"protector:protect"}, 2},
{"dro", {"protector:protect2"}, 2},
{"dro", {"protector:door_wood"}, 2},
{"dro", {"protector:door_steel"}, 2},
{"exp", 5, true},
{"dro", {"protector:trapdoor"}, 2},
{"dro", {"protector:trapdoor_steel"}, 2},
{"dro", {"protector:tool"}, 1},
{"dro", {"protector:chest"}, 1},
{"exp"}
})
+4 -4
View File
@@ -1,4 +1,4 @@
name = protector
description = Lets players craft special blocks to protect their builds or disable PVP in areas.
optional_depends = default, lucky_block, mesecons_mvps, playerfactions, mcl_core, mcl_formspec, mcl_sounds
min_minetest_version = 5.0
name = protector
description = Lets players craft special blocks to protect their builds or disable PVP in areas.
optional_depends = default, lucky_block, mesecons_mvps, playerfactions, mcl_core, mcl_formspec, mcl_sounds
min_minetest_version = 5.0
+70 -70
View File
@@ -1,70 +1,70 @@
-- get static spawn position
local statspawn = core.string_to_pos(core.settings:get("static_spawnpoint"))
or {x = 0, y = 2, z = 0}
-- is spawn protected
local protector_spawn = tonumber(core.settings:get("protector_spawn")
or core.settings:get("protector_pvp_spawn")) or 0
-- is night-only pvp enabled
local protector_night_pvp = core.settings:get_bool("protector_night_pvp")
-- disables PVP in your own protected areas
if core.settings:get_bool("enable_pvp")
and core.settings:get_bool("protector_pvp") then
if core.register_on_punchplayer then
core.register_on_punchplayer(function(player, hitter,
time_from_last_punch, tool_capabilities, dir, damage)
if not player or not hitter then
print("[MOD] Protector - on_punchplayer called with nil objects")
return false
end
if not hitter:is_player() then return false end
-- no pvp at spawn area
local pos = player:get_pos()
if pos.x < statspawn.x + protector_spawn
and pos.x > statspawn.x - protector_spawn
and pos.y < statspawn.y + protector_spawn
and pos.y > statspawn.y - protector_spawn
and pos.z < statspawn.z + protector_spawn
and pos.z > statspawn.z - protector_spawn then
return true
end
-- do we enable pvp at night time only ?
if protector_night_pvp then
-- get time of day
local tod = core.get_timeofday() or 0
if tod > 0.2 and tod < 0.8 then
--
else
return false
end
end
-- is player being punched inside a protected area ?
if core.is_protected(pos, hitter:get_player_name()) then
return true
end
return false
end)
else
print("[MOD] Protector - pvp_protect not active, update your version of Minetest")
end
else
print("[MOD] Protector - pvp_protect is disabled")
end
-- get static spawn position
local statspawn = core.string_to_pos(core.settings:get("static_spawnpoint"))
or {x = 0, y = 2, z = 0}
-- is spawn protected
local protector_spawn = tonumber(core.settings:get("protector_spawn")
or core.settings:get("protector_pvp_spawn")) or 0
-- is night-only pvp enabled
local protector_night_pvp = core.settings:get_bool("protector_night_pvp")
-- disables PVP in your own protected areas
if core.settings:get_bool("enable_pvp")
and core.settings:get_bool("protector_pvp") then
if core.register_on_punchplayer then
core.register_on_punchplayer(function(player, hitter,
time_from_last_punch, tool_capabilities, dir, damage)
if not player or not hitter then
print("[MOD] Protector - on_punchplayer called with nil objects")
return false
end
if not hitter:is_player() then return false end
-- no pvp at spawn area
local pos = player:get_pos()
if pos.x < statspawn.x + protector_spawn
and pos.x > statspawn.x - protector_spawn
and pos.y < statspawn.y + protector_spawn
and pos.y > statspawn.y - protector_spawn
and pos.z < statspawn.z + protector_spawn
and pos.z > statspawn.z - protector_spawn then
return true
end
-- do we enable pvp at night time only ?
if protector_night_pvp then
-- get time of day
local tod = core.get_timeofday() or 0
if tod > 0.2 and tod < 0.8 then
--
else
return false
end
end
-- is player being punched inside a protected area ?
if core.is_protected(pos, hitter:get_player_name()) then
return true
end
return false
end)
else
print("[MOD] Protector - pvp_protect not active, update your version of Minetest")
end
else
print("[MOD] Protector - pvp_protect is disabled")
end
+35 -35
View File
@@ -1,35 +1,35 @@
# Size of protected area around protection node limiting player interaction
protector_radius (Protector Radius [max 30]) int 5
# Flips player around when accessing protected area to stop lag griefing
protector_flip (Protector Flip) bool false
# Hurts player by amount entered when accessing protected area, 0 to disable
protector_hurt (Protector Hurt) int 0
# Sets a protected area around spawn by node radius given
protector_spawn (Protector Spawn) int 0
# Enables PVP inside of protected areas
protector_pvp (Protector PVP) bool false
# When true will allow PVP inside protected spawn area
protector_pvp_spawn (Protector PVP Spawn) int 0
# When true will allow PVP inside all protected areas at night time only
protector_night_pvp (Protector Night PVP) bool false
# Interval in seconds that protection field is shown
protector_show_interval (Protector Show Interval) int 5
# Interval in seconds that HUD ownership text is updated, 0 to disable
protector_hud_interval (Protector HUD Interval) int 5
# Enables craft recipe for protection block
protector_recipe (Enable Protector recipe) bool true
# Enables craft recipes for protected doors and chest
protector_crafts (Enable Protector door/chest recipes) bool true
# Enables protection messages in player chat
protector_msg (Enable Protector Messages) bool true
# Length of protected cube from the corner of the protection node
protector_length (Protector Length [max 60]) int 15
# Flips player around when accessing protected area to stop lag griefing
protector_flip (Protector Flip) bool false
# Hurts player by amount entered when accessing protected area, 0 to disable
protector_hurt (Protector Hurt) int 0
# Sets a protected area around spawn by node radius given
protector_spawn (Protector Spawn) int 0
# Enables PVP inside of protected areas
protector_pvp (Protector PVP) bool false
# When true will allow PVP inside protected spawn area
protector_pvp_spawn (Protector PVP Spawn) int 0
# When true will allow PVP inside all protected areas at night time only
protector_night_pvp (Protector Night PVP) bool false
# Interval in seconds that protection field is shown
protector_show_interval (Protector Show Interval) int 5
# Interval in seconds that HUD ownership text is updated, 0 to disable
protector_hud_interval (Protector HUD Interval) int 5
# Enables craft recipe for protection block
protector_recipe (Enable Protector recipe) bool true
# Enables craft recipes for protected doors and chest
protector_crafts (Enable Protector door/chest recipes) bool true
# Enables protection messages in player chat
protector_msg (Enable Protector Messages) bool true
+34 -34
View File
@@ -1,34 +1,34 @@
following Textures created by Fernando Zapata (CC BY-SA 3.0):
doors_wood.png
doors_wood_a.png
doors_wood_b.png
doors_brown.png
following Textures created by BlockMen (WTFPL):
doors_trapdoor.png
following textures created by celeron55 (CC BY-SA 3.0):
doors_trapdoor_side.png
following textures created by PilzAdam (WTFPL):
doors_steel.png
doors_steel_a.png
doors_steel_b.png
doors_grey.png
doors_trapdoor_steel.png
doors_trapdoor_steel_side.png
following textures by Cisoun (WTFPL):
default_chest_front.png
default_chest_side.png
default_chest_top.png
following textures by TenPlus1 (CC BY-SA 3.0):
protector_logo.png
protector_display.png
protector_overlay.png
following textures by Kilbith (CC BY-SA 3.0):
protector_up_icon.png
protector_down_icon.png (both rotated)
following Textures created by Fernando Zapata (CC BY-SA 3.0):
doors_wood.png
doors_wood_a.png
doors_wood_b.png
doors_brown.png
following Textures created by BlockMen (WTFPL):
doors_trapdoor.png
following textures created by celeron55 (CC BY-SA 3.0):
doors_trapdoor_side.png
following textures created by PilzAdam (WTFPL):
doors_steel.png
doors_steel_a.png
doors_steel_b.png
doors_grey.png
doors_trapdoor_steel.png
doors_trapdoor_steel_side.png
following textures by Cisoun (WTFPL):
default_chest_front.png
default_chest_side.png
default_chest_top.png
following textures by TenPlus1 (CC BY-SA 3.0):
protector_logo.png
protector_display.png
protector_overlay.png
following textures by Kilbith (CC BY-SA 3.0):
protector_up_icon.png
protector_down_icon.png (both rotated)
+173 -168
View File
@@ -1,168 +1,173 @@
-- protector placement tool (thanks to Shara for code and idea)
local S = core.get_translator("protector")
-- get protection radius
local r = protector.radius
-- protector placement tool
core.register_craftitem("protector:tool", {
description = S("Protector Placer Tool (stand near protector, face direction and use)"),
inventory_image = "protector_tool.png",
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
local name = user:get_player_name()
-- check for protector near player (2 block radius)
local pos = user:get_pos()
local pp = core.find_nodes_in_area(
vector.subtract(pos, 2), vector.add(pos, 2),
{"protector:protect", "protector:protect2", "protector:protect_hidden"})
if #pp == 0 then return end -- none found
pos = pp[1] -- take position of first protector found
-- get members on protector
local meta = core.get_meta(pos)
local members = meta:get_string("members") or ""
local factions = meta:get_string("factions") or ""
-- get direction player is facing
local dir = core.dir_to_facedir( user:get_look_dir() )
local vec = {x = 0, y = 0, z = 0}
local gap = (r * 2) + 1
local pit = user:get_look_vertical()
-- set placement coords
if pit > 1.2 then vec.y = -gap -- up
elseif pit < -1.2 then vec.y = gap -- down
elseif dir == 0 then vec.z = gap -- north
elseif dir == 1 then vec.x = gap -- east
elseif dir == 2 then vec.z = -gap -- south
elseif dir == 3 then vec.x = -gap -- west
end
-- new position
pos.x = pos.x + vec.x
pos.y = pos.y + vec.y
pos.z = pos.z + vec.z
-- does placing a protector overlap existing area
if not protector.can_dig(r * 2, pos, user:get_player_name(), true, 3) then
core.chat_send_player(name,
S("Overlaps into above players protected area"))
return
end
-- does a protector already exist ?
if #core.find_nodes_in_area(pos, pos,
{"protector:protect", "protector:protect2",
"protector:protect_hidden"}) > 0 then
core.chat_send_player(name, S("Protector already in place!"))
return
end
-- do not place protector out of map bounds or replace bedrock
if #core.find_nodes_in_area(pos, pos, {"ignore", "mcl_core:bedrock"}) > 0 then
core.chat_send_player(name, S("Out of bounds!"))
return
end
-- do we have protectors to use ?
local nod
local inv = user:get_inventory()
if not inv:contains_item("main", "protector:protect")
and not inv:contains_item("main", "protector:protect2") then
core.chat_send_player(name,
S("No protectors available to place!"))
return
end
-- take protector (block first then logo)
if inv:contains_item("main", "protector:protect") then
inv:remove_item("main", "protector:protect")
nod = "protector:protect"
elseif inv:contains_item("main", "protector:protect2") then
inv:remove_item("main", "protector:protect2")
nod = "protector:protect2"
end
-- do not replace containers with inventory space
local inv = core.get_inventory({type = "node", pos = pos})
if inv then
core.chat_send_player(name,
S("Cannot place protector, container at @1",
core.pos_to_string(pos)))
return
end
-- protection check for other mods like Areas
if core.is_protected(pos, name) then
core.chat_send_player(name,
S("Cannot place protector, already protected at @1",
core.pos_to_string(pos)))
return
end
-- place protector
core.set_node(pos, {name = nod, param2 = 1})
-- set protector metadata
local meta = core.get_meta(pos)
meta:set_string("owner", name)
meta:set_string("infotext", "Protection (owned by " .. name .. ")")
-- copy members across if holding sneak when using tool
if user:get_player_control().sneak then
meta:set_string("members", members)
meta:set_string("factions", factions)
else
meta:set_string("members", "")
end
core.add_entity(pos, "protector:display")
core.chat_send_player(name,
S("Protector placed at @1", core.pos_to_string(pos)))
end
})
-- tool recipe
local df = "default:steel_ingot"
if core.get_modpath("mcl_core") then
df = "mcl_core:iron_ingot"
end
core.register_craft({
output = "protector:tool",
recipe = {
{df, df, df},
{df, "protector:protect", df},
{df, df, df}
}
})
-- protector placement tool (thanks to Shara for code and idea)
local S = core.get_translator("protector")
-- get protection length
local r = protector.length
-- protector placement tool
core.register_craftitem("protector:tool", {
description = S("Protector Placer Tool (stand near protector, face direction and use)"),
inventory_image = "protector_tool.png",
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
local name = user:get_player_name()
-- check for protector near player (2 block search)
local pos = user:get_pos()
local pp = core.find_nodes_in_area(
vector.subtract(pos, 2), vector.add(pos, 2),
{"protector:protect", "protector:protect2", "protector:protect_hidden"})
if #pp == 0 then return end -- none found
pos = pp[1] -- take position of first protector found
-- get members on protector
local meta = core.get_meta(pos)
local members = meta:get_string("members") or ""
local factions = meta:get_string("factions") or ""
-- get direction player is facing
local dir = core.dir_to_facedir( user:get_look_dir() )
local vec = {x = 0, y = 0, z = 0}
local gap = r + 1
local pit = user:get_look_vertical()
-- set placement coords
if pit > 1.2 then vec.y = -gap -- up
elseif pit < -1.2 then vec.y = gap -- down
elseif dir == 0 then vec.z = gap -- north
elseif dir == 1 then vec.x = gap -- east
elseif dir == 2 then vec.z = -gap -- south
elseif dir == 3 then vec.x = -gap -- west
end
-- new position
pos.x = pos.x + vec.x
pos.y = pos.y + vec.y
pos.z = pos.z + vec.z
-- does placing a protector overlap existing area
local ov = core.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"})
for _, npos in ipairs(ov) do
if core.get_meta(npos):get_string("owner") ~= name then
core.chat_send_player(name,
S("Overlaps into above players protected area"))
return
end
end
-- does a protector already exist ?
if #core.find_nodes_in_area(pos, pos,
{"protector:protect", "protector:protect2",
"protector:protect_hidden"}) > 0 then
core.chat_send_player(name, S("Protector already in place!"))
return
end
-- do not place protector out of map bounds or replace bedrock
if #core.find_nodes_in_area(pos, pos, {"ignore", "mcl_core:bedrock"}) > 0 then
core.chat_send_player(name, S("Out of bounds!"))
return
end
-- do we have protectors to use ?
local nod
local inv = user:get_inventory()
if not inv:contains_item("main", "protector:protect")
and not inv:contains_item("main", "protector:protect2") then
core.chat_send_player(name,
S("No protectors available to place!"))
return
end
-- take protector (block first then logo)
if inv:contains_item("main", "protector:protect") then
inv:remove_item("main", "protector:protect")
nod = "protector:protect"
elseif inv:contains_item("main", "protector:protect2") then
inv:remove_item("main", "protector:protect2")
nod = "protector:protect2"
end
-- do not replace containers with inventory space
local inv = core.get_inventory({type = "node", pos = pos})
if inv then
core.chat_send_player(name,
S("Cannot place protector, container at @1",
core.pos_to_string(pos)))
return
end
-- protection check for other mods like Areas
if core.is_protected(pos, name) then
core.chat_send_player(name,
S("Cannot place protector, already protected at @1",
core.pos_to_string(pos)))
return
end
-- place protector
core.set_node(pos, {name = nod, param2 = 1})
-- set protector metadata
local meta = core.get_meta(pos)
meta:set_string("owner", name)
meta:set_string("infotext", "Protection (owned by " .. name .. ")")
-- copy members across if holding sneak when using tool
if user:get_player_control().sneak then
meta:set_string("members", members)
meta:set_string("factions", factions)
else
meta:set_string("members", "")
end
core.add_entity({x=pos.x+r/2, y=pos.y+r/2, z=pos.z+r/2}, "protector:display")
core.chat_send_player(name,
S("Protector placed at @1", core.pos_to_string(pos)))
end
})
-- tool recipe
local df = "default:steel_ingot"
if core.get_modpath("mcl_core") then
df = "mcl_core:iron_ingot"
end
core.register_craft({
output = "protector:tool",
recipe = {
{df, df, df},
{df, "protector:protect", df},
{df, df, df}
}
})