diff --git a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf index e5be23449f2..35f736b00f7 100644 --- a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf +++ b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf @@ -120,7 +120,7 @@ private _actions = [ // Dummy statement so it's not collapsed when there's no available actions true }, - {[ACE_player, _target, ["isNotInside","isNotDragging", "isNotCarrying", "isNotSwimming", "notOnMap", "isNotEscorting", "isNotSurrendering", "isNotHandcuffed", "isNotSitting", "isNotOnLadder", "isNotRefueling"]] call EFUNC(common,canInteractWith)}, + {[ACE_player, _target, ["isNotInside","isNotDragging", "isNotCarrying", "isNotSwimming", "notOnMap", "isNotEscorting", "isNotSurrendering", "isNotHandcuffed", "isNotSitting", "isNotOnLadder", "isNotRefueling", "isNotDazed"]] call EFUNC(common,canInteractWith)}, {}, {}, "Spine3", diff --git a/addons/interact_menu/functions/fnc_keyDown.sqf b/addons/interact_menu/functions/fnc_keyDown.sqf index 1ed969b04a7..925688ff4f7 100644 --- a/addons/interact_menu/functions/fnc_keyDown.sqf +++ b/addons/interact_menu/functions/fnc_keyDown.sqf @@ -36,7 +36,7 @@ if (_isTextEditing) then { if ( _isTextEditing || {(isNull curatorCamera) && { - !([ACE_player, objNull, ["isNotInside","isNotDragging", "isNotCarrying", "isNotSwimming", "notOnMap", "isNotEscorting", "isNotSurrendering", "isNotHandcuffed", "isNotSitting", "isNotOnLadder", "isNotRefueling"]] call EFUNC(common,canInteractWith)) + !([ACE_player, objNull, ["isNotInside","isNotDragging", "isNotCarrying", "isNotSwimming", "notOnMap", "isNotEscorting", "isNotSurrendering", "isNotHandcuffed", "isNotSitting", "isNotOnLadder", "isNotRefueling", "isNotDazed"]] call EFUNC(common,canInteractWith)) } }) exitWith {false}; diff --git a/addons/medical/functions/fnc_serializeState.sqf b/addons/medical/functions/fnc_serializeState.sqf index b12cf781cd3..6351e0415df 100644 --- a/addons/medical/functions/fnc_serializeState.sqf +++ b/addons/medical/functions/fnc_serializeState.sqf @@ -58,6 +58,8 @@ _state setVariable [VAR_MEDICATIONS, _medications]; // Medical statemachine state private _currentState = [_unit, GVAR(STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState; +// simplify dazed back to unconscious +if (_currentState == "Dazed") then { _currentState = "Unconscious"; }; _state setVariable [QGVAR(statemachineState), _currentState]; // Serialize & return diff --git a/addons/medical/initSettings.inc.sqf b/addons/medical/initSettings.inc.sqf index adc53c2ea83..1f598d3860f 100644 --- a/addons/medical/initSettings.inc.sqf +++ b/addons/medical/initSettings.inc.sqf @@ -46,3 +46,12 @@ [1, 30, 1.5, 1], true ] call CBA_fnc_addSetting; + +[ + QGVAR(dazedChance), + "SLIDER", + [LSTRING(dazedChance_DisplayName), LSTRING(dazedChance_Description)], + LSTRING(Category), + [0, 1, 0, 2, true], + true +] call CBA_fnc_addSetting; diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index 4f40b153636..0f64da54d90 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -413,6 +413,12 @@ Kapalı Gözkapağı Закрити кришку + + The probability that a person with stable vitals will enter a dazed state from unconscious (checked every 10 seconds). + + + Dazed Chance + Open lid Otevřít víko diff --git a/addons/medical_engine/CfgMoves.hpp b/addons/medical_engine/CfgMoves.hpp index 34f05724798..08cabf59853 100644 --- a/addons/medical_engine/CfgMoves.hpp +++ b/addons/medical_engine/CfgMoves.hpp @@ -1,4 +1,128 @@ -class CfgMovesBasic; +class CfgMovesBasic { + class Actions { + class CivilProneActions; + class ACE_Dazed: CivilProneActions { + stop = QGVAR(dazed_AmovPpneMstpSnonWnonDnon); + StopRelaxed = QGVAR(dazed_AmovPpneMstpSnonWnonDnon); + default = QGVAR(dazed_AmovPpneMstpSnonWnonDnon); + + WalkF = QGVAR(dazed_AmovPpneMrunSnonWnonDf); + LimpF = QGVAR(dazed_AmovPpneMrunSnonWnonDf); + PlayerWalkF = QGVAR(dazed_AmovPpneMrunSnonWnonDf); + SlowF = QGVAR(dazed_AmovPpneMrunSnonWnonDf); + PlayerSlowF = QGVAR(dazed_AmovPpneMrunSnonWnonDf); + TactF = QGVAR(dazed_AmovPpneMrunSnonWnonDf); + PlayerTactF = QGVAR(dazed_AmovPpneMrunSnonWnonDf); + + turnL = QGVAR(dazed_AmovPpneMstpSnonWnonDnon_turnL); + turnLRelaxed = QGVAR(dazed_AmovPpneMstpSnonWnonDnon_turnL); + + turnR = QGVAR(dazed_AmovPpneMstpSnonWnonDnon_turnR); + turnRRelaxed = QGVAR(dazed_AmovPpneMstpSnonWnonDnon_turnR); + PutDown = ""; + getOver = ""; + throwPrepare = ""; + throwGrenade = ""; + LimpLF = ""; + LimpRF = ""; + LimpL = ""; + LimpR = ""; + LimpB = ""; + LimpLB = ""; + LimpRB = ""; + reloadMagazine = ""; + reloadMGun = ""; + reloadMortar = ""; + WalkLF = ""; + WalkRF = ""; + WalkL = ""; + WalkR = ""; + WalkLB = ""; + WalkRB = ""; + WalkB = ""; + PlayerWalkLF = ""; + PlayerWalkRF = ""; + PlayerWalkL = ""; + PlayerWalkR = ""; + PlayerWalkLB = ""; + PlayerWalkRB = ""; + PlayerWalkB = ""; + SlowLF = ""; + SlowRF = ""; + SlowL = ""; + SlowR = ""; + SlowLB = ""; + SlowRB = ""; + SlowB = ""; + PlayerSlowLF = ""; + PlayerSlowRF = ""; + PlayerSlowL = ""; + PlayerSlowR = ""; + PlayerSlowLB = ""; + PlayerSlowRB = ""; + PlayerSlowB = ""; + FastF = ""; + FastLF = ""; + FastRF = ""; + FastL = ""; + FastR = ""; + FastLB = ""; + FastRB = ""; + FastB = ""; + TactLF = ""; + TactRF = ""; + TactL = ""; + TactR = ""; + TactLB = ""; + TactRB = ""; + TactB = ""; + PlayerTactLF = ""; + PlayerTactRF = ""; + PlayerTactL = ""; + PlayerTactR = ""; + PlayerTactLB = ""; + PlayerTactRB = ""; + PlayerTactB = ""; + EvasiveLeft = ""; + EvasiveRight = ""; + down = ""; + weaponOn = ""; + weaponOff = ""; + binocOff = ""; + handGunOn = ""; + takeFlag = ""; + treated = ""; + Lying = ""; + Crouch = ""; + CanNotMove = ""; + FireNotPossible = ""; + strokeGun = ""; + PlayerStand = ""; + Relax = ""; + PrimaryWeapon = ""; + SecondaryWeapon = ""; + Binoculars = ""; + Up = ""; + PlayerCrouch = ""; + PlayerProne = ""; + Combat = ""; + Stand = ""; + Civil = ""; + CivilLying = ""; + GetInLow = ""; + GetInMedium = ""; + GetInHigh = ""; + GetInSDV = ""; + Surrender = ""; + saluteOff = ""; + grabDrag = ""; + dooraction = ""; + agonyStop = ""; + gear = ""; + }; + }; +}; + class CfgMovesMaleSdr: CfgMovesBasic { class States { // fixes hand being stuck at rifle which is on the back @@ -93,7 +217,10 @@ class CfgMovesMaleSdr: CfgMovesBasic { class UNCON_ANIM(faceUp): Unconscious {}; - class AmovPpneMstpSnonWnonDnon; + class AmovPercMstpSnonWnonDnon; + class AmovPpneMstpSnonWnonDnon: AmovPercMstpSnonWnonDnon { + ConnectTo[] += {QGVAR(dazed_AmovPpneMstpSnonWnonDnon),0.1}; + }; class ACE_UnconsciousOutProne: AmovPpneMstpSnonWnonDnon { //file = "\A3\anims_f\Data\Anim\Sdr\dth\pne\stp\ras\Rfl\AdthPpneMstpSrasWrflDnon_1"; looped = 0; @@ -108,5 +235,43 @@ class CfgMovesMaleSdr: CfgMovesBasic { ConnectTo[] = {"AmovPpneMstpSnonWnonDnon",0.2}; speed = 100; }; + + class GVAR(dazed_AmovPpneMstpSnonWnonDnon): AmovPpneMstpSnonWnonDnon { + actions = "ACE_Dazed"; + speed = 0.5; + ConnectTo[] = {QGVAR(dazed_AmovPpneMstpSnonWnonDnon),0.1}; + InterpolateTo[] = { + QGVAR(dazed_AmovPpneMrunSnonWnonDf),0.02, + QGVAR(dazed_AmovPpneMstpSnonWnonDnon_turnL),0.02, + QGVAR(dazed_AmovPpneMstpSnonWnonDnon_turnR),0.02, + "Unconscious",0.02 + }; + variantsPlayer[] = {}; + disableWeapons = 1; + }; + class AmovPpneMrunSnonWnonDf; + class GVAR(dazed_AmovPpneMrunSnonWnonDf): AmovPpneMrunSnonWnonDf { + actions = "ACE_Dazed"; + speed = 0.5; + InterpolateTo[] = {QGVAR(dazed_AmovPpneMstpSnonWnonDnon),0.02, "Unconscious",0.02}; + variantsPlayer[] = {}; + disableWeapons = 1; + }; + class AmovPpneMstpSnonWnonDnon_turnL; + class GVAR(dazed_AmovPpneMstpSnonWnonDnon_turnL): AmovPpneMstpSnonWnonDnon_turnL { + actions = "ACE_Dazed"; + speed = 0.5; + InterpolateTo[] = {QGVAR(dazed_AmovPpneMstpSnonWnonDnon),0.02, "Unconscious",0.02}; + variantsPlayer[] = {}; + disableWeapons = 1; + }; + class AmovPpneMstpSnonWnonDnon_turnR; + class GVAR(dazed_AmovPpneMstpSnonWnonDnon_turnR): AmovPpneMstpSnonWnonDnon_turnR { + actions = "ACE_Dazed"; + speed = 0.5; + InterpolateTo[] = {QGVAR(dazed_AmovPpneMstpSnonWnonDnon),0.02, "Unconscious",0.02}; + variantsPlayer[] = {}; + disableWeapons = 1; + }; }; }; diff --git a/addons/medical_engine/script_macros_medical.hpp b/addons/medical_engine/script_macros_medical.hpp index 1f7c2aee6bd..d4becd42063 100644 --- a/addons/medical_engine/script_macros_medical.hpp +++ b/addons/medical_engine/script_macros_medical.hpp @@ -173,6 +173,7 @@ #define VAR_PAIN_SUPP QEGVAR(medical,painSuppress) #define VAR_PERIPH_RES QEGVAR(medical,peripheralResistance) #define VAR_UNCON "ACE_isUnconscious" +#define VAR_DAZED "ACE_isDazed" #define VAR_OPEN_WOUNDS QEGVAR(medical,openWounds) #define VAR_BANDAGED_WOUNDS QEGVAR(medical,bandagedWounds) #define VAR_STITCHED_WOUNDS QEGVAR(medical,stitchedWounds) @@ -202,6 +203,7 @@ #define IS_BLEEDING(unit) (GET_WOUND_BLEEDING(unit) > 0) #define IS_IN_PAIN(unit) (unit getVariable [VAR_IN_PAIN, false]) #define IS_UNCONSCIOUS(unit) (unit getVariable [VAR_UNCON, false]) +#define IS_DAZED(unit) (unit getVariable [VAR_DAZED, false]) #define GET_OPEN_WOUNDS(unit) (unit getVariable [VAR_OPEN_WOUNDS, createHashMap]) #define GET_BANDAGED_WOUNDS(unit) (unit getVariable [VAR_BANDAGED_WOUNDS, createHashMap]) #define GET_STITCHED_WOUNDS(unit) (unit getVariable [VAR_STITCHED_WOUNDS, createHashMap]) diff --git a/addons/medical_feedback/XEH_PREP.hpp b/addons/medical_feedback/XEH_PREP.hpp index 85dcd64d430..9d9f132a550 100644 --- a/addons/medical_feedback/XEH_PREP.hpp +++ b/addons/medical_feedback/XEH_PREP.hpp @@ -1,6 +1,7 @@ PREP(effectBleeding); PREP(effectBloodVolume); PREP(effectBloodVolumeIcon); +PREP(effectDazed); PREP(effectHeartBeat); PREP(effectIncapacitated); PREP(effectPain); diff --git a/addons/medical_feedback/XEH_postInit.sqf b/addons/medical_feedback/XEH_postInit.sqf index 731fd1f8859..46307526e7b 100644 --- a/addons/medical_feedback/XEH_postInit.sqf +++ b/addons/medical_feedback/XEH_postInit.sqf @@ -54,6 +54,15 @@ GVAR(bloodTickCounter) = 0; ["unconscious", _unconscious] call EFUNC(common,setDisableUserInputStatus); }] call CBA_fnc_addEventHandler; +["ace_medical_dazed", { + params ["_unit", "_dazed"]; + + if (_unit != ACE_player) exitWith {}; + TRACE_1("player dazed eh",_dazed); + + [true] call FUNC(handleEffects); +}] call CBA_fnc_addEventHandler; + // Reset volume upon death for spectators [QEGVAR(medical,death), { params ["_unit"]; diff --git a/addons/medical_feedback/functions/fnc_effectDazed.sqf b/addons/medical_feedback/functions/fnc_effectDazed.sqf new file mode 100644 index 00000000000..0c05537e379 --- /dev/null +++ b/addons/medical_feedback/functions/fnc_effectDazed.sqf @@ -0,0 +1,20 @@ +#include "..\script_component.hpp" +/* + * Author: PabstMirror + * Triggers the dazed effect. + * + * Arguments: + * 0: Enable + * + * Return Value: + * None + * + * Example: + * [true] call ace_medical_feedback_fnc_effectDazed + * + * Public: No + */ + +params ["_enable"]; + +GVAR(ppDazedDOF) ppEffectEnable _enable; diff --git a/addons/medical_feedback/functions/fnc_handleEffects.sqf b/addons/medical_feedback/functions/fnc_handleEffects.sqf index 67e3583b1a5..36be936c67e 100644 --- a/addons/medical_feedback/functions/fnc_handleEffects.sqf +++ b/addons/medical_feedback/functions/fnc_handleEffects.sqf @@ -31,6 +31,7 @@ BEGIN_COUNTER(handleEffects); private _bleedingStrength = GET_BLOOD_LOSS(ACE_player); private _bloodVolume = GET_BLOOD_VOLUME(ACE_player); private _unconscious = IS_UNCONSCIOUS(ACE_player); +private _dazed = IS_DAZED(ACE_player); private _heartRate = GET_HEART_RATE(ACE_player); private _pain = GET_PAIN_PERCEIVED(ACE_player); @@ -42,6 +43,7 @@ if ((!GVAR(heartBeatEffectRunning)) && {_heartRate != 0} && {(_heartRate > 160) // - Visual effects ----------------------------------------------------------- [_unconscious, 2] call FUNC(effectUnconscious); +[_dazed] call FUNC(effectDazed); [ true, linearConversion [BLOOD_VOLUME_CLASS_2_HEMORRHAGE, BLOOD_VOLUME_CLASS_4_HEMORRHAGE, _bloodVolume, 0, 1, true] diff --git a/addons/medical_feedback/functions/fnc_initEffects.sqf b/addons/medical_feedback/functions/fnc_initEffects.sqf index ccaaffa9768..22f24cec6de 100644 --- a/addons/medical_feedback/functions/fnc_initEffects.sqf +++ b/addons/medical_feedback/functions/fnc_initEffects.sqf @@ -111,6 +111,13 @@ GVAR(ppUnconsciousBlackout) = [ [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] ] call _fnc_createEffect; +// - Dazed -------------------------------------------------------------- +GVAR(ppDazedDOF) = [ + "DepthOfField", + 817, // weird if over ~2000 + [8, 5, 8] +] call _fnc_createEffect; + // - Incapacitation ----------------------------------------------------------- GVAR(ppIncapacitationGlare) = [ "ColorCorrections", diff --git a/addons/medical_statemachine/Statemachine.hpp b/addons/medical_statemachine/Statemachine.hpp index d3888140c09..782c20c48ee 100644 --- a/addons/medical_statemachine/Statemachine.hpp +++ b/addons/medical_statemachine/Statemachine.hpp @@ -62,6 +62,41 @@ class ACE_Medical_StateMachine { targetState = "FatalInjury"; events[] = {QEGVAR(medical,FatalInjury)}; }; + class DazedStart { + targetState = "Dazed"; + condition = QUOTE([ARR_2(_this,true)]call FUNC(conditionDazedShift)); + onTransition = QUOTE([ARR_2(_this,false)] call EFUNC(medical_status,setUnconsciousState)); + }; + }; + class Dazed { + onState = QUOTE(call FUNC(handleStateDazed)); + onStateEntered = QUOTE(call FUNC(enteredStateDazed)); + onStateLeaving = QUOTE(call FUNC(leftStateDazed)); + class FullHeal { + targetState = "Default"; + events[] = {QEGVAR(medical,FullHeal)}; + }; + class WakeUp { + targetState = "Injured"; + condition = QEFUNC(medical_status,hasStableVitals); + events[] = {QEGVAR(medical,WakeUp)}; + }; + class DazedStop { + targetState = "Unconscious"; + condition = QUOTE([ARR_2(_this,false)]call FUNC(conditionDazedShift)); + }; + class CriticalInjuryOrVitals { + targetState = "Unconscious"; + events[] = {QEGVAR(medical,CriticalInjury), QEGVAR(medical,CriticalVitals), QEGVAR(medical,knockOut)}; + }; + class FatalTransitions { + targetState = "CardiacArrest"; + events[] = {QEGVAR(medical,FatalVitals), QEGVAR(medical,Bleedout)}; + }; + class FatalInjury { + targetState = "FatalInjury"; + events[] = {QEGVAR(medical,FatalInjury)}; + }; }; class FatalInjury { // Transition state for handling instant death from fatal injuries diff --git a/addons/medical_statemachine/XEH_PREP.hpp b/addons/medical_statemachine/XEH_PREP.hpp index df481ae6345..af852674a2b 100644 --- a/addons/medical_statemachine/XEH_PREP.hpp +++ b/addons/medical_statemachine/XEH_PREP.hpp @@ -1,15 +1,19 @@ PREP(conditionCardiacArrestTimer); +PREP(conditionDazedShift); PREP(conditionExecutionDeath); PREP(conditionSecondChance); PREP(enteredStateCardiacArrest); +PREP(enteredStateDazed); PREP(enteredStateDeath); PREP(enteredStateFatalInjury); PREP(enteredStateUnconscious); PREP(handleStateCardiacArrest); +PREP(handleStateDazed); PREP(handleStateDefault); PREP(handleStateInjured); PREP(handleStateUnconscious); PREP(leftStateCardiacArrest); +PREP(leftStateDazed); PREP(localityChangedEH); PREP(resetStateDefault); PREP(transitionSecondChance); diff --git a/addons/medical_statemachine/functions/fnc_conditionDazedShift.sqf b/addons/medical_statemachine/functions/fnc_conditionDazedShift.sqf new file mode 100644 index 00000000000..889a0f209b9 --- /dev/null +++ b/addons/medical_statemachine/functions/fnc_conditionDazedShift.sqf @@ -0,0 +1,36 @@ +#include "..\script_component.hpp" +/* + * Author: PabstMirror + * Condition for switching between "Dazed" and "Unconscious" states (both directions) + * + * Arguments: + * 0: Unit + * 1: Become Dazed (true: uncon->dazed, false: dazed->uncon) + * + * Returns: + * + * + * Example: + * [player, true] call ace_medical_statemachine_fnc_conditionDazedShift + * + * Public: No + */ + +params ["_unit", "_becomeDazed"]; + +if (!(_unit call EFUNC(medical_status,canBecomeDazed))) exitWith { + !_becomeDazed +}; + +if (_unit isNil QEGVAR(medical,lastDazedCheck)) then { + _unit setVariable [QEGVAR(medical,lastDazedCheck), CBA_missionTime]; +}; +private _timeCheck = CBA_missionTime - (_unit getVariable QEGVAR(medical,lastDazedCheck)); +if (_timeCheck < 10) exitWith { false }; +_unit setVariable [QEGVAR(medical,lastDazedCheck), CBA_missionTime]; + +if (_becomeDazed) then { + random 1 < EGVAR(medical,dazedChance) +} else { + random 1 >= EGVAR(medical,dazedChance) +} diff --git a/addons/medical_statemachine/functions/fnc_enteredStateDazed.sqf b/addons/medical_statemachine/functions/fnc_enteredStateDazed.sqf new file mode 100644 index 00000000000..63a01290730 --- /dev/null +++ b/addons/medical_statemachine/functions/fnc_enteredStateDazed.sqf @@ -0,0 +1,21 @@ +#include "..\script_component.hpp" +/* + * Author: PabstMirror + * Called when a unit enters the "Dazed" state in the medical statemachine. + * + * Arguments: + * 0: Unit + * + * Returns: + * None + * + * Example: + * [player] call ace_medical_statemachine_fnc_enteredStateDazed + * + * Public: No + */ + +params ["_unit"]; +TRACE_1("enteredStateDazed",_unit); + +[_unit, true] call EFUNC(medical_status,setDazedState); diff --git a/addons/medical_statemachine/functions/fnc_enteredStateUnconscious.sqf b/addons/medical_statemachine/functions/fnc_enteredStateUnconscious.sqf index c80481bad23..17ae99214cc 100644 --- a/addons/medical_statemachine/functions/fnc_enteredStateUnconscious.sqf +++ b/addons/medical_statemachine/functions/fnc_enteredStateUnconscious.sqf @@ -24,3 +24,5 @@ if (isNull _unit || {!isNil {_unit getVariable QEGVAR(medical,causeOfDeath)}}) e TRACE_4("enteredStateUnconscious",_this,_thisOrigin,_thisTransition,CBA_missionTime); [_unit, true] call EFUNC(medical_status,setUnconsciousState); + +_unit setVariable [QEGVAR(medical,lastDazedCheck), nil]; diff --git a/addons/medical_statemachine/functions/fnc_handleStateDazed.sqf b/addons/medical_statemachine/functions/fnc_handleStateDazed.sqf new file mode 100644 index 00000000000..d3a3e31240c --- /dev/null +++ b/addons/medical_statemachine/functions/fnc_handleStateDazed.sqf @@ -0,0 +1,19 @@ +#include "..\script_component.hpp" +/* + * Author: PabstMirror + * Handles logic for units in the "Dazed" state in the medical statemachine. + * + * Arguments: + * 0: Unit + * + * Returns: + * None + * + * Example: + * [player] call ace_medical_statemachine_fnc_handleStateDazed + * + * Public: No + */ + +// possible to Spontaneous wake up +call FUNC(handleStateUnconscious); diff --git a/addons/medical_statemachine/functions/fnc_leftStateDazed.sqf b/addons/medical_statemachine/functions/fnc_leftStateDazed.sqf new file mode 100644 index 00000000000..72c39861e5b --- /dev/null +++ b/addons/medical_statemachine/functions/fnc_leftStateDazed.sqf @@ -0,0 +1,21 @@ +#include "..\script_component.hpp" +/* + * Author: PabstMirror + * Handles a unit leaving dazed + * + * Arguments: + * 0: The Unit + * + * Return Value: + * None + * + * Example: + * [player] call ace_medical_statemachine_fnc_leftStateDazed + * + * Public: No + */ + +params ["_unit"]; +TRACE_1("leftStateDazed",_unit); + +[_unit, false] call EFUNC(medical_status,setDazedState); diff --git a/addons/medical_statemachine/functions/fnc_localityChangedEH.sqf b/addons/medical_statemachine/functions/fnc_localityChangedEH.sqf index 6f6ee43c6fa..62caf43bc19 100644 --- a/addons/medical_statemachine/functions/fnc_localityChangedEH.sqf +++ b/addons/medical_statemachine/functions/fnc_localityChangedEH.sqf @@ -40,6 +40,12 @@ if (_isLocal) then { TRACE_1("manually changing state to Unconscious",_currentState); [_unit, EGVAR(medical,STATE_MACHINE), _currentState, "Unconscious", {}, "LocalityChange"] call CBA_statemachine_fnc_manualTransition; }; + case (IS_DAZED(_unit)): { + // Simplify and just go straight to unconscious (this is for locality change, so it should not be a real player) + _unit setVariable [VAR_DAZED, nil, true]; + TRACE_1("manually changing state to Unconscious",_currentState); + [_unit, EGVAR(medical,STATE_MACHINE), _currentState, "Unconscious", {}, "LocalityChange"] call CBA_statemachine_fnc_manualTransition; + }; case (IS_BLEEDING(_unit) || {IS_IN_PAIN(_unit)}): { if (_currentState == "Injured") exitWith {}; TRACE_1("manually changing state to Injured",_currentState); diff --git a/addons/medical_status/XEH_PREP.hpp b/addons/medical_status/XEH_PREP.hpp index 37e5bf644ad..2c3509669bc 100644 --- a/addons/medical_status/XEH_PREP.hpp +++ b/addons/medical_status/XEH_PREP.hpp @@ -1,6 +1,7 @@ PREP(addInventoryActions); PREP(addMedicationAdjustment); PREP(adjustPainLevel); +PREP(canBecomeDazed); PREP(getAllMedicationCount); PREP(getBloodLoss); PREP(getBloodPressure); @@ -12,6 +13,7 @@ PREP(hasStableVitals); PREP(initUnit); PREP(isInStableCondition); PREP(setCardiacArrestState); +PREP(setDazedState); PREP(setDead); PREP(setStatusEffects); PREP(setUnconsciousState); diff --git a/addons/medical_status/XEH_postInit.sqf b/addons/medical_status/XEH_postInit.sqf index 1865fe1d7fc..d214c762086 100644 --- a/addons/medical_status/XEH_postInit.sqf +++ b/addons/medical_status/XEH_postInit.sqf @@ -36,3 +36,5 @@ [_unit, false, true] call FUNC(setStatusEffects); }; }] call CBA_fnc_addPlayerEventHandler; + +["isNotDazed", {!IS_DAZED(_this select 0)}] call EFUNC(common,addCanInteractWithCondition); diff --git a/addons/medical_status/functions/fnc_canBecomeDazed.sqf b/addons/medical_status/functions/fnc_canBecomeDazed.sqf new file mode 100644 index 00000000000..1979c0ea520 --- /dev/null +++ b/addons/medical_status/functions/fnc_canBecomeDazed.sqf @@ -0,0 +1,40 @@ +#include "..\script_component.hpp" +/* + * Author: PabstMirror + * Condition for being dazed + * + * Arguments: + * 0: Unit + * + * Returns: + * + * + * Example: + * [player] call ace_medical_status_fnc_canBecomeDazed + * + * Public: No + */ + +if (EGVAR(medical,dazedChance) == 0) exitWith { false }; + +params ["_unit"]; + +// only for players +if (_unit != ACE_player) exitWith { false }; +// skip if in a vic or odd animation +if (!isNull objectParent _unit) exitWith { false }; +if (!isTouchingGround _unit) exitWith { false }; +if (surfaceIsWater position _unit) exitWith { false }; + +// less restrictive than hasStableVitals +if (GET_BLOOD_VOLUME(_unit) < BLOOD_VOLUME_CLASS_3_HEMORRHAGE) exitWith { false }; +if IN_CRDC_ARRST(_unit) exitWith { false }; + +private _bloodPressure = GET_BLOOD_PRESSURE(_unit); +_bloodPressure params ["_bloodPressureL", "_bloodPressureH"]; +if (_bloodPressureL < 50 || {_bloodPressureH < 60}) exitWith { false }; + +private _heartRate = GET_HEART_RATE(_unit); +if (_heartRate < 40) exitWith { false }; + +true diff --git a/addons/medical_status/functions/fnc_initUnit.sqf b/addons/medical_status/functions/fnc_initUnit.sqf index f1e5c1a4df3..33228d45567 100644 --- a/addons/medical_status/functions/fnc_initUnit.sqf +++ b/addons/medical_status/functions/fnc_initUnit.sqf @@ -56,6 +56,7 @@ if (_isRespawn) then { // - Misc --------------------------------------------------------------------- _unit setVariable [VAR_UNCON, false, true]; + _unit setVariable [VAR_DAZED, false, true]; // - Treatments --------------------------------------------------------------- _unit setVariable [VAR_TOURNIQUET, DEFAULT_TOURNIQUET_VALUES, true]; diff --git a/addons/medical_status/functions/fnc_setDazedState.sqf b/addons/medical_status/functions/fnc_setDazedState.sqf new file mode 100644 index 00000000000..0225b84daf7 --- /dev/null +++ b/addons/medical_status/functions/fnc_setDazedState.sqf @@ -0,0 +1,61 @@ +#include "..\script_component.hpp" +/* + * Author: PabstMirror + * Sets a unit in the dazed state. + * For Internal Use: Called from the state machine. + * + * Arguments: + * 0: The unit that will be put in an dazed state + * 1: Set dazed + * + * Return Value: + * None + * + * Example: + * [player, true] call ace_medical_status_fnc_setDazedState + * + * Public: No + */ + +params ["_unit", "_active"]; +TRACE_2("setDazedState",_unit,_active); + +// No change to make +if (_active isEqualTo IS_DAZED(_unit) || {!alive _unit}) exitWith { WARNING_2("no change %1-%2",_active,IS_DAZED(_unit)); }; + +_unit setVariable [VAR_DAZED, _active, true]; + + // Dazed state only relevant to actual players +if (_unit != ACE_player) exitWith { WARNING_1("%1 not player",_unit); }; + +if (_active) then { + // set dazed anim + [_unit, QEGVAR(medical_engine,dazed_AmovPpneMstpSnonWnonDnon), 1] call EFUNC(common,doAnimation); + + // prevent players from throwing grenades (does not work) + // [_unit, "Throw", {true}, {systemChat "block";}] call EFUNC(common,addActionEventhandler); + + [{ + params ["_args", "_pfid"]; + _args params ["_unit"]; + + if ((ACE_player != _unit) || {!alive _unit} || {!IS_DAZED(_unit)}) exitWith { + _pfid call CBA_fnc_removePerFrameHandler; + }; + + if (visibleMap) then { openMap false }; + while {dialog} do { closeDialog 0; }; + if (currentWeapon _unit != "") then { + _unit action ["SwitchWeapon", _unit, _unit, -1]; + }; + if (stance _unit != "PRONE") then { + WARNING_1("%1 fixing stance",animationState _unit); + [_unit, QEGVAR(medical_engine,dazed_AmovPpneMstpSnonWnonDnon), 1] call EFUNC(common,doAnimation); + }; + }, 0, [_unit]] call CBA_fnc_addPerFrameHandler; +} else { + // Set anim back to normal + [_unit, false] call EFUNC(medical_engine,setUnconsciousAnim); +}; + +["ace_medical_dazed", [_unit, _active]] call CBA_fnc_localEvent; diff --git a/addons/medical_status/functions/fnc_setDead.sqf b/addons/medical_status/functions/fnc_setDead.sqf index 138948c0386..2f5548d0416 100644 --- a/addons/medical_status/functions/fnc_setDead.sqf +++ b/addons/medical_status/functions/fnc_setDead.sqf @@ -24,6 +24,7 @@ _unit setVariable [VAR_BLOOD_PRESS, [0, 0], true]; // Clear uncon variable just to be safe _unit setVariable [VAR_UNCON, nil, true]; +_unit setVariable [VAR_DAZED, nil, true]; _unit setVariable [QEGVAR(medical,causeOfDeath), _reason, true]; diff --git a/addons/medical_treatment/functions/fnc_checkResponse.sqf b/addons/medical_treatment/functions/fnc_checkResponse.sqf index ca95fcb1d16..1c1c5062a6e 100644 --- a/addons/medical_treatment/functions/fnc_checkResponse.sqf +++ b/addons/medical_treatment/functions/fnc_checkResponse.sqf @@ -22,6 +22,7 @@ params ["_medic", "_patient"]; private _output = if (_patient call EFUNC(common,isAwake)) then { LSTRING(Check_Response_Responsive) } else { + if (IS_DAZED(_patient)) exitWith { LSTRING(Check_Response_Dazed) }; if (GVAR(advancedDiagnose) == 3) exitWith { if (IN_CRDC_ARRST(_patient)) exitWith { LSTRING(Check_Response_CardiacArrestDirect) }; if (!alive _patient) exitWith { LSTRING(Check_Response_DeadDirect) }; diff --git a/addons/medical_treatment/stringtable.xml b/addons/medical_treatment/stringtable.xml index 22d02a1ad0e..a314810caa0 100644 --- a/addons/medical_treatment/stringtable.xml +++ b/addons/medical_treatment/stringtable.xml @@ -2527,6 +2527,24 @@ Ellenőrzöd a páciens reagálóképességét Ви перевіряєте реакцію пораненого + + %1 is dazed + %1 je omámený + %1 est étourdi. + %1 está aturdido + %1 è stordito + %1 jest oszołomiony + %1 está atordoado + %1 в замешательстве + %1 ist benommen + %1은(는) 멍한 상태입니다 + %1 はぼんやりしています + %1 处于眩晕状态 + %1 处于眩晕状态 + %1 sersemlemiş durumda + %1 zavarodott + %1 спантеличений + %1 is not responsive, motionless and cold %1 est inconscient, inanimé et froid.