Compare commits
	
		
			12 Commits
		
	
	
		
			nalc-1.2.0
			...
			2fda1adbd7
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 2fda1adbd7 | |||
| 
						 | 
					cba647225c | ||
| 
						 | 
					c8cf4aba92 | ||
| 64b19c2594 | |||
| 
						 | 
					d464d3484f | ||
| a8cacee8cc | |||
| 76f8ccf8ab | |||
| 02b23b0371 | |||
| 
						 | 
					4018c0d204 | ||
| 
						 | 
					c167b30ebf | ||
| 4eeb2a9d11 | |||
| 
						 | 
					a9c05f0e38 | 
@@ -10,7 +10,7 @@ read_globals = {
 | 
				
			|||||||
	"AreaStore",
 | 
						"AreaStore",
 | 
				
			||||||
	"default",
 | 
						"default",
 | 
				
			||||||
	"factions",
 | 
						"factions",
 | 
				
			||||||
	table = { fields = { "copy", "getn" } }
 | 
						table = { fields = { "copy", "getn", "indexof" } }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
globals = {
 | 
					globals = {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										19
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								README.md
									
									
									
									
									
								
							@@ -5,6 +5,11 @@ Dependencies
 | 
				
			|||||||
------------
 | 
					------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Minetest 5.0.0+ is recommended, but 0.4.16+ should work as well.
 | 
					Minetest 5.0.0+ is recommended, but 0.4.16+ should work as well.
 | 
				
			||||||
 | 
					Minetest 5.0.0+
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Optional support for following mods:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  * [playerfactions](https://git.leagueh.xyz/katp32/playerfactions/) by [katp32](https://git.leagueh.xyz/katp32) & [Kalio_42](https://git.leagueh.xyz/Kalio_42)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Configuration
 | 
					Configuration
 | 
				
			||||||
@@ -82,7 +87,7 @@ Commands
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  * `/remove_area <ID>` -- Removes an area that you own. Any sub-areas of that
 | 
					  * `/remove_area <ID>` -- Removes an area that you own. Any sub-areas of that
 | 
				
			||||||
	area are made sub-areas of the removed area's parent, if it exists.
 | 
						area are made sub-areas of the removed area's parent, if it exists.
 | 
				
			||||||
	If the removed area has no parent it's sub-areas will have no parent.
 | 
						If the removed area has no parent its sub-areas will have no parent.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  * `/recursive_remove_areas <ID>` -- Removes an area and all sub-areas of it.
 | 
					  * `/recursive_remove_areas <ID>` -- Removes an area and all sub-areas of it.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -101,14 +106,22 @@ Commands
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  * `/area_pos2 [X,Y,Z|X Y Z]` -- Sets area position two to your position or
 | 
					  * `/area_pos2 [X,Y,Z|X Y Z]` -- Sets area position two to your position or
 | 
				
			||||||
	the one supplied.
 | 
						the one supplied.
 | 
				
			||||||
	
 | 
					
 | 
				
			||||||
  * `/areas_cleanup` -- Removes all ownerless areas.
 | 
					  * `/areas_cleanup` -- Removes all ownerless areas.
 | 
				
			||||||
	Useful for cleaning after user deletion, for example using /remove_player.
 | 
						Useful for cleaning after user deletion, for example using /remove_player.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  * `/area_open <ID>` -- Toggle open/closed the specified area for everyone.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  * `/area_faction_open <ID> <faction>` -- Toggle open/closed the specified
 | 
				
			||||||
 | 
						area for members of the faction. Factions are created and managed by
 | 
				
			||||||
 | 
						playerfactions mod.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
License
 | 
					License
 | 
				
			||||||
-------
 | 
					-------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Copyright (C) 2013 ShadowNinja
 | 
					Copyright (C) 2013-2017 ShadowNinja
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Copyright (C) 2015-2020 various contributors
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Licensed under the GNU LGPL version 2.1 or later.
 | 
					Licensed under the GNU LGPL version 2.1 or later.
 | 
				
			||||||
See LICENSE.txt and http://www.gnu.org/licenses/lgpl-2.1.txt
 | 
					See LICENSE.txt and http://www.gnu.org/licenses/lgpl-2.1.txt
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										67
									
								
								api.lua
									
									
									
									
									
								
							
							
						
						
									
										67
									
								
								api.lua
									
									
									
									
									
								
							@@ -2,12 +2,21 @@ local hudHandlers = {}
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
---plants to place in openfarming
 | 
					---plants to place in openfarming
 | 
				
			||||||
local plants = {
 | 
					local plants = {
 | 
				
			||||||
	["farming:blueberries"]="air", ["farming:carrot"]="air", ["farming:coffee_beans"]="air",
 | 
						["farming:beetroot"]="air", ["farming:blueberries"]="air", ["farming:cabbage"]="air",
 | 
				
			||||||
	["farming:corn"]="air", ["farming:cucumber"]="air", ["farming:melon_slice"]="air",
 | 
						["farming:carrot"]="air", ["farming:chili_pepper"]="air", ["farming:coffee_beans"]="air",
 | 
				
			||||||
 | 
						["farming:corn"]="air", ["farming:cucumber"]="air", ["farming:garlic_clove"]="air",
 | 
				
			||||||
 | 
						["farming:melon_slice"]="air", ["farming:onion"]="air", ["default:papyrus"]="air",
 | 
				
			||||||
 | 
						["farming:pea_pod"]="air",	["farming:peppercorn"]="air", ["farming:pineapple_top"]="air",
 | 
				
			||||||
	["farming:potato"]="air", ["farming:pumpkin_slice"]="air", ["farming:raspberries"]="air",
 | 
						["farming:potato"]="air", ["farming:pumpkin_slice"]="air", ["farming:raspberries"]="air",
 | 
				
			||||||
	["farming:rhubarb"]="air",	["farming:tomato"]="air", ["farming:seed_cotton"]="air",
 | 
						["farming:rhubarb"]="air",
 | 
				
			||||||
	["farming:seed_wheat"]="air",["default:papyrus"]="air", ["farming:trellis"]="air",
 | 
						["farming:seed_barley"]="air", ["farming:seed_cotton"]="air", ["farming:seed_hemp"]="air",
 | 
				
			||||||
	["farming:grapes"]="farming:trellis", ["farming:beanpole"]="air", ["farming:beans"]="farming:beanpole",
 | 
						["farming:seed_mint"]="air", ["farming:seed_oat"]="air", ["farming:seed_rice"]="air",
 | 
				
			||||||
 | 
						["farming:seed_rye"]="air", ["farming:seed_wheat"]="air",
 | 
				
			||||||
 | 
						["farming:tomato"]="air",
 | 
				
			||||||
 | 
						["farming:trellis"]="air", ["farming:grapes"]="farming:trellis",
 | 
				
			||||||
 | 
						["farming:beanpole"]="air", ["farming:beans"]="farming:beanpole",
 | 
				
			||||||
 | 
						["morefarming:seed_wildcarrot"]="air", ["morefarming:seed_teosinte"]="air",
 | 
				
			||||||
 | 
						["morefarming:seed_carrot"]="air", ["morefarming:seed_corn"]="air",
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
areas.registered_on_adds = {}
 | 
					areas.registered_on_adds = {}
 | 
				
			||||||
@@ -101,28 +110,42 @@ function areas:canInteract(pos, name)
 | 
				
			|||||||
	for _, area in pairs(self:getAreasAtPos(pos)) do
 | 
						for _, area in pairs(self:getAreasAtPos(pos)) do
 | 
				
			||||||
		if area.owner == name or area.open then
 | 
							if area.owner == name or area.open then
 | 
				
			||||||
			return true
 | 
								return true
 | 
				
			||||||
		elseif area.openfarming then
 | 
							end
 | 
				
			||||||
 | 
							if area.openfarming then
 | 
				
			||||||
			-- if area is openfarming
 | 
								-- if area is openfarming
 | 
				
			||||||
			local node = minetest.get_node(pos).name
 | 
					 | 
				
			||||||
			if not minetest.registered_nodes[node] then return false end
 | 
					 | 
				
			||||||
			local player = minetest.get_player_by_name(name)
 | 
								local player = minetest.get_player_by_name(name)
 | 
				
			||||||
			if not player then return false end
 | 
								local node = minetest.get_node(pos).name
 | 
				
			||||||
			local wstack = player:get_wielded_item():get_name()
 | 
								if player and minetest.registered_nodes[node] then
 | 
				
			||||||
			if wstack == "" then wstack = "hand" end
 | 
									local wstack = player:get_wielded_item():get_name()
 | 
				
			||||||
 | 
									if wstack == "" then wstack = "hand" end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			--on_dig
 | 
									--on_dig
 | 
				
			||||||
			if minetest.get_item_group(node, "plant") == 1 and (wstack == "hand" or minetest.registered_tools[wstack]) then
 | 
									if minetest.get_item_group(node, "plant") == 1 and (wstack == "hand" or minetest.registered_tools[wstack]) then
 | 
				
			||||||
				return true
 | 
										return true
 | 
				
			||||||
			end
 | 
									end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			--on_place
 | 
									--on_place
 | 
				
			||||||
			if plants[wstack] ~= nil and plants[wstack] == node then
 | 
									if plants[wstack] ~= nil and plants[wstack] == node then
 | 
				
			||||||
				return true
 | 
										return true
 | 
				
			||||||
 | 
									end
 | 
				
			||||||
			end
 | 
								end
 | 
				
			||||||
		elseif areas.factions_available and area.faction_open then
 | 
							end
 | 
				
			||||||
			local faction_name = factions.get_player_faction(area.owner)
 | 
							if areas.factions_available and area.faction_open then
 | 
				
			||||||
			if faction_name ~= nil and faction_name == factions.get_player_faction(name) then
 | 
								if (factions.version or 0) < 2 then
 | 
				
			||||||
				return true
 | 
									local faction_name = factions.get_player_faction(name)
 | 
				
			||||||
 | 
									if faction_name then
 | 
				
			||||||
 | 
										for _, fname in ipairs(area.faction_open or {}) do
 | 
				
			||||||
 | 
											if faction_name == fname then
 | 
				
			||||||
 | 
												return true
 | 
				
			||||||
 | 
											end
 | 
				
			||||||
 | 
										end
 | 
				
			||||||
 | 
									end
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
 | 
									for _, fname in ipairs(area.faction_open or {}) do
 | 
				
			||||||
 | 
										if factions.player_is_in_faction(fname, name) then
 | 
				
			||||||
 | 
											return true
 | 
				
			||||||
 | 
										end
 | 
				
			||||||
 | 
									end
 | 
				
			||||||
			end
 | 
								end
 | 
				
			||||||
		end
 | 
							end
 | 
				
			||||||
		owned = true
 | 
							owned = true
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -71,7 +71,7 @@ minetest.register_chatcommand("set_owner", {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
minetest.register_chatcommand("add_owner", {
 | 
					minetest.register_chatcommand("add_owner", {
 | 
				
			||||||
	params = S("<ParentID>").." "..S("<PlayerName>").." "..S("<AreaName>"),
 | 
						params = S("<ParentID>").." "..S("<PlayerName>").." "..S("<AreaName>"),
 | 
				
			||||||
	description = S("Give a player access to a sub-area beetween two"
 | 
						description = S("Give a player access to a sub-area between two"
 | 
				
			||||||
		.." positions that have already been protected,"
 | 
							.." positions that have already been protected,"
 | 
				
			||||||
		.." Use set_owner if you don't want the parent to be set."),
 | 
							.." Use set_owner if you don't want the parent to be set."),
 | 
				
			||||||
	func = function(name, param)
 | 
						func = function(name, param)
 | 
				
			||||||
@@ -207,7 +207,7 @@ minetest.register_chatcommand("recursive_remove_areas", {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		areas:remove(id, true)
 | 
							areas:remove(id, true)
 | 
				
			||||||
		areas:save()
 | 
							areas:save()
 | 
				
			||||||
		return true, S("Removed area @1 and it's sub areas.", id)
 | 
							return true, S("Removed area @1 and its sub areas.", id)
 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -308,11 +308,15 @@ minetest.register_chatcommand(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
if areas.factions_available then
 | 
					if areas.factions_available then
 | 
				
			||||||
	minetest.register_chatcommand("area_faction_open", {
 | 
						minetest.register_chatcommand("area_faction_open", {
 | 
				
			||||||
		params = S("<ID>"),
 | 
							params = S("<ID> [faction_name]"),
 | 
				
			||||||
		description = S("Toggle an area open/closed for members in your faction."),
 | 
							description = S("Toggle an area open/closed for members in your faction."),
 | 
				
			||||||
		func = function(name, param)
 | 
							func = function(name, param)
 | 
				
			||||||
			local id = tonumber(param)
 | 
								local params = param:split(" ")
 | 
				
			||||||
			if not id then
 | 
					
 | 
				
			||||||
 | 
								local id = tonumber(params[1])
 | 
				
			||||||
 | 
								local faction_name = params[2]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if not id or not faction_name then
 | 
				
			||||||
				return false, S("Invalid usage, see /help @1.", "area_faction_open")
 | 
									return false, S("Invalid usage, see /help @1.", "area_faction_open")
 | 
				
			||||||
			end
 | 
								end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -320,11 +324,25 @@ if areas.factions_available then
 | 
				
			|||||||
				return false, S("Area @1 does not exist"
 | 
									return false, S("Area @1 does not exist"
 | 
				
			||||||
						.." or is not owned by you.", id)
 | 
											.." or is not owned by you.", id)
 | 
				
			||||||
			end
 | 
								end
 | 
				
			||||||
			local open = not areas.areas[id].faction_open
 | 
					
 | 
				
			||||||
			-- Save false as nil to avoid inflating the DB.
 | 
								if not factions.get_owner(faction_name) then
 | 
				
			||||||
			areas.areas[id].faction_open = open or nil
 | 
									return false, S("Faction doesn't exists")
 | 
				
			||||||
 | 
								end
 | 
				
			||||||
 | 
								local fnames = areas.areas[id].faction_open or {}
 | 
				
			||||||
 | 
								local pos = table.indexof(fnames, faction_name)
 | 
				
			||||||
 | 
								if pos < 0 then
 | 
				
			||||||
 | 
									-- Add new faction to the list
 | 
				
			||||||
 | 
									table.insert(fnames, faction_name)
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
 | 
									table.remove(fnames, pos)
 | 
				
			||||||
 | 
								end
 | 
				
			||||||
 | 
								if #fnames == 0 then
 | 
				
			||||||
 | 
									-- Save {} as nil to avoid inflating the DB.
 | 
				
			||||||
 | 
									fnames = nil
 | 
				
			||||||
 | 
								end
 | 
				
			||||||
 | 
								areas.areas[id].faction_open = fnames
 | 
				
			||||||
			areas:save()
 | 
								areas:save()
 | 
				
			||||||
			return true, open and S("Area opened for faction members.")
 | 
								return true, fnames and S("Area is open for members of: @1", table.concat(fnames, ", "))
 | 
				
			||||||
				or S("Area closed for faction members.")
 | 
									or S("Area closed for faction members.")
 | 
				
			||||||
		end
 | 
							end
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										25
									
								
								hud.lua
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								hud.lua
									
									
									
									
									
								
							@@ -20,9 +20,28 @@ minetest.register_globalstep(function(dtime)
 | 
				
			|||||||
		local areaStrings = {}
 | 
							local areaStrings = {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for id, area in pairs(areas:getAreasAtPos(pos)) do
 | 
							for id, area in pairs(areas:getAreasAtPos(pos)) do
 | 
				
			||||||
			local faction_info = area.faction_open and areas.factions_available and
 | 
								local faction_info
 | 
				
			||||||
					factions.get_player_faction(area.owner)
 | 
								if area.faction_open and areas.factions_available then
 | 
				
			||||||
			area.faction_open = faction_info
 | 
									-- Gather and clean up disbanded factions
 | 
				
			||||||
 | 
									local changed = false
 | 
				
			||||||
 | 
									for i, fac_name in ipairs(area.faction_open) do
 | 
				
			||||||
 | 
										if not factions.get_owner(fac_name) then
 | 
				
			||||||
 | 
											table.remove(area.faction_open, i)
 | 
				
			||||||
 | 
											changed = true
 | 
				
			||||||
 | 
										end
 | 
				
			||||||
 | 
									end
 | 
				
			||||||
 | 
									if #area.faction_open == 0 then
 | 
				
			||||||
 | 
										-- Prevent DB clutter, remove value
 | 
				
			||||||
 | 
										area.faction_open = nil
 | 
				
			||||||
 | 
									else
 | 
				
			||||||
 | 
										faction_info = table.concat(area.faction_open, ", ")
 | 
				
			||||||
 | 
									end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									if changed then
 | 
				
			||||||
 | 
										areas:save()
 | 
				
			||||||
 | 
									end
 | 
				
			||||||
 | 
								end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			table.insert(areaStrings, ("%s [%u] (%s%s%s)")
 | 
								table.insert(areaStrings, ("%s [%u] (%s%s%s)")
 | 
				
			||||||
					:format(area.name, id, area.owner,
 | 
										:format(area.name, id, area.owner,
 | 
				
			||||||
					area.open and S(":open") or area.openfarming and ":openfarming" or "",
 | 
										area.open and S(":open") or area.openfarming and ":openfarming" or "",
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										12
									
								
								init.lua
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								init.lua
									
									
									
									
									
								
							@@ -4,7 +4,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
areas = {}
 | 
					areas = {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
areas.factions_available = minetest.global_exists("factions")
 | 
					areas.factions_available = minetest.get_modpath("playerfactions") and true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
areas.adminPrivs = {areas=true}
 | 
					areas.adminPrivs = {areas=true}
 | 
				
			||||||
areas.startTime = os.clock()
 | 
					areas.startTime = os.clock()
 | 
				
			||||||
@@ -21,11 +21,15 @@ dofile(areas.modpath.."/hud.lua")
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
areas:load()
 | 
					areas:load()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local S = minetest.get_translator("areas")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
minetest.register_privilege("areas", {
 | 
					minetest.register_privilege("areas", {
 | 
				
			||||||
	description = "Can administer areas."
 | 
						description = S("Can administer areas."),
 | 
				
			||||||
 | 
						give_to_singleplayer = false
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
minetest.register_privilege("areas_high_limit", {
 | 
					minetest.register_privilege("areas_high_limit", {
 | 
				
			||||||
	description = "Can protect more, bigger areas."
 | 
						description = S("Can protect more, bigger areas."),
 | 
				
			||||||
 | 
						give_to_singleplayer = false
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
-- Mega_builder privilege -- MFF
 | 
					-- Mega_builder privilege -- MFF
 | 
				
			||||||
minetest.register_privilege("megabuilder", {
 | 
					minetest.register_privilege("megabuilder", {
 | 
				
			||||||
@@ -34,7 +38,7 @@ minetest.register_privilege("megabuilder", {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
if not minetest.registered_privileges[areas.config.self_protection_privilege] then
 | 
					if not minetest.registered_privileges[areas.config.self_protection_privilege] then
 | 
				
			||||||
	minetest.register_privilege(areas.config.self_protection_privilege, {
 | 
						minetest.register_privilege(areas.config.self_protection_privilege, {
 | 
				
			||||||
		description = "Can protect areas.",
 | 
							description = S("Can protect areas."),
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										17
									
								
								internal.lua
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								internal.lua
									
									
									
									
									
								
							@@ -18,7 +18,7 @@ end
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
-- Save the areas table to a file
 | 
					-- Save the areas table to a file
 | 
				
			||||||
function areas:save()
 | 
					function areas:save()
 | 
				
			||||||
	local datastr = minetest.serialize(self.areas)
 | 
						local datastr = minetest.write_json(self.areas)
 | 
				
			||||||
	if not datastr then
 | 
						if not datastr then
 | 
				
			||||||
		minetest.log("error", "[areas] Failed to serialize area data!")
 | 
							minetest.log("error", "[areas] Failed to serialize area data!")
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
@@ -33,10 +33,19 @@ function areas:load()
 | 
				
			|||||||
		self.areas = self.areas or {}
 | 
							self.areas = self.areas or {}
 | 
				
			||||||
		return err
 | 
							return err
 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
	self.areas = minetest.deserialize(file:read("*a"))
 | 
						local data = file:read("*a")
 | 
				
			||||||
 | 
						if data:sub(1, 1) == "[" then
 | 
				
			||||||
 | 
							self.areas, err = minetest.parse_json(data)
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							self.areas, err = minetest.deserialize(data)
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
	if type(self.areas) ~= "table" then
 | 
						if type(self.areas) ~= "table" then
 | 
				
			||||||
		self.areas = {}
 | 
							self.areas = {}
 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
 | 
						if err and #data > 10 then
 | 
				
			||||||
 | 
							minetest.log("error", "[areas] Failed to load area data: " ..
 | 
				
			||||||
 | 
								tostring(err))
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
	file:close()
 | 
						file:close()
 | 
				
			||||||
	self:populateStore()
 | 
						self:populateStore()
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
@@ -109,7 +118,7 @@ function areas:add(owner, name, pos1, pos2, parent)
 | 
				
			|||||||
	return id
 | 
						return id
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
--- Remove a area, and optionally it's children recursively.
 | 
					--- Remove a area, and optionally its children recursively.
 | 
				
			||||||
-- If a area is deleted non-recursively the children will
 | 
					-- If a area is deleted non-recursively the children will
 | 
				
			||||||
-- have the removed area's parent as their new parent.
 | 
					-- have the removed area's parent as their new parent.
 | 
				
			||||||
function areas:remove(id, recurse)
 | 
					function areas:remove(id, recurse)
 | 
				
			||||||
@@ -186,7 +195,7 @@ function areas:isSubarea(pos1, pos2, id)
 | 
				
			|||||||
	end
 | 
						end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- Returns a table (list) of children of an area given it's identifier
 | 
					-- Returns a table (list) of children of an area given its identifier
 | 
				
			||||||
function areas:getChildren(id)
 | 
					function areas:getChildren(id)
 | 
				
			||||||
	local children = {}
 | 
						local children = {}
 | 
				
			||||||
	for cid, area in pairs(self.areas) do
 | 
						for cid, area in pairs(self.areas) do
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,9 +1,11 @@
 | 
				
			|||||||
# textdomain: areas
 | 
					# textdomain: areas
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### chatcommands.lua ###
 | 
					### chatcommands.lua ###
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<AreaName>=<NomZone>
 | 
					<AreaName>=<NomZone>
 | 
				
			||||||
 | 
					<ID> [faction_name]=<ID> [nom_de_faction]
 | 
				
			||||||
<NewOwner>=<NouveauPropriétaire>
 | 
					<NewOwner>=<NouveauPropriétaire>
 | 
				
			||||||
<ParentID>=<IDZonePrincipale>
 | 
					<ParentID>=<IDZonePrincipale>
 | 
				
			||||||
<PlayerName>=<NomJoueur>
 | 
					<PlayerName>=<NomJoueur>
 | 
				
			||||||
@@ -15,16 +17,17 @@ Area @1 does not exist or is not owned by you.=La zone @1 n’existe pas ou ne v
 | 
				
			|||||||
Area closed for faction members.=Zone fermée aux membres de la faction.
 | 
					Area closed for faction members.=Zone fermée aux membres de la faction.
 | 
				
			||||||
Area closed.=Zone fermée.
 | 
					Area closed.=Zone fermée.
 | 
				
			||||||
Area does not exist.=La zone n’existe pas.
 | 
					Area does not exist.=La zone n’existe pas.
 | 
				
			||||||
Area opened for faction members.=Zone ouverte aux membres de la faction.
 | 
					Area is open for members of: @1=Zone ouverte aux membres de ces factions : @1
 | 
				
			||||||
Area opened.=Zone ouverte.
 | 
					Area opened.=Zone ouverte.
 | 
				
			||||||
Area protected. ID: @1=Zone protégée. ID : @1
 | 
					Area protected. ID: @1=Zone protégée. ID : @1
 | 
				
			||||||
Area renamed.=Zone renommée.
 | 
					Area renamed.=Zone renommée.
 | 
				
			||||||
Area successfully moved.=Zone déplacée avec succès.
 | 
					Area successfully moved.=Zone déplacée avec succès.
 | 
				
			||||||
Change the owner of an area using its ID=Change le propriétaire d’une zone en utilisant son ID.
 | 
					Change the owner of an area using its ID=Change le propriétaire d’une zone en utilisant son ID.
 | 
				
			||||||
 | 
					Faction doesn't exists=La faction n'existe pas
 | 
				
			||||||
Find areas using a Lua regular expression=Trouve les zones en utilisant une expression régulière Lua.
 | 
					Find areas using a Lua regular expression=Trouve les zones en utilisant une expression régulière Lua.
 | 
				
			||||||
Get information about area configuration and usage.=Obtient des informations sur la configuration des zones et l’utilisation des zones.
 | 
					Get information about area configuration and usage.=Obtient des informations sur la configuration des zones et l’utilisation des zones.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Give a player access to a sub-area beetween two positions that have already been protected, Use set_owner if you don't want the parent to be set.=Donne au joueur accès aux sous-zones entre deux positions qui ont déjà été protégées ; utilisez set_owner si vous ne voulez pas que la zone pricipale soit définie.
 | 
					Give a player access to a sub-area between two positions that have already been protected, Use set_owner if you don't want the parent to be set.=Donne au joueur accès aux sous-zones entre deux positions qui ont déjà été protégées ; utilisez set_owner si vous ne voulez pas que la zone pricipale soit définie.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Invalid regular expression.=Expression régulière invalide.
 | 
					Invalid regular expression.=Expression régulière invalide.
 | 
				
			||||||
Limit: @1 areas=Limite: @1 zones.
 | 
					Limit: @1 areas=Limite: @1 zones.
 | 
				
			||||||
@@ -42,7 +45,8 @@ Protect your own area=Protège votre zone.
 | 
				
			|||||||
Recursively remove areas using an ID=Supprime les zones récursivement en utilisant un ID.
 | 
					Recursively remove areas using an ID=Supprime les zones récursivement en utilisant un ID.
 | 
				
			||||||
Remove an area using an ID=Supprime une zone en utilisant son ID.
 | 
					Remove an area using an ID=Supprime une zone en utilisant son ID.
 | 
				
			||||||
Removed area @1=Zone @1 supprimée.
 | 
					Removed area @1=Zone @1 supprimée.
 | 
				
			||||||
Removed area @1 and it's sub areas.=Zone @1 et ses sous-zones supprimées.
 | 
					Removed area @1 and its sub areas.=Zone @1 et ses sous-zones supprimées.
 | 
				
			||||||
 | 
					Removes all ownerless areas=Supprime toutes les zones sans propriétaire
 | 
				
			||||||
Rename an area that you own=Renomme une zone qui vous appartient.
 | 
					Rename an area that you own=Renomme une zone qui vous appartient.
 | 
				
			||||||
Self protection is disabled.=L’autoprotection est désactivée.
 | 
					Self protection is disabled.=L’autoprotection est désactivée.
 | 
				
			||||||
Self protection is enabled.=L’autoprotection est activée.
 | 
					Self protection is enabled.=L’autoprotection est activée.
 | 
				
			||||||
@@ -76,6 +80,12 @@ Invalid usage, see /help @1.=Utilisation incorrecte, voir /help @1.
 | 
				
			|||||||
:open= : ouverte
 | 
					:open= : ouverte
 | 
				
			||||||
Areas:=Zones :
 | 
					Areas:=Zones :
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### init.lua ###
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Can administer areas.=Permet d’administrer des zones.
 | 
				
			||||||
 | 
					Can protect areas.=Permet de protéger des zones.
 | 
				
			||||||
 | 
					Can protect more, bigger areas.=Permet de protéger plus, et de plus grandes zones.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### interact.lua ###
 | 
					### interact.lua ###
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@1 is protected by @2.=@1 est protégée par @2.
 | 
					@1 is protected by @2.=@1 est protégée par @2.
 | 
				
			||||||
@@ -113,7 +123,7 @@ Area position @1 set to @2=Position @1 de la zone définie à @2.
 | 
				
			|||||||
Position @1 set to @2=Position @1 définie à @2.
 | 
					Position @1 set to @2=Position @1 définie à @2.
 | 
				
			||||||
Position @1: =Position @1 :
 | 
					Position @1: =Position @1 :
 | 
				
			||||||
Select an area by ID.=Sélectionnez une zone par son ID.
 | 
					Select an area by ID.=Sélectionnez une zone par son ID.
 | 
				
			||||||
Select position @1 by punching a node.=Sélectionnez une position en frappant un bloc.
 | 
					Select position @1 by punching a node.=Sélectionnez une position @1 en frappant un bloc.
 | 
				
			||||||
Select positions by punching two nodes.=Sélectionnez une position en frappant deux blocs.
 | 
					Select positions by punching two nodes.=Sélectionnez une position en frappant deux blocs.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Set area protection region position @1 to your location or the one specified=Définit la position @1 de la région de protection de zone à votre position ou à celle spécifiée.
 | 
					Set area protection region position @1 to your location or the one specified=Définit la position @1 de la région de protection de zone à votre position ou à celle spécifiée.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,9 +1,11 @@
 | 
				
			|||||||
# textdomain: areas
 | 
					# textdomain: areas
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### chatcommands.lua ###
 | 
					### chatcommands.lua ###
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<AreaName>=<NomeArea>
 | 
					<AreaName>=<NomeArea>
 | 
				
			||||||
 | 
					<ID> [faction_name]= <ID> [nome_fazione]
 | 
				
			||||||
<NewOwner>=<NuovoProprietario>
 | 
					<NewOwner>=<NuovoProprietario>
 | 
				
			||||||
<ParentID>=<IDparent>
 | 
					<ParentID>=<IDparent>
 | 
				
			||||||
<PlayerName>=<NomeGiocatore>
 | 
					<PlayerName>=<NomeGiocatore>
 | 
				
			||||||
@@ -15,16 +17,17 @@ Area @1 does not exist or is not owned by you.=L'area @1 non esiste o non è di
 | 
				
			|||||||
Area closed for faction members.=Area chiusa per i membri della fazione.
 | 
					Area closed for faction members.=Area chiusa per i membri della fazione.
 | 
				
			||||||
Area closed.=Area chiusa.
 | 
					Area closed.=Area chiusa.
 | 
				
			||||||
Area does not exist.=L'area non esiste.
 | 
					Area does not exist.=L'area non esiste.
 | 
				
			||||||
Area opened for faction members.=Area aperta per i membri della fazione.
 | 
					Area is open for members of: @1=L'area è aperta ai membri di: @1
 | 
				
			||||||
Area opened.=Area aperta.
 | 
					Area opened.=Area aperta.
 | 
				
			||||||
Area protected. ID: @1=Area protetta. ID: @1
 | 
					Area protected. ID: @1=Area protetta. ID: @1
 | 
				
			||||||
Area renamed.=Area rinominata.
 | 
					Area renamed.=Area rinominata.
 | 
				
			||||||
Area successfully moved.=Area spostata con successo.
 | 
					Area successfully moved.=Area spostata con successo.
 | 
				
			||||||
Change the owner of an area using its ID=Cambia il proprietario di un'area usando il suo ID
 | 
					Change the owner of an area using its ID=Cambia il proprietario di un'area usando il suo ID
 | 
				
			||||||
 | 
					Faction doesn't exists=La fazione non esiste
 | 
				
			||||||
Find areas using a Lua regular expression=Trova aree usando una espressione regolare Lua
 | 
					Find areas using a Lua regular expression=Trova aree usando una espressione regolare Lua
 | 
				
			||||||
Get information about area configuration and usage.=Ottieni informazioni sulla configurazione e l'uso delle aree.
 | 
					Get information about area configuration and usage.=Ottieni informazioni sulla configurazione e l'uso delle aree.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Give a player access to a sub-area beetween two positions that have already been protected, Use set_owner if you don't want the parent to be set.=Dai a un giocatore l'accesso a una sotto-area tra due posizioni che sono già state protette, usa set_owner se non vuoi che sia impostato il parent.
 | 
					Give a player access to a sub-area between two positions that have already been protected, Use set_owner if you don't want the parent to be set.=Dai a un giocatore l'accesso a una sotto-area tra due posizioni che sono già state protette, usa set_owner se non vuoi che sia impostato il parent.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Invalid regular expression.=Espressione regolare non valida.
 | 
					Invalid regular expression.=Espressione regolare non valida.
 | 
				
			||||||
Limit: @1 areas=Limite: @1 aree
 | 
					Limit: @1 areas=Limite: @1 aree
 | 
				
			||||||
@@ -42,7 +45,8 @@ Protect your own area=Proteggi la tua area
 | 
				
			|||||||
Recursively remove areas using an ID=Elimina ricorsivamente delle aree usando un ID
 | 
					Recursively remove areas using an ID=Elimina ricorsivamente delle aree usando un ID
 | 
				
			||||||
Remove an area using an ID=Elimina un'area usando un ID
 | 
					Remove an area using an ID=Elimina un'area usando un ID
 | 
				
			||||||
Removed area @1=Eliminata l'area @1
 | 
					Removed area @1=Eliminata l'area @1
 | 
				
			||||||
Removed area @1 and it's sub areas.=Eliminata l'area @1 e le sue sotto-aree.
 | 
					Removed area @1 and its sub areas.=Eliminata l'area @1 e le sue sotto-aree.
 | 
				
			||||||
 | 
					Removes all ownerless areas=
 | 
				
			||||||
Rename an area that you own=Rinomina un'area che ti appartiene
 | 
					Rename an area that you own=Rinomina un'area che ti appartiene
 | 
				
			||||||
Self protection is disabled.=L'auto-protezione è disattivata.
 | 
					Self protection is disabled.=L'auto-protezione è disattivata.
 | 
				
			||||||
Self protection is enabled.=L'auto-protezione è attivata.
 | 
					Self protection is enabled.=L'auto-protezione è attivata.
 | 
				
			||||||
@@ -76,6 +80,12 @@ Invalid usage, see /help @1.=Utilizzo non valido, si veda /help @1.
 | 
				
			|||||||
:open=:aperta
 | 
					:open=:aperta
 | 
				
			||||||
Areas:=Aree:
 | 
					Areas:=Aree:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### init.lua ###
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Can administer areas.=
 | 
				
			||||||
 | 
					Can protect areas.=
 | 
				
			||||||
 | 
					Can protect more, bigger areas.=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### interact.lua ###
 | 
					### interact.lua ###
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@1 is protected by @2.=@1 è protetta da @2.
 | 
					@1 is protected by @2.=@1 è protetta da @2.
 | 
				
			||||||
@@ -111,7 +121,7 @@ unnamed=innominato
 | 
				
			|||||||
Area @1 selected.=Area @1 selezionata.
 | 
					Area @1 selected.=Area @1 selezionata.
 | 
				
			||||||
Area position @1 set to @2=Posizione @1 dell'area impostata a @2
 | 
					Area position @1 set to @2=Posizione @1 dell'area impostata a @2
 | 
				
			||||||
Position @1 set to @2=Posizione @1 impostata a @2
 | 
					Position @1 set to @2=Posizione @1 impostata a @2
 | 
				
			||||||
Position @1: =Posizione @1: 
 | 
					Position @1: =Posizione @1:
 | 
				
			||||||
Select an area by ID.=Scegli un'area tramite l'ID.
 | 
					Select an area by ID.=Scegli un'area tramite l'ID.
 | 
				
			||||||
Select position @1 by punching a node.=Seleziona la posizione @1 colpendo un nodo.
 | 
					Select position @1 by punching a node.=Seleziona la posizione @1 colpendo un nodo.
 | 
				
			||||||
Select positions by punching two nodes.=Seleziona le posizioni colpendo due nodi.
 | 
					Select positions by punching two nodes.=Seleziona le posizioni colpendo due nodi.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,9 +1,11 @@
 | 
				
			|||||||
# textdomain: areas
 | 
					# textdomain: areas
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### chatcommands.lua ###
 | 
					### chatcommands.lua ###
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<AreaName>=
 | 
					<AreaName>=
 | 
				
			||||||
 | 
					<ID> [faction_name]=
 | 
				
			||||||
<NewOwner>=
 | 
					<NewOwner>=
 | 
				
			||||||
<ParentID>=
 | 
					<ParentID>=
 | 
				
			||||||
<PlayerName>=
 | 
					<PlayerName>=
 | 
				
			||||||
@@ -15,16 +17,17 @@ Area @1 does not exist or is not owned by you.=
 | 
				
			|||||||
Area closed for faction members.=
 | 
					Area closed for faction members.=
 | 
				
			||||||
Area closed.=
 | 
					Area closed.=
 | 
				
			||||||
Area does not exist.=
 | 
					Area does not exist.=
 | 
				
			||||||
Area opened for faction members.=
 | 
					Area is open for members of: @1=
 | 
				
			||||||
Area opened.=
 | 
					Area opened.=
 | 
				
			||||||
Area protected. ID: @1=
 | 
					Area protected. ID: @1=
 | 
				
			||||||
Area renamed.=
 | 
					Area renamed.=
 | 
				
			||||||
Area successfully moved.=
 | 
					Area successfully moved.=
 | 
				
			||||||
Change the owner of an area using its ID=
 | 
					Change the owner of an area using its ID=
 | 
				
			||||||
 | 
					Faction doesn't exists=
 | 
				
			||||||
Find areas using a Lua regular expression=
 | 
					Find areas using a Lua regular expression=
 | 
				
			||||||
Get information about area configuration and usage.=
 | 
					Get information about area configuration and usage.=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Give a player access to a sub-area beetween two positions that have already been protected, Use set_owner if you don't want the parent to be set.=
 | 
					Give a player access to a sub-area between two positions that have already been protected, Use set_owner if you don't want the parent to be set.=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Invalid regular expression.=
 | 
					Invalid regular expression.=
 | 
				
			||||||
Limit: @1 areas=
 | 
					Limit: @1 areas=
 | 
				
			||||||
@@ -42,7 +45,8 @@ Protect your own area=
 | 
				
			|||||||
Recursively remove areas using an ID=
 | 
					Recursively remove areas using an ID=
 | 
				
			||||||
Remove an area using an ID=
 | 
					Remove an area using an ID=
 | 
				
			||||||
Removed area @1=
 | 
					Removed area @1=
 | 
				
			||||||
Removed area @1 and it's sub areas.=
 | 
					Removed area @1 and its sub areas.=
 | 
				
			||||||
 | 
					Removes all ownerless areas=
 | 
				
			||||||
Rename an area that you own=
 | 
					Rename an area that you own=
 | 
				
			||||||
Self protection is disabled.=
 | 
					Self protection is disabled.=
 | 
				
			||||||
Self protection is enabled.=
 | 
					Self protection is enabled.=
 | 
				
			||||||
@@ -65,8 +69,6 @@ You have extended area protection limits ("areas_high_limit" privilege).=
 | 
				
			|||||||
You have the necessary privilege ("@1").=
 | 
					You have the necessary privilege ("@1").=
 | 
				
			||||||
You need to select an area first.=
 | 
					You need to select an area first.=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Removes all ownerless areas.=
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### chatcommands.lua ###
 | 
					### chatcommands.lua ###
 | 
				
			||||||
### pos.lua ###
 | 
					### pos.lua ###
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -78,6 +80,12 @@ Invalid usage, see /help @1.=
 | 
				
			|||||||
:open=
 | 
					:open=
 | 
				
			||||||
Areas:=
 | 
					Areas:=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### init.lua ###
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Can administer areas.=
 | 
				
			||||||
 | 
					Can protect areas.=
 | 
				
			||||||
 | 
					Can protect more, bigger areas.=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### interact.lua ###
 | 
					### interact.lua ###
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@1 is protected by @2.=
 | 
					@1 is protected by @2.=
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user