control function changed

This commit is contained in:
Alexsandro Percy 2024-09-29 17:56:34 -03:00
parent b5b5933afa
commit 83b7aa7dca
2 changed files with 12 additions and 2 deletions

View File

@ -375,7 +375,12 @@ minetest.register_entity("automobiles_motorcycle:motorcycle", {
local mid_speed = (steering_speed/2)
steering_speed = mid_speed + mid_speed / math.abs(longit_speed*0.25)
end
accel, stop = automobiles_lib.control(self, dtime, hull_direction, longit_speed, longit_drag, later_drag, accel, motorcycle.max_acc_factor, motorcycle.max_speed, steering_angle_max, steering_speed)
local control = automobiles_lib.control
if self._control_function then
control = self._control_function
end
accel, stop = control(self, dtime, hull_direction, longit_speed, longit_drag, later_drag, accel, motorcycle.max_acc_factor, motorcycle.max_speed, steering_angle_max, steering_speed)
else
if self.driver_mesh then self.driver_mesh:set_properties({is_visible=false}) end
self._show_lights = false

View File

@ -370,7 +370,12 @@ minetest.register_entity("automobiles_vespa:vespa", {
local mid_speed = (steering_speed/2)
steering_speed = mid_speed + mid_speed / math.abs(longit_speed*0.25)
end
accel, stop = automobiles_lib.control(self, dtime, hull_direction, longit_speed, longit_drag, later_drag, accel, vespa.max_acc_factor, vespa.max_speed, steering_angle_max, steering_speed)
local control = automobiles_lib.control
if self._control_function then
control = self._control_function
end
accel, stop = control(self, dtime, hull_direction, longit_speed, longit_drag, later_drag, accel, motorcycle.max_acc_factor, motorcycle.max_speed, steering_angle_max, steering_speed)
else
if self.driver_mesh then self.driver_mesh:set_properties({is_visible=false}) end
self._show_lights = false