Added some extra checks for building permissions + fixed /f promote
This commit is contained in:
parent
c87e691a42
commit
95ab0e3bfd
27
factions.lua
27
factions.lua
|
@ -27,7 +27,7 @@ factions.players = {}
|
||||||
|
|
||||||
factions.factions = {}
|
factions.factions = {}
|
||||||
--- settings
|
--- settings
|
||||||
factions.lower_laimable_height = -512
|
factions.protection_max_depth = -512
|
||||||
factions.power_per_parcel = .5
|
factions.power_per_parcel = .5
|
||||||
|
|
||||||
---------------------
|
---------------------
|
||||||
|
@ -396,7 +396,7 @@ function factions.Faction.on_new_banner(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
function factions.Faction.on_promote(self, member)
|
function factions.Faction.on_promote(self, member)
|
||||||
minetest.chat_send_player(player, "You have been promoted to "..self.players[member])
|
minetest.chat_send_player(member, "You have been promoted to "..self.players[member])
|
||||||
end
|
end
|
||||||
|
|
||||||
function factions.Faction.on_revoke_invite(self, player)
|
function factions.Faction.on_revoke_invite(self, player)
|
||||||
|
@ -598,12 +598,27 @@ 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)
|
||||||
local parcelpos = factions.get_parcel_pos(pos)
|
local parcelpos = factions.get_parcel_pos(pos)
|
||||||
local faction = factions.parcels[parcelpos]
|
local parcel_faction = factions.parcels[parcelpos]
|
||||||
if not faction then
|
local player_faction = factions.players[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
|
||||||
|
if not parcel_faction then
|
||||||
return default_is_protected(pos, player)
|
return default_is_protected(pos, player)
|
||||||
else
|
else
|
||||||
faction = factions.factions[faction]
|
parcel_faction = factions.factions[faction]
|
||||||
return not faction:has_permission(player, "build")
|
if 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
|
||||||
|
return false
|
||||||
|
else
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return not parcel_faction:has_permission(player, "build")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user