From 6142d99626917aef7f8611e55cc609af29ba8c2b Mon Sep 17 00:00:00 2001 From: ViperMaul Date: Sun, 26 Jul 2015 18:20:36 -0700 Subject: [PATCH 1/2] Add support for loading unconscious into co-pilot seat fixes #1727 --- .../common/functions/fnc_loadPersonLocal.sqf | 51 ++++++++++++------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/addons/common/functions/fnc_loadPersonLocal.sqf b/addons/common/functions/fnc_loadPersonLocal.sqf index ccde28b9aa..8718be1e75 100644 --- a/addons/common/functions/fnc_loadPersonLocal.sqf +++ b/addons/common/functions/fnc_loadPersonLocal.sqf @@ -10,35 +10,48 @@ #include "script_component.hpp" -private ["_unit","_vehicle","_caller","_handle","_loaded"]; +private ["_unit","_vehicle","_caller","_handle","_loaded","_slotsOpen"]; _unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param; _vehicle = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param; _caller = [_this, 2, ObjNull,[ObjNull]] call BIS_fnc_Param; +_slotsOpen = false; if (!alive _unit) then { _unit = [_unit,_caller] call FUNC(makeCopyOfBody); }; -_unit moveInCargo _vehicle; -_loaded = _vehicle getvariable [QGVAR(loaded_persons),[]]; -_loaded pushback _unit; -_vehicle setvariable [QGVAR(loaded_persons),_loaded,true]; -if (!([_unit] call FUNC(isAwake))) then { - _handle = [_unit,_vehicle] spawn { - private ["_unit","_vehicle"]; - _unit = _this select 0; - _vehicle = _this select 1; - waituntil {vehicle _unit == _vehicle}; - sleep 0.5; - //Save the "awake" animation before applying the death animation - if (vehicle _unit == _vehicle) then { - _unit setVariable [QEGVAR(medical,vehicleAwakeAnim), [_vehicle, (animationState _unit)]]; - }; - [_unit,([_unit] call FUNC(getDeathAnim)), 1, true] call FUNC(doAnimation); - }; +if (_vehicle emptyPositions "cargo" > 0) then { + _unit moveInCargo _vehicle; + _slotsOpen = true; } else { - if ([_unit] call FUNC(isArrested)) then { + if (_vehicle emptyPositions "gunner" > 0) then { + _unit moveInGunner _vehicle; + _slotsOpen = true; + }; +}; +if (_slotsOpen) then { + _loaded = _vehicle getvariable [QGVAR(loaded_persons),[]]; + _loaded pushback _unit; + _vehicle setvariable [QGVAR(loaded_persons),_loaded,true]; + if (!([_unit] call FUNC(isAwake))) then { + _handle = [_unit,_vehicle] spawn { + private ["_unit","_vehicle"]; + _unit = _this select 0; + _vehicle = _this select 1; + waituntil {vehicle _unit == _vehicle}; + sleep 0.5; + + //Save the "awake" animation before applying the death animation + if (vehicle _unit == _vehicle) then { + _unit setVariable [QEGVAR(medical,vehicleAwakeAnim), [_vehicle, (animationState _unit)]]; + }; + [_unit,([_unit] call FUNC(getDeathAnim)), 1, true] call FUNC(doAnimation); + }; + } else { + if ([_unit] call FUNC(isArrested)) then { + + }; }; }; \ No newline at end of file From 9a98530392930ee34abc17393e1520a6a0a35452 Mon Sep 17 00:00:00 2001 From: ViperMaul Date: Sun, 26 Jul 2015 18:33:25 -0700 Subject: [PATCH 2/2] Add support for loading unconscious into boats, refs #1729 --- addons/common/functions/fnc_loadPerson.sqf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/common/functions/fnc_loadPerson.sqf b/addons/common/functions/fnc_loadPerson.sqf index 53bf51d599..30bb6a7e38 100644 --- a/addons/common/functions/fnc_loadPerson.sqf +++ b/addons/common/functions/fnc_loadPerson.sqf @@ -12,7 +12,7 @@ #define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson)) -private ["_caller", "_unit","_vehicle", "_loadcar", "_loadhelicopter", "_loadtank"]; +private ["_caller", "_unit","_vehicle", "_loadcar", "_loadhelicopter", "_loadtank","_loadboat"]; _caller = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param; _unit = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param; _vehicle = ObjNull; @@ -30,6 +30,11 @@ if (_unit distance _loadcar <= 10) then { _loadtank = nearestObject [_unit, "tank"]; if (_unit distance _loadtank <= 10) then { _vehicle = _loadtank; + } else { + _loadboat = nearestObject [_unit, "ship"]; + if (_unit distance _loadboat <= 10) then { + _vehicle = _loadboat; + }; }; }; };