mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Medical - Add unconscious animations (#7363)
* Add custom anim entries * Switch to SQF based animation detection * Add time out to CBA_fnc_waitUntilAndExecute * Remove unneeded comments or defines * Restore line break * Styling and removal of not needed code * Move waitForAnime and make it local nil * Extended comment * Add Kola to authors file * Small bug fix in terms of animation names * Add custom anim entries Switch to SQF based animation detection Add time out to CBA_fnc_waitUntilAndExecute Remove unneeded comments or defines Restore line break Styling and removal of not needed code Move waitForAnime and make it local nil Extended comment Add Kola to authors file Small bug fix in terms of animation names * Move animations into data folder * add uppercase on sqf command * Rename animation config names and files * fix physx uncon fix * Change initial after ragdoll animation name
This commit is contained in:
parent
444ee88f08
commit
b16ca5c204
@ -105,6 +105,7 @@ Karneck <dschultz26@hotmail.com>
|
||||
Kavinsky <nmunozfernandez@gmail.com>
|
||||
Keithen <Keithen.Neu@gmail.com>
|
||||
Kllrt <kllrtik@gmail.com>
|
||||
KokaKolaA3
|
||||
legman <juicemelon@msn.com>
|
||||
Legolasindar "Viper" <legolasindar@gmail.com>
|
||||
licht-im-Norden87 <lichtimnorden87@gmail.com>
|
||||
|
@ -1,10 +1,9 @@
|
||||
|
||||
// we want the face down animation every time
|
||||
class CfgExtendedAnimation {
|
||||
class Revive {
|
||||
left = "Unconscious";
|
||||
right = "Unconscious";
|
||||
front = "Unconscious";
|
||||
back = "Unconscious";
|
||||
left = QGVAR(faceLeft_unconscious);
|
||||
right = QGVAR(faceRight_unconscious);
|
||||
front = QGVAR(faceDown_unconscious);
|
||||
back = QGVAR(faceUp_unconscious);
|
||||
};
|
||||
};
|
||||
|
@ -8,6 +8,76 @@ class CfgMovesMaleSdr: CfgMovesBasic {
|
||||
weaponIK = 0;
|
||||
};
|
||||
|
||||
class Unconscious;
|
||||
class DeadState;
|
||||
class ace_unconscious_1: DeadState {
|
||||
file = QPATHTO_T(data\ace_unconscious_1.rtm);
|
||||
};
|
||||
class ace_unconscious_2: ace_unconscious_1 {
|
||||
file = QPATHTO_T(data\ace_unconscious_2.rtm);
|
||||
};
|
||||
class ace_unconscious_3: ace_unconscious_1 {
|
||||
file = QPATHTO_T(data\ace_unconscious_3.rtm);
|
||||
};
|
||||
class ace_unconscious_4: ace_unconscious_1 {
|
||||
file = QPATHTO_T(data\ace_unconscious_4.rtm);
|
||||
};
|
||||
class ace_unconscious_5: ace_unconscious_1 {
|
||||
file = QPATHTO_T(data\ace_unconscious_5.rtm);
|
||||
};
|
||||
class ace_unconscious_6: ace_unconscious_1 {
|
||||
file = QPATHTO_T(data\ace_unconscious_6.rtm);
|
||||
};
|
||||
class ace_unconscious_7: ace_unconscious_1 {
|
||||
file = QPATHTO_T(data\ace_unconscious_7.rtm);
|
||||
};
|
||||
class ace_unconscious_8: ace_unconscious_1 {
|
||||
file = QPATHTO_T(data\ace_unconscious_8.rtm);
|
||||
};
|
||||
class ace_unconscious_1_1: ace_unconscious_1 {
|
||||
file = QPATHTO_T(data\ace_unconscious_1_1.rtm);
|
||||
};
|
||||
class ace_unconscious_2_1: ace_unconscious_1 {
|
||||
file = QPATHTO_T(data\ace_unconscious_2_1.rtm);
|
||||
};
|
||||
class ace_unconscious_3_1: ace_unconscious_1 {
|
||||
file = QPATHTO_T(data\ace_unconscious_3_1.rtm);
|
||||
};
|
||||
class ace_unconscious_4_1: ace_unconscious_1 {
|
||||
file = QPATHTO_T(data\ace_unconscious_4_1.rtm);
|
||||
};
|
||||
class ace_unconscious_5_1: ace_unconscious_1 {
|
||||
file = QPATHTO_T(data\ace_unconscious_5_1.rtm);
|
||||
};
|
||||
class ace_unconscious_6_1: ace_unconscious_1 {
|
||||
file = QPATHTO_T(data\ace_unconscious_6_1.rtm);
|
||||
};
|
||||
class ace_unconscious_7_1: ace_unconscious_1 {
|
||||
file = QPATHTO_T(data\ace_unconscious_7_1.rtm);
|
||||
};
|
||||
class ace_unconscious_8_1: ace_unconscious_1 {
|
||||
file = QPATHTO_T(data\ace_unconscious_8_1.rtm);
|
||||
};
|
||||
/* added for the "ace_unc" part */
|
||||
class KIA_passenger_boat_holdleft;
|
||||
class ace_unconscious_9: KIA_passenger_boat_holdleft {
|
||||
};
|
||||
class KIA_driver_boat01;
|
||||
class ace_unconscious_10: KIA_driver_boat01 {
|
||||
};
|
||||
|
||||
class GVAR(faceDown_unconscious): Unconscious {
|
||||
};
|
||||
|
||||
class GVAR(faceLeft_unconscious): Unconscious {
|
||||
};
|
||||
|
||||
class GVAR(faceRight_unconscious): Unconscious {
|
||||
};
|
||||
|
||||
class GVAR(faceUp_unconscious): Unconscious {
|
||||
};
|
||||
|
||||
class AmovPpneMstpSnonWnonDnon;
|
||||
class ACE_UnconsciousOutProne: AmovPpneMstpSnonWnonDnon {
|
||||
//file = "\A3\anims_f\Data\Anim\Sdr\dth\pne\stp\ras\Rfl\AdthPpneMstpSrasWrflDnon_1";
|
||||
|
@ -6,3 +6,4 @@ PREP(setStructuralDamage);
|
||||
PREP(setUnconsciousAnim);
|
||||
PREP(getHitpointArmor);
|
||||
PREP(getItemArmor);
|
||||
PREP(applyAnimAfterRagdoll);
|
||||
|
@ -66,7 +66,7 @@
|
||||
// Fixes units being stuck in unconscious animation when being knocked over by a PhysX object
|
||||
["CAManBase", "AnimDone", {
|
||||
params ["_unit", "_anim"];
|
||||
if (local _unit && {_anim == "unconscious" && {lifeState _unit != "INCAPACITATED"}}) then {
|
||||
if (local _unit && {_anim find QGVAR(face) != -1 && {lifeState _unit != "INCAPACITATED"}}) then {
|
||||
[_unit, false] call FUNC(setUnconsciousAnim);
|
||||
};
|
||||
}] call CBA_fnc_addClassEventHandler;
|
||||
|
@ -36,6 +36,12 @@ GVAR(armorCache) = false call CBA_fnc_createNamespace;
|
||||
// with handle damage not returning full results.
|
||||
GVAR(fixedStatics) = [];
|
||||
|
||||
GVAR(animations) = [] call CBA_fnc_createNamespace;
|
||||
GVAR(animations) setVariable [QGVAR(faceUp_unconscious), ["ace_unconscious_2","ace_unconscious_2_1","ace_unconscious_7_1","ace_unconscious_8_1","ace_unconscious_5_1","ace_unconscious_6_1"]];
|
||||
GVAR(animations) setVariable [QGVAR(faceDown_unconscious), ["ace_unconscious_1", "ace_unconscious_3", "ace_unconscious_4","unconscious","ace_unconscious_9","ace_unconscious_3_1","ace_unconscious_4_1"]];
|
||||
GVAR(animations) setVariable [QGVAR(faceLeft_unconscious), ["ace_unconscious_7","ace_unconscious_8","ace_unconscious_1_1","ace_unconscious_7_1","ace_unconscious_8_1"]];
|
||||
GVAR(animations) setVariable [QGVAR(faceRight_unconscious), ["ace_unconscious_5","ace_unconscious_6","ace_unconscious_10","ace_unconscious_5_1","ace_unconscious_6_1"]];
|
||||
|
||||
private _fnc_fixStatic = {
|
||||
params ["_vehicle"];
|
||||
private _type = typeOf _vehicle;
|
||||
@ -55,4 +61,21 @@ addMissionEventHandler ["Loaded", {
|
||||
} forEach GVAR(fixedStatics);
|
||||
}];
|
||||
|
||||
["ace_unconscious", {
|
||||
params ["_unit", "_active"];
|
||||
if (_active) then {
|
||||
if (_unit getVariable [QGVAR(waitForAnim), true]) then {
|
||||
[{(animationState _this) find QGVAR(face) != -1}, {
|
||||
[_this, animationState _this] call FUNC(applyAnimAfterRagdoll);
|
||||
}, _unit, 20] call CBA_fnc_waitUntilAndExecute;
|
||||
_unit setVariable [QGVAR(waitForAnim), false];
|
||||
};
|
||||
} else {
|
||||
_unit setVariable [QGVAR(waitForAnim), nil];
|
||||
if (local _unit) then {
|
||||
[_unit, _active] call FUNC(setUnconsciousAnim);
|
||||
};
|
||||
};
|
||||
}] call CBA_fnc_addEventhandler;
|
||||
|
||||
ADDON = true;
|
||||
|
BIN
addons/medical_engine/data/ace_unconscious_1.rtm
Normal file
BIN
addons/medical_engine/data/ace_unconscious_1.rtm
Normal file
Binary file not shown.
BIN
addons/medical_engine/data/ace_unconscious_1_1.rtm
Normal file
BIN
addons/medical_engine/data/ace_unconscious_1_1.rtm
Normal file
Binary file not shown.
BIN
addons/medical_engine/data/ace_unconscious_2.rtm
Normal file
BIN
addons/medical_engine/data/ace_unconscious_2.rtm
Normal file
Binary file not shown.
BIN
addons/medical_engine/data/ace_unconscious_2_1.rtm
Normal file
BIN
addons/medical_engine/data/ace_unconscious_2_1.rtm
Normal file
Binary file not shown.
BIN
addons/medical_engine/data/ace_unconscious_3.rtm
Normal file
BIN
addons/medical_engine/data/ace_unconscious_3.rtm
Normal file
Binary file not shown.
BIN
addons/medical_engine/data/ace_unconscious_3_1.rtm
Normal file
BIN
addons/medical_engine/data/ace_unconscious_3_1.rtm
Normal file
Binary file not shown.
BIN
addons/medical_engine/data/ace_unconscious_4.rtm
Normal file
BIN
addons/medical_engine/data/ace_unconscious_4.rtm
Normal file
Binary file not shown.
BIN
addons/medical_engine/data/ace_unconscious_4_1.rtm
Normal file
BIN
addons/medical_engine/data/ace_unconscious_4_1.rtm
Normal file
Binary file not shown.
BIN
addons/medical_engine/data/ace_unconscious_5.rtm
Normal file
BIN
addons/medical_engine/data/ace_unconscious_5.rtm
Normal file
Binary file not shown.
BIN
addons/medical_engine/data/ace_unconscious_5_1.rtm
Normal file
BIN
addons/medical_engine/data/ace_unconscious_5_1.rtm
Normal file
Binary file not shown.
BIN
addons/medical_engine/data/ace_unconscious_6.rtm
Normal file
BIN
addons/medical_engine/data/ace_unconscious_6.rtm
Normal file
Binary file not shown.
BIN
addons/medical_engine/data/ace_unconscious_6_1.rtm
Normal file
BIN
addons/medical_engine/data/ace_unconscious_6_1.rtm
Normal file
Binary file not shown.
BIN
addons/medical_engine/data/ace_unconscious_7.rtm
Normal file
BIN
addons/medical_engine/data/ace_unconscious_7.rtm
Normal file
Binary file not shown.
BIN
addons/medical_engine/data/ace_unconscious_7_1.rtm
Normal file
BIN
addons/medical_engine/data/ace_unconscious_7_1.rtm
Normal file
Binary file not shown.
BIN
addons/medical_engine/data/ace_unconscious_8.rtm
Normal file
BIN
addons/medical_engine/data/ace_unconscious_8.rtm
Normal file
Binary file not shown.
BIN
addons/medical_engine/data/ace_unconscious_8_1.rtm
Normal file
BIN
addons/medical_engine/data/ace_unconscious_8_1.rtm
Normal file
Binary file not shown.
@ -0,0 +1,34 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: diwako
|
||||
* Apply a fitting unconscious animation to a knocked out unit
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Animation <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [_unit, _anim] call ace_medical_engine_fnc_applyAnimAfterRagdoll;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_unit", "_anim"];
|
||||
if !(IS_UNCONSCIOUS(_unit) && // do not run if unit is conscious
|
||||
{alive _unit && // do not run if unit is dead
|
||||
{isNull objectParent _unit}}) exitWith {}; // do not run if unit in any vehicle
|
||||
|
||||
private _unconsciousAnimation = selectRandom (GVAR(animations) getVariable [_anim, [""]]);
|
||||
|
||||
if (_unconsciousAnimation isEqualTo "") exitWith {
|
||||
// not a valid animation found
|
||||
ERROR("No valid animation found!");
|
||||
};
|
||||
|
||||
// Apply the animation only locally on the machine and do not broadcast it to others
|
||||
// Reason is the nature of setUnconscious' end of ragdoll animation is not synced on all machines either
|
||||
// Not synced animations are preferred over units snapping from one to another animation
|
||||
_unit switchMove _unconsciousAnimation;
|
@ -47,10 +47,10 @@ if (_isUnconscious) then {
|
||||
} else {
|
||||
// and on foot
|
||||
TRACE_1("onfoot - playing standard anim",_unit);
|
||||
[_unit, "AmovPpneMstpSnonWnonDnon"] call EFUNC(common,doAnimation);
|
||||
[_unit, "AmovPpneMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
||||
|
||||
if (currentWeapon _unit == secondaryWeapon _unit && {currentWeapon _unit != ""}) then {
|
||||
[_unit, "AmovPknlMstpSrasWlnrDnon"] call EFUNC(common,doAnimation);
|
||||
[_unit, "AmovPknlMstpSrasWlnrDnon", 2] call EFUNC(common,doAnimation);
|
||||
};
|
||||
|
||||
[{
|
||||
@ -58,7 +58,8 @@ if (_isUnconscious) then {
|
||||
TRACE_3("after delay",_unit,animationState _unit,lifeState _unit);
|
||||
if (!alive _unit) exitWith {};
|
||||
// Fix unit being in locked animation with switchMove (If unit was unloaded from a vehicle, they may be in deadstate instead of unconscious)
|
||||
if (((animationState _unit == "unconscious") || {animationState _unit == "deadstate"}) && {lifeState _unit != "INCAPACITATED"}) then {
|
||||
private _animation = animationState _unit;
|
||||
if ((_animation == "unconscious" || {_animation == "deadstate" || {_animation find "ace_unconscious_" != -1}}) && {lifeState _unit != "INCAPACITATED"}) then {
|
||||
[_unit, "AmovPpneMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
||||
TRACE_1("forcing SwitchMove",animationState _unit);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user