added priv validation for a plane

This commit is contained in:
Alexsandro Percy 2023-08-19 17:56:18 -03:00
parent aa2f00212e
commit 8e6a39ec81
2 changed files with 10 additions and 1 deletions

View file

@ -586,7 +586,8 @@ function airutils.on_punch(self, puncher, ttime, toolcaps, dir, damage)
-- lets permit destroying on the air
local is_flying = not self.colinfo.touching_ground
if is_flying and not puncher:is_player() then
--if is_flying and not puncher:is_player() then
if not puncher:is_player() then
damage_vehicle(self, toolcaps, ttime, damage)
end
--end

View file

@ -55,6 +55,14 @@ end
-- attach player
function airutils.attach(self, player, instructor_mode)
if self._needed_licence then
local can_fly = minetest.check_player_privs(player, self._needed_licence)
if not can_fly then
minetest.chat_send_player(player:get_player_name(), core.colorize('#ff0000', ' >>> You need trhe priv "'..self._needed_licence..'" to fly this plane.'))
return
end
end
instructor_mode = instructor_mode or false
local name = player:get_player_name()
self.driver_name = name