no punch in protected areas
This commit is contained in:
parent
7365733a09
commit
64e672a1c7
@ -631,22 +631,31 @@ local function damage_vehicle(self, toolcaps, ttime, damage)
|
||||
end
|
||||
|
||||
function airutils.on_punch(self, puncher, ttime, toolcaps, dir, damage)
|
||||
local name = puncher:get_player_name()
|
||||
local name = ""
|
||||
local ppos = {}
|
||||
|
||||
if not puncher or not puncher:is_player() then
|
||||
return
|
||||
end
|
||||
|
||||
if (puncher:is_player()) then
|
||||
name = puncher:get_player_name()
|
||||
ppos = puncher:get_pos()
|
||||
if (minetest.is_protected(ppos, name)) then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if self.hp_max <= 0 then
|
||||
airutils.destroy(self, name)
|
||||
end
|
||||
airutils.setText(self, self._vehicle_name)
|
||||
|
||||
if (puncher and puncher:is_player() and
|
||||
(string.find(puncher:get_wielded_item():get_name(), "rayweapon") or
|
||||
toolcaps.damage_groups.vehicle)) then
|
||||
damage_vehicle(self, toolcaps, ttime, damage)
|
||||
if (string.find(puncher:get_wielded_item():get_name(), "rayweapon") or
|
||||
toolcaps.damage_groups.vehicle) then
|
||||
damage_vehicle(self, toolcaps, ttime, damage)
|
||||
end
|
||||
|
||||
if not puncher or not puncher:is_player() then
|
||||
return
|
||||
end
|
||||
|
||||
local is_admin = false
|
||||
is_admin = minetest.check_player_privs(puncher, {server=true})
|
||||
if self.owner and self.owner ~= name and self.owner ~= "" then
|
||||
|
Loading…
x
Reference in New Issue
Block a user