2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2016-07-14 14:16:53 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
* Blow off turret effect.
|
|
|
|
*
|
|
|
|
* Arguments:
|
2024-06-22 18:08:43 +00:00
|
|
|
* 0: Vehicle <OBJECT>
|
2016-07-14 14:16:53 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2024-08-20 19:23:21 +00:00
|
|
|
* cursorObject call ace_vehicle_damage_fnc_blowOffTurret
|
2016-07-14 14:16:53 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2024-06-22 18:08:43 +00:00
|
|
|
// Delayed so the object is spawned after the model changes to a wreck
|
|
|
|
// The sudden change in the model would cause nearby PhysX objects to get stuck
|
2016-07-14 14:16:53 +00:00
|
|
|
[{
|
|
|
|
params ["_vehicle"];
|
2024-08-20 19:23:21 +00:00
|
|
|
TRACE_1("blowOffTurret",_vehicle);
|
2016-07-14 14:16:53 +00:00
|
|
|
|
2024-06-22 18:08:43 +00:00
|
|
|
(getArray (configOf _vehicle >> QGVAR(turret))) params [["_model", "", [""]], ["_offset", [0, 0, 0], [[]], 3]];
|
2016-07-14 14:16:53 +00:00
|
|
|
|
|
|
|
if (_model isEqualTo "") exitWith {};
|
|
|
|
|
|
|
|
private _position = _vehicle modelToWorld _offset;
|
|
|
|
private _turret = createVehicle [_model, _position, [], 0, "CAN_COLLIDE"];
|
|
|
|
|
|
|
|
_turret setVectorUp [random 1, random 1, 1];
|
|
|
|
_turret setVelocity [random 7, random 7, 8 + random 5];
|
2016-09-18 09:31:28 +00:00
|
|
|
|
2024-06-22 18:08:43 +00:00
|
|
|
// Add turret to all curators that already own the wreck
|
|
|
|
if (["ace_zeus"] call EFUNC(common,isModLoaded)) then {
|
|
|
|
[QEGVAR(zeus,addObjects), [[_turret], objectCurators _vehicle]] call CBA_fnc_serverEvent;
|
|
|
|
};
|
2016-07-14 14:16:53 +00:00
|
|
|
}, _this, 1] call CBA_fnc_waitAndExecute;
|