2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-02-02 08:35:17 +00:00
|
|
|
* Author: Garth 'L-H' de Wet
|
|
|
|
* Sets the Dir and pitch of passed object
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Explosive <OBJECT>
|
|
|
|
* 1: Direction <NUMBER>
|
|
|
|
* 2: Pitch <NUMBER>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2015-07-17 04:59:31 +00:00
|
|
|
* [_explosive, 150, 90] call ACE_Explosives_fnc_setPosition;
|
2015-02-02 08:35:17 +00:00
|
|
|
*
|
2015-08-16 06:51:44 +00:00
|
|
|
* Public: No
|
2015-02-02 08:35:17 +00:00
|
|
|
*/
|
2015-01-13 21:21:31 +00:00
|
|
|
#include "script_component.hpp"
|
2015-07-17 04:59:31 +00:00
|
|
|
|
2015-08-15 19:35:33 +00:00
|
|
|
params ["_explosive", "_direction", "_pitch"];
|
|
|
|
TRACE_3("params",_explosive,_direction,_pitch);
|
2015-07-17 04:59:31 +00:00
|
|
|
|
|
|
|
if (isNull (attachedTo _explosive)) then {
|
|
|
|
_explosive setDir _direction;
|
|
|
|
if (_pitch != 0) then {
|
|
|
|
[_explosive, _pitch, 0] call CALLSTACK(BIS_fnc_setPitchBank);
|
|
|
|
};
|
|
|
|
} else {
|
2015-08-16 06:51:44 +00:00
|
|
|
//Attaching to a vehicle (dirAndUp based on vehicle)
|
2015-07-17 04:59:31 +00:00
|
|
|
_explosive setVectorDirAndUp [[0,0,1],[(sin _direction),(cos _direction),0]];
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
2016-02-23 12:53:38 +00:00
|
|
|
|
|
|
|
if (isServer) then {
|
|
|
|
// Store the orientation to broadcast it later to JIP players
|
|
|
|
GVAR(explosivesOrientations) pushBack [_explosive, _direction, _pitch];
|
|
|
|
|
|
|
|
// This is a good time to filter the array and remove explosives that no longer exist
|
|
|
|
GVAR(explosivesOrientations) = GVAR(explosivesOrientations) select {
|
2016-02-27 12:50:44 +00:00
|
|
|
_x params ["_explosive"];
|
2016-02-23 12:53:38 +00:00
|
|
|
(!isNull _explosive && {alive _explosive})
|
|
|
|
};
|
2016-02-27 12:14:07 +00:00
|
|
|
TRACE_1("setPosition",GVAR(explosivesOrientations));
|
2016-02-23 12:53:38 +00:00
|
|
|
};
|