Update existing files

This commit is contained in:
johnb432 2024-07-16 21:22:33 +02:00
parent 77269fb571
commit 9a1b24df27
2 changed files with 44 additions and 13 deletions

View File

@ -5,35 +5,51 @@
* *
* Arguments: * Arguments:
* 0: Item <OBJECT or STRING> * 0: Item <OBJECT or STRING>
* 1: Empty position <ARRAY> * 1: Vehicle with the item loaded <OBJECT>
* 2: Items loaded in cargo <ARRAY> * 2: Unloading position <ARRAY>
* 3: Vehicle with the item loaded <OBJECT> * 3: If the object was deployed <BOOL>
* *
* Return Value: * Return Value:
* Object unloaded <OBJECT> * Object unloaded <OBJECT>
* *
* Example: * Example:
* [item, posAGL, loaded, vehicle] call ace_cargo_fnc_unload * ["ACE_Wheel", cursorObject, getPos player, false] call ace_cargo_fnc_unload
* *
* Public: No * Public: No
*/ */
params ["_item", "_posAGL", "_loaded", "_vehicle"]; params ["_item", "_posAGL", "_vehicle", "_deployed"];
// Unload item from cargo
private _loaded = _vehicle getVariable [QGVAR(loaded), []];
_loaded deleteAt (_loaded find _item); _loaded deleteAt (_loaded find _item);
_vehicle setVariable [QGVAR(loaded), _loaded, true]; _vehicle setVariable [QGVAR(loaded), _loaded, true];
private _space = [_vehicle] call FUNC(getCargoSpaceLeft); // Update cargo space remaining
private _itemSize = [_item] call FUNC(getSizeItem); private _cargoSpace = _vehicle call FUNC(getCargoSpaceLeft);
_vehicle setVariable [QGVAR(space), _space + _itemSize, true]; _vehicle setVariable [QGVAR(space), _cargoSpace + _itemSize, true];
private _object = _item; private _object = _item;
if (_object isEqualType objNull) then { if (_object isEqualType objNull) then {
if (isNull isVehicleCargo _object) then { if (isNull isVehicleCargo _object) then {
detach _object; detach _object;
// hideObjectGlobal must be executed before setPos to ensure light objects are rendered correctly
// do both on server to ensure they are executed in the correct order // If player unloads via deployment, set direction first, then unload
[QGVAR(serverUnload), [_object, _posAGL]] call CBA_fnc_serverEvent; if (_deployed) then {
[QGVAR(setDirAndUnload), [_object, _emptyPosAGL, _direction], _object] call CBA_fnc_targetEvent;
} else {
[QGVAR(serverUnload), [_object, _emptyPosAGL]] call CBA_fnc_serverEvent;
};
if (["ace_zeus"] call EFUNC(common,isModLoaded)) then {
// Get which curators had this object as editable
private _objectCurators = _object getVariable [QGVAR(objectCurators), []];
if (_objectCurators isEqualTo []) exitWith {};
[QEGVAR(zeus,addObjects), [[_object], _objectCurators]] call CBA_fnc_serverEvent;
};
private _cargoNet = _object getVariable [QGVAR(cargoNet), objNull]; private _cargoNet = _object getVariable [QGVAR(cargoNet), objNull];
if !(isNull _cargoNet) then { if !(isNull _cargoNet) then {
@ -50,8 +66,14 @@ if (_object isEqualType objNull) then {
_object setPosASL (AGLtoASL _posAGL); _object setPosASL (AGLtoASL _posAGL);
}; };
} else { } else {
_object = createVehicle [_item, _posAGL, [], 0, "NONE"]; _object = createVehicle [_item, _emptyPosAGL, [], 0, "NONE"];
_object setPosASL (AGLtoASL _posAGL);
// If player unloads via deployment, set direction. Must happen before setPosASL command according to wiki
if (_deployed) then {
_object setDir _direction;
};
_object setPosASL (AGLtoASL _emptyPosAGL);
[QEGVAR(common,fixCollision), _object] call CBA_fnc_localEvent; [QEGVAR(common,fixCollision), _object] call CBA_fnc_localEvent;
[QEGVAR(common,fixPosition), _object] call CBA_fnc_localEvent; [QEGVAR(common,fixPosition), _object] call CBA_fnc_localEvent;

View File

@ -59,3 +59,12 @@ private _category = [ELSTRING(main,Category_Logistics), LSTRING(openMenu)];
_category, _category,
true true
] call CBA_fnc_addSetting; ] call CBA_fnc_addSetting;
[
QGVAR(cargoNetType),
"LIST",
[LSTRING(cargoNetType), LSTRING(cargoNetType_description)],
_category,
[["CargoNet_01_box_F", "Land_WoodenBox_02_F"], [LSTRING(cargoNetType_modernStyle), LSTRING(cargoNetType_ww2)], 0],
1
] call CBA_fnc_addSetting;