Fixed members of the attacked faction not being able to edit their chunk
This commit is contained in:
parent
7492c88e1d
commit
b763015f3d
23
factions.lua
23
factions.lua
@ -385,7 +385,8 @@ function factions.Faction.stop_attack(self, parcelpos)
|
|||||||
attacked_faction = factions.factions[attacked_faction]
|
attacked_faction = factions.factions[attacked_faction]
|
||||||
if attacked_faction.attacked_parcels[parcelpos] then
|
if attacked_faction.attacked_parcels[parcelpos] then
|
||||||
attacked_faction.attacked_parcels[parcelpos][self.name] = nil
|
attacked_faction.attacked_parcels[parcelpos][self.name] = nil
|
||||||
attacked_faction:broadcast("Parcel ("..self.name..") is no longer under attack.")
|
attacked_faction:broadcast("Parcel ("..parcelpos..") is no longer under attack from "..self.name..".")
|
||||||
|
self:broadcast("Parcel ("..parcelpos..") has been reconquered by "..attacked_faction.name..".")
|
||||||
end
|
end
|
||||||
factions.save()
|
factions.save()
|
||||||
end
|
end
|
||||||
@ -694,6 +695,13 @@ minetest.register_on_respawnplayer(
|
|||||||
|
|
||||||
local default_is_protected = minetest.is_protected
|
local default_is_protected = minetest.is_protected
|
||||||
minetest.is_protected = function(pos, player)
|
minetest.is_protected = function(pos, player)
|
||||||
|
if pos.y < factions.protection_max_depth then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if factions.disallow_edit_nofac and not player_faction then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
local parcelpos = factions.get_parcel_pos(pos)
|
local parcelpos = factions.get_parcel_pos(pos)
|
||||||
local parcel_faction = factions.parcels[parcelpos]
|
local parcel_faction = factions.parcels[parcelpos]
|
||||||
local player_faction = factions.players[player]
|
local player_faction = factions.players[player]
|
||||||
@ -710,24 +718,19 @@ minetest.is_protected = function(pos, player)
|
|||||||
if player_wield:get_name() == "banners:death_banner" and player_faction then --todo: check for allies, maybe for permissions
|
if player_wield:get_name() == "banners:death_banner" and player_faction then --todo: check for allies, maybe for permissions
|
||||||
return not factions.factions[player_faction]:has_permission(player, "claim")
|
return not factions.factions[player_faction]:has_permission(player, "claim")
|
||||||
end
|
end
|
||||||
if pos.y < factions.protection_max_depth then
|
-- no faction
|
||||||
return false
|
|
||||||
end
|
|
||||||
if factions.disallow_edit_nofac and not player_faction then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
if not parcel_faction then
|
if not parcel_faction then
|
||||||
return default_is_protected(pos, player)
|
return default_is_protected(pos, player)
|
||||||
else
|
else
|
||||||
parcel_faction = factions.factions[parcel_faction]
|
parcel_faction = factions.factions[parcel_faction]
|
||||||
if parcel_faction.attacked_parcels[parcelpos] then -- chunk is being attacked
|
if parcel_faction.name == player_faction then
|
||||||
|
return not parcel_faction:has_permission(player, "build")
|
||||||
|
elseif parcel_faction.attacked_parcels[parcelpos] then -- chunk is being attacked
|
||||||
if parcel_faction.attacked_parcels[parcelpos][player_faction] then -- attacked by the player's faction
|
if parcel_faction.attacked_parcels[parcelpos][player_faction] then -- attacked by the player's faction
|
||||||
return false
|
return false
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
else
|
|
||||||
return not parcel_faction:has_permission(player, "build")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user