Merge pull request #3191 from acemod/cargoCleanup

Cargo Cleanup, Add makeLoadable
This commit is contained in:
Thomas Kooi 2016-02-04 19:44:27 +01:00
commit 038befbce0
25 changed files with 249 additions and 111 deletions

View File

@ -12,7 +12,9 @@ class Extended_PostInit_EventHandlers {
class Extended_Killed_EventHandlers {
class All {
init = QUOTE(call FUNC(handleDestroyed));
class ADDON {
serverKilled = QUOTE(call FUNC(handleDestroyed));
};
};
};

View File

@ -1,5 +1,9 @@
class CfgVehicles {
class ACE_Module;
class Logic;
class Module_F: Logic {
class ModuleDescription;
};
class ACE_Module: Module_F {};
class ACE_moduleCargoSettings: ACE_Module {
scope = 2;
displayName = CSTRING(SettingsModule_DisplayName);
@ -26,6 +30,33 @@ class CfgVehicles {
sync[] = {};
};
};
class GVAR(makeLoadable): ACE_Module {
scope = 2;
displayName = CSTRING(makeLoadable_displayName);
icon = QUOTE(PATHTOF(UI\Icon_Module_makeLoadable_ca.paa));
category = "ACE_Logistics";
function = QFUNC(moduleMakeLoadable);
isGlobal = 1;
isTriggerActivated = 0;
author = ECSTRING(common,ACETeam);
class Arguments {
class canLoad {
displayName = CSTRING(makeLoadable_displayName);
description = CSTRING(MakeLoadable_description);
typeName = "BOOL";
defaultValue = 1;
};
class setSize {
displayName = CSTRING(makeLoadable_setSize_displayName);
typeName = "NUMBER";
defaultValue = 1;
};
};
class ModuleDescription: ModuleDescription {
description = CSTRING(module_MakeLoadable_description);
sync[] = {"AnyStaticObject"};
};
};
class LandVehicle;
class Car: LandVehicle {
@ -178,7 +209,7 @@ class CfgVehicles {
GVAR(space) = 0;
GVAR(hasCargo) = 0;
};
// boats
class Ship;
class Ship_F: Ship {
@ -245,7 +276,7 @@ class CfgVehicles {
class RoadBarrier_F: RoadCone_F {
GVAR(size) = 2;
};
class Scrapyard_base_F;
class Land_PaperBox_closed_F: Scrapyard_base_F {

Binary file not shown.

View File

@ -4,14 +4,13 @@
["LoadCargo", {
(_this select 0) params ["_item","_vehicle"];
private ["_loaded", "_hint", "_itemName", "_vehicleName"];
_loaded = [_item, _vehicle] call FUNC(loadItem);
private _loaded = [_item, _vehicle] call FUNC(loadItem);
// Show hint as feedback
_hint = [LSTRING(LoadingFailed), LSTRING(LoadedItem)] select _loaded;
_itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName");
_vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
private _hint = [LSTRING(LoadingFailed), LSTRING(LoadedItem)] select _loaded;
private _itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName");
private _vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
["displayTextStructured", [[_hint, _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent);
@ -23,16 +22,15 @@
["UnloadCargo", {
(_this select 0) params ["_item","_vehicle"];
private ["_unloaded", "_itemClass", "_hint", "_itemName", "_vehicleName"];
_unloaded = [_item, _vehicle] call FUNC(unloadItem);
private _unloaded = [_item, _vehicle] call FUNC(unloadItem);
_itemClass = if (_item isEqualType "") then {_item} else {typeOf _item};
private _itemClass = if (_item isEqualType "") then {_item} else {typeOf _item};
// Show hint as feedback
_hint = [LSTRING(UnloadingFailed), LSTRING(UnloadedItem)] select _unloaded;
_itemName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName");
_vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
private _hint = [LSTRING(UnloadingFailed), LSTRING(UnloadedItem)] select _unloaded;
private _itemName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName");
private _vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
["displayTextStructured", [[_hint, _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent);

View File

@ -13,6 +13,8 @@ PREP(handleDestroyed);
PREP(initObject);
PREP(initVehicle);
PREP(loadItem);
PREP(makeLoadable);
PREP(moduleMakeLoadable);
PREP(moduleSettings);
PREP(onMenuOpen);
PREP(startLoadIn);
@ -21,5 +23,6 @@ PREP(unloadItem);
PREP(validateCargoSpace);
GVAR(initializedItemClasses) = [];
GVAR(initializedVehicleClasses) = [];
ADDON = true;

View File

@ -17,11 +17,11 @@
#include "script_component.hpp"
params ["_player", "_object"];
TRACE_2("params",_player,_object);
if (!([_player, _object, []] call EFUNC(common,canInteractWith))) exitWith {false};
private ["_nearestVehicle"];
_nearestVehicle = [_player] call FUNC(findNearestVehicle);
private _nearestVehicle = [_player] call FUNC(findNearestVehicle);
if (_nearestVehicle isKindOf "Cargo_Base_F" || isNull _nearestVehicle) then {
{

View File

@ -18,11 +18,10 @@
params [["_item", "", [objNull,""]], "_vehicle"];
if (speed _vehicle > 1 || (((getPos _vehicle) select 2) > 3)) exitWith {false};
private ["_itemSize", "_validItem"];
_itemSize = [_item] call FUNC(getSizeItem);
if (speed _vehicle > 1 || {((getPos _vehicle) select 2) > 3}) exitWith {false};
private _itemSize = [_item] call FUNC(getSizeItem);
private _validItem = false;
if (_item isEqualType "") then {
_validItem =
isClass (configFile >> "CfgVehicles" >> _item) &&

View File

@ -17,15 +17,15 @@
#include "script_component.hpp"
params ["_item", "_vehicle"];
private ["_loaded", "_itemClass", "_validVehiclestate", "_emptyPos"];
TRACE_2("params",_item,_vehicle);
_loaded = _vehicle getVariable [QGVAR(loaded), []];
private _loaded = _vehicle getVariable [QGVAR(loaded), []];
if !(_item in _loaded) exitWith {false};
_itemClass = if (_item isEqualType "") then {_item} else {typeOf _item};
private _itemClass = if (_item isEqualType "") then {_item} else {typeOf _item};
_validVehiclestate = true;
_emptyPos = [];
private _validVehiclestate = true;
private _emptyPos = [];
if (_vehicle isKindOf "Ship" ) then {
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, _itemClass]); // TODO: if spot is underwater pick another spot.

View File

@ -15,23 +15,21 @@
*/
#include "script_component.hpp"
private ["_loadCar", "_loadHelicopter", "_loadTank", "_loadShip", "_loadContainer"];
params ["_unit"];
_loadCar = nearestObject [_unit, "car"];
private _loadCar = nearestObject [_unit, "car"];
if (_unit distance _loadCar <= MAX_LOAD_DISTANCE) exitWith {_loadCar};
_loadHelicopter = nearestObject [_unit, "air"];
private _loadHelicopter = nearestObject [_unit, "air"];
if (_unit distance _loadHelicopter <= MAX_LOAD_DISTANCE) exitWith {_loadHelicopter};
_loadTank = nearestObject [_unit, "tank"];
private _loadTank = nearestObject [_unit, "tank"];
if (_unit distance _loadTank <= MAX_LOAD_DISTANCE) exitWith {_loadTank};
_loadShip = nearestObject [_unit, "ship"];
private _loadShip = nearestObject [_unit, "ship"];
if (_unit distance _loadShip <= MAX_LOAD_DISTANCE) exitWith {_loadShip};
_loadContainer = nearestObject [_unit,"Cargo_base_F"];
private _loadContainer = nearestObject [_unit,"Cargo_base_F"];
if (_unit distance _loadContainer <= MAX_LOAD_DISTANCE) exitWith {_loadContainer};
objNull

View File

@ -16,5 +16,6 @@
#include "script_component.hpp"
params ["_object"];
// TRACE_1("params",_object);
_object getVariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeOf _object >> QGVAR(space))]

View File

@ -16,22 +16,23 @@
#include "script_component.hpp"
params ["_item"];
private ["_isVirtual","_itemClass","_config"];
scopeName "return";
_isVirtual = (_item isEqualType "");
_itemClass = if (_isVirtual) then {_item} else {typeOf _item};
_config = (configFile >> "CfgVehicles" >> _itemClass >> QGVAR(size));
private _isVirtual = (_item isEqualType "");
private _itemClass = if (_isVirtual) then {_item} else {typeOf _item};
private _config = (configFile >> "CfgVehicles" >> _itemClass >> QGVAR(size));
if (_isVirtual) then {
if (isNumber _config) then {
(getNumber _config) breakOut "return";
};
} else {
_config = (configFile >> "CfgVehicles" >> typeOf _item >> QGVAR(size));
if (!isNil {_item getVariable QGVAR(size)}) then {
(_item getVariable QGVAR(size)) breakOut "return";
};
if (isNumber _config) then {
(_item getVariable [QGVAR(size), getNumber _config]) breakOut "return";
(getNumber _config) breakOut "return";
};
};

View File

@ -1,6 +1,6 @@
/*
* Author: Glowbal
* Handle object being destroyed.
* Handle object being destroyed. Only runs on server.
*
* Arguments:
* 0: Object <OBJECT>
@ -16,10 +16,9 @@
#include "script_component.hpp"
params ["_vehicle"];
TRACE_1("params",_vehicle);
private["_loaded"];
_loaded = _vehicle getVariable [QGVAR(loaded), []];
private _loaded = _vehicle getVariable [QGVAR(loaded), []];
if (_loaded isEqualTo []) exitWith {};
{
@ -27,6 +26,7 @@ if (_loaded isEqualTo []) exitWith {};
if (_x isEqualType objNull) then {
deleteVehicle _x;
};
nil
} count _loaded;
[_vehicle] call FUNC(validateCargoSpace);

View File

@ -16,15 +16,31 @@
#include "script_component.hpp"
params ["_object"];
private _type = typeOf _object;
TRACE_2("params",_object,_type);
if (getNumber (configFile >> "CfgVehicles" >> typeOf _object >> QGVAR(canLoad)) != 1) exitWith {};
private ["_type", "_action"];
_type = typeOf _object;
if ((_object getVariable [QGVAR(canLoad), getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(canLoad))]) != 1) exitWith {};
// do nothing if the class is already initialized
if (_type in GVAR(initializedItemClasses)) exitWith {};
GVAR(initializedItemClasses) pushBack _type;
_action = [QGVAR(load), localize LSTRING(loadObject), QUOTE(PATHTOF(UI\Icon_load.paa)), {[_player, _target] call FUNC(startLoadIn)}, {GVAR(enable) && {[_player, _target] call FUNC(canLoad)}}] call EFUNC(interact_menu,createAction);
TRACE_1("Adding load cargo action to class", _type);
private _condition = {
GVAR(enable) &&
{(_target getVariable [QGVAR(canLoad), getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(canLoad))]) == 1} &&
{locked _target < 2} &&
{alive _target} &&
{[_player, _target, []] call EFUNC(common,canInteractWith)}
};
private _statement = {
params ["_target", "_player"];
[_player, _target] call FUNC(startLoadIn);
};
private _text = localize LSTRING(loadObject);
private _icon = QUOTE(PATHTOF(UI\Icon_load.paa));
private _action = [QGVAR(load), _text, _icon, _statement, _condition] call EFUNC(interact_menu,createAction);
[_type, 0, ["ACE_MainActions"], _action] call EFUNC(interact_menu,addActionToClass);

View File

@ -18,9 +18,7 @@
params ["_vehicle"];
TRACE_1("params", _vehicle);
private ["_type", "_initializedClasses"];
_type = typeOf _vehicle;
_initializedClasses = GETMVAR(GVAR(initializedClasses),[]);
private _type = typeOf _vehicle;
if (isServer) then {
{
@ -35,21 +33,24 @@ if (isServer) then {
};
// do nothing if the class is already initialized
if (_type in _initializedClasses) exitWith {};
if (_type in GVAR(initializedVehicleClasses)) exitWith {};
// set class as initialized
_initializedClasses pushBack _type;
SETMVAR(GVAR(initializedClasses),_initializedClasses);
GVAR(initializedVehicleClasses) pushBack _type;
if (!hasInterface) exitWith {};
if (getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(hasCargo)) != 1) exitWith {};
private ["_text", "_condition", "_statement", "_icon", "_action"];
_condition = {
params ["_target", "_player"];
TRACE_1("Adding unload cargo action to class", _type);
private _condition = {
GVAR(enable) && {locked _target < 2} && {alive _target} && {[_player, _target, []] call EFUNC(common,canInteractWith)}
};
_text = localize LSTRING(openMenu);
_statement = {GVAR(interactionVehicle) = _target; createDialog QGVAR(menu);};
_icon = "";
private _statement = {
GVAR(interactionVehicle) = _target;
createDialog QGVAR(menu);
};
private _text = localize LSTRING(openMenu);
private _icon = "";
_action = [QGVAR(openMenu), _text, _icon, _statement, _condition] call EFUNC(interact_menu,createAction);
private _action = [QGVAR(openMenu), _text, _icon, _statement, _condition] call EFUNC(interact_menu,createAction);
[_type, 0, ["ACE_MainActions"], _action] call EFUNC(interact_menu,addActionToClass);

View File

@ -19,18 +19,17 @@
#include "script_component.hpp"
params [["_item","",[objNull,""]], ["_vehicle",objNull,[objNull]]];
private ["_loaded", "_space", "_itemSize"];
if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith {false};
_loaded = _vehicle getVariable [QGVAR(loaded), []];
private _loaded = _vehicle getVariable [QGVAR(loaded), []];
_loaded pushBack _item;
_vehicle setVariable [QGVAR(loaded), _loaded, true];
TRACE_1("added to loaded array",_loaded);
_space = [_vehicle] call FUNC(getCargoSpaceLeft);
_itemSize = [_item] call FUNC(getSizeItem);
private _space = [_vehicle] call FUNC(getCargoSpaceLeft);
private _itemSize = [_item] call FUNC(getSizeItem);
_vehicle setVariable [QGVAR(space), _space - _itemSize, true];
if (_item isEqualType objNull) then {

View File

@ -0,0 +1,47 @@
/*
* Author: PabstMirror
* Makes any object loadable. Needs to be called on all machines.
*
* Arguments:
* 0: Object <OBJECT>
* 1: Set as loadable (default: true) <BOOL><SCALAR>
* 2: Size. (default: 1) <NUMBER>
*
* Return value:
* None
*
* Example:
* [cursorTarget, true, 1] call ace_cargo_fnc_makeLoadable
*
* Public: Yes
*/
#include "script_component.hpp"
params [["_object", objNull, [objNull]], ["_canLoad", true, [false, 0]], ["_setSize", 1, [0]]];
TRACE_3("params",_object,_canLoad,_setSize);
if (isNull _object) exitWith {TRACE_1("null",_object);};
private _type = typeOf _object;
private _cfgCanLoad = getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(canLoad));
private _curSize = [_object] call FUNC(getSizeItem);
_canLoad = [0, 1] select _canLoad; //convert true/false to scalar
if ((_canLoad == 1) && {_setSize <= 0}) exitWith {
ACE_LOGERROR("ace_cargo_fnc_makeLoadable (size <= 0) when making loadable");
};
TRACE_2("setVar if different from config",_canLoad,_cfgCanLoad);
if (_canLoad != _cfgCanLoad) then {
_object setVariable [QGVAR(canLoad), _canLoad];
};
TRACE_2("setVar if different from config",_setSize,_curSize);
if (_setSize != _curSize) then {
_object setVariable [QGVAR(size), _setSize];
};
//Add the load actions to the object class if not already added
[_object] call FUNC(initObject);
nil

View File

@ -0,0 +1,34 @@
/*
* Author: PabstMirror
* Module to make an object loadable.
*
* Arguments:
* 0: The module logic <OBJECT>
* 1: Synchronized units <ARRAY>
* 2: Activated <BOOL>
*
* Return Value:
* None
*
* Example:
* [logic, [box], true] call ace_cargo_fnc_moduleMakeLoadable
*
* Public: No
*/
#include "script_component.hpp"
params ["_logic", "_objects", "_activated"];
TRACE_3("params",_logic,_objects,_activated);
if ((isNull _logic) || {!_activated}) exitWith {};
if (_objects isEqualTo []) exitWith {
ACE_LOGWARNING_1("ace_cargo_fnc_moduleMakeLoadable has no synced objects [%1]", _logic);
};
private _canLoad = _logic getVariable ["canLoad", true];
private _setSize = _logic getVariable ["setSize", 1];
TRACE_2("settings",_canLoad,_setSize);
{
[_x, _canLoad, _setSize] call FUNC(makeLoadable);
} forEach _objects;

View File

@ -19,7 +19,7 @@
if (!isServer) exitWith {};
params ["_logic", "_units", "_activated"];
params ["_logic", "", "_activated"];
if (!_activated) exitWith {};

View File

@ -22,25 +22,24 @@ params ["_display"];
uiNamespace setVariable [QGVAR(menuDisplay), _display];
[{
private ["_display","_loaded", "_ctrl", "_class", "_label"];
disableSerialization;
_display = uiNamespace getVariable QGVAR(menuDisplay);
private _display = uiNamespace getVariable QGVAR(menuDisplay);
if (isnil "_display") exitWith {
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
if (isNull GVAR(interactionVehicle) || ACE_player distance GVAR(interactionVehicle) >= 10) exitWith {
if (isNull GVAR(interactionVehicle) || {ACE_player distance GVAR(interactionVehicle) >= 10}) exitWith {
closeDialog 0;
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
_loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []];
_ctrl = _display displayCtrl 100;
_label = _display displayCtrl 2;
private _loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []];
private _ctrl = _display displayCtrl 100;
private _label = _display displayCtrl 2;
lbClear _ctrl;
{
_class = if (_x isEqualType "") then {_x} else {typeOf _x};
private _class = if (_x isEqualType "") then {_x} else {typeOf _x};
_ctrl lbAdd (getText(configfile >> "CfgVehicles" >> _class >> "displayName"));
true
} count _loaded;

View File

@ -3,38 +3,46 @@
* Start load item.
*
* Arguments:
* 0: Object <OBJECT>
* 0: Player <OBJECT>
* 1: Object <OBJECT>
*
* Return value:
* Object loaded <BOOL>
* Load ProgressBar Started <BOOL>
*
* Example:
* [object] call ace_cargo_fnc_starLoadIn
* [player, cursorTarget] call ace_cargo_fnc_startLoadIn
*
* Public: No
*/
#include "script_component.hpp"
params ["_player", "_object"];
private ["_vehicle", "_size", "_displayName"];
TRACE_2("params",_player,_object);
_vehicle = [_player] call FUNC(findNearestVehicle);
private _vehicle = [_player] call FUNC(findNearestVehicle);
if (isNull _vehicle || _vehicle isKindOf "Cargo_Base_F") then {
if ((isNull _vehicle) || {_vehicle isKindOf "Cargo_Base_F"}) then {
{
if ([_object, _x] call FUNC(canLoadItemIn)) exitWith {_vehicle = _x};
} forEach (nearestObjects [_player, ["Cargo_base_F", "Land_PaperBox_closed_F"], MAX_LOAD_DISTANCE]);
};
if (isNull _vehicle) exitWith {false};
if (isNull _vehicle) exitWith {
TRACE_3("Could not find vehicle",_player,_object,_vehicle);
false
};
_return = false;
// Start progress bar
if ([_object, _vehicle] call FUNC(canLoadItemIn)) then {
_size = [_object] call FUNC(getSizeItem);
private _size = [_object] call FUNC(getSizeItem);
[5 * _size, [_object,_vehicle], "LoadCargo", {}, localize LSTRING(LoadingItem)] call EFUNC(common,progressBar);
_return = true;
} else {
_displayName = getText (configFile >> "CfgVehicles" >> typeOf _object >> "displayName");
private _displayName = getText (configFile >> "CfgVehicles" >> typeOf _object >> "displayName");
["displayTextStructured", [[LSTRING(LoadingFailed), _displayName], 3.0]] call EFUNC(common,localEvent);
};
_return

View File

@ -15,34 +15,29 @@
*/
#include "script_component.hpp"
private ["_display", "_loaded", "_ctrl", "_selected", "_item"];
disableSerialization;
_display = uiNamespace getVariable QGVAR(menuDisplay);
private _display = uiNamespace getVariable QGVAR(menuDisplay);
if (isNil "_display") exitWith {};
_loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []];
if (count _loaded == 0) exitWith {};
private _loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []];
if (_loaded isEqualTo []) exitWith {};
_ctrl = _display displayCtrl 100;
private _ctrl = _display displayCtrl 100;
_selected = (lbCurSel _ctrl) max 0;
private _selected = (lbCurSel _ctrl) max 0;
if (count _loaded <= _selected) exitWith {};
_item = _loaded select _selected;
private _item = _loaded select _selected; //This can be an object or a classname string
// Start progress bar
private ["_size", "_itemClass", "_displayName"];
if ([_item, GVAR(interactionVehicle)] call FUNC(canUnloadItem)) then {
_size = [_item] call FUNC(getSizeItem);
private _size = [_item] call FUNC(getSizeItem);
[5 * _size, [_item, GVAR(interactionVehicle)], "UnloadCargo", {}, localize LSTRING(UnloadingItem)] call EFUNC(common,progressBar);
} else {
_itemClass = if (_item isEqualType "") then {_item} else {typeOf _item};
_displayName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName");
private _itemClass = if (_item isEqualType "") then {_item} else {typeOf _item};
private _displayName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName");
["displayTextStructured", [[LSTRING(UnloadingFailed), _displayName], 3.0]] call EFUNC(common,localEvent);
};

View File

@ -17,7 +17,7 @@
#include "script_component.hpp"
params ["_item", "_vehicle"];
private ["_loaded", "_space", "_itemSize", "_emptyPos", "_validVehiclestate"];
TRACE_2("params",_item,_vehicle);
if !([_item, _vehicle] call FUNC(canUnloadItem)) exitWith {
false
@ -25,8 +25,8 @@ if !([_item, _vehicle] call FUNC(canUnloadItem)) exitWith {
_itemClass = if (_item isEqualType "") then {_item} else {typeOf _item};
_validVehiclestate = true;
_emptyPos = [];
private _validVehiclestate = true;
private _emptyPos = [];
if (_vehicle isKindOf "Ship" ) then {
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
TRACE_1("SHIP Ground Check", getPosATL _vehicle );
@ -45,16 +45,14 @@ if (_vehicle isKindOf "Ship" ) then {
};
TRACE_1("getPosASL Vehicle Check", getPosASL _vehicle);
if (!_validVehiclestate) exitWith {false};
if ((!_validVehiclestate) || {_emptyPos isEqualTo []}) exitWith {false};
if (count _emptyPos == 0) exitWith {false};
_loaded = _vehicle getVariable [QGVAR(loaded), []];
private _loaded = _vehicle getVariable [QGVAR(loaded), []];
_loaded deleteAt (_loaded find _item);
_vehicle setVariable [QGVAR(loaded), _loaded, true];
_space = [_vehicle] call FUNC(getCargoSpaceLeft);
_itemSize = [_item] call FUNC(getSizeItem);
private _space = [_vehicle] call FUNC(getCargoSpaceLeft);
private _itemSize = [_item] call FUNC(getSizeItem);
_vehicle setVariable [QGVAR(space), (_space + _itemSize), true];
if (_item isEqualType objNull) then {

View File

@ -15,14 +15,13 @@
*/
#include "script_component.hpp"
private ["_loaded", "_newLoaded", "_totalSpaceOccupied"];
params ["_vehicle"];
TRACE_1("params",_vehicle);
_loaded = _vehicle getVariable [QGVAR(loaded), []];
private _loaded = _vehicle getVariable [QGVAR(loaded), []];
_newLoaded = [];
_totalSpaceOccupied = 0;
private _newLoaded = [];
private _totalSpaceOccupied = 0;
{
if ((_x isEqualType "") || {!isNull _x}) then {
_newLoaded pushback _x;

View File

@ -134,5 +134,14 @@
<Czech>%1&lt;br/&gt;nemůže být vyloženo</Czech>
<Russian>%1&lt;br/&gt;не может быть выгружен</Russian>
</Key>
<Key ID="STR_ACE_Cargo_makeLoadable_displayName">
<English>Make Object Loadable</English>
</Key>
<Key ID="STR_ACE_Cargo_makeLoadable_description">
<English>Sets the synced object as loadable by the cargo system.</English>
</Key>
<Key ID="STR_ACE_Cargo_makeLoadable_setSize_displayName">
<English>Object's Size</English>
</Key>
</Package>
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB