Merge branch 'master' of https://notabug.org/TenPlus1/protector into upstream
This commit is contained in:
commit
3d3332cda2
@ -59,6 +59,8 @@ Change log:
|
||||
- 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)
|
||||
|
||||
Lucky Blocks: 10
|
||||
|
||||
@ -95,6 +97,11 @@ reset name list
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
104
admin.lua
104
admin.lua
@ -68,7 +68,7 @@ minetest.register_chatcommand("protector_replace", {
|
||||
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"protector:protect", "protector:protect2"},
|
||||
nodenames = {"protector:protect", "protector:protect2", "protector:protect_hidden"},
|
||||
interval = 8,
|
||||
chance = 1,
|
||||
catch_up = false,
|
||||
@ -112,7 +112,7 @@ minetest.register_abm({
|
||||
local r = tonumber(minetest.settings:get("protector_radius")) or 5
|
||||
|
||||
-- show protection areas of nearby protectors owned by you (thanks agaran)
|
||||
minetest.register_chatcommand("protector_show", {
|
||||
minetest.register_chatcommand("protector_show_area", {
|
||||
params = "",
|
||||
description = S("Show protected areas of your nearby protectors"),
|
||||
privs = {},
|
||||
@ -125,7 +125,7 @@ minetest.register_chatcommand("protector_show", {
|
||||
local pos = minetest.find_nodes_in_area(
|
||||
{x = ppos.x - r, y = ppos.y - r, z = ppos.z - r},
|
||||
{x = ppos.x + r, y = ppos.y + r, z = ppos.z + r},
|
||||
{"protector:protect", "protector:protect2"})
|
||||
{"protector:protect", "protector:protect2", "protector:protect_hidden"})
|
||||
|
||||
local meta, owner
|
||||
|
||||
@ -135,9 +135,105 @@ minetest.register_chatcommand("protector_show", {
|
||||
meta = minetest.get_meta(pos[n])
|
||||
owner = meta:get_string("owner") or ""
|
||||
|
||||
if owner == name then
|
||||
if owner == name
|
||||
or minetest.check_player_privs(name, {protection_bypass = true}) then
|
||||
minetest.add_entity(pos[n], "protector:display")
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
-- ability to hide protection blocks (borrowed from doors mod :)
|
||||
minetest.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},
|
||||
on_blast = function() end,
|
||||
-- 1px block inside door hinge near node top
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {-15/32, 13/32, -15/32, -13/32, 1/2, -13/32},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
minetest.register_chatcommand("protector_show", {
|
||||
params = "",
|
||||
description = S("Show your nearby protection blocks"),
|
||||
privs = {interact = true},
|
||||
|
||||
func = function(name, param)
|
||||
|
||||
local player = minetest.get_player_by_name(name)
|
||||
|
||||
if not player then
|
||||
return false, "Player not found"
|
||||
end
|
||||
|
||||
local pos = player:get_pos()
|
||||
|
||||
local a = minetest.find_nodes_in_area(
|
||||
{x = pos.x - r, y = pos.y - r, z = pos.z - r},
|
||||
{x = pos.x + r, y = pos.y + r, z = pos.z + r},
|
||||
{"protector:protect_hidden"})
|
||||
|
||||
local meta, owner
|
||||
|
||||
for _, row in pairs(a) do
|
||||
|
||||
meta = minetest.get_meta(row)
|
||||
owner = meta:get_string("owner") or ""
|
||||
|
||||
if owner == name
|
||||
or minetest.check_player_privs(name, {protection_bypass = true}) then
|
||||
minetest.swap_node(row, {name = "protector:protect"})
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("protector_hide", {
|
||||
params = "",
|
||||
description = S("Hide your nearby protection blocks"),
|
||||
privs = {interact = true},
|
||||
|
||||
func = function(name, param)
|
||||
|
||||
local player = minetest.get_player_by_name(name)
|
||||
|
||||
if not player then
|
||||
return false, "Player not found"
|
||||
end
|
||||
|
||||
local pos = player:get_pos()
|
||||
|
||||
local a = minetest.find_nodes_in_area(
|
||||
{x = pos.x - r, y = pos.y - r, z = pos.z - r},
|
||||
{x = pos.x + r, y = pos.y + r, z = pos.z + r},
|
||||
{"protector:protect", "protector:protect2"})
|
||||
|
||||
local meta, owner
|
||||
|
||||
for _, row in pairs(a) do
|
||||
|
||||
meta = minetest.get_meta(row)
|
||||
owner = meta:get_string("owner") or ""
|
||||
|
||||
if owner == name
|
||||
or minetest.check_player_privs(name, {protection_bypass = true}) then
|
||||
minetest.swap_node(row, {name = "protector:protect_hidden"})
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
@ -2,3 +2,4 @@ default?
|
||||
intllib?
|
||||
lucky_block?
|
||||
mesecons_mvps?
|
||||
playerfactions?
|
||||
|
8
hud.lua
8
hud.lua
@ -3,12 +3,14 @@ local S = protector.intllib
|
||||
local radius = (tonumber(minetest.setting_get("protector_radius")) or 5)
|
||||
local hud = {}
|
||||
local hud_timer = 0
|
||||
local hud_interval = (tonumber(minetest.setting_get("protector_hud_interval")) or 5)
|
||||
|
||||
if hud_interval > 0 then
|
||||
minetest.register_globalstep(function(dtime)
|
||||
|
||||
-- every 5 seconds
|
||||
hud_timer = hud_timer + dtime
|
||||
if hud_timer < 5 then
|
||||
if hud_timer < hud_interval then
|
||||
return
|
||||
end
|
||||
hud_timer = 0
|
||||
@ -22,7 +24,7 @@ minetest.register_globalstep(function(dtime)
|
||||
local protectors = minetest.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","protector:protect2", "protector:protect_hidden"})
|
||||
|
||||
if #protectors > 0 then
|
||||
local npos = protectors[1]
|
||||
@ -57,3 +59,5 @@ end)
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
hud[player:get_player_name()] = nil
|
||||
end)
|
||||
|
||||
end
|
||||
|
37
init.lua
37
init.lua
@ -13,6 +13,8 @@ local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||
local S = dofile(MP .. "/intllib.lua")
|
||||
local F = minetest.formspec_escape
|
||||
|
||||
-- Load support for factions
|
||||
local factions_available = minetest.global_exists("factions")
|
||||
|
||||
protector = {
|
||||
mod = "redo",
|
||||
@ -58,6 +60,15 @@ end
|
||||
-- check for member name
|
||||
local is_member = function (meta, name)
|
||||
|
||||
if factions_available
|
||||
and meta:get_int("faction_members") == 1
|
||||
and factions.get_player_faction(name) ~= nil
|
||||
and factions.get_player_faction(meta:get_string("owner")) ==
|
||||
factions.get_player_faction(name) then
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
for _, n in pairs(get_member_list(meta)) do
|
||||
|
||||
if n == name then
|
||||
@ -129,6 +140,19 @@ local protector_formspec = function(meta)
|
||||
local npp = protector_max_share_count -- max users added to protector list
|
||||
local i = 0
|
||||
|
||||
if factions_available
|
||||
and factions.get_player_faction(meta:get_string("owner")) then
|
||||
|
||||
formspec = formspec .. "checkbox[0,5;faction_members;"
|
||||
.. F(S("Allow faction access"))
|
||||
.. ";" .. (meta:get_int("faction_members") == 1 and
|
||||
"true" or "false") .. "]"
|
||||
|
||||
if npp > 8 then
|
||||
npp = 8
|
||||
end
|
||||
end
|
||||
|
||||
for n = 1, #members do
|
||||
|
||||
if i < npp then
|
||||
@ -220,7 +244,7 @@ protector.can_dig = function(r, pos, digger, onlyowner, infolevel)
|
||||
pos = minetest.find_nodes_in_area(
|
||||
{x = pos.x - r, y = pos.y - r, z = pos.z - r},
|
||||
{x = pos.x + r, y = pos.y + r, z = pos.z + r},
|
||||
{"protector:protect", "protector:protect2"})
|
||||
{"protector:protect", "protector:protect2", "protector:protect_hidden"})
|
||||
|
||||
local meta, owner, members
|
||||
|
||||
@ -293,7 +317,11 @@ function minetest.is_protected(pos, digger)
|
||||
|
||||
-- hurt player if protection violated
|
||||
if protector_hurt > 0 and player:get_hp() > 0 then
|
||||
player:set_hp(player:get_hp() - protector_hurt)
|
||||
|
||||
-- This delay fixes item duplication bug (thanks luk3yx)
|
||||
minetest.after(0.1, function()
|
||||
player:set_hp(player:get_hp() - protector_hurt)
|
||||
end)
|
||||
end
|
||||
|
||||
-- flip player when protection violated
|
||||
@ -609,6 +637,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
return
|
||||
end
|
||||
|
||||
-- add faction members
|
||||
if factions_available then
|
||||
meta:set_int("faction_members", fields.faction_members == "true" and 1 or 0)
|
||||
end
|
||||
|
||||
-- add member [+]
|
||||
if add_member_input then
|
||||
|
||||
|
180
locale/it.po
Normal file
180
locale/it.po
Normal file
@ -0,0 +1,180 @@
|
||||
# Italian translation for PROTECTOR MOD.
|
||||
# Copyright (C) 2020 Hamlet
|
||||
# This file is distributed under the same license as the PROTECTOR MOD package.
|
||||
# Xanthin <xanthin@wiuwiu.de>, 2016.
|
||||
# CodeXP <codexp@gmx.net>, 2018.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PROTECTOR MOD\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-07-10 17:33+0200\n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 2.2.1\n"
|
||||
"Last-Translator: Hamlet <hamlatgitlab@riseup.net>\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"Language: it\n"
|
||||
|
||||
#: admin.lua
|
||||
msgid "Remove Protectors around players (separate names with spaces)"
|
||||
msgstr "Elimina i protettori attorno ai giocatori (separa i nomi con gli spazi)"
|
||||
|
||||
#: admin.lua
|
||||
msgid "<names list>"
|
||||
msgstr "<elenco nomi>"
|
||||
|
||||
#: admin.lua
|
||||
msgid "Replace Protector Owner with name provided"
|
||||
msgstr "Sostituisci il proprietario del protettore col nome fornito"
|
||||
|
||||
#: admin.lua
|
||||
msgid "<owner name> <name to replace with>"
|
||||
msgstr "<nome proprietario> <nome con cui sostituirlo>"
|
||||
|
||||
#: admin.lua
|
||||
msgid "Replacing Protector name '@1' with '@2'"
|
||||
msgstr "Sostituzione del nome del protettore '@1' con '@2'"
|
||||
|
||||
#: admin.lua
|
||||
msgid "Show protected areas of your nearby protectors"
|
||||
msgstr "Mostra le aree protette dei protettori vicino a te"
|
||||
|
||||
#: admin.lua
|
||||
msgid "Protector Names to remove: @1"
|
||||
msgstr "Nomi dei protettori da eliminare: @1"
|
||||
|
||||
#: admin.lua
|
||||
msgid "Name List Reset"
|
||||
msgstr "Azzera l'elenco dei nomi"
|
||||
|
||||
#: doors_chest.lua
|
||||
msgid "Protected Wooden Door"
|
||||
msgstr "Porta di legno protetta"
|
||||
|
||||
#: doors_chest.lua
|
||||
msgid "Protected Steel Door"
|
||||
msgstr "Porta d'acciaio protetta"
|
||||
|
||||
#: doors_chest.lua
|
||||
msgid "Protected Trapdoor"
|
||||
msgstr "Botola protetta"
|
||||
|
||||
#: doors_chest.lua
|
||||
msgid "Protected Steel Trapdoor"
|
||||
msgstr "Botola d'acciaio protetta"
|
||||
|
||||
#: doors_chest.lua
|
||||
msgid "Protected Chest"
|
||||
msgstr "Baule protetto"
|
||||
|
||||
#: doors_chest.lua
|
||||
msgid "To Chest"
|
||||
msgstr "Al baule"
|
||||
|
||||
#: doors_chest.lua
|
||||
msgid "To Inventory"
|
||||
msgstr "All'inventario"
|
||||
|
||||
#: doors_chest.lua
|
||||
msgid "Protected Chest (@1)"
|
||||
msgstr "Baule protetto (@1)"
|
||||
|
||||
#: init.lua
|
||||
msgid "-- Protector interface --"
|
||||
msgstr "-- Interfaccia protettore --"
|
||||
|
||||
#: init.lua
|
||||
msgid "PUNCH node to show protected area"
|
||||
msgstr "COLPISCI il nodo per mostrare l'area protetta"
|
||||
|
||||
#: init.lua
|
||||
msgid "USE for area check"
|
||||
msgstr "USA per controllare l'area"
|
||||
|
||||
#: init.lua
|
||||
msgid "Members:"
|
||||
msgstr "Membri:"
|
||||
|
||||
#: init.lua
|
||||
msgid "Close"
|
||||
msgstr "Chiudi"
|
||||
|
||||
#: init.lua
|
||||
msgid "Protection located at: @1"
|
||||
msgstr "Protezione collocata a: @1"
|
||||
|
||||
#: init.lua
|
||||
msgid "Members: @1."
|
||||
msgstr "Membri: @1."
|
||||
|
||||
#: init.lua
|
||||
msgid "This area is not protected."
|
||||
msgstr "Quest'area non è protetta."
|
||||
|
||||
#: init.lua
|
||||
msgid "You can build here."
|
||||
msgstr "Qui puoi costruire."
|
||||
|
||||
#: init.lua tool.lua
|
||||
msgid "Overlaps into above players protected area"
|
||||
msgstr "Si sovrappone ad un'area sovrastante protetta dai giocatori"
|
||||
|
||||
#: init.lua
|
||||
msgid "Protection Block"
|
||||
msgstr "Blocco di protezione"
|
||||
|
||||
#: admin.lua init.lua tool.lua
|
||||
msgid "Protection (owned by @1)"
|
||||
msgstr "Protezione (di proprietà di @1)"
|
||||
|
||||
#: init.lua
|
||||
msgid "Protection Logo"
|
||||
msgstr "Logo di protezione"
|
||||
|
||||
#: init.lua
|
||||
msgid "[MOD] Protector Redo loaded"
|
||||
msgstr "[MOD] Protector Redo caricato"
|
||||
|
||||
#: init.lua
|
||||
msgid "Spawn @1 has been protected up to a @2 block radius."
|
||||
msgstr "Lo spawn @1 è stato protetto fino a un raggio di @2 blocchi."
|
||||
|
||||
#: init.lua
|
||||
msgid "This area is owned by @1"
|
||||
msgstr "Quest'area è di proprietà di @1"
|
||||
|
||||
#: pvp.lua
|
||||
msgid "[Protector] on_punchplayer called with nil objects"
|
||||
msgstr "[Protector] on_punchplayer chiamato con oggetti nil"
|
||||
|
||||
#: pvp.lua
|
||||
msgid "[Protector] pvp_protect not active, update your version of Minetest"
|
||||
msgstr "[Protector] pvp_protect non attiva, aggiorna la tua versione di Minetest"
|
||||
|
||||
#: pvp.lua
|
||||
msgid "[Protector] pvp_protect is disabled"
|
||||
msgstr "[Protector] pvp_protect è disattivato"
|
||||
|
||||
#: hud.lua
|
||||
msgid "Owner: @1"
|
||||
msgstr "Proprietario: @1"
|
||||
|
||||
#: tool.lua
|
||||
msgid "Protector Placer Tool (stand near protector, face direction and use)"
|
||||
msgstr "Strumento di posizionamento protettore (stai vicino al protettore, guarda la direzione e usa)"
|
||||
|
||||
#: tool.lua
|
||||
msgid "Protector already in place!"
|
||||
msgstr "Protettore già presente!"
|
||||
|
||||
#: tool.lua
|
||||
msgid "No protectors available to place!"
|
||||
msgstr "Nessun protettore disponibile da posizionare!"
|
||||
|
||||
#: tool.lua
|
||||
msgid "Protector placed at @1"
|
||||
msgstr "Protettore posizionato a @1"
|
26
settingtypes.txt
Normal file
26
settingtypes.txt
Normal file
@ -0,0 +1,26 @@
|
||||
# Size of protected area around protection node limiting player interaction
|
||||
protector_radius (Protector Radius) 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
|
Loading…
x
Reference in New Issue
Block a user