mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
commit
f59927a9a7
@ -1,4 +1,3 @@
|
||||
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||
|
@ -1,13 +1,11 @@
|
||||
|
||||
class CfgVehicles {
|
||||
|
||||
class ACE_Module;
|
||||
class ACE_moduleCargoSettings: ACE_Module {
|
||||
scope = 2;
|
||||
displayName = CSTRING(SettingsModule_DisplayName);
|
||||
icon = QUOTE(PATHTOF(UI\Icon_Module_Cargo_ca.paa));
|
||||
category = "ACE";
|
||||
function = QUOTE(DFUNC(moduleSettings));
|
||||
function = QFUNC(moduleSettings);
|
||||
functionPriority = 1;
|
||||
isGlobal = 1;
|
||||
isTriggerActivated = 0;
|
||||
@ -41,11 +39,11 @@ class CfgVehicles {
|
||||
};*/
|
||||
};
|
||||
};
|
||||
|
||||
class Tank: LandVehicle {
|
||||
GVAR(space) = 4;
|
||||
GVAR(hasCargo) = 1;
|
||||
};
|
||||
|
||||
class Car_F;
|
||||
class Truck_F: Car_F {
|
||||
GVAR(space) = 8;
|
||||
@ -53,25 +51,20 @@ class CfgVehicles {
|
||||
};
|
||||
|
||||
class Air;
|
||||
// Repair helicopters
|
||||
class Helicopter: Air {
|
||||
GVAR(space) = 8;
|
||||
GVAR(hasCargo) = 1;
|
||||
};
|
||||
|
||||
class Heli_Transport_02_base_F;
|
||||
class I_Heli_Transport_02_F : Heli_Transport_02_base_F {
|
||||
GVAR(space) = 20;
|
||||
GVAR(hasCargo) = 1;
|
||||
};
|
||||
|
||||
// Repair fixed wing aircraft
|
||||
class Plane: Air {
|
||||
GVAR(space) = 4;
|
||||
GVAR(hasCargo) = 1;
|
||||
};
|
||||
|
||||
// boats
|
||||
class Ship;
|
||||
class Ship_F: Ship {
|
||||
GVAR(space) = 4;
|
||||
|
@ -2,22 +2,23 @@
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP(canLoad);
|
||||
PREP(canLoadItemIn);
|
||||
PREP(canUnloadItem);
|
||||
PREP(canLoad);
|
||||
PREP(findNearestVehicle);
|
||||
PREP(getCargoSpaceLeft);
|
||||
PREP(GetSizeItem);
|
||||
PREP(getSizeItem);
|
||||
PREP(handleDestroyed);
|
||||
PREP(initObject);
|
||||
PREP(initVehicle);
|
||||
PREP(handleDestroyed);
|
||||
PREP(moduleSettings);
|
||||
PREP(loadItem);
|
||||
PREP(moduleSettings);
|
||||
PREP(onMenuOpen);
|
||||
PREP(unloadItem);
|
||||
PREP(validateCargoSpace);
|
||||
PREP(startLoadIn);
|
||||
PREP(startUnload);
|
||||
PREP(unloadItem);
|
||||
PREP(validateCargoSpace);
|
||||
|
||||
GVAR(initializedItemClasses) = [];
|
||||
|
||||
if (isServer) then {
|
||||
|
@ -12,7 +12,7 @@ class CfgPatches {
|
||||
};
|
||||
};
|
||||
|
||||
#include "ACE_Settings.hpp"
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "menu.hpp"
|
||||
#include "ACE_Settings.hpp"
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Check if player can load item into the nearest vehicle
|
||||
* Check if player can load an item into the nearest vehicle.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Player <OBJECT>
|
||||
@ -9,9 +9,11 @@
|
||||
* Return value:
|
||||
* Can load <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [player, object] call ace_cargo_fnc_canLoad
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_player", "_object"];
|
||||
@ -20,12 +22,11 @@ private ["_nearestVehicle"];
|
||||
_nearestVehicle = [_player] call FUNC(findNearestVehicle);
|
||||
|
||||
if (_nearestVehicle isKindOf "Cargo_Base_F" || isNull _nearestVehicle) then {
|
||||
|
||||
{
|
||||
if ([_object, _x] call FUNC(canLoadItemIn)) exitwith {_nearestVehicle = _x};
|
||||
}foreach (nearestObjects [_player, ["Cargo_base_F", "Land_PaperBox_closed_F"], MAX_LOAD_DISTANCE]);
|
||||
if ([_object, _x] call FUNC(canLoadItemIn)) exitWith {_nearestVehicle = _x};
|
||||
} forEach (nearestObjects [_player, ["Cargo_base_F", "Land_PaperBox_closed_F"], MAX_LOAD_DISTANCE]);
|
||||
};
|
||||
|
||||
if (isNull _nearestVehicle) exitwith {false};
|
||||
if (isNull _nearestVehicle) exitWith {false};
|
||||
|
||||
[_object, _nearestVehicle] call FUNC(canLoadItemIn);
|
||||
[_object, _nearestVehicle] call FUNC(canLoadItemIn)
|
||||
|
@ -1,23 +1,29 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Check if item can be loaded into other Object
|
||||
* Check if item can be loaded into other Object.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Item Object <OBJECT>
|
||||
* 1: Holder Object (vehicle) <OBJECT>
|
||||
* 1: Holder Object (Vehicle) <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Can load in <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [item, holder] call ace_cargo_fnc_canLoadItemIn
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_item", "_vehicle"];
|
||||
|
||||
if (speed _vehicle > 1 || (((getPos _vehicle) select 2) > 3)) exitwith {false};
|
||||
if (speed _vehicle > 1 || (((getPos _vehicle) select 2) > 3)) exitWith {false};
|
||||
|
||||
private "_itemSize";
|
||||
_itemSize = ([_item] call FUNC(getSizeItem));
|
||||
_itemSize > 0 && {alive _item && alive _vehicle} && {(_item distance _vehicle <= MAX_LOAD_DISTANCE)} && {_itemSize <= ([_vehicle] call FUNC(getCargoSpaceLeft))};
|
||||
|
||||
(_itemSize > 0) &&
|
||||
{alive _item && alive _vehicle} &&
|
||||
{(_item distance _vehicle <= MAX_LOAD_DISTANCE)} &&
|
||||
{_itemSize <= ([_vehicle] call FUNC(getCargoSpaceLeft))}
|
||||
|
@ -1,23 +1,27 @@
|
||||
/*
|
||||
* Author: Glowbal, ViperMaul
|
||||
* Check if item can be unloaded
|
||||
* Check if item can be unloaded.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: loaded object <OBJECT>
|
||||
* 0: loaded Object <OBJECT>
|
||||
* 1: Object <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Can be unloaded <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [item, holder] call ace_cargo_fnc_canUnloadItem
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_loaded", "_validVehiclestate", "_emptyPos"];
|
||||
|
||||
params ["_item", "_vehicle"];
|
||||
_loaded = _vehicle getvariable [QGVAR(loaded), []];
|
||||
if !(_item in _loaded) exitwith {false};
|
||||
|
||||
_loaded = _vehicle getVariable [QGVAR(loaded), []];
|
||||
if !(_item in _loaded) exitWith {false};
|
||||
|
||||
_validVehiclestate = true;
|
||||
_emptyPos = [];
|
||||
@ -35,5 +39,6 @@ if (_vehicle isKindOf "Ship" ) then {
|
||||
};
|
||||
};
|
||||
|
||||
if (!_validVehiclestate) exitwith { false };
|
||||
(count _emptyPos != 0);
|
||||
if (!_validVehiclestate) exitWith {false};
|
||||
|
||||
(count _emptyPos != 0)
|
||||
|
@ -1,34 +1,37 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Get nearest vehicle, priority car, air, tank, ship
|
||||
* Get nearest vehicle from unit, priority: Car-Air-Tank-Ship.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Object <OBJECT>
|
||||
* 0: Unit <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Vehicle that is in Distance <OBJECT>
|
||||
* Vehicle in Distance <OBJECT>
|
||||
*
|
||||
* Example:
|
||||
* [unit] call ace_cargo_fnc_findNearestVehicle
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_loadCar", "_loadHelicopter", "_loadTank", "_loadShip", "_loadContainer"];
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
_loadCar = nearestObject [_unit, "car"];
|
||||
if (_unit distance _loadCar <= MAX_LOAD_DISTANCE) exitwith {_loadCar};
|
||||
if (_unit distance _loadCar <= MAX_LOAD_DISTANCE) exitWith {_loadCar};
|
||||
|
||||
_loadHelicopter = nearestObject [_unit, "air"];
|
||||
if (_unit distance _loadHelicopter <= MAX_LOAD_DISTANCE) exitwith {_loadHelicopter};
|
||||
if (_unit distance _loadHelicopter <= MAX_LOAD_DISTANCE) exitWith {_loadHelicopter};
|
||||
|
||||
_loadTank = nearestObject [_unit, "tank"];
|
||||
if (_unit distance _loadTank <= MAX_LOAD_DISTANCE) exitwith {_loadTank};
|
||||
if (_unit distance _loadTank <= MAX_LOAD_DISTANCE) exitWith {_loadTank};
|
||||
|
||||
_loadShip = nearestObject [_unit, "ship"];
|
||||
if (_unit distance _loadShip <= MAX_LOAD_DISTANCE) exitwith {_loadShip};
|
||||
if (_unit distance _loadShip <= MAX_LOAD_DISTANCE) exitWith {_loadShip};
|
||||
|
||||
_loadContainer = nearestObject [_unit,"Cargo_base_F"];
|
||||
if (_unit distance _loadContainer <= MAX_LOAD_DISTANCE) exitwith {_loadContainer};
|
||||
if (_unit distance _loadContainer <= MAX_LOAD_DISTANCE) exitWith {_loadContainer};
|
||||
|
||||
objNull;
|
||||
objNull
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Get the cargo space left on object
|
||||
* Get the cargo space left on object.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Object <OBJECT>
|
||||
@ -8,10 +8,13 @@
|
||||
* Return value:
|
||||
* Cargo space left <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* [object] call ace_cargo_fnc_getCargoSpaceLeft
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_vehicle"];
|
||||
_vehicle getvariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeof _vehicle >> QGVAR(space))];
|
||||
params ["_object"];
|
||||
|
||||
_object getVariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeof _object >> QGVAR(space))]
|
||||
|
@ -1,22 +1,28 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Get the cargo size of an object
|
||||
* Get the cargo size of an object.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Object <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Cargo size. <NUMBER> (default: -1)
|
||||
* Cargo size <NUMBER> (default: -1)
|
||||
*
|
||||
* Example:
|
||||
* [object] call ace_cargo_fnc_getSizeItem
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_config";
|
||||
|
||||
params ["_item"];
|
||||
|
||||
_config = (configFile >> "CfgVehicles" >> typeof _item >> QGVAR(size));
|
||||
if (isNumber (_config)) exitwith {
|
||||
_item getvariable [QGVAR(size), getNumber (_config)];
|
||||
|
||||
if (isNumber (_config)) exitWith {
|
||||
_item getVariable [QGVAR(size), getNumber (_config)]
|
||||
};
|
||||
|
||||
-1
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Handle object being destroyed
|
||||
* Handle object being destroyed.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Object <OBJECT>
|
||||
@ -8,17 +8,19 @@
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [object] call ace_cargo_fnc_handleDestroyed
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_vehicle"];
|
||||
|
||||
private["_loaded"];
|
||||
|
||||
_loaded = _vehicle getvariable [QGVAR(loaded), []];
|
||||
if (count _loaded == 0) exitwith {};
|
||||
_loaded = _vehicle getVariable [QGVAR(loaded), []];
|
||||
if (count _loaded == 0) exitWith {};
|
||||
|
||||
{
|
||||
// TODO deleteVehicle or just delete vehicle? Do we want to be able to recover destroyed equipment?
|
||||
|
@ -1,21 +1,23 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Initialize variables for loadable objects. Called from init EH.
|
||||
* Initializes variables for loadable objects. Called from init EH.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Any object <OBJECT>
|
||||
* 0: Object <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [object] call ace_cargo_fnc_initObject
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_object"];
|
||||
|
||||
if (getNumber (configFile >> "CfgVehicles" >> typeOf _object >> QGVAR(canLoad)) != 1) exitwith {};
|
||||
if (getNumber (configFile >> "CfgVehicles" >> typeOf _object >> QGVAR(canLoad)) != 1) exitWith {};
|
||||
|
||||
private ["_type", "_action"];
|
||||
_type = typeOf _object;
|
||||
|
@ -1,16 +1,18 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* initalize vehicle. Adds open caro menu action if available
|
||||
* Initializes vehicle, adds open caro menu action if available.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: vehicle <OBJECT>
|
||||
* 0: Vehicle <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [vehicle] call ace_cargo_fnc_initVehicle
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_vehicle"];
|
||||
@ -31,7 +33,7 @@ if (isServer) then {
|
||||
_position set [2, (_position select 2) + 7.5];
|
||||
for "_i" from 1 to _amount do {
|
||||
_object = createVehicle [_className, _position, [], 0, "CAN_COLLIDE"];
|
||||
if !([_object, _vehicle] call FUNC(loadItem)) exitwith {
|
||||
if !([_object, _vehicle] call FUNC(loadItem)) exitWith {
|
||||
deleteVehicle _object;
|
||||
};
|
||||
};
|
||||
@ -46,7 +48,7 @@ if (_type in _initializedClasses) exitWith {};
|
||||
_initializedClasses pushBack _type;
|
||||
SETMVAR(GVAR(initializedClasses),_initializedClasses);
|
||||
|
||||
if (getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(hasCargo)) != 1) exitwith {};
|
||||
if (getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(hasCargo)) != 1) exitWith {};
|
||||
|
||||
private ["_text", "_condition", "_statement", "_icon", "_action"];
|
||||
_condition = {GVAR(enable)};
|
||||
|
@ -1,34 +1,37 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Load object into vehicle
|
||||
* Load object into vehicle.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Object <OBJECT>
|
||||
* 1: Vehicle <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
* Object loaded <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [object, vehicle] call ace_cargo_fnc_loadItem
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_loaded", "_space", "_itemSize"];
|
||||
|
||||
params ["_item", "_vehicle"];
|
||||
|
||||
if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitwith {false};
|
||||
if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith {false};
|
||||
|
||||
_loaded = _vehicle getvariable [QGVAR(loaded), []];
|
||||
_loaded = _vehicle getVariable [QGVAR(loaded), []];
|
||||
_loaded pushback _item;
|
||||
_vehicle setvariable [QGVAR(loaded), _loaded, true];
|
||||
_vehicle setVariable [QGVAR(loaded), _loaded, true];
|
||||
|
||||
_space = [_vehicle] call FUNC(getCargoSpaceLeft);
|
||||
_itemSize = [_item] call FUNC(getSizeItem);
|
||||
_vehicle setvariable [QGVAR(space), _space - _itemSize, true];
|
||||
_vehicle setVariable [QGVAR(space), _space - _itemSize, true];
|
||||
|
||||
detach _item;
|
||||
_item attachTo [_vehicle,[0,0,100]];
|
||||
["cargo_hideItem", [_item, true]] call EFUNC(common,serverEvent);
|
||||
|
||||
true;
|
||||
true
|
||||
|
@ -3,19 +3,26 @@
|
||||
* Module for adjusting the cargo settings
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The module logic <LOGIC>
|
||||
* 1: units <ARRAY>
|
||||
* 2: activated <BOOL>
|
||||
* 0: The module logic <OBJECT>
|
||||
* 1: Synchronized units <ARRAY>
|
||||
* 2: Activated <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* function = "ace_cargo_fnc_loadItem"
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
params ["_logic", "_units", "_activated"];
|
||||
if !(_activated) exitWith {};
|
||||
|
||||
if (!_activated) exitWith {};
|
||||
|
||||
[_logic, QGVAR(enable), "enable"] call EFUNC(common,readSettingFromModule);
|
||||
|
||||
diag_log text "[ACE]: Cargo Module Initialized.";
|
||||
|
@ -1,37 +1,40 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Handle the UI data display
|
||||
* Handle the UI data display.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: display <DISPLAY>
|
||||
* 0: Display <DISPLAY>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [display] call ace_cargo_fnc_onMenuOpen
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
disableSerialization;
|
||||
params["_display"];
|
||||
|
||||
uiNamespace setvariable [QGVAR(menuDisplay), _display];
|
||||
params ["_display"];
|
||||
|
||||
uiNamespace setVariable [QGVAR(menuDisplay), _display];
|
||||
|
||||
[{
|
||||
private ["_display","_loaded", "_ctrl", "_label"];
|
||||
disableSerialization;
|
||||
_display = uiNamespace getvariable QGVAR(menuDisplay);
|
||||
if (isnil "_display") exitwith {
|
||||
_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), []];
|
||||
_loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []];
|
||||
_ctrl = _display displayCtrl 100;
|
||||
_label = _display displayCtrl 2;
|
||||
|
||||
|
@ -1,16 +1,18 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Start load item
|
||||
* Start load item.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Any object <OBJECT>
|
||||
* 0: Object <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
* Object loaded <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [object] call ace_cargo_fnc_starLoadIn
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_player", "_object"];
|
||||
@ -19,11 +21,11 @@ private ["_nearestVehicle"];
|
||||
_nearestVehicle = [_player] call FUNC(findNearestVehicle);
|
||||
|
||||
if (isNull _nearestVehicle || _nearestVehicle isKindOf "Cargo_Base_F") then {
|
||||
|
||||
{
|
||||
if ([_object, _x] call FUNC(canLoadItemIn)) exitwith {_nearestVehicle = _x};
|
||||
}foreach (nearestObjects [_player, ["Cargo_base_F", "Land_PaperBox_closed_F"], MAX_LOAD_DISTANCE]);
|
||||
if ([_object, _x] call FUNC(canLoadItemIn)) exitWith {_nearestVehicle = _x};
|
||||
} foreach (nearestObjects [_player, ["Cargo_base_F", "Land_PaperBox_closed_F"], MAX_LOAD_DISTANCE]);
|
||||
};
|
||||
|
||||
if (isNull _nearestVehicle) exitwith {false};
|
||||
[_object, _nearestVehicle] call FUNC(loadItem);
|
||||
if (isNull _nearestVehicle) exitWith {false};
|
||||
|
||||
[_object, _nearestVehicle] call FUNC(loadItem)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Start unload action
|
||||
* Start unload action.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
@ -8,24 +8,28 @@
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [] call ace_cargo_fnc_startUnload
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_display", "_loaded", "_ctrl", "_selected", "_item"];
|
||||
disableSerialization;
|
||||
_display = uiNamespace getvariable QGVAR(menuDisplay);
|
||||
if (isnil "_display") exitwith {};
|
||||
|
||||
_loaded = GVAR(interactionVehicle) getvariable [QGVAR(loaded), []];
|
||||
if (count _loaded == 0) exitwith {};
|
||||
disableSerialization;
|
||||
|
||||
_display = uiNamespace getVariable QGVAR(menuDisplay);
|
||||
if (isnil "_display") exitWith {};
|
||||
|
||||
_loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []];
|
||||
if (count _loaded == 0) exitWith {};
|
||||
|
||||
_ctrl = _display displayCtrl 100;
|
||||
|
||||
_selected = (lbCurSel _ctrl) max 0;
|
||||
|
||||
if (count _loaded <= _selected) exitwith {};
|
||||
if (count _loaded <= _selected) exitWith {};
|
||||
_item = _loaded select _selected;
|
||||
|
||||
[_item, GVAR(interactionVehicle)] call FUNC(unloadItem);
|
||||
|
@ -1,23 +1,26 @@
|
||||
/*
|
||||
* Author: Glowbal, ViperMaul
|
||||
* Unload object from vehicle
|
||||
* Unload object from vehicle.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Object <OBJECT>
|
||||
* 1: Vehicle <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
* Object unloaded <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [object, vehicle] call ace_cargo_fnc_unloadItem
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_loaded", "_space", "_itemSize", "_emptyPos", "_validVehiclestate"];
|
||||
|
||||
params ["_item", "_vehicle"];
|
||||
|
||||
if !([_item, _vehicle] call FUNC(canUnloadItem)) exitwith {
|
||||
if !([_item, _vehicle] call FUNC(canUnloadItem)) exitWith {
|
||||
false
|
||||
};
|
||||
|
||||
@ -41,17 +44,17 @@ if (_vehicle isKindOf "Ship" ) then {
|
||||
};
|
||||
|
||||
TRACE_1("getPosASL Vehicle Check", getPosASL _vehicle);
|
||||
if (!_validVehiclestate) exitwith { false };
|
||||
if (!_validVehiclestate) exitWith {false};
|
||||
|
||||
if (count _emptyPos == 0) exitwith { false }; //consider displaying text saying there are no safe places to exit the vehicle
|
||||
if (count _emptyPos == 0) exitWith {false}; //consider displaying text saying there are no safe places to exit the vehicle
|
||||
|
||||
_loaded = _vehicle getvariable [QGVAR(loaded), []];
|
||||
_loaded = _vehicle getVariable [QGVAR(loaded), []];
|
||||
_loaded = _loaded - [_item];
|
||||
_vehicle setvariable [QGVAR(loaded), _loaded, true];
|
||||
_vehicle setVariable [QGVAR(loaded), _loaded, true];
|
||||
|
||||
_space = [_vehicle] call FUNC(getCargoSpaceLeft);
|
||||
_itemSize = [_item] call FUNC(getSizeItem);
|
||||
_vehicle setvariable [QGVAR(space), (_space + _itemSize), true];
|
||||
_vehicle setVariable [QGVAR(space), (_space + _itemSize), true];
|
||||
|
||||
detach _item;
|
||||
_item setPosASL (_emptyPos call EFUNC(common,PositiontoASL));
|
||||
@ -59,4 +62,4 @@ _item setPosASL (_emptyPos call EFUNC(common,PositiontoASL));
|
||||
|
||||
// TOOO maybe drag/carry the unloaded item?
|
||||
|
||||
true;
|
||||
true
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Validate the vehicle cargo space
|
||||
* Validate the vehicle cargo space.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Object <OBJECT>
|
||||
@ -8,14 +8,19 @@
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [object] call ace_cargo_fnc_validateCargoSpace
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_loaded", "_newLoaded", "_totalSpaceOccupied"];
|
||||
|
||||
params ["_vehicle"];
|
||||
_loaded = _vehicle getvariable [QGVAR(loaded), []];
|
||||
|
||||
_loaded = _vehicle getVariable [QGVAR(loaded), []];
|
||||
|
||||
_newLoaded = [];
|
||||
_totalSpaceOccupied = 0;
|
||||
{
|
||||
@ -27,6 +32,7 @@ _totalSpaceOccupied = 0;
|
||||
} count _loaded;
|
||||
|
||||
if (count _loaded != count _newLoaded) then {
|
||||
_vehicle setvariable [QGVAR(loaded), _newLoaded, true];
|
||||
_vehicle setVariable [QGVAR(loaded), _newLoaded, true];
|
||||
};
|
||||
_vehicle setvariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeof _vehicle >> QGVAR(space)) - _totalSpaceOccupied, true];
|
||||
|
||||
_vehicle setVariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeof _vehicle >> QGVAR(space)) - _totalSpaceOccupied, true];
|
||||
|
@ -1 +1 @@
|
||||
#include "\z\ace\addons\cargo\script_component.hpp"
|
||||
#include "\z\ace\addons\cargo\script_component.hpp"
|
||||
|
@ -1,11 +1,10 @@
|
||||
|
||||
#include "\z\ace\addons\common\define.hpp"
|
||||
|
||||
class GVAR(menu) {
|
||||
idd = 314614;
|
||||
movingEnable = true;
|
||||
onLoad = QUOTE([_this select 0] call FUNC(onMenuOpen));
|
||||
onUnload = QUOTE(uiNamespace setvariable [ARR_2(QUOTE(QGVAR(menuDisplay)),nil)];);
|
||||
onUnload = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(menuDisplay)),nil)];);
|
||||
class controlsBackground {
|
||||
class HeaderBackground: ACE_gui_backgroundBase{
|
||||
idc = -1;
|
||||
@ -20,8 +19,8 @@ class GVAR(menu) {
|
||||
y = "2.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
|
||||
h = "14 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
|
||||
text = "#(argb,8,8,3)color(0,0,0,0.8)";
|
||||
colorText[] = {0, 0, 0, "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.9])"};
|
||||
colorBackground[] = {0,0,0,"(profilenamespace getvariable ['GUI_BCG_RGB_A',0.9])"};
|
||||
colorText[] = {0, 0, 0, "(profilenamespace getVariable ['GUI_BCG_RGB_A',0.9])"};
|
||||
colorBackground[] = {0,0,0,"(profilenamespace getVariable ['GUI_BCG_RGB_A',0.9])"};
|
||||
};
|
||||
};
|
||||
|
||||
@ -37,7 +36,7 @@ class GVAR(menu) {
|
||||
font = "PuristaMedium";
|
||||
SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
|
||||
colorText[] = {0.95, 0.95, 0.95, 0.75};
|
||||
colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.9])"};
|
||||
colorBackground[] = {"(profilenamespace getVariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getVariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getVariable ['GUI_BCG_RGB_B',0.5])", "(profilenamespace getVariable ['GUI_BCG_RGB_A',0.9])"};
|
||||
text = CSTRING(cargoMenu);
|
||||
};
|
||||
class SubHeader: HeaderName {
|
||||
@ -101,4 +100,4 @@ class GVAR(menu) {
|
||||
action = QUOTE([] call FUNC(startUnload););
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user