Skip to content

Commit

Permalink
Merge pull request #248 from MissHeda/dev-Tomcat
Browse files Browse the repository at this point in the history
Pervitin, Ketamine, Fentanyl Eventhandler update & Bug fixes
  • Loading branch information
Tomcat-SG authored Feb 5, 2023
2 parents ebdde10 + 84b1187 commit 462057a
Show file tree
Hide file tree
Showing 16 changed files with 386 additions and 211 deletions.
56 changes: 56 additions & 0 deletions addons/breathing/functions/fnc_fullHealLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,59 @@ _unit setDamage 0;
[QACEGVAR(medical,FullHeal), _unit] call CBA_fnc_localEvent;
_state = [_unit, ACEGVAR(medical,STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState;
TRACE_1("after FullHeal",_state);

/// Clear Stamina & weapon sway
if (ACEGVAR(advanced_fatigue,enabled)) then {

["PDF"] call ACEFUNC(advanced_fatigue,removeDutyFactor);
["EDF"] call ACEFUNC(advanced_fatigue,removeDutyFactor);
["LSDF"] call ACEFUNC(advanced_fatigue,removeDutyFactor);
ACEGVAR(advanced_fatigue,swayFactor) = EGVAR(pharma,originalSwayFactor);

} else {

_unit enableStamina true;
_unit setAnimSpeedCoef 1;
_unit setCustomAimCoef 1;

};

/// Clear chroma effect & camera shake

resetCamShake;
["ChromAberration", 200, [ 0, 0, true ]] spawn
{
params["_name", "_priority", "_effect", "_handle"];
while
{
_handle = ppEffectCreate[_name, _priority];
_handle < 0
}
do
{
_priority = _priority + 1;
};
_handle ppEffectEnable true;
_handle ppEffectAdjust _effect;
_handle ppEffectCommit 0;
[
{
params["_handle"];
ppEffectCommitted _handle
},
{
params["_handle"];
_handle ppEffectEnable false;
ppEffectDestroy _handle;
},
[_handle]] call CBA_fnc_waitUntilAndExecute;
};

// Reenable ace fatige animationspeed override

if (!isNil QACEGVAR(advanced_fatigue,setAnimExclusions)) then {
_index = ACEGVAR(advanced_fatigue,setAnimExclusions) find "PervitinOverride";
if (_index != -1) then {
ACEGVAR(advanced_fatigue,setAnimExclusions) deleteAt _index;
};
};
8 changes: 4 additions & 4 deletions addons/breathing/functions/fnc_handleBreathing.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ if (!local _unit) then {
[QGVAR(handleBreathing), [_unit], _unit] call CBA_fnc_targetEvent;
};

if (!(_unit getVariable [QGVAR(lowSpO2ppActive), false]) && hasInterface && ACE_Player == _unit) then {
[QGVAR(lowSpO2pp), [_unit], _unit] call CBA_fnc_targetEvent;
};

[{
params ["_args", "_idPFH"];
_args params ["_unit"];
Expand All @@ -37,6 +33,10 @@ if (!(_unit getVariable [QGVAR(lowSpO2ppActive), false]) && hasInterface && ACE_
[_idPFH] call CBA_fnc_removePerFrameHandler;
};

if (!(_unit getVariable [QGVAR(lowSpO2ppActive), false]) && hasInterface && ACE_Player == _unit) then {
[QGVAR(lowSpO2pp), [_unit], _unit] call CBA_fnc_targetEvent;
};

private _airway = true;
private _breathing = true;

Expand Down
88 changes: 39 additions & 49 deletions addons/breathing/functions/fnc_lowSpO2pp.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,56 +18,46 @@

params ["_target"];

_target setVariable [QGVAR(lowSpO2ppActive), true, true];
_currentSpO2 = _target getVariable [QGVAR(airwayStatus), 100];

[{
if (!(alive _target) || !([_target] call ACEFUNC(common,isAwake)) || _currentSpO2 > GVAR(lowSPO2Level)) exitWith {};

params ["_args", "_idPFH"];
_args params ["_target"];
["ColorCorrections", 1500, [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 1], [0.33, 0.33, 0.33, 0], [0.55, 0.5, 0, 0, 0, 0, 4]]] spawn {

_currentSpO2 = _target getVariable [QGVAR(airwayStatus), 100];
if (!(alive _target) || !([_target] call ACEFUNC(common,isAwake)) || _currentSpO2 > GVAR(lowSPO2Level)) exitWith {
_target setVariable [QGVAR(lowSpO2ppActive), false, true];
[_idPFH] call CBA_fnc_removePerFrameHandler;
params ["_name", "_priority", "_effect", "_handle"];
while {
_handle = ppEffectCreate [_name, _priority];
_handle < 0
} do {
_priority = _priority + 1;
};

["ColorCorrections", 1500, [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 1], [0.33, 0.33, 0.33, 0], [0.55, 0.5, 0, 0, 0, 0, 4]]] spawn
{
params ["_name", "_priority", "_effect", "_handle"];
while {
_handle = ppEffectCreate [_name, _priority];
_handle < 0
} do {
_priority = _priority + 1;
};
_handle ppEffectEnable true;
_handle ppEffectAdjust _effect;
_handle ppEffectCommit 0.7;

[{ params["_handle"];
ppEffectCommitted _handle
},
{ params["_handle"];
_handle ppEffectAdjust [1, 1, 0, [0, 0, 0, 0.9], [0, 0, 0, 1], [0.33, 0.33, 0.33, 0], [0.55, 0.5, 0, 0, 0, 0, 4]];
_handle ppEffectCommit 0.7;

[{ params["_handle"];
ppEffectCommitted _handle
},
{ params["_handle"];
_handle ppEffectAdjust [1, 1, 0, [0, 0, 0, 0.1], [0, 0, 0, 1], [0.33, 0.33, 0.33, 0], [0.55, 0.5, 0, 0, 0, 0, 4]];
_handle ppEffectCommit 1.6;

[{ params["_handle"];
ppEffectCommitted _handle
},
{ params["_handle"];
_handle ppEffectEnable false;
ppEffectDestroy _handle;
}, [_handle]] call CBA_fnc_waitUntilAndExecute;

}, [_handle]] call CBA_fnc_waitUntilAndExecute;

}, [_handle]] call CBA_fnc_waitUntilAndExecute;
};
}, 3, [_target]] call CBA_fnc_addPerFrameHandler;
_handle ppEffectEnable true;
_handle ppEffectAdjust _effect;
_handle ppEffectCommit 0.7;

[{ params["_handle"];
ppEffectCommitted _handle
},
{ params["_handle"];
_handle ppEffectAdjust [1, 1, 0, [0, 0, 0, 0.9], [0, 0, 0, 1], [0.33, 0.33, 0.33, 0], [0.55, 0.5, 0, 0, 0, 0, 4]];
_handle ppEffectCommit 0.7;

[{ params["_handle"];
ppEffectCommitted _handle
},
{ params["_handle"];
_handle ppEffectAdjust [1, 1, 0, [0, 0, 0, 0.1], [0, 0, 0, 1], [0.33, 0.33, 0.33, 0], [0.55, 0.5, 0, 0, 0, 0, 4]];
_handle ppEffectCommit 1.6;

[{ params["_handle"];
ppEffectCommitted _handle
},
{ params["_handle"];
_handle ppEffectEnable false;
ppEffectDestroy _handle;
}, [_handle]] call CBA_fnc_waitUntilAndExecute;

}, [_handle]] call CBA_fnc_waitUntilAndExecute;

}, [_handle]] call CBA_fnc_waitUntilAndExecute;
};
24 changes: 17 additions & 7 deletions addons/misc/functions/fnc_handleRespawn.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -224,20 +224,22 @@ if (EGVAR(pharma,coagulation)) then {
/// Clear Stamina & weapon sway
if (ACEGVAR(advanced_fatigue,enabled)) then {

["PDF"] call ace_advanced_fatigue_fnc_removeDutyFactor;
["EDF"] call ace_advanced_fatigue_fnc_removeDutyFactor;
["PDF"] call ACEFUNC(advanced_fatigue,removeDutyFactor);
["EDF"] call ACEFUNC(advanced_fatigue,removeDutyFactor);
["LSDF"] call ACEFUNC(advanced_fatigue,removeDutyFactor);
ACEGVAR(advanced_fatigue,swayFactor) = EGVAR(pharma,originalSwayFactor);

} else {

_patient enableStamina true;
_patient setAnimSpeedCoef 1;
_patient setCustomAimCoef 1;
_unit enableStamina true;
_unit setAnimSpeedCoef 1;
_unit setCustomAimCoef 1;

};

/// Clear chroma effect
/// Clear chroma effect & camera shake

resetCamShake;
["ChromAberration", 200, [ 0, 0, true ]] spawn
{
params["_name", "_priority", "_effect", "_handle"];
Expand All @@ -253,7 +255,6 @@ if (ACEGVAR(advanced_fatigue,enabled)) then {
_handle ppEffectEnable true;
_handle ppEffectAdjust _effect;
_handle ppEffectCommit 0;
addCamShake[0, 0, 50];
[
{
params["_handle"];
Expand All @@ -265,4 +266,13 @@ if (ACEGVAR(advanced_fatigue,enabled)) then {
ppEffectDestroy _handle;
},
[_handle]] call CBA_fnc_waitUntilAndExecute;
};

// Reenable ace fatige animationspeed override

if (!isNil QACEGVAR(advanced_fatigue,setAnimExclusions)) then {
_index = ACEGVAR(advanced_fatigue,setAnimExclusions) find "PervitinOverride";
if (_index != -1) then {
ACEGVAR(advanced_fatigue,setAnimExclusions) deleteAt _index;
};
};
6 changes: 3 additions & 3 deletions addons/pharma/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
PREP(alphaAction);
PREP(applyIV);
PREP(checkIV);
PREP(fentanylPP);
PREP(fluid);
PREP(fluidLocal);
PREP(getBloodLoss);
Expand All @@ -9,6 +10,8 @@ PREP(hasStableVitals);
PREP(init);
PREP(inspectBreath);
PREP(inspectCatheter);
PREP(ketaminePP);
PREP(pervitinPP);
PREP(removeItemfromMag);
PREP(removeIV);
PREP(retrieveIV);
Expand All @@ -26,13 +29,11 @@ PREP(treatmentAdvanced_DialysisLocal);
PREP(treatmentAdvanced_EACA);
PREP(treatmentAdvanced_EACALocal);
PREP(treatmentAdvanced_Fentanyl);
PREP(treatmentAdvanced_FentanylLocal);
PREP(treatmentAdvanced_Flumazenil);
PREP(treatmentAdvanced_FlumazenilLocal);
PREP(treatmentAdvanced_Flush);
PREP(treatmentAdvanced_FlushLocal);
PREP(treatmentAdvanced_Ketamine);
PREP(treatmentAdvanced_KetamineLocal);
PREP(treatmentAdvanced_Lorazepam);
PREP(treatmentAdvanced_LorazepamLocal);
PREP(treatmentAdvanced_medication);
Expand All @@ -47,4 +48,3 @@ PREP(treatmentAdvanced_ReorientationLocal);
PREP(treatmentAdvanced_TXA);
PREP(treatmentAdvanced_TXALocal);
PREP(vehicleCheckDialysis);

5 changes: 3 additions & 2 deletions addons/pharma/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
[QGVAR(fluidLocal), LINKFUNC(fluidLocal)] call CBA_fnc_addEventHandler;
[QGVAR(flushLocal), LINKFUNC(treatmentAdvanced_FlushLocal)] call CBA_fnc_addEventHandler;
[QGVAR(pervitinLocal), LINKFUNC(treatmentAdvanced_PervitinLocal)] call CBA_fnc_addEventHandler;
[QGVAR(ketamineLocal), LINKFUNC(treatmentAdvanced_KetamineLocal)] call CBA_fnc_addEventHandler;
[QGVAR(fentanylLocal), LINKFUNC(treatmentAdvanced_FentanylLocal)] call CBA_fnc_addEventHandler;
[QGVAR(pervitinPP), LINKFUNC(pervitinPP)] call CBA_fnc_addEventHandler;
[QGVAR(ketaminePP), LINKFUNC(ketaminePP)] call CBA_fnc_addEventHandler;
[QGVAR(fentanylPP), LINKFUNC(fentanylPP)] call CBA_fnc_addEventHandler;
[QGVAR(caffeineLocal), LINKFUNC(treatmentAdvanced_CaffeineLocal)] call CBA_fnc_addEventHandler;


Expand Down
Loading

0 comments on commit 462057a

Please sign in to comment.