Skip to content

Commit

Permalink
Car rebalance: "car blower" increases consumption proportionally to i…
Browse files Browse the repository at this point in the history
…ncrease in speed

- This ensures constant consumption for a given distance traveled
  • Loading branch information
phobos2077 committed Jul 5, 2024
1 parent 4cc6d74 commit ea48a38
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 6 additions & 3 deletions root/mods/ecco/misc.ini
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,12 @@ enable_tweaks=1
speed_mult=0.75
; Base fuel consumption, vanilla is 100. This is per "turn", not per distance. So speed_mult above will affect actual consumption. Range [0; 1000]
fuel_consumption_base=75
; Fuel Cell regulator fuel consumption reduction percentage.
; 100 means no comsumption, 50 - vanilla value, 0 - no effect on consumption. Range [0; 100]
fuel_cell_regulator_percent=30
; Fuel Cell regulator fuel consumption modifier.
; -100 means no comsumption, -50 - vanilla value, 0 - no effect on consumption. Range [-1000; 1000]
fuel_cell_regulator_percent=-30
; Car Blower fuel consumption percentage modifier.
; 100 means no consumption, 0 - no effect on consumption (vanilla). Range [-1000; 1000]
car_blower_consumption_percent=25


[MAP_LOOT]
Expand Down
9 changes: 6 additions & 3 deletions scripts_src/_pbs_main/gl_pbs_car_rebalance.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ variable
ini_speed_mult,
ini_fuel_consumption_base,
ini_fuel_cell_regulator_percent,
ini_car_blower_consumption_percent,
step_remainder;

/*
Expand Down Expand Up @@ -56,9 +57,10 @@ procedure cartravel_hook begin
step_remainder -= floor(step_remainder);

fuel := ini_fuel_consumption_base;
if (global_var(GVAR_NEW_RENO_SUPER_CAR)) then fuel -= fuel * 80 / 100;
if (global_var(GVAR_CAR_BLOWER)) then fuel += fuel * ini_car_blower_consumption_percent / 100;
if (global_var(GVAR_NEW_RENO_SUPER_CAR)) then fuel += fuel * (-80) / 100;
//if (global_var(GVAR_NEW_RENO_CAR_UPGRADE)) then fuel -= fuel * 10 / 100;
if (global_var(GVAR_CAR_UPGRADE_FUEL_CELL_REGULATOR)) then fuel -= fuel * ini_fuel_cell_regulator_percent / 100;
if (global_var(GVAR_CAR_UPGRADE_FUEL_CELL_REGULATOR)) then fuel += fuel * ini_fuel_cell_regulator_percent / 100;

//debug_msg(string_format("car orig: %d, %d, calc: %d, %d", origSteps, origFuel, steps, fuel));
set_sfall_return(steps);
Expand All @@ -79,7 +81,8 @@ procedure start begin

float_from_ini_file_clamped(speed_mult, INI_FILE, INI_SECTION, 0.25, 3);
int_from_ini_file_clamped(fuel_consumption_base, INI_FILE, INI_SECTION, 0, 1000);
int_from_ini_file_clamped(fuel_cell_regulator_percent, INI_FILE, INI_SECTION, 0, 100);
int_from_ini_file_clamped(fuel_cell_regulator_percent, INI_FILE, INI_SECTION, -1000, 1000);
int_from_ini_file_clamped(car_blower_consumption_percent, INI_FILE, INI_SECTION, -1000, 1000);

register_hook_proc(HOOK_CARTRAVEL, cartravel_hook);
//register_hook_proc(HOOK_ENCOUNTER, enc_hook);
Expand Down

0 comments on commit ea48a38

Please sign in to comment.