Skip to content

Commit

Permalink
Override ACE cargo space of vehicles (to fix incompatibility with GM …
Browse files Browse the repository at this point in the history
…and maybe other mods/DLCs)
  • Loading branch information
Sparker95 committed Feb 15, 2021
1 parent c5431ca commit 5e0fcba
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/Templates/initCargoSpace.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Cargo space of vehicles (ACE cargo)

#define T_DECLARE_CARGO_SPACE(catId, space) T_cargoSpace set [catId, space];

T_cargoSpace = [];
T_cargoSpace resize T_VEH_SIZE;

T_DECLARE_CARGO_SPACE(T_VEH_default, 4);
T_DECLARE_CARGO_SPACE(T_VEH_car_unarmed, 8);
T_DECLARE_CARGO_SPACE(T_VEH_car_armed, 8);
T_DECLARE_CARGO_SPACE(T_VEH_MRAP_unarmed, 8);
T_DECLARE_CARGO_SPACE(T_VEH_MRAP_HMG, 8);
T_DECLARE_CARGO_SPACE(T_VEH_MRAP_GMG, 8);
T_DECLARE_CARGO_SPACE(T_VEH_IFV, 8);
T_DECLARE_CARGO_SPACE(T_VEH_APC, 8);
T_DECLARE_CARGO_SPACE(T_VEH_MBT, 8);
T_DECLARE_CARGO_SPACE(T_VEH_MRLS, 8); //Multiple Rocket Launch System
T_DECLARE_CARGO_SPACE(T_VEH_SPA, 8); //Self-Propelled Artillery
T_DECLARE_CARGO_SPACE(T_VEH_SPAA, 8); //Self-Propelled Anti-Aircraft system
T_DECLARE_CARGO_SPACE(T_VEH_stat_HMG_high, 0);
T_DECLARE_CARGO_SPACE(T_VEH_stat_GMG_high, 0);
T_DECLARE_CARGO_SPACE(T_VEH_stat_HMG_low, 0);
T_DECLARE_CARGO_SPACE(T_VEH_stat_GMG_low, 0);
T_DECLARE_CARGO_SPACE(T_VEH_stat_AA, 0);
T_DECLARE_CARGO_SPACE(T_VEH_stat_AT, 0);
T_DECLARE_CARGO_SPACE(T_VEH_stat_mortar_light, 0); //Light mortar
T_DECLARE_CARGO_SPACE(T_VEH_stat_mortar_heavy, 0); //Heavy mortar, because RHS has some
T_DECLARE_CARGO_SPACE(T_VEH_heli_light, 20); //Light transport helicopter for infantry
T_DECLARE_CARGO_SPACE(T_VEH_heli_heavy, 20); //Heavy transport helicopter, both for cargo and infantry
T_DECLARE_CARGO_SPACE(T_VEH_heli_cargo, 20); //Heavy transport helicopter only for cargo
T_DECLARE_CARGO_SPACE(T_VEH_heli_attack, 20); //Attack helicopter
T_DECLARE_CARGO_SPACE(T_VEH_plane_attack, 4); //Attack plane, mainly for air-to-ground
T_DECLARE_CARGO_SPACE(T_VEH_plane_fighter, 4); //Fighter plane
T_DECLARE_CARGO_SPACE(T_VEH_plane_cargo, 4); //Cargo plane
T_DECLARE_CARGO_SPACE(T_VEH_plane_unarmed, 4); //Light unarmed plane like cessna
T_DECLARE_CARGO_SPACE(T_VEH_plane_VTOL, 20); //VTOL
T_DECLARE_CARGO_SPACE(T_VEH_boat_unarmed, 10); //Unarmed boat
T_DECLARE_CARGO_SPACE(T_VEH_boat_armed, 10); //Armed boat
T_DECLARE_CARGO_SPACE(T_VEH_personal, 3); //Quad bike or something for 1-2 men personal transport
T_DECLARE_CARGO_SPACE(T_VEH_truck_inf, 20); //Truck for infantry transport
T_DECLARE_CARGO_SPACE(T_VEH_truck_cargo, 20); //Truck for general cargo transport
T_DECLARE_CARGO_SPACE(T_VEH_truck_ammo, 20); //Ammo truck
T_DECLARE_CARGO_SPACE(T_VEH_truck_repair, 20); //Repair truck
T_DECLARE_CARGO_SPACE(T_VEH_truck_medical, 20); //Medical truck
T_DECLARE_CARGO_SPACE(T_VEH_truck_fuel, 20); //Fuel truck
T_DECLARE_CARGO_SPACE(T_VEH_submarine, 6); //Submarine
1 change: 1 addition & 0 deletions src/Templates/initVariables.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ CALL_COMPILE_COMMON("Templates\initCategoriesNames.sqf");
CALL_COMPILE_COMMON("Templates\initEfficiency.sqf");
CALL_COMPILE_COMMON("Templates\initComposition.sqf");
CALL_COMPILE_COMMON("Templates\initLoadouts.sqf");
CALL_COMPILE_COMMON("Templates\initCargoSpace.sqf");
CALL_COMPILE_COMMON("Templates\combatTips.sqf");

if (IS_SERVER) then {
Expand Down
27 changes: 27 additions & 0 deletions src/Unit/Unit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,9 @@ CLASS("Unit", ["Storable" ARG "GOAP_Agent"])

// Initialize vehicle lock
T_CALLM0("updateVehicleLock");

// Set vehicle cargo space
T_CALLM0("initObjectCargoSpace");
};
case T_DRONE: {
};
Expand Down Expand Up @@ -1462,6 +1465,30 @@ CLASS("Unit", ["Storable" ARG "GOAP_Agent"])
};
ENDMETHOD;

// Initializes ACE cargo space for vehicles
METHOD(initObjectCargoSpace)
params [P_THISOBJECT];

pr _data = T_GETV("data");
pr _catid = _data select UNIT_DATA_ID_CAT;

// Bail if not vehicle
if (_catID != T_VEH) exitWith {};

pr _subcatId = _data select UNIT_DATA_ID_SUBCAT;

// Bail if default subcategory (civilian cars use those)
if (_subcatId == T_VEH_default) exitWith {};

pr _cargoSpace = T_cargoSpace#_subcatId;
pr _hO = _data select UNIT_DATA_ID_OBJECT_HANDLE;

[_hO, _cargoSpace] call ace_cargo_fnc_setSpace;

OOP_INFO_2("Set cargo space of %1 to %2", _hO, _cargoSpace);

ENDMETHOD;

// D E S P A W N
/*
Method: despawn
Expand Down

0 comments on commit 5e0fcba

Please sign in to comment.