mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
40 lines
1.1 KiB
Plaintext
40 lines
1.1 KiB
Plaintext
/*
|
|
* Author: Glowbal
|
|
* Replace a dead body by a bodybag
|
|
*
|
|
* Arguments:
|
|
* 0: The patient <OBJECT>
|
|
* 1: The new item classname <STRING>
|
|
*
|
|
* Return Value:
|
|
* nil
|
|
*
|
|
* Public: Yes
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
private ["_target","_caller", "_nameOfUnit", "_onPosition", "_bodyBagCreated"];
|
|
_caller = _this select 0;
|
|
_target = _this select 1;
|
|
|
|
if !([_caller, "ACE_itemBodyBag"] call EFUNC(common,hasItem)) exitwith {};
|
|
|
|
[_caller, "ACE_itemBodyBag"] call EFUNC(common,useItem);
|
|
|
|
_nameOfUnit = [_target] call EFUNC(common,getName);
|
|
if (alive _target) then {
|
|
// force kill the unit.
|
|
[_target, true] call FUNC(setDead);
|
|
};
|
|
_onPosition = getPos _target;
|
|
deleteVehicle _target;
|
|
_bodyBagCreated = createVehicle ["ACE_bodyBag", _onPosition, [], 0, "NONE"];
|
|
// reset the position to ensure it is on the correct one.
|
|
_bodyBagCreated setPos _onPosition;
|
|
|
|
// TODO Does this need to be something with QUOTE(DEFUNC)?
|
|
[[_bodyBagCreated], QUOTE(DEFUNC(common,revealObject)), true] call call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
|
|
|
_bodyBagCreated;
|