mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fixed minor issues with unconscious & blackout effect.
Fixed error in XEH_postInit
This commit is contained in:
parent
8a61f5fbb5
commit
83128ad3d2
@ -8,7 +8,7 @@ QGVAR(remoteFnc) addPublicVariableEventHandler {
|
||||
[missionNamespace] call FUNC(executePersistent);
|
||||
|
||||
// check previous version number from profile
|
||||
_currentVersion = getText (configFile >> "CfgPatches" >> ADDON >> "version");
|
||||
_currentVersion = getText (configFile >> "CfgPatches" >> QUOTE(ADDON) >> "version");
|
||||
_previousVersion = profileNamespace getVariable ["ACE_VersionNumberString", ""];
|
||||
|
||||
if (_currentVersion != _previousVersion) then {
|
||||
|
@ -36,14 +36,14 @@ if (count _this > 3) then {
|
||||
};
|
||||
|
||||
// don't overwrite more important animations
|
||||
if (_unit getVariable ["ACE_isUnconscious", false] && {!_force}) exitWith {
|
||||
if (_unit getVariable [/*"ACE_isUnconscious"*/ QGVAR(StateUnconscious), false] && {!_force}) exitWith {
|
||||
if (_animation != "Unconscious") then {
|
||||
[_unit, "Unconscious", 2] call FUNC(doAnimation);
|
||||
};
|
||||
};
|
||||
|
||||
// don't go unconscious if the unit isn't unconscious
|
||||
if (_animation == "Unconscious" && {!(_unit getVariable ["ACE_isUnconscious", false])}) exitWith {};
|
||||
if (_animation == "Unconscious" && {!(_unit getVariable [/*"ACE_isUnconscious"*/ QGVAR(StateUnconscious), false])}) exitWith {};
|
||||
|
||||
// switchMove "" no longer works in dev 1.37
|
||||
if (_animation == "") then {
|
||||
|
@ -13,22 +13,33 @@
|
||||
private ["_unit", "_animState", "_dAnim"];
|
||||
_unit = _this select 0;
|
||||
|
||||
if !([_unit] call FUNC(canGoUnconsciousState)) exitwith{};
|
||||
if (!local _unit) exitwith {
|
||||
[[_unit], QUOTE(FUNC(setUnconsciousState)), _unit, false] call EFUNC(common,execRemoteFnc);
|
||||
if !([_unit] call FUNC(canGoUnconsciousState)) exitwith{
|
||||
[format["Exit setUnconscious: %1", _this]] call FUNC(debug);
|
||||
};
|
||||
|
||||
_dAnim = ([_unit] call FUNC(getDeathAnim));
|
||||
// We only want this function to work on local machines
|
||||
if (!local _unit) exitwith {
|
||||
[[_unit], QUOTE(FUNC(setUnconsciousState)), _unit, false] call EFUNC(common,execRemoteFnc);
|
||||
[format["Exit setUnconscious: %1", _this]] call FUNC(debug);
|
||||
};
|
||||
|
||||
// get rid of the object we are carrying, before we go unconscious.
|
||||
[_unit, ObjNull, [0,0,0]] call FUNC(carryObj);
|
||||
|
||||
// Set the unit in the unconscious state.
|
||||
_unit setvariable [QGVAR(StateUnconscious),true,true];
|
||||
_unit setUnconscious true;
|
||||
|
||||
// If a unit has the launcher out, it will sometimes start selecting the primairy weapon while unconscious,
|
||||
// therefor we force it to select the primairy weapon before going unconscious
|
||||
[_unit] call FUNC(setWeaponsCorrectUnconscious);
|
||||
|
||||
_animState = animationState _unit;
|
||||
|
||||
// We are storing the current animation, so we can use it later on when waking the unit up inside a vehicle
|
||||
_animState = animationState _unit;
|
||||
_originalPos = unitPos _unit;
|
||||
|
||||
// Handle the on screen effects
|
||||
if (isPlayer _unit) then {
|
||||
[] call FUNC(closeAllDialogs_f);
|
||||
[true] call EFUNC(GUI,effectBlackOut);
|
||||
@ -38,14 +49,20 @@ if (isPlayer _unit) then {
|
||||
_unit setUnitPos "DOWN";
|
||||
[_unit, true] call FUNC(disableAI_F);
|
||||
};
|
||||
|
||||
// So the AI does not get stuck, we are moving the unit to a temp group on its own.
|
||||
[_unit, true, QGVAR(StateUnconscious), side group _unit] call FUNC(switchToGroupSide_f);
|
||||
|
||||
_captiveSwitch = [_unit, true] call FUNC(setCaptiveSwitch);
|
||||
_unit setUnconscious true;
|
||||
[_unit, _dAnim, 1, true] call FUNC(doAnimation);
|
||||
[_unit, [_unit] call FUNC(getDeathAnim), 1, true] call FUNC(doAnimation);
|
||||
|
||||
|
||||
[format["Unit moving into unconscious: %1", _this]] call FUNC(debug);
|
||||
|
||||
|
||||
_startingTime = time;
|
||||
_minWaitingTime = (round(random(10)+5));
|
||||
|
||||
[{
|
||||
private ["_unit", "_vehicleOfUnit","_lockSwitch","_minWaitingTime", "_oldAnimation", "_captiveSwitch"];
|
||||
_args = _this select 0;
|
||||
@ -58,13 +75,15 @@ _minWaitingTime = (round(random(10)+5));
|
||||
|
||||
// Since the unit is no longer alive, get rid of this PFH.
|
||||
if (!alive _unit) exitwith {
|
||||
[format["%1 Unit no longer alive, exiting"], _unit] call FUNC(debug);
|
||||
// EXIT PFH
|
||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||
[[_unit, false],"setUnconsciousState"] call FUNC(raiseScriptedEvent_f);
|
||||
};
|
||||
|
||||
// In case the unit is no longer in an unconscious state, we are going to check if we can already reset the animation
|
||||
if !([_unit] call FUNC(isUnconscious)) exitwith {
|
||||
|
||||
[format["%1 Unit no longer unconscious, handling exit and animation"], _unit] call FUNC(debug);
|
||||
// Wait until the unit isn't being carried anymore, so we won't end up with wierd animations
|
||||
if !([_unit] call FUNC(beingCarried)) then {
|
||||
if (vehicle _unit == _unit) then {
|
||||
@ -74,6 +93,8 @@ _minWaitingTime = (round(random(10)+5));
|
||||
// TODO: what if the unit switched vehicle?
|
||||
[_unit, _oldAnimation, 1] call FUNC(doAnimation);
|
||||
};
|
||||
|
||||
// EXIT PFH
|
||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||
[[_unit, false],"setUnconsciousState"] call FUNC(raiseScriptedEvent_f);
|
||||
};
|
||||
@ -83,7 +104,7 @@ _minWaitingTime = (round(random(10)+5));
|
||||
|
||||
// Wait until the unit is no longer unconscious
|
||||
if (!([_unit] call FUNC(getUnconsciousCondition))) then {
|
||||
|
||||
[format["%1 No unconscious condition valid anymore, moving uit out of unconsciousState"], _unit] call FUNC(debug);
|
||||
// Reset the unit back to the previous captive state.
|
||||
if (_captiveSwitch) then {
|
||||
[_unit, false] call FUNC(setCaptiveSwitch);
|
||||
@ -105,13 +126,15 @@ _minWaitingTime = (round(random(10)+5));
|
||||
|
||||
// Move unit out of unconscious state
|
||||
_unit setvariable [QGVAR(StateUnconscious), false, true];
|
||||
[format["%1 Unit no longer unconsicous"], _unit] call FUNC(debug);
|
||||
};
|
||||
};
|
||||
|
||||
// A check to ensure that the animation is being played properly.
|
||||
// TODO: Might no longer be necessary: Have to test this in MP
|
||||
if (vehicle _unit == _unit && {animationState _unit != "deadState" && animationState _unit != "unconscious"} && {(isNull ([_unit] call FUNC(getCarriedBy)))}) then {
|
||||
// TODO: Might no longer be necessary: Have to test this in MP.
|
||||
if (vehicle _unit == _unit && {animationState _unit != "deadState" && animationState _unit != "unconscious"} && {(isNull ([_unit] call FUNC(getCarriedBy)))} && (time - _startingTime >= 0.5)) then {
|
||||
[_unit,([_unit] call FUNC(getDeathAnim)), 1, true] call FUNC(doAnimation); // Reset animations if unit starts doing wierd things.
|
||||
[format["%1 Had to reset an animation for unconscious"], _unit] call FUNC(debug);
|
||||
};
|
||||
|
||||
}, 0.1, [_unit,_animState, _captiveSwitch, _originalPos, _startingTime, _minWaitingTime] ] call CBA_fnc_addPerFrameHandler;
|
||||
|
@ -176,11 +176,11 @@ class RscTitles {
|
||||
};
|
||||
};
|
||||
|
||||
class ACE_common_ScreenEffectsBlack {
|
||||
class GVAR(ScreenEffectsBlack) {
|
||||
duration = 10e10;
|
||||
idd = 1111;
|
||||
movingenable = 0;
|
||||
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QUOTE(ACE_common_ScreenEffectsBlack)), _this select 0)]);
|
||||
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QUOTE(GVAR(ScreenEffectsBlack))), _this select 0)]);
|
||||
|
||||
class controlsBackground {
|
||||
class blackScreen: ACE_gui_backgroundBase {
|
||||
@ -194,11 +194,11 @@ class RscTitles {
|
||||
};
|
||||
};
|
||||
};
|
||||
class ACE_common_ScreenEffectsBleeding {
|
||||
class GVAR(ScreenEffectsBleeding) {
|
||||
duration = 1;
|
||||
idd = 1111;
|
||||
movingenable = 0;
|
||||
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QUOTE(ACE_common_ScreenEffectsBleeding)), _this select 0)]);
|
||||
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QUOTE(GVAR(ScreenEffectsBleeding))), _this select 0)]);
|
||||
|
||||
class controlsBackground {
|
||||
class bleedingScreen: ACE_gui_backgroundBase {
|
||||
@ -212,11 +212,11 @@ class RscTitles {
|
||||
};
|
||||
};
|
||||
};
|
||||
class ACE_common_ScreenEffectsHit {
|
||||
class GVAR(ScreenEffectsHit) {
|
||||
duration = 1.1;
|
||||
idd = 1111;
|
||||
movingenable = 0;
|
||||
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QUOTE(ACE_common_ScreenEffectsHit)), _this select 0)]);
|
||||
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QUOTE(GVAR(ScreenEffectsHit))), _this select 0)]);
|
||||
|
||||
class controlsBackground {
|
||||
class effectHit: ACE_gui_backgroundBase {
|
||||
@ -230,11 +230,11 @@ class RscTitles {
|
||||
};
|
||||
};
|
||||
};
|
||||
class ACE_common_ScreenEffectsPain {
|
||||
class GVAR(ScreenEffectsPain) {
|
||||
duration = 1;
|
||||
idd = 1111;
|
||||
movingenable = 0;
|
||||
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QUOTE(ACE_common_ScreenEffectsPain)), _this select 0)]);
|
||||
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QUOTE(GVAR(ScreenEffectsPain))), _this select 0)]);
|
||||
|
||||
class controlsBackground {
|
||||
class painScreen: ACE_gui_backgroundBase {
|
||||
|
@ -12,8 +12,16 @@
|
||||
|
||||
private ["_displayEffect","_effect"];
|
||||
_displayEffect = [_this, 0, false,[false]] call bis_fnc_param;
|
||||
|
||||
if (!hasInterface) exitwith {};
|
||||
|
||||
disableSerialization;
|
||||
_effect = uiNamespace getVariable QGVAR(ScreenEffectsBlack);
|
||||
if (isNil "_effect") then {
|
||||
45 cutRsc [QGVAR(ScreenEffectsBlack),"PLAIN"];
|
||||
_effect = uiNamespace getVariable QGVAR(ScreenEffectsBlack);
|
||||
};
|
||||
|
||||
if (_displayEffect) then {
|
||||
(_effect displayCtrl 11112) ctrlSetTextColor [0.0,0.0,0.0,0.9];
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user