mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Make array of cargo holders dynamic (#5274)
This commit is contained in:
parent
bb8d5cadd7
commit
af0f7f36d8
@ -8,5 +8,6 @@ PREP_RECOMPILE_END;
|
||||
|
||||
GVAR(initializedItemClasses) = [];
|
||||
GVAR(initializedVehicleClasses) = [];
|
||||
GVAR(cargoHolderTypes) = ["Car", "Air", "Tank", "Ship", "Cargo_base_F", "Land_PaperBox_closed_F"];
|
||||
|
||||
ADDON = true;
|
||||
|
@ -40,6 +40,6 @@ private _actions = [];
|
||||
private _action = [format ["%1", _x], _name, _icon, _statement, {true}, {}, [_x]] call EFUNC(interact_menu,createAction);
|
||||
_actions pushBack [_action, [], _target];
|
||||
};
|
||||
} forEach (nearestObjects [_player, CARGO_VEHICLE_CLASSES, MAX_LOAD_DISTANCE]);
|
||||
} forEach (nearestObjects [_player, GVAR(cargoHolderTypes), MAX_LOAD_DISTANCE]);
|
||||
|
||||
_actions
|
||||
|
@ -56,7 +56,7 @@ private _condition = {
|
||||
private _hasCargoPublic = _x getVariable [QGVAR(hasCargo), false];
|
||||
private _hasCargoConfig = getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(hasCargo)) == 1;
|
||||
(_hasCargoPublic || _hasCargoConfig) && {_x != _target}
|
||||
} count (nearestObjects [_player, CARGO_VEHICLE_CLASSES, MAX_LOAD_DISTANCE])}
|
||||
} count (nearestObjects [_player, GVAR(cargoHolderTypes), MAX_LOAD_DISTANCE])}
|
||||
};
|
||||
private _statement = {
|
||||
params ["_target", "_player"];
|
||||
|
@ -27,6 +27,16 @@ private _hasCargoConfig = getNumber (configFile >> "CfgVehicles" >> _type >> QGV
|
||||
// Nothing to do here if vehicle has no cargo space
|
||||
if !(_hasCargoConfig || _hasCargoPublic) exitWith {};
|
||||
|
||||
// Check if cargo is in cargo holder types (checked when trying to search for loadable objects)
|
||||
private _addCargoType = true;
|
||||
{
|
||||
if (_type isKindOf _x) exitWith {_addCargoType = false};
|
||||
} forEach GVAR(cargoHolderTypes);
|
||||
TRACE_2("",_addCargoType,_type);
|
||||
if (_addCargoType) then {
|
||||
GVAR(cargoHolderTypes) pushBack _type;
|
||||
};
|
||||
|
||||
// Vehicle can have default ace cargo in its config
|
||||
if (isServer) then {
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ private _vehicle = _cargoVehicle;
|
||||
if (isNull _vehicle) then {
|
||||
{
|
||||
if ([_object, _x] call FUNC(canLoadItemIn)) exitWith {_vehicle = _x};
|
||||
} forEach (nearestObjects [_player, CARGO_VEHICLE_CLASSES, MAX_LOAD_DISTANCE]);
|
||||
} forEach (nearestObjects [_player, GVAR(cargoHolderTypes), MAX_LOAD_DISTANCE]);
|
||||
};
|
||||
|
||||
if (isNull _vehicle) exitWith {
|
||||
|
@ -18,8 +18,6 @@
|
||||
|
||||
#define MAX_LOAD_DISTANCE 10
|
||||
|
||||
#define CARGO_VEHICLE_CLASSES ["Car", "Air", "Tank", "Ship", "Cargo_base_F", "Land_PaperBox_closed_F"]
|
||||
|
||||
#define GET_NUMBER(config,default) (if (isNumber (config)) then {getNumber (config)} else {default})
|
||||
|
||||
// Default cargo size is -1 as 0 is a valid size
|
||||
|
Loading…
Reference in New Issue
Block a user