2015-02-21 20:53:07 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
2015-06-01 20:33:25 +00:00
|
|
|
* Replace a (dead) body by a body bag
|
2015-02-21 20:53:07 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2015-06-01 20:33:25 +00:00
|
|
|
* 0: The actor <OBJECT>
|
|
|
|
* 1: The patient <OBJECT>
|
2015-02-21 20:53:07 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2016-02-13 23:59:11 +00:00
|
|
|
* body bag (will return objNull when run where target is not local) <OBJECT>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [player, cursorTarget] call ace_medical_fnc_actionPlaceInBodyBag
|
2015-02-21 20:53:07 +00:00
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-22 14:25:10 +00:00
|
|
|
params ["_caller", "_target"];
|
2016-02-13 23:59:11 +00:00
|
|
|
TRACE_2("params",_caller,_target);
|
|
|
|
|
|
|
|
if (!local _target) exitWith {
|
|
|
|
TRACE_1("running where local",local _target);
|
2016-06-03 18:57:21 +00:00
|
|
|
[QGVAR(actionPlaceInBodyBag), [_caller, _target], [_target]] call CBA_fnc_targetEvent;
|
2016-02-13 23:59:11 +00:00
|
|
|
objNull
|
|
|
|
};
|
2015-02-21 20:53:07 +00:00
|
|
|
|
2015-04-05 17:27:53 +00:00
|
|
|
if (alive _target) then {
|
2016-02-13 23:59:11 +00:00
|
|
|
TRACE_1("manually killing with setDead",_target);
|
2015-04-05 17:27:53 +00:00
|
|
|
[_target, true] call FUNC(setDead);
|
2015-02-21 20:53:07 +00:00
|
|
|
};
|
2015-06-01 20:33:25 +00:00
|
|
|
|
2016-02-13 23:59:11 +00:00
|
|
|
private _position = (getPosASL _target) vectorAdd [0, 0, 0.2];
|
2015-06-01 20:33:25 +00:00
|
|
|
|
2016-02-13 23:59:11 +00:00
|
|
|
private _headPos = _target modelToWorldVisual (_target selectionPosition "head");
|
|
|
|
private _spinePos = _target modelToWorldVisual (_target selectionPosition "Spine3");
|
|
|
|
private _dirVect = _headPos vectorFromTo _spinePos;
|
|
|
|
private _direction = _dirVect call CBA_fnc_vectDir;
|
2015-06-01 20:33:25 +00:00
|
|
|
|
2016-02-13 23:59:11 +00:00
|
|
|
//move the body away now, so it won't physX the bodyBag object (this setPos seems to need to be called where object is local)
|
|
|
|
_target setPosASL [-5000, -5000, 0];
|
2015-06-01 20:33:25 +00:00
|
|
|
|
2017-12-01 16:34:27 +00:00
|
|
|
private _bodyBag = createVehicle ["ACE_bodyBagObject", _position, [], 0, "NONE"];
|
2015-12-12 17:21:11 +00:00
|
|
|
|
2015-06-01 20:33:25 +00:00
|
|
|
// prevent body bag from flipping
|
|
|
|
_bodyBag setPosASL _position;
|
|
|
|
_bodyBag setDir _direction;
|
|
|
|
|
2016-06-03 19:38:16 +00:00
|
|
|
["ace_placedInBodyBag", [_target, _bodyBag]] call CBA_fnc_globalEvent; //hide and delete body on server
|
2016-02-13 23:59:11 +00:00
|
|
|
|
2015-06-01 20:33:25 +00:00
|
|
|
_bodyBag
|