Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unconscious Issues (Not waking up, bugged wakeup) #7126

Closed
PabstMirror opened this issue Aug 9, 2019 · 1 comment · Fixed by #7136
Closed

Unconscious Issues (Not waking up, bugged wakeup) #7126

PabstMirror opened this issue Aug 9, 2019 · 1 comment · Fixed by #7136

Comments

@PabstMirror
Copy link
Contributor

We have been having rare but serious issues with units not waking up from unconscious
And when they do wakeup, they are sometimes bugged and cannot move.

Here is a recent example:

19:26:14 (miscMedical) INFO: SLOG - uncon event: X [Unit:UNIT_BLU_TH2_P] [Active:true]
19:27:23 4x: [ACRE] (sys_server) WARNING: Desync - Garbage collection prevented for radio 'acre_prc148_id_3' from player 'X' as it still exists for them locally! idi\acre\addons\sys_server\fnc_stopRadioGarbageCollect.sqf:27
19:35:38 (miscMedical) INFO: SLOG - _checkUnconc: X [VitalsStableExamine: Stable: Should eventually wakeup] [Checker: Z] // external unit checks "hasStableVitals"
// I finaly notice him down from spectator and manually global exec 
// `if (profileName == "X") then { [player] call ace_medical_statemachine_fnc_handleStateUnconscious };`
19:43:48 (miscMedical) INFO: SLOG - wakeUp event: X [Unit:UNIT_BLU_TH2_P] [Stable: true]
19:43:53 (miscMedical) INFO: SLOG - wakeUp check: X [State:Injured] [isUncon:true] [Anim:unconscious] [Weap: rhs_weap_m3a1] [InputD: 105]

Even though he is unconscious and hasStableVitals there is no wakeUp event
I manually call handleStateUnconscious and immedietly get a wakeUp event
5 seconds later it checks and anim is broken and input blocker is still running
We got a uncon-true event, but never a uncon-false, yet is in state=Injured at the end

What could cause this? It seems like handleStateUnconscious was never called
(probability of waking up is guaranteed with 10min waiting @ 0.5 chance)
Statemachine - statemachine not running for unit, or somehow not in correct state
LocalUnits - player somehow not in localUnits array
Possibly related to desync (acre warning)?

Medical Settings:

[QACEGVAR(medical,spontaneousWakeUpChance), 0.5], // default: 0.05
[QACEGVAR(medical_treatment,woundReopening), false], // default: true
[QACEGVAR(medical_treatment,litterCleanupDelay), 300], // default: 600
[QACEGVAR(medical_statemachine,AIUnconsciousness), false], // default: true
[QACEGVAR(medical_statemachine,cardiacArrestTime), 1], // default: 30

Debugging code:

["ace_medical_wakeUp", {
    params ["_unit"];
    if (_unit == ACE_player) then {
        private _stable = [_unit] call ace_medical_status_fnc_hasStableVitals;
        TRACE_2("wakeUp event",_unit,_stable);
        [QGVAR(sLog), ["wakeUp event", format ["%1 [Unit:%2] [Stable: %3]", profileName, _unit, _stable]]] call CBA_fnc_serverEvent;
        [{
            params ["_unit"];
            private _targetState = [_unit, ACEGVAR(medical,STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState;
            private _isUncon = _unit getVariable ["ACE_isUnconscious", -1];
            private _anim = animationState _unit;
            private _weap = currentWeapon _unit;
            private _inputD = missionNamespace getVariable ["ace_common_disableInputPFH", nil];
            if (isNil "_inputD") then {_inputD = "nil"};
            TRACE_6("wakeUp check",_unit,_targetState,_isUncon,_anim,_weap,_inputD);
            [QGVAR(sLog), ["wakeUp check", format ["%1 [State:%2] [isUncon:%3] [Anim:%4] [Weap: %5] [InputD: %6]", profileName, _targetState, _isUncon, _anim, _weap, _inputD]]] call CBA_fnc_serverEvent;
        }, [_unit], 5] call CBA_fnc_waitAndExecute;
    };
}] call CBA_fnc_addEventHandler;
["ace_unconscious", {
    params ["_unit", "_active"];
    if (_unit == ACE_player) then {
        TRACE_2("uncon event",_unit,_active);
        [QGVAR(sLog), ["uncon event", format ["%1 [Unit:%2] [Active:%3]", profileName, _unit, _active]]] call CBA_fnc_serverEvent;
    };
}] call CBA_fnc_addEventHandler;

I have tried but cannot reproduce this in small scale tests.

@PabstMirror
Copy link
Contributor Author

Another reproduction with new logging

// Guy goes through normal knockout and wakeup
19:18:04 LOG: A [Default][stable true][isUncon false][anim amovpercmrunsraswrfldr][input -1][WakUpC -1][TimeU 0.797974]
19:18:44 uncon event: A [Unit:UNIT_BLU_A2_AAR] [Active:true]
19:19:14 uncon event: A [Unit:UNIT_BLU_A2_AAR] [Active:false]
19:19:14 wakeUp event: A [Unit:UNIT_BLU_A2_AAR] [Stable: true]
19:21:04 LOG: A [Injured][stable true][isUncon false][anim amovpknlmstpsoptwbindnon][input -1][WakUpC -1][TimeU 0.637939]

// Goes uncon again but transitions from Unconscious->Injured without a wakeUp event and leaves him with bugged anim/input bloker
19:24:17 uncon event: A [Unit:UNIT_BLU_A2_AAR] [Active:true]
19:25:04 LOG: A [Unconscious][stable false][isUncon true][anim unconscious][input 45][WakUpC 0.0119629][TimeU 0.890015]
19:27:44 LOG: A [Injured][stable false][isUncon true][anim unconscious][input 45][WakUpC 68.026][TimeU 0.842041]

Somehow it's going Unconscious->Injured without getting a wakeUp event (or the event is lost??)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant