Check if a parachute is already attached

Objct can be attached to a parachute if the unloading is done throught ViV command
This commit is contained in:
Vdauphin 2021-08-22 18:09:06 +02:00
parent 0025268eb0
commit d69fff6f9f
3 changed files with 21 additions and 18 deletions

View File

@ -29,33 +29,41 @@ private _distBehind = ((_bb1 select 1) min (_bb2 select 1)) - 4; // 4 meters beh
TRACE_1("",_distBehind);
private _posBehindVehicleAGL = _vehicle modelToWorld [0, _distBehind, -2];
private _object = [_item, _posBehindVehicleAGL, _loaded, _vehicle, true] call FUNC(unload);
private _object = [_item, _posBehindVehicleAGL, _loaded, _vehicle] call FUNC(unload);
_object setVelocity ((velocity _vehicle) vectorAdd ((vectorNormalized (vectorDir _vehicle)) vectorMultiply -5));
// open parachute and ir light effect
[{
params ["_object"];
params ["_object", "_vehicle"];
if (isNull _object || {getPos _object select 2 < 1}) exitWith {};
private _parachute = createVehicle ["B_Parachute_02_F", [0,0,0], [], 0, "CAN_COLLIDE"];
private _objectAttachedTo = attachedTo _object;
private _parachuteTypeVehicle = getText (configOf _vehicle >> "VehicleTransport" >> "Cargo" >> "parachuteClass");
private _parachuteTypeObject = getText (configOf _object >> "VehicleTransport" >> "Carrier" >> "parachuteClassDefault");
if (
!(_objectAttachedTo isKindOf _parachuteTypeVehicle) &&
!(_objectAttachedTo isKindOf _parachuteTypeObject)
) then {
private _velocity = velocity _object;
// cannot use setPos on parachutes without them closing down
_parachute attachTo [_object, [0,0,0]];
detach _parachute;
private _parachute = createVehicle ["B_Parachute_02_F", [0,0,0], [], 0, "CAN_COLLIDE"];
private _velocity = velocity _object;
// cannot use setPos on parachutes without them closing down
_parachute attachTo [_object, [0,0,0]];
detach _parachute;
_object attachTo [_parachute, [0,0,1]];
_object attachTo [_parachute, [0,0,1]];
_parachute setVelocity _velocity;
_parachute setVelocity _velocity;
};
if ((GVAR(disableParadropEffectsClasstypes) findIf {_object isKindOf _x}) == -1) then {
private _light = "Chemlight_yellow" createVehicle [0,0,0];
_light attachTo [_object, [0,0,0]];
};
}, [_object], 0.7] call CBA_fnc_waitAndExecute;
}, [_object, _vehicle], 0.7] call CBA_fnc_waitAndExecute;
// smoke effect when crate landed
[{

View File

@ -8,7 +8,6 @@
* 1: Empty position <ARRAY>
* 2: Items loaded in cargo <ARRAY>
* 3: Vehicle with the item loaded <OBJECT>
* 4: Avoid creation of a parachute by A3 <BOOL>
*
* Return Value:
* Object unloaded <OBJECT>
@ -19,7 +18,7 @@
* Public: No
*/
params ["_item", "_posAGL", "_loaded", "_vehicle", "_isParadrop"];
params ["_item", "_posAGL", "_loaded", "_vehicle"];
_loaded deleteAt (_loaded find _item);
_vehicle setVariable [QGVAR(loaded), _loaded, true];
@ -47,11 +46,7 @@ if (_object isEqualType objNull) then {
};
};
} else {
if (_isParadrop) then {
detach _object; // Don't create a parachute by A3 engine
} else {
objNull setVehicleCargo _object;
};
objNull setVehicleCargo _object;
_object setPosASL (AGLtoASL _posAGL);
};
} else {

View File

@ -40,7 +40,7 @@ if !(_item in _loaded) exitWith {
false
};
private _object = [_item, _emptyPosAGL, _loaded, _vehicle, false] call FUNC(unload);
private _object = [_item, _emptyPosAGL, _loaded, _vehicle] call FUNC(unload);
// Invoke listenable event
["ace_cargoUnloaded", [_object, _vehicle, "unload"]] call CBA_fnc_globalEvent;