From 048e5b6f6d476839cf10580cfa1cb5a2d0064043 Mon Sep 17 00:00:00 2001 From: ulteq Date: Mon, 1 Jun 2015 22:33:25 +0200 Subject: [PATCH] Body bag cleanup: * Increased the treatment time to match the animation duration * Fixed the body bag alignment with the dead unit --- addons/medical/ACE_Medical_Treatments.hpp | 2 +- .../functions/fnc_actionPlaceInBodyBag.sqf | 37 ++++++++++++------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/addons/medical/ACE_Medical_Treatments.hpp b/addons/medical/ACE_Medical_Treatments.hpp index 29e21201b0..3ca8c56ed7 100644 --- a/addons/medical/ACE_Medical_Treatments.hpp +++ b/addons/medical/ACE_Medical_Treatments.hpp @@ -66,7 +66,7 @@ class ACE_Medical_Actions { displayNameProgress = "$STR_ACE_Medical_PlacingInBodyBag"; treatmentLocations[] = {"All"}; requiredMedic = 0; - treatmentTime = 2; + treatmentTime = 4; items[] = {"ACE_bodyBag"}; condition = "!alive (_this select 1);"; callbackSuccess = QUOTE(DFUNC(actionPlaceInBodyBag)); diff --git a/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf b/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf index 1812912c6b..73f9eeca4d 100644 --- a/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf +++ b/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf @@ -1,31 +1,40 @@ /* * Author: Glowbal - * Replace a dead body by a bodybag + * Replace a (dead) body by a body bag * * Arguments: - * 0: The patient - * 1: The new item classname + * 0: The actor + * 1: The patient * * Return Value: - * nil + * body bag * * Public: Yes */ #include "script_component.hpp" -private ["_target","_caller", "_nameOfUnit", "_onPosition", "_bodyBagCreated"]; -_caller = _this select 0; -_target = _this select 1; +PARAMS_2(_caller,_target); + +private ["_position", "_headPos", "_spinePos", "_dirVect", "_direction", "_bodyBag"]; -_nameOfUnit = [_target] call EFUNC(common,getName); if (alive _target) then { [_target, true] call FUNC(setDead); }; -_onPosition = getPosASL _target; -deleteVehicle _target; -_bodyBagCreated = createVehicle ["ACE_bodyBagObject", _onPosition, [], 0, "NONE"]; -// reset the position to ensure it is on the correct one. -_bodyBagCreated setPosASL [_onPosition select 0, _onPosition select 1, (_onPosition select 2) + 0.2]; -_bodyBagCreated; +_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; + +deleteVehicle _target; + +_bodyBag = createVehicle ["ACE_bodyBagObject", _position, [], 0, "CAN_COLLIDE"]; + +// prevent body bag from flipping +_bodyBag setPosASL _position; +_bodyBag setDir _direction; + +_bodyBag