added valet parking priv

This commit is contained in:
Alexsandro Percy 2023-09-12 13:39:46 -03:00
parent cf29e4fa22
commit 352d0e6a70
3 changed files with 9 additions and 22 deletions

View File

@ -54,24 +54,3 @@ function delorean.destroy(self, puncher)
minetest.add_item({x=pos.x+math.random()-0.5,y=pos.y,z=pos.z+math.random()-0.5},'automobiles_lib:wheel')
end
function delorean.engine_set_sound_and_animation(self, _longit_speed)
--minetest.chat_send_all('test1 ' .. dump(self._engine_running) )
if self.sound_handle then
if (math.abs(self._longit_speed) > math.abs(_longit_speed) + 0.03) or (math.abs(self._longit_speed) + 0.03 < math.abs(_longit_speed)) then
--minetest.chat_send_all('test2')
delorean.engineSoundPlay(self)
end
end
end
function delorean.engineSoundPlay(self)
--sound
if self.sound_handle then minetest.sound_stop(self.sound_handle) end
if self.object then
self.sound_handle = minetest.sound_play({name = delorean.engine_sound},
{object = self.object, gain = 2,
pitch = 1 + ((self._longit_speed/10)/2),
max_hear_distance = 10,
loop = true,})
end
end

View File

@ -15,7 +15,10 @@ function automobiles_lib.on_rightclick (self, clicker)
if self._formspec_function then formspec_f = self._formspec_function end
formspec_f(name)
else
if name == self.owner then
if name == self.owner or
(self.driver_name == nil and
( minetest.check_player_privs(clicker, "valet_parking") or minetest.check_player_privs(clicker, {server=true}) )
) then
if clicker:get_player_control().aux1 == true then
automobiles_lib.show_vehicle_trunk_formspec(self, clicker, self._trunk_slots)
else

View File

@ -594,3 +594,8 @@ initial_properties = {
end,
})
minetest.register_privilege("valet_parking", {
description = "Gives a valet parking priv for a player",
give_to_singleplayer = true
})