forked from mtcontrib/factions
Replaced "chunk" with "parcel"
This commit is contained in:
parent
a38c82a4e7
commit
4df6d0357b
104
chatcommands.lua
104
chatcommands.lua
|
@ -100,10 +100,10 @@ factions.register_command = function(cmd_name, cmd)
|
|||
|
||||
-- get some more data
|
||||
local pos = minetest.get_player_by_name(player):getpos()
|
||||
local chunkpos = factions.get_chunk_pos(pos)
|
||||
return self.on_success(player, player_faction, pos, chunkpos, args)
|
||||
local parcelpos = factions.get_parcel_pos(pos)
|
||||
return self.on_success(player, player_faction, pos, parcelpos, args)
|
||||
end,
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
minetest.chat_send_player(player, "Not implemented yet!")
|
||||
end
|
||||
}
|
||||
|
@ -159,22 +159,22 @@ end
|
|||
factions.register_command ("claim", {
|
||||
faction_permissions = {"claim"},
|
||||
description = "Claim the plot of land you're on.",
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
local can_claim = faction:can_claim_chunk(chunkpos)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local can_claim = faction:can_claim_parcel(parcelpos)
|
||||
if can_claim then
|
||||
minetest.chat_send_player(player, "Claming chunk "..chunkpos)
|
||||
faction:claim_chunk(chunkpos)
|
||||
minetest.chat_send_player(player, "Claming parcel "..parcelpos)
|
||||
faction:claim_parcel(parcelpos)
|
||||
return true
|
||||
else
|
||||
local chunk = factions.chunks[chunkpos]
|
||||
if not chunk then
|
||||
send_error(player, "You faction cannot claim any (more) chunk(s).")
|
||||
local parcel = factions.parcels[parcelpos]
|
||||
if not parcel then
|
||||
send_error(player, "You faction cannot claim any (more) parcel(s).")
|
||||
return false
|
||||
elseif chunk == faction.name then
|
||||
send_error(player, "This chunk already belongs to your faction.")
|
||||
elseif parcel == faction.name then
|
||||
send_error(player, "This parcel already belongs to your faction.")
|
||||
return false
|
||||
else
|
||||
send_error(player, "This chunk belongs to another faction.")
|
||||
send_error(player, "This parcel belongs to another faction.")
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
@ -184,13 +184,13 @@ factions.register_command ("claim", {
|
|||
factions.register_command("unclaim", {
|
||||
faction_permissions = {"claim"},
|
||||
description = "Unclaim the plot of land you're on.",
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
local chunk = factions.chunks[chunkpos]
|
||||
if chunk ~= faction.name then
|
||||
send_error(player, "This chunk does not belong to you.")
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local parcel = factions.parcels[parcelpos]
|
||||
if parcel ~= faction.name then
|
||||
send_error(player, "This parcel does not belong to you.")
|
||||
return false
|
||||
else
|
||||
faction:unclaim_chunk(chunkpos)
|
||||
faction:unclaim_parcel(parcelpos)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
@ -200,7 +200,7 @@ factions.register_command("unclaim", {
|
|||
factions.register_command("list", {
|
||||
description = "List all registered factions.",
|
||||
infaction = false,
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local list = factions.get_faction_list()
|
||||
local tosend = "Existing factions:"
|
||||
|
||||
|
@ -219,7 +219,7 @@ factions.register_command("list", {
|
|||
--show factions mod version
|
||||
factions.register_command("version", {
|
||||
description = "Displays mod version.",
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
minetest.chat_send_player(player, "factions: version " .. factions_version , false)
|
||||
end
|
||||
})
|
||||
|
@ -228,7 +228,7 @@ factions.register_command("version", {
|
|||
factions.register_command("info", {
|
||||
format = {"faction"},
|
||||
description = "Shows a faction's description.",
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
minetest.chat_send_player(player,
|
||||
"factions: " .. args.factions[1].name .. ": " ..
|
||||
args.factions[1].description, false)
|
||||
|
@ -238,7 +238,7 @@ factions.register_command("info", {
|
|||
|
||||
factions.register_command("leave", {
|
||||
description = "Leave your faction.",
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
faction:remove_player(player)
|
||||
return true
|
||||
end
|
||||
|
@ -248,7 +248,7 @@ factions.register_command("kick", {
|
|||
faction_permissions = {"playerslist"},
|
||||
format = {"player"},
|
||||
description = "Kick a player from your faction.",
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local victim = args.players[1]
|
||||
if factions.players[victim.name] == faction.name
|
||||
and victim.name ~= faction.leader then -- can't kick da king
|
||||
|
@ -266,7 +266,7 @@ factions.register_command("create", {
|
|||
format = {"string"},
|
||||
infaction = false,
|
||||
description = "Create a new faction.",
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
if faction then
|
||||
send_error(player, "You are already in a faction.")
|
||||
return false
|
||||
|
@ -287,7 +287,7 @@ factions.register_command("join", {
|
|||
format = {"faction"},
|
||||
description = "Join a faction.",
|
||||
infaction = false,
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local new_faction = args.factions[1]
|
||||
if new_faction:can_join(player) then
|
||||
if faction then -- leave old faction
|
||||
|
@ -305,7 +305,7 @@ factions.register_command("join", {
|
|||
factions.register_command("disband", {
|
||||
faction_permissions = {"disband"},
|
||||
description = "Disband your faction.",
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
faction:disband()
|
||||
return true
|
||||
end
|
||||
|
@ -314,7 +314,7 @@ factions.register_command("disband", {
|
|||
factions.register_command("close", {
|
||||
faction_permissions = {"playerslist"},
|
||||
description = "Make your faction invite-only.",
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
faction:toggle_join_free(false)
|
||||
--TODO: message
|
||||
return true
|
||||
|
@ -324,7 +324,7 @@ factions.register_command("close", {
|
|||
factions.register_command("open", {
|
||||
faction_permissions = {"playerslist"},
|
||||
description = "Allow any player to join your faction.",
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
faction:toggle_join_free(true)
|
||||
--TODO: message
|
||||
return true
|
||||
|
@ -334,7 +334,7 @@ factions.register_command("open", {
|
|||
factions.register_command("description", {
|
||||
faction_permissions = {"description"},
|
||||
description = "Set your faction's description",
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
faction:set_description(table.concat(args.other," "))
|
||||
--TODO: message
|
||||
return true
|
||||
|
@ -345,7 +345,7 @@ factions.register_command("invite", {
|
|||
format = {"player"},
|
||||
faction_permissions = {"playerslist"},
|
||||
description = "Invite a player to your faction.",
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
faction:invite_player(args.players[1]:get_player_name())
|
||||
--TODO: message
|
||||
return true
|
||||
|
@ -356,7 +356,7 @@ factions.register_command("uninvite", {
|
|||
format = {"player"},
|
||||
faction_permissions = {"playerslist"},
|
||||
description = "Revoke a player's invite.",
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
faction:revoke_invite(args.players[1]:get_player_name())
|
||||
--TODO: message
|
||||
return true
|
||||
|
@ -368,7 +368,7 @@ factions.register_command("delete", {
|
|||
format = {"faction"},
|
||||
infaction = false,
|
||||
description = "Delete a faction.",
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
args.factions[1]:disband()
|
||||
--TODO: message
|
||||
return true
|
||||
|
@ -377,7 +377,7 @@ factions.register_command("delete", {
|
|||
|
||||
factions.register_command("ranks", {
|
||||
description = "List ranks within your faction",
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
for rank, permissions in pairs(faction.ranks) do
|
||||
minetest.chat_send_player(player, rank..": "..table.concat(permissions, " "))
|
||||
end
|
||||
|
@ -387,7 +387,7 @@ factions.register_command("ranks", {
|
|||
|
||||
factions.register_command("who", {
|
||||
description = "List players in your faction, and their ranks.",
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
if not faction.players then
|
||||
minetest.chat_send_player(player, "There is nobody in this faction ("..faction.name..")")
|
||||
return true
|
||||
|
@ -404,7 +404,7 @@ factions.register_command("newrank", {
|
|||
description = "Add a new rank.",
|
||||
format = {"string"},
|
||||
faction_permissions = {"ranks"},
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local rank = args.strings[1]
|
||||
if faction.ranks[rank] then
|
||||
--TODO: rank already exists
|
||||
|
@ -419,7 +419,7 @@ factions.register_command("delrank", {
|
|||
description = "Replace and delete a rank.",
|
||||
format = {"string", "string"},
|
||||
faction_permissions = {"ranks"},
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local rank = args.strings[1]
|
||||
local newrank = args.strings[2]
|
||||
if not faction.ranks[rank] or not faction.ranks[rank] then
|
||||
|
@ -434,18 +434,18 @@ factions.register_command("delrank", {
|
|||
factions.register_command("setspawn", {
|
||||
description = "Set the faction's spawn",
|
||||
faction_permissions = {"spawn"},
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
faction:set_spawn(pos)
|
||||
return true
|
||||
end
|
||||
})
|
||||
|
||||
factions.register_command("where", {
|
||||
description = "See whose chunk you stand on.",
|
||||
description = "See whose parcel you stand on.",
|
||||
infaction = false,
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
local chunk = factions.chunks[chunkpos]
|
||||
minetest.chat_send_player(player, "You are standing on chunk "..chunkpos..", part of "..(chunk or "Wilderness"))
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local parcel = factions.parcels[parcelpos]
|
||||
minetest.chat_send_player(player, "You are standing on parcel "..parcelpos..", part of "..(parcel or "Wilderness"))
|
||||
return true
|
||||
end
|
||||
})
|
||||
|
@ -453,7 +453,7 @@ factions.register_command("where", {
|
|||
factions.register_command("help", {
|
||||
description = "Shows help for commands.",
|
||||
infaction = false,
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
factions_chat.show_help(player)
|
||||
return true
|
||||
end
|
||||
|
@ -461,7 +461,7 @@ factions.register_command("help", {
|
|||
|
||||
factions.register_command("spawn", {
|
||||
description = "Shows your faction's spawn",
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
if faction.spawn then
|
||||
minetest.chat_send_player(player, "Spawn is at ("..table.concat(faction.spawn, ", ")..")")
|
||||
return true
|
||||
|
@ -476,7 +476,7 @@ factions.register_command("promote", {
|
|||
description = "Promotes a player to a rank",
|
||||
format = {"player", "string"},
|
||||
faction_permissions = {"promote"},
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local rank = args.strings[1]
|
||||
if faction.ranks[rank] then
|
||||
faction:promote(args.players[1], rank)
|
||||
|
@ -490,7 +490,7 @@ factions.register_command("promote", {
|
|||
|
||||
factions.register_command("power", {
|
||||
description = "Display your faction's power",
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
minetest.chat_send_player(player, "Power: "..faction.power)
|
||||
return true
|
||||
end
|
||||
|
@ -499,7 +499,7 @@ factions.register_command("power", {
|
|||
factions.register_command("setbanner", {
|
||||
description = "Sets the banner you're on as the faction's banner.",
|
||||
faction_permissions = {"banner"},
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local meta = minetest.get_meta({x = pos.x, y = pos.y - 1, z = pos.z})
|
||||
local banner = meta:get_string("banner")
|
||||
if not banner then
|
||||
|
@ -515,7 +515,7 @@ factions.register_command("convert", {
|
|||
infaction = false,
|
||||
global_privileges = {"faction_admin"},
|
||||
format = {"string"},
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
if factions.convert(args.strings[1]) then
|
||||
minetest.chat_send_player(player, "Factions successfully converted.")
|
||||
else
|
||||
|
@ -526,23 +526,23 @@ factions.register_command("convert", {
|
|||
})
|
||||
|
||||
factions.register_command("free", {
|
||||
description = "Forcefully frees a chunk",
|
||||
description = "Forcefully frees a parcel",
|
||||
infaction = false,
|
||||
global_privileges = {"faction_admin"},
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
local fac = factions.chunks[chunkpos]
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local fac = factions.parcels[parcelpos]
|
||||
if not fac then
|
||||
send_error(player, "No claim at this position")
|
||||
return false
|
||||
end
|
||||
faction:unclaim_chunk(chunkpos)
|
||||
faction:unclaim_parcel(parcelpos)
|
||||
return true
|
||||
end
|
||||
})
|
||||
|
||||
factions.register_command("chat", {
|
||||
description = "Send a message to your faction's members",
|
||||
on_success = function(player, faction, pos, chunkpos, args)
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local msg = table.concat(args.other, " ")
|
||||
faction:broadcast(msg, player)
|
||||
end
|
||||
|
|
84
factions.lua
84
factions.lua
|
@ -21,14 +21,14 @@ factions = {}
|
|||
|
||||
--! @brief runtime data
|
||||
factions.factions = {}
|
||||
factions.chunks = {}
|
||||
factions.parcels = {}
|
||||
factions.players = {}
|
||||
|
||||
|
||||
factions.factions = {}
|
||||
--- settings
|
||||
factions.lower_laimable_height = -512
|
||||
factions.power_per_chunk = .5
|
||||
factions.power_per_parcel = .5
|
||||
|
||||
---------------------
|
||||
--! @brief returns whether a faction can be created or not (allows for implementation of blacklists and the like)
|
||||
|
@ -57,7 +57,7 @@ factions.Faction.__index = factions.Faction
|
|||
-- Faction permissions:
|
||||
--
|
||||
-- disband: disband the faction
|
||||
-- claim: (un)claim chunks
|
||||
-- claim: (un)claim parcels
|
||||
-- playerslist: invite/kick players and open/close the faction
|
||||
-- build: dig and place nodes
|
||||
-- description: set the faction's description
|
||||
|
@ -68,7 +68,7 @@ factions.Faction.__index = factions.Faction
|
|||
|
||||
function factions.Faction:new(faction)
|
||||
faction = {
|
||||
--! @brief power of a faction (needed for chunk claiming)
|
||||
--! @brief power of a faction (needed for parcel claiming)
|
||||
power = 0.,
|
||||
--! @brief maximum power of a faction
|
||||
maxpower = 0.,
|
||||
|
@ -89,14 +89,14 @@ function factions.Faction:new(faction)
|
|||
description = "Default faction description.",
|
||||
--! @brief list of players currently invited (can join with /f join)
|
||||
invited_players = {},
|
||||
--! @brief table of claimed chunks (keys are chunkpos strings)
|
||||
--! @brief table of claimed parcels (keys are parcelpos strings)
|
||||
land = {},
|
||||
--! @brief table of allies
|
||||
allies = {},
|
||||
--! @brief table of enemies
|
||||
enemies = {},
|
||||
--! @brief table of chunks/factions that are under attack
|
||||
attacked_chunks = {},
|
||||
--! @brief table of parcels/factions that are under attack
|
||||
attacked_parcels = {},
|
||||
--! @brief whether faction is closed or open (boolean)
|
||||
join_free = false,
|
||||
--! @brief banner texture string
|
||||
|
@ -141,53 +141,53 @@ function factions.Faction.remove_player(self, player)
|
|||
factions.save()
|
||||
end
|
||||
|
||||
--! @param chunkpos position of the wanted chunk
|
||||
--! @return whether this faction can claim a chunkpos
|
||||
function factions.Faction.can_claim_chunk(self, chunkpos)
|
||||
local fac = factions.chunks[chunkpos]
|
||||
--! @param parcelpos position of the wanted parcel
|
||||
--! @return whether this faction can claim a parcelpos
|
||||
function factions.Faction.can_claim_parcel(self, parcelpos)
|
||||
local fac = factions.parcels[parcelpos]
|
||||
if fac then
|
||||
if factions.factions[fac].power < 0. and self.power >= factions.power_per_chunk then
|
||||
if factions.factions[fac].power < 0. and self.power >= factions.power_per_parcel then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
elseif self.power < factions.power_per_chunk then
|
||||
elseif self.power < factions.power_per_parcel then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
--! @brief claim a chunk, update power and update global chunks table
|
||||
function factions.Faction.claim_chunk(self, chunkpos)
|
||||
--! @brief claim a parcel, update power and update global parcels table
|
||||
function factions.Faction.claim_parcel(self, parcelpos)
|
||||
-- check if claiming over other faction's territory
|
||||
local otherfac = factions.chunks[chunkpos]
|
||||
local otherfac = factions.parcels[parcelpos]
|
||||
if otherfac then
|
||||
local faction = factions.factions[otherfac]
|
||||
faction:unclaim_chunk(chunkpos)
|
||||
faction:unclaim_parcel(parcelpos)
|
||||
end
|
||||
factions.chunks[chunkpos] = self.name
|
||||
self.land[chunkpos] = true
|
||||
self:decrease_power(factions.power_per_chunk)
|
||||
self:on_claim_chunk(chunkpos)
|
||||
factions.parcels[parcelpos] = self.name
|
||||
self.land[parcelpos] = true
|
||||
self:decrease_power(factions.power_per_parcel)
|
||||
self:on_claim_parcel(parcelpos)
|
||||
factions.save()
|
||||
end
|
||||
|
||||
--! @brief claim a chunk, update power and update global chunks table
|
||||
function factions.Faction.unclaim_chunk(self, chunkpos)
|
||||
factions.chunks[chunkpos] = nil
|
||||
self.land[chunkpos] = nil
|
||||
self:increase_power(factions.power_per_chunk)
|
||||
self:on_unclaim_chunk(chunkpos)
|
||||
--! @brief claim a parcel, update power and update global parcels table
|
||||
function factions.Faction.unclaim_parcel(self, parcelpos)
|
||||
factions.parcels[parcelpos] = nil
|
||||
self.land[parcelpos] = nil
|
||||
self:increase_power(factions.power_per_parcel)
|
||||
self:on_unclaim_parcel(parcelpos)
|
||||
factions.save()
|
||||
end
|
||||
|
||||
--! @brief disband faction, updates global players and chunks table
|
||||
--! @brief disband faction, updates global players and parcels table
|
||||
function factions.Faction.disband(self)
|
||||
for k, _ in pairs(self.players) do -- remove players affiliation
|
||||
factions.players[k] = nil
|
||||
end
|
||||
for k, v in pairs(self.land) do -- remove chunk claims
|
||||
factions.chunks[k] = nil
|
||||
for k, v in pairs(self.land) do -- remove parcel claims
|
||||
factions.parcels[k] = nil
|
||||
end
|
||||
self:on_disband()
|
||||
factions.factions[self.name] = nil
|
||||
|
@ -343,11 +343,11 @@ function factions.Faction.on_player_join(self, player)
|
|||
self:broadcast(player.." has joined this faction.")
|
||||
end
|
||||
|
||||
function factions.Faction.on_claim_chunk(self, pos)
|
||||
function factions.Faction.on_claim_parcel(self, pos)
|
||||
self:broadcast("Chunk ("..pos..") has been claimed.")
|
||||
end
|
||||
|
||||
function factions.Faction.on_unclaim_chunk(self, pos)
|
||||
function factions.Faction.on_unclaim_parcel(self, pos)
|
||||
self:broadcast("Chunk ("..pos..") has been unclaimed.")
|
||||
end
|
||||
|
||||
|
@ -405,7 +405,7 @@ end
|
|||
|
||||
--??????????????
|
||||
|
||||
function factions.get_chunk_pos(pos)
|
||||
function factions.get_parcel_pos(pos)
|
||||
return math.floor(pos.x / 16.)..","..math.floor(pos.z / 16.)
|
||||
end
|
||||
|
||||
|
@ -497,8 +497,8 @@ function factions.load()
|
|||
minetest.log("action", player..","..rank)
|
||||
factions.players[player] = facname
|
||||
end
|
||||
for chunkpos, val in pairs(faction.land) do
|
||||
factions.chunks[chunkpos] = facname
|
||||
for parcelpos, val in pairs(faction.land) do
|
||||
factions.parcels[parcelpos] = facname
|
||||
end
|
||||
setmetatable(faction, factions.Faction)
|
||||
end
|
||||
|
@ -527,9 +527,9 @@ function factions.convert(filename)
|
|||
for player, _ in pairs(attrs.invitations) do
|
||||
newfac:invite_player(player)
|
||||
end
|
||||
for i in ipairs(attrs.chunk) do
|
||||
local chunkpos = table.concat(attrs.chunk[i],",")
|
||||
newfac:claim_chunk(chunkpos)
|
||||
for i in ipairs(attrs.parcel) do
|
||||
local parcelpos = table.concat(attrs.parcel[i],",")
|
||||
newfac:claim_parcel(parcelpos)
|
||||
end
|
||||
end
|
||||
for player, attrs in pairs(objects) do
|
||||
|
@ -556,8 +556,8 @@ minetest.register_globalstep(
|
|||
local playerslist = minetest.get_connected_players()
|
||||
for i in pairs(playerslist) do
|
||||
local player = playerslist[i]
|
||||
local chunkpos = factions.get_chunk_pos(player:getpos())
|
||||
local faction = factions.chunks[chunkpos]
|
||||
local parcelpos = factions.get_parcel_pos(player:getpos())
|
||||
local faction = factions.parcels[parcelpos]
|
||||
player:hud_remove("factionLand")
|
||||
player:hud_add({
|
||||
hud_elem_type = "text",
|
||||
|
@ -597,8 +597,8 @@ minetest.register_on_respawnplayer(
|
|||
|
||||
local default_is_protected = minetest.is_protected
|
||||
minetest.is_protected = function(pos, player)
|
||||
local chunkpos = factions.get_chunk_pos(pos)
|
||||
local faction = factions.chunks[chunkpos]
|
||||
local parcelpos = factions.get_parcel_pos(pos)
|
||||
local faction = factions.parcels[parcelpos]
|
||||
if not faction then
|
||||
return default_is_protected(pos, player)
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue
Block a user