mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
animations, onUnconscious events
This commit is contained in:
parent
43846970fa
commit
749352f0a8
@ -33,6 +33,8 @@ if (hasInterface) then {
|
||||
_this lock (_this getVariable [QGVAR(lockStatus), locked _this]);
|
||||
}] call FUNC(addEventhandler);
|
||||
|
||||
["setDir", {(_this select 0) setDir (_this select 1)}] call FUNC(addEventhandler);
|
||||
|
||||
// hack to get PFH to work in briefing
|
||||
[QGVAR(onBriefingPFH), "onEachFrame", {
|
||||
if (time > 0) exitWith {
|
||||
|
@ -17,3 +17,8 @@ if (isNil "ACE_maxWeightCarry") then {
|
||||
// release object on player change. This does work when returning to lobby, but not when hard disconnecting.
|
||||
["playerChanged", {_this call DFUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler);
|
||||
["playerWeaponChanged", {_this call DFUNC(handlePlayerWeaponChanged)}] call EFUNC(common,addEventhandler);
|
||||
|
||||
// handle waking up dragged unit and falling unconscious while dragging
|
||||
["medical_onUnconscious", {_this call DFUNC(handleUnconscious)}] call EFUNC(common,addEventhandler);
|
||||
|
||||
//@todo Captivity?
|
||||
|
@ -18,6 +18,7 @@ PREP(handleKilled);
|
||||
PREP(handlePlayerChanged);
|
||||
PREP(handlePlayerWeaponChanged);
|
||||
PREP(handleScrollWheel);
|
||||
PREP(handleUnconscious);
|
||||
PREP(initObject);
|
||||
PREP(initPerson);
|
||||
PREP(isObjectOnObject);
|
||||
|
@ -22,4 +22,4 @@ if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// a static weapon has to be empty for dragging
|
||||
if ((typeOf _target) isKindOf "StaticWeapon" && {count crew _target > 0}) exitWith {false};
|
||||
|
||||
alive _target && {_target getVariable [QGVAR(canCarry), false]}
|
||||
alive _target && {_target getVariable [QGVAR(canCarry), false]} && {animationState _target in ["", "unconscious"]}
|
||||
|
@ -22,4 +22,4 @@ if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// a static weapon has to be empty for dragging
|
||||
if ((typeOf _target) isKindOf "StaticWeapon" && {count crew _target > 0}) exitWith {false};
|
||||
|
||||
alive _target && {_target getVariable [QGVAR(canDrag), false]}
|
||||
alive _target && {_target getVariable [QGVAR(canDrag), false]} && {animationState _target in ["", "unconscious"]}
|
||||
|
@ -33,6 +33,10 @@ _position = _position vectorAdd [0, 0, _offset];
|
||||
_target attachTo [_unit, _position];
|
||||
_target setDir _direction;
|
||||
|
||||
if (_target isKindOf "CAManBase") then {
|
||||
[_target, "AinjPpneMrunSnonWnonDb_still", 0, true] call EFUNC(common,doAnimation);
|
||||
};
|
||||
|
||||
_unit setVariable [QGVAR(isDragging), true, true];
|
||||
_unit setVariable [QGVAR(draggedObject), _target, true];
|
||||
|
||||
|
@ -33,6 +33,14 @@ _unit playAction "released";
|
||||
// release object
|
||||
detach _target;
|
||||
|
||||
if (_target isKindOf "CAManBase") then {
|
||||
if (_target getVariable ["ACE_isUnconscious", false]) then {
|
||||
[_target, "unconscious", 2, true] call EFUNC(common,doAnimation);
|
||||
} else {
|
||||
[_target, "", 2, true] call EFUNC(common,doAnimation); //@todo "AinjPpneMrunSnonWnonDb_release" seems to fall back to unconsciousness anim. retest after config fix
|
||||
};
|
||||
};
|
||||
|
||||
_unit removeWeapon "ACE_FakePrimaryWeapon";
|
||||
|
||||
// prevent object from flipping inside buildings
|
||||
|
25
addons/dragging/functions/fnc_handleUnconscious.sqf
Normal file
25
addons/dragging/functions/fnc_handleUnconscious.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_isUnconscious"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_isUnconscious = _this select 1;
|
||||
|
||||
private "_player";
|
||||
_player = ACE_player;
|
||||
|
||||
if !(_player getVariable [QGVAR(isDragging), false]) exitWith {};
|
||||
|
||||
private "_draggedObject";
|
||||
_draggedObject = _player getVariable [QGVAR(draggedObject), objNull];
|
||||
|
||||
// handle falling unconscious
|
||||
if (_unit == _player) then {
|
||||
[_unit, _draggedObject] call FUNC(dropObject);
|
||||
};
|
||||
|
||||
// handle waking up dragged unit
|
||||
if (_unit == _draggedObject) then {
|
||||
[_player, _draggedObject] call FUNC(dropObject);
|
||||
};
|
@ -15,5 +15,5 @@ private "_unit";
|
||||
|
||||
_unit = _this select 0;
|
||||
|
||||
[_unit, true/*, _position, _direction*/] call FUNC(setDraggable);
|
||||
[_unit, true/*, _position, _direction*/] call FUNC(setCarryable);
|
||||
[_unit, true, [0,1.1,0.092], 180] call FUNC(setDraggable);
|
||||
[_unit, true, [0.4,-0.1,-1.25], 195] call FUNC(setCarryable); // hard-coded selection: "LeftShoulder"
|
||||
|
@ -40,6 +40,13 @@ _unit selectWeapon primaryWeapon _unit;
|
||||
// can't play action that depends on weapon if it was added the same frame
|
||||
[{_this playActionNow "grabDrag";}, _unit] call EFUNC(common,execNextFrame);
|
||||
|
||||
// move a bit closer and adjust direction when trying to pick up a person
|
||||
if (_target isKindOf "CAManBase") then {
|
||||
[_target, "AinjPpneMrunSnonWnonDb_grab", 2, true] call EFUNC(common,doAnimation);
|
||||
_target setDir (getDir _unit + 180);
|
||||
_target setPos (getPos _unit vectorAdd (vectorDir _unit vectorMultiply 1.5));
|
||||
};
|
||||
|
||||
// prevents draging and carrying at the same time
|
||||
_unit setVariable [QGVAR(isDragging), true, true];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user