mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
fea2326488
- Add a ace_cargo_space attribute to vehicles to alter how much cargo they can carry. - Add an ace_cargo_size attribute to objects to alter how much cargo space they consume. - Add two public functions `fnc_setSize.sqf` and `fnc_setSpace.sqf` to update the cargo size/space respectively of any given object. - Deprecate cargo makeLoadable module and public function. - Added some macros to get the space/size of a config, making code more readable in places.
46 lines
1.4 KiB
Plaintext
46 lines
1.4 KiB
Plaintext
/*
|
|
* Author: Dystopian
|
|
* Create actions for nearest vehicles with cargo.
|
|
*
|
|
* Arguments:
|
|
* 0: Target <OBJECT>
|
|
* 1: Player <OBJECT>
|
|
*
|
|
* Return Value:
|
|
* Children actions <ARRAY>
|
|
*
|
|
* Example:
|
|
* [target, player] call ace_cargo_fnc_addCargoVehiclesActions
|
|
*
|
|
* Public: No
|
|
*/
|
|
#include "script_component.hpp"
|
|
|
|
params ["_target", "_player"];
|
|
|
|
private _statement = {
|
|
params ["_target", "_player", "_params"];
|
|
_params params ["_vehicle"];
|
|
[_player, _target, _vehicle] call FUNC(startLoadIn);
|
|
};
|
|
|
|
private _actions = [];
|
|
|
|
{
|
|
private _config = configFile >> "CfgVehicles" >> typeOf _x;
|
|
private _hasCargoPublic = _x getVariable [QGVAR(hasCargo), false];
|
|
private _hasCargoConfig = getNumber (_config >> QGVAR(hasCargo)) == 1;
|
|
if ((_hasCargoPublic || _hasCargoConfig) && {_x != _target}) then {
|
|
private _name = getText (_config >> "displayName");
|
|
private _ownerName = [_x, true] call EFUNC(common,getName);
|
|
if ("" != _ownerName) then {
|
|
_name = format ["%1 (%2)", _name, _ownerName];
|
|
};
|
|
private _icon = (getText (_config >> "icon")) call BIS_fnc_textureVehicleIcon;
|
|
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]);
|
|
|
|
_actions
|