mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Add: getVehicleCargo and differentiate normal "CargoNet_01_box_F" and ACE "CargoNet_01_box_F"
This commit is contained in:
parent
0bf95f7917
commit
d8118ac3aa
@ -5,6 +5,7 @@ PREP(canShowUnloadAllVehicles);
|
|||||||
PREP(canUnloadItem);
|
PREP(canUnloadItem);
|
||||||
PREP(getCargoSpaceLeft);
|
PREP(getCargoSpaceLeft);
|
||||||
PREP(getSizeItem);
|
PREP(getSizeItem);
|
||||||
|
PREP(getVehicleCargo);
|
||||||
PREP(handleDeleted);
|
PREP(handleDeleted);
|
||||||
PREP(handleDestroyed);
|
PREP(handleDestroyed);
|
||||||
PREP(initObject);
|
PREP(initObject);
|
||||||
|
@ -23,4 +23,4 @@ params [
|
|||||||
|
|
||||||
driver _vehicle isEqualTo _unit &&
|
driver _vehicle isEqualTo _unit &&
|
||||||
{isClass (configOf _vehicle >> "VehicleTransport" >> "Carrier")} &&
|
{isClass (configOf _vehicle >> "VehicleTransport" >> "Carrier")} &&
|
||||||
{!(getVehicleCargo _vehicle - (_vehicle getVariable [QGVAR(loaded), []]) isEqualTo [])}
|
{!([_vehicle] call ace_cargo_fnc_getVehicleCargo isEqualTo [])}
|
||||||
|
22
addons/cargo/functions/fnc_getVehicleCargo.sqf
Normal file
22
addons/cargo/functions/fnc_getVehicleCargo.sqf
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: Vdauphin
|
||||||
|
* Get vehicle in cargo.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Vehicle <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Loaded vehicles not part of ACE Cargo <ARRAY>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [vehicle player] call ace_cargo_fnc_getVehicleCargo
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
params ["_vehicle"];
|
||||||
|
|
||||||
|
(getVehicleCargo _vehicle - (_vehicle getVariable [QGVAR(loaded), []])) select {
|
||||||
|
!(_x getVariable [QGVAR(isCargoNet), false])
|
||||||
|
}
|
@ -41,14 +41,14 @@ if (_item isEqualType objNull) then {
|
|||||||
(_vehicle canVehicleCargo _item) isEqualTo [false, true] && // Could be loaded if _vehicle was empty
|
(_vehicle canVehicleCargo _item) isEqualTo [false, true] && // Could be loaded if _vehicle was empty
|
||||||
{_vehicleCargo findIf {
|
{_vehicleCargo findIf {
|
||||||
!(_x in _loaded) && // Don't use ViV if ViV was used outside of ACE Cargo
|
!(_x in _loaded) && // Don't use ViV if ViV was used outside of ACE Cargo
|
||||||
!(typeOf _x isEqualTo "CargoNet_01_box_F")
|
!(_x getVariable [QGVAR(isCargoNet), false])
|
||||||
} isEqualTo -1}
|
} isEqualTo -1}
|
||||||
) then {
|
) then {
|
||||||
private _cargoNet = createVehicle ["CargoNet_01_box_F", [0, 0, 0], [], 0, "CAN_COLLIDE"];
|
private _cargoNet = createVehicle ["CargoNet_01_box_F", [0, 0, 0], [], 0, "CAN_COLLIDE"];
|
||||||
if ((_vehicle canVehicleCargo _cargoNet) select 1) then {
|
if ((_vehicle canVehicleCargo _cargoNet) select 1) then {
|
||||||
while {!(_vehicle setVehicleCargo _cargoNet)} do { // Move ViV cargo to ACE Cargo
|
while {!(_vehicle setVehicleCargo _cargoNet)} do { // Move ViV cargo to ACE Cargo
|
||||||
private _itemViV = _vehicleCargo deleteAt 0;
|
private _itemViV = _vehicleCargo deleteAt 0;
|
||||||
if (typeOf _itemViV isEqualTo "CargoNet_01_box_F") exitWith { // The vehicle is already full of "CargoNet_01_box_F")
|
if (_itemViV getVariable [QGVAR(isCargoNet), false]) exitWith { // The vehicle is already full of cargo net
|
||||||
deleteVehicle _cargoNet;
|
deleteVehicle _cargoNet;
|
||||||
_item setVariable [QGVAR(cargoNet), _itemViV, true];
|
_item setVariable [QGVAR(cargoNet), _itemViV, true];
|
||||||
};
|
};
|
||||||
@ -62,6 +62,7 @@ if (_item isEqualType objNull) then {
|
|||||||
[_itemViV, "blockDamage", "ACE_cargo", true] call EFUNC(common,statusEffect_set);
|
[_itemViV, "blockDamage", "ACE_cargo", true] call EFUNC(common,statusEffect_set);
|
||||||
};
|
};
|
||||||
if !(isNull _cargoNet) then {
|
if !(isNull _cargoNet) then {
|
||||||
|
_cargoNet setVariable [QGVAR(isCargoNet), true, true];
|
||||||
_item setVariable [QGVAR(cargoNet), _cargoNet, true];
|
_item setVariable [QGVAR(cargoNet), _cargoNet, true];
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* 0: Vehicle <OBJECT>
|
* 0: Vehicle <OBJECT>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Loaded vehiclesnot part of ACE Cargo <ARRAY>
|
* Loaded vehicles not part of ACE Cargo <ARRAY>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [vehicle player] call ace_cargo_fnc_unloadAllVehicles
|
* [vehicle player] call ace_cargo_fnc_unloadAllVehicles
|
||||||
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
params ["_vehicle"];
|
params ["_vehicle"];
|
||||||
|
|
||||||
private _loadedVehicles = getVehicleCargo _vehicle - (_vehicle getVariable [QGVAR(loaded), []]);
|
private _loadedVehicles = [_vehicle] call ace_cargo_fnc_getVehicleCargo;
|
||||||
private _unloadingInterval = getNumber (configOf _vehicle >> "VehicleTransport" >> "Carrier" >> "unloadingInterval");
|
private _unloadingInterval = getNumber (configOf _vehicle >> "VehicleTransport" >> "Carrier" >> "unloadingInterval");
|
||||||
{
|
{
|
||||||
[{objnull setVehicleCargo _this}, _x, _forEachIndex * _unloadingInterval] call CBA_fnc_waitAndExecute;
|
[{objnull setVehicleCargo _this}, _x, _forEachIndex * _unloadingInterval] call CBA_fnc_waitAndExecute;
|
||||||
|
Loading…
Reference in New Issue
Block a user