ACE3/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf

42 lines
994 B
Plaintext
Raw Normal View History

2015-02-21 20:53:07 +00:00
/*
* Author: Glowbal
* Replace a (dead) body by a body bag
2015-02-21 20:53:07 +00:00
*
* Arguments:
* 0: The actor <OBJECT>
* 1: The patient <OBJECT>
2015-02-21 20:53:07 +00:00
*
* Return Value:
* body bag <OBJECT>
2015-02-21 20:53:07 +00:00
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_position", "_headPos", "_spinePos", "_dirVect", "_direction", "_bodyBag"];
2015-08-22 14:25:10 +00:00
params ["_caller", "_target"];
2015-02-21 20:53:07 +00:00
2015-04-05 17:27:53 +00:00
if (alive _target) then {
[_target, true] call FUNC(setDead);
2015-02-21 20:53:07 +00:00
};
_position = (getPosASL _target) vectorAdd [0, 0, 0.2];
_headPos = _target modelToWorldVisual (_target selectionPosition "head");
_spinePos = _target modelToWorldVisual (_target selectionPosition "Spine3");
_dirVect = _headPos vectorFromTo _spinePos;
_direction = _dirVect call CBA_fnc_vectDir;
_bodyBag = createVehicle ["ACE_bodyBagObject", _position, [], 0, "CAN_COLLIDE"];
["placedInBodyBag", [_target, _bodyBag]] call EFUNC(common,globalEvent);
deleteVehicle _target;
// prevent body bag from flipping
_bodyBag setPosASL _position;
_bodyBag setDir _direction;
_bodyBag