mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #1587 from acemod/fixVehicleUnconcious
fix animation and consistently unload units from vehicle
This commit is contained in:
commit
1322da5537
@ -41,6 +41,8 @@
|
|||||||
["fixFloating", DFUNC(fixFloating)] call FUNC(addEventhandler);
|
["fixFloating", DFUNC(fixFloating)] call FUNC(addEventhandler);
|
||||||
["fixPosition", DFUNC(fixPosition)] call FUNC(addEventhandler);
|
["fixPosition", DFUNC(fixPosition)] call FUNC(addEventhandler);
|
||||||
|
|
||||||
|
["unloadPersonEvent", DFUNC(unloadPersonLocal)] call FUNC(addEventhandler);
|
||||||
|
|
||||||
["lockVehicle", {
|
["lockVehicle", {
|
||||||
_this setVariable [QGVAR(lockStatus), locked _this];
|
_this setVariable [QGVAR(lockStatus), locked _this];
|
||||||
_this lock 2;
|
_this lock 2;
|
||||||
|
@ -15,21 +15,41 @@
|
|||||||
|
|
||||||
#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson))
|
#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson))
|
||||||
|
|
||||||
private ["_vehicle", "_loaded", "_emptyPos"];
|
private ["_loaded", "_emptyPos"];
|
||||||
PARAMS_1(_unit);
|
PARAMS_2(_unit,_vehicle);
|
||||||
_vehicle = vehicle _unit;
|
|
||||||
|
|
||||||
if (_vehicle == _unit) exitwith {false;};
|
if (driver _vehicle == _unit) exitwith {TRACE_1("Exiting on Failed Driver Check", driver _vehicle == _unit); false;};
|
||||||
if !(speed _vehicle <1 && (((getpos _vehicle) select 2) < 2)) exitwith {false;};
|
TRACE_1("Vehicle Check", driver _vehicle == _unit);
|
||||||
|
if !(speed _vehicle <1 && (((getPos _vehicle) select 2) < 2)) exitwith {TRACE_1("Exiting on Failed speed check", getPosASL _vehicle == _unit); false;};
|
||||||
|
TRACE_1("getPosASL Vehicle Check", getPos _vehicle);
|
||||||
|
|
||||||
_emptyPos = ((getPos _vehicle) findEmptyPosition [0, 10, typeof _unit]);
|
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 13, typeof _unit]);
|
||||||
if (count _emptyPos == 0) exitwith {false};
|
if (count _emptyPos == 0) exitwith {false}; //consider displaying text saying there are no safe places to exit the vehicle
|
||||||
|
|
||||||
_unit setPos _emptyPos;
|
|
||||||
unassignVehicle _unit;
|
unassignVehicle _unit;
|
||||||
if (!alive _unit) then {
|
[_unit] orderGetIn false;
|
||||||
|
TRACE_1("Ejecting", alive _unit);
|
||||||
_unit action ["Eject", vehicle _unit];
|
_unit action ["Eject", vehicle _unit];
|
||||||
|
[ {
|
||||||
|
private "_anim";
|
||||||
|
PARAMS_2(_unit,_emptyPos);
|
||||||
|
_unit setPosASL (_emptyPos call EFUNC(common,PositiontoASL));
|
||||||
|
if (!([_unit] call FUNC(isAwake))) then {
|
||||||
|
TRACE_1("Check if isAwake", [_unit] call FUNC(isAwake));
|
||||||
|
if (driver _unit == _unit) then {
|
||||||
|
_anim = [_unit] call EFUNC(common,getDeathAnim);
|
||||||
|
[_unit, _anim, 1, true] call EFUNC(common,doAnimation);
|
||||||
|
[{
|
||||||
|
_unit = _this select 0;
|
||||||
|
_anim = _this select 1;
|
||||||
|
if ((_unit getVariable "ACE_isUnconscious") and (animationState _unit != _anim)) then {
|
||||||
|
[_unit, _anim, 2, true] call EFUNC(common,doAnimation);
|
||||||
};
|
};
|
||||||
|
}, [_unit, _anim], 0.5, 0] call EFUNC(common,waitAndExecute);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
},[_unit,_emptyPos], 0.5, 0] call EFUNC(common,waitAndExecute);
|
||||||
|
|
||||||
|
|
||||||
[_unit, false, GROUP_SWITCH_ID, side group _unit] call FUNC(switchToGroupSide);
|
[_unit, false, GROUP_SWITCH_ID, side group _unit] call FUNC(switchToGroupSide);
|
||||||
|
|
||||||
@ -37,8 +57,4 @@ _loaded = _vehicle getvariable [QGVAR(loaded_persons),[]];
|
|||||||
_loaded = _loaded - [_unit];
|
_loaded = _loaded - [_unit];
|
||||||
_vehicle setvariable [QGVAR(loaded_persons),_loaded,true];
|
_vehicle setvariable [QGVAR(loaded_persons),_loaded,true];
|
||||||
|
|
||||||
if (!([_unit] call FUNC(isAwake))) then {
|
true
|
||||||
[_unit,([_unit] call FUNC(getDeathAnim)), 1, true] call FUNC(doAnimation);
|
|
||||||
};
|
|
||||||
|
|
||||||
true;
|
|
@ -24,4 +24,4 @@ _drag = if (count _this > 2) then {_this select 2} else {false};
|
|||||||
if (vehicle _target == _target) exitwith {};
|
if (vehicle _target == _target) exitwith {};
|
||||||
if (([_target] call EFUNC(common,isAwake))) exitwith {};
|
if (([_target] call EFUNC(common,isAwake))) exitwith {};
|
||||||
|
|
||||||
[_target] call EFUNC(common,unloadPerson)
|
["unloadPersonEvent", _target, [_target, vehicle _target]] call EFUNC(common,targetEvent)
|
Loading…
Reference in New Issue
Block a user