Skip to content

Commit

Permalink
Car rebalanced slightly (adds gl_pbs_car_rebalance)
Browse files Browse the repository at this point in the history
- (see script comment for details)
- Fix Plasma Pistol (ext cap) ammo cost
- Increase MFC pack size from 20 to 24 (vanilla is 50) to balance against car refueling fix (lower pack size = less gas available overall) and energy weapon ammo cost tweaks (plasma rifle shots per cell: 6->8, laser rifle: 10->12)
  • Loading branch information
phobos2077 committed May 12, 2024
1 parent 82dc14d commit 9f0d3dd
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 3 deletions.
6 changes: 3 additions & 3 deletions proto_src/items/ammo/00000039.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ sid: -1
type: ITEM_TYPE_AMMO
material: 1
size: 1
weight: 2
cost: 400
weight: 3
cost: 480
inventoryFid: 117440549
soundId: '0'
ammoData:
caliber: 4
quantity: 20
quantity: 24
armorClassMod: 0
damageResistanceMod: -20
damageMult: 1
Expand Down
Binary file modified root/data/proto/items/00000039.pro
Binary file not shown.
2 changes: 2 additions & 0 deletions root/mods/ecco/combat.ini
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ carry_unspent_ap=2
401=2
; plasma pistol
24=2
; plasma pistol (ext cap)
406=2
; plasma rifle
15=3
; turbo plasma rifle
Expand Down
67 changes: 67 additions & 0 deletions scripts_src/_pbs_main/gl_pbs_car_rebalance.ssl
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
Car travel mod:

- Reduces both speed and fuel consumption by 25%.
- This means: car with no upgrades will have the same mileage as vanilla, but will take longer (in real time and game time) to there.
- Fuel cell regulator effect on fuel consumption is nerfed from -50% to -30%.
- Removed -10% fuel consumption bonus for New reno car upgrade (it already increases mileage considerably due to 25% more speed).
*/

#include "../sfall/sfall.h"
#include "../headers/global.h"

#define GAS_TANK_CAPACITY (80000)

variable step_remainder;

/*
Runs continuously during worldmap travel on car.

int arg0 - vanilla car speed (between 3 and 8 "steps")
int arg1 - vanilla fuel consumption (100 and below)

int ret0 - car speed override (pass -1 if you just want to override fuel consumption)
int ret1 - fuel consumption override
*/
procedure cartravel_hook begin
variable steps, subSteps, fuel,
origSteps := get_sfall_arg,
origFuel := get_sfall_arg;

/* VANILLA FO2 LOGIC, for reference:
steps := 3;
if (global_var(GVAR_CAR_BLOWER)) then steps += 1;
if (global_var(GVAR_NEW_RENO_CAR_UPGRADE)) then steps += 1;
if (global_var(GVAR_NEW_RENO_SUPER_CAR)) then steps += 3;

fuel := 100;
if (global_var(GVAR_NEW_RENO_SUPER_CAR)) then fuel -= fuel * 90 / 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 /= 2;
*/

steps := (origSteps + 1) * 0.75 - 1; // +1 accounts for 1 unskippable step
step_remainder += steps - floor(steps);
steps := floor(steps) + floor(step_remainder);
step_remainder -= floor(step_remainder);

fuel := 75;
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 * 30 / 100;

debug_msg(string_format("car orig: %d, %d, calc: %d, %d", origSteps, origFuel, steps, fuel));
set_sfall_return(steps);
set_sfall_return(fuel);
end

/* FOR TESTING, disable encounters:
procedure enc_hook begin
if (get_sfall_arg == 0) then
set_sfall_return(-1);
end*/

procedure start begin
register_hook_proc(HOOK_CARTRAVEL, cartravel_hook);
//register_hook_proc(HOOK_ENCOUNTER, cartravel_hook);
end

0 comments on commit 9f0d3dd

Please sign in to comment.