improved fuel by vehicle, fixed motorcycles drift

This commit is contained in:
Alexsandro Percy 2024-10-20 09:01:42 -03:00
parent 5c27a89082
commit c09843b4ee
10 changed files with 25 additions and 6 deletions

View File

@ -413,6 +413,7 @@ auto_beetle.car_properties1 = {
_max_acc_factor = 5,
_max_speed = 14,
_min_later_speed = 3,
_consumption_divisor = 60000,
get_staticdata = automobiles_lib.get_staticdata,

View File

@ -262,6 +262,7 @@ minetest.register_entity("automobiles_buggy:buggy", {
_max_acc_factor = 5,
_max_speed = 15,
_min_later_speed = 4.0,
_consumption_divisor = 60000,
get_staticdata = automobiles_lib.get_staticdata,

View File

@ -301,6 +301,7 @@ catrelle.car_properties1 = {
_max_acc_factor = 5,
_max_speed = 14,
_min_later_speed = 3,
_consumption_divisor = 50000,
get_staticdata = automobiles_lib.get_staticdata,

View File

@ -290,6 +290,7 @@ minetest.register_entity("automobiles_coupe:coupe", {
_max_acc_factor = 8,
_max_speed = 22,
_min_later_speed = 2,
_consumption_divisor = 50000,
get_staticdata = automobiles_lib.get_staticdata,

View File

@ -441,6 +441,7 @@ minetest.register_entity("automobiles_delorean:delorean", {
_max_acc_factor = 8.0,
_max_speed = 30,
_min_later_speed = 4.5,
_consumption_divisor = 40000,
_wheel_compensation = 0.8,

View File

@ -392,8 +392,14 @@ function automobiles_lib.on_step(self, dtime)
dynamic_later_drag = dynamic_later_drag/(longit_speed*2)
end
local later_drag = vector.multiply(nhdir,later_speed*
local later_drag = 0
if self._is_motorcycle == true then
later_drag = vector.multiply(nhdir,later_speed*
later_speed*self._LATER_DRAG_FACTOR*-1*automobiles_lib.sign(later_speed))
else
later_drag = vector.multiply(nhdir,later_speed*
later_speed*dynamic_later_drag*-1*automobiles_lib.sign(later_speed))
end
local accel = vector.add(longit_drag,later_drag)
local stop = nil
@ -653,7 +659,11 @@ function automobiles_lib.on_step(self, dtime)
local acceleration = automobiles_lib.get_hipotenuse_value(accel, zero_reference)
--minetest.chat_send_all(acceleration)
if automobiles_lib.is_drift_game == false then
local consumed_power = acceleration/40000
local consumption = 40000
if self._consumption_divisor then
consumption = self._consumption_divisor
end
local consumed_power = acceleration/consumption
self._energy = self._energy - consumed_power;
else
self._energy = 5

View File

@ -186,12 +186,13 @@ minetest.register_entity("automobiles_motorcycle:motorcycle", {
_rear_lights = 'automobiles_motorcycle:r_lights',
_LONGIT_DRAG_FACTOR = 0.14*0.14,
_LATER_DRAG_FACTOR = 200.0,
_LATER_DRAG_FACTOR = 25.0,
_max_acc_factor = 8,
_max_speed = 20,
_min_later_speed = 5,
_have_transmission = false,
_is_motorcycle = true,
_consumption_divisor = 100000,
_attach = motorcycle.attach_driver_stand,
_dettach = motorcycle.dettach_driver_stand,

View File

@ -293,7 +293,8 @@ minetest.register_entity("automobiles_roadster:roadster", {
_LATER_DRAG_FACTOR = 20.0,
_max_acc_factor = 5,
_max_speed = 12,
_min_later_speed = 2,
_min_later_speed = 5,
_consumption_divisor = 60000,
get_staticdata = automobiles_lib.get_staticdata,

View File

@ -360,6 +360,7 @@ minetest.register_entity("automobiles_trans_am:trans_am", {
_max_acc_factor = 12,
_max_speed = 40,
_min_later_speed = 4.5,
_consumption_divisor = 40000,
_wheel_compensation = 0.8,

View File

@ -180,12 +180,13 @@ minetest.register_entity("automobiles_vespa:vespa", {
_rear_lights = 'automobiles_vespa:r_lights',
_LONGIT_DRAG_FACTOR = 0.15*0.15,
_LATER_DRAG_FACTOR = 200.0,
_LATER_DRAG_FACTOR = 25.0,
_max_acc_factor = 6,
_max_speed = 15,
_max_speed = 14,
_min_later_speed = 5,
_have_transmission = false,
_is_motorcycle = true,
_consumption_divisor = 150000,
_attach = vespa.attach_driver_stand,
_dettach = vespa.dettach_driver_stand,