Skip to content

Commit 9eb3a2e

Browse files
Chemical/Circulation/Watch - Fix Testing Errors (KAT-Advanced-Medical#665)
**When merged this pull request will:** - Fixes Poison variable error - Fixes Watch timer duplicating - Fixes ApplyABG issue ### IMPORTANT - [Development Guidelines](https://ace3.acemod.org/wiki/development/) are read, understood and applied. - Title of this PR uses our standard template `Component - Add|Fix|Improve|Change|Make|Remove {changes}`.
1 parent b365921 commit 9eb3a2e

11 files changed

Lines changed: 97 additions & 46 deletions

addons/chemical/functions/fnc_poison.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ if (_gasLevel == 0) exitWith {
4545
};
4646

4747
// We assume that oxygen masks only cover the mouth and nose, leaving the eyes exposed to CS gas
48-
if ((_unit getVariable [QEGVAR(breathing,oxygenMaskActive)])) exitWith {
48+
if ((_unit getVariable [QEGVAR(breathing,oxygenMaskActive), false])) exitWith {
4949
TRACE_1("unit has oxygen mask",_unit);
5050
};
5151

addons/circulation/CfgVehicles.hpp

Lines changed: 78 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,15 @@ class CfgVehicles {
235235

236236
class LandVehicle;
237237
class Car: LandVehicle {
238+
class ACE_SelfActions {
239+
class KAT_ArterialTest {
240+
displayName = CSTRING(Arterial_Test_Action);
241+
condition = QUOTE(_target call ACEFUNC(medical_treatment,isMedicalVehicle));
242+
statement = "";
243+
insertChildren = QUOTE([ARR_2(_target,_player)] call FUNC(addArterialTestActions));
244+
icon = QACEPATHTOF(medical_gui,ui\cross.paa);
245+
};
246+
};
238247
class ACE_Actions {
239248
class ACE_MainActions {
240249
class KAT_ArterialTest {
@@ -250,6 +259,15 @@ class CfgVehicles {
250259

251260
class Car_F: Car {};
252261
class Quadbike_01_base_F: Car_F {
262+
class ACE_SelfActions {
263+
class KAT_ArterialTest {
264+
displayName = CSTRING(Arterial_Test_Action);
265+
condition = QUOTE(_target call ACEFUNC(medical_treatment,isMedicalVehicle));
266+
statement = "";
267+
insertChildren = QUOTE([ARR_2(_target,_player)] call FUNC(addArterialTestActions));
268+
icon = QACEPATHTOF(medical_gui,ui\cross.paa);
269+
};
270+
};
253271
class ACE_Actions: ACE_Actions {
254272
class ACE_MainActions: ACE_MainActions {
255273
class KAT_ArterialTest {
@@ -264,6 +282,15 @@ class CfgVehicles {
264282
};
265283

266284
class Kart_01_Base_F: Car_F {
285+
class ACE_SelfActions {
286+
class KAT_ArterialTest {
287+
displayName = CSTRING(Arterial_Test_Action);
288+
condition = QUOTE(_target call ACEFUNC(medical_treatment,isMedicalVehicle));
289+
statement = "";
290+
insertChildren = QUOTE([ARR_2(_target,_player)] call FUNC(addArterialTestActions));
291+
icon = QACEPATHTOF(medical_gui,ui\cross.paa);
292+
};
293+
};
267294
class ACE_Actions: ACE_Actions {
268295
class ACE_MainActions: ACE_MainActions {
269296
class KAT_ArterialTest {
@@ -278,6 +305,15 @@ class CfgVehicles {
278305
};
279306

280307
class Tank: LandVehicle {
308+
class ACE_SelfActions {
309+
class KAT_ArterialTest {
310+
displayName = CSTRING(Arterial_Test_Action);
311+
condition = QUOTE(_target call ACEFUNC(medical_treatment,isMedicalVehicle));
312+
statement = "";
313+
insertChildren = QUOTE([ARR_2(_target,_player)] call FUNC(addArterialTestActions));
314+
icon = QACEPATHTOF(medical_gui,ui\cross.paa);
315+
};
316+
};
281317
class ACE_Actions {
282318
class ACE_MainActions {
283319
class KAT_ArterialTest {
@@ -292,6 +328,15 @@ class CfgVehicles {
292328
};
293329

294330
class Motorcycle: LandVehicle {
331+
class ACE_SelfActions {
332+
class KAT_ArterialTest {
333+
displayName = CSTRING(Arterial_Test_Action);
334+
condition = QUOTE(_target call ACEFUNC(medical_treatment,isMedicalVehicle));
335+
statement = "";
336+
insertChildren = QUOTE([ARR_2(_target,_player)] call FUNC(addArterialTestActions));
337+
icon = QACEPATHTOF(medical_gui,ui\cross.paa);
338+
};
339+
};
295340
class ACE_Actions {
296341
class ACE_MainActions {
297342
class KAT_ArterialTest {
@@ -307,6 +352,15 @@ class CfgVehicles {
307352

308353
class Air;
309354
class Helicopter: Air {
355+
class ACE_SelfActions {
356+
class KAT_ArterialTest {
357+
displayName = CSTRING(Arterial_Test_Action);
358+
condition = QUOTE(_target call ACEFUNC(medical_treatment,isMedicalVehicle));
359+
statement = "";
360+
insertChildren = QUOTE([ARR_2(_target,_player)] call FUNC(addArterialTestActions));
361+
icon = QACEPATHTOF(medical_gui,ui\cross.paa);
362+
};
363+
};
310364
class ACE_Actions {
311365
class ACE_MainActions {
312366
class KAT_ArterialTest {
@@ -321,6 +375,15 @@ class CfgVehicles {
321375
};
322376

323377
class Plane: Air {
378+
class ACE_SelfActions {
379+
class KAT_ArterialTest {
380+
displayName = CSTRING(Arterial_Test_Action);
381+
condition = QUOTE(_target call ACEFUNC(medical_treatment,isMedicalVehicle));
382+
statement = "";
383+
insertChildren = QUOTE([ARR_2(_target,_player)] call FUNC(addArterialTestActions));
384+
icon = QACEPATHTOF(medical_gui,ui\cross.paa);
385+
};
386+
};
324387
class ACE_Actions {
325388
class ACE_MainActions {
326389
class KAT_ArterialTest {
@@ -336,6 +399,15 @@ class CfgVehicles {
336399

337400
class Ship;
338401
class Ship_F: Ship {
402+
class ACE_SelfActions {
403+
class KAT_ArterialTest {
404+
displayName = CSTRING(Arterial_Test_Action);
405+
condition = QUOTE(_target call ACEFUNC(medical_treatment,isMedicalVehicle));
406+
statement = "";
407+
insertChildren = QUOTE([ARR_2(_target,_player)] call FUNC(addArterialTestActions));
408+
icon = QACEPATHTOF(medical_gui,ui\cross.paa);
409+
};
410+
};
339411
class ACE_Actions {
340412
class ACE_MainActions {
341413
class KAT_ArterialTest {
@@ -354,12 +426,12 @@ class CfgVehicles {
354426
class ACE_Actions {
355427
class ACE_MainActions {
356428
class KAT_ApplyBloodTest {
357-
displayName = CSTRING(Arterial_Test);
358-
condition = "true";
359-
statement = "true";
360-
insertChildren = QUOTE([ARR_2(_target,_player)] call FUNC(addArterialApplyActions));
361-
icon = QACEPATHTOF(medical_gui,ui\cross.paa);
362-
};
429+
displayName = CSTRING(Arterial_Test);
430+
condition = QUOTE(GVAR(abgEnable));
431+
statement = "true";
432+
insertChildren = QUOTE([ARR_2(_target,_player)] call FUNC(addArterialApplyActions));
433+
icon = QACEPATHTOF(medical_gui,ui\cross.paa);
434+
};
363435
};
364436
class ACE_Head {
365437
class CheckBloodPressure {}; // Remove the ability to check blood pressure at the head

addons/circulation/functions/fnc_addArterialApplyActions.sqf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ private _fnc_getActions = {
3030

3131
if (_idNumber > 0) then {
3232
private _resultSampleMap = missionNamespace getVariable [QEGVAR(circulation,resultSampleMap), []];
33-
_resultSampleMap = _resultSampleMap get _idNumber;
34-
_resultSampleMap = _resultSampleMap select 1;
35-
private _patient = _resultSampleMap select 0;
33+
_resultSampleArray = _resultSampleMap get _idNumber;
34+
_resultSampleActual = _resultSampleArray select 1;
35+
private _patient = _resultSampleArray select 0;
3636

3737
_actions pushBack [
3838
[
@@ -45,7 +45,7 @@ private _fnc_getActions = {
4545
[]
4646
] call ACEFUNC(interact_menu,createAction),
4747
[],
48-
[_resultSampleMap, _target, _idNumber, _player]
48+
[_resultSampleActual, _target, _idNumber, _player]
4949
];
5050
};
5151
} forEach ([_player, 0] call ACEFUNC(common,uniqueItems));
@@ -54,4 +54,4 @@ private _fnc_getActions = {
5454
};
5555

5656

57-
[[], _fnc_getActions, _player, QGVAR(actionsCache), 9999, "cba_events_loadoutEvent"] call ACEFUNC(common,cachedCall);
57+
[[], _fnc_getActions, _player, QGVAR(actionsCache), 9999, "cba_events_loadoutEvent"] call ACEFUNC(common,cachedCall);

addons/circulation/functions/fnc_addArterialTestActions.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ private _fnc_getActions = {
5656
};
5757

5858

59-
[[], _fnc_getActions, _player, QGVAR(actionsCache), 9999, "cba_events_loadoutEvent"] call ACEFUNC(common,cachedCall);
59+
[[], _fnc_getActions, _player, QGVAR(actionsCache), 9999, "cba_events_loadoutEvent"] call ACEFUNC(common,cachedCall);

addons/circulation/functions/fnc_attachBloodGas.sqf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
*/
1717
params ["_entries"];
1818
_entries params ["_bloodGas", "_patient", "_idNumber", "_player"];
19-
_bloodGas params ["_patientName", "_bloodGasArray"];
2019

21-
_patient setVariable [QGVAR(testedBloodGas), _bloodGasArray, true];
20+
_patient setVariable [QGVAR(testedBloodGas), _bloodGas, true];
2221

2322
_player removeItem (format ["KAT_bloodResult_%1",_idNumber]);

addons/circulation/functions/fnc_showBloodGas.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ private _resultSampleMap = missionNamespace getVariable [QEGVAR(circulation,resu
2828
_resultCounter = [_resultCounter +1, 1] select (_resultCounter == 20);
2929
missionNamespace setVariable [QEGVAR(circulation,resultCounter), _resultCounter, true];
3030

31-
_resultSampleMap set [_resultCounter, [name(_patient), _bloodGas]];
31+
_resultSampleMap set [_resultCounter, [_patientName, _bloodGasArray]];
3232
missionNamespace setVariable [QEGVAR(circulation,resultSampleMap), _resultSampleMap, true];
3333

3434
private _itemStr = format ["KAT_bloodResult_%1", _resultCounter];

addons/watch/XEH_PREP.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
PREP(closeWatchTimer);
21
PREP(handleRespawn);
32
PREP(hideKWatch);
43
PREP(hideCWatch);
@@ -8,4 +7,5 @@ PREP(init);
87
PREP(showKWatch);
98
PREP(showCWatch);
109
PREP(showSWatch);
11-
PREP(showRWatch);
10+
PREP(showRWatch);
11+
PREP(startWatchTimer);

addons/watch/XEH_postInit.sqf

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
if (!hasInterface) exitWith {};
44

5-
[QGVAR(closeWatchTimer), LINKFUNC(closeWatchTimer)] call CBA_fnc_addEventHandler;
5+
[QGVAR(startWatchTimer), LINKFUNC(startWatchTimer)] call CBA_fnc_addEventHandler;
66
[QEGVAR(misc,handleRespawn), LINKFUNC(handleRespawn)] call CBA_fnc_addEventHandler;
77

88
[QGVAR(playWatchTone), {
@@ -51,7 +51,7 @@ if (!hasInterface) exitWith {};
5151
[ACE_player] call FUNC(showRWatch);
5252
} else {
5353
call FUNC(hideRWatch);
54-
};
54+
};
5555
};
5656
};
5757

@@ -96,11 +96,8 @@ if (!hasInterface) exitWith {};
9696
if (_timerActive) then {
9797
ACE_player setVariable [QGVAR(rangerStart), false, false];
9898
} else {
99-
if !(GETMVAR(GVAR(RangerActive),false)) then {
100-
[QGVAR(closeWatchTimer), [ACE_player], ACE_player] call CBA_fnc_targetEvent;
101-
};
102-
10399
ACE_player setVariable [QGVAR(rangerStart), true, false];
100+
[QGVAR(startWatchTimer), [ACE_player], ACE_player] call CBA_fnc_targetEvent;
104101
};
105102
};
106103

addons/watch/functions/fnc_handleRespawn.sqf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@
2020
params ["_unit","_dead"];
2121
TRACE_2("handleRespawn",_unit,_dead);
2222

23-
_unit setVariable [QGVAR(RangerStart), false, true];
24-
_unit setVariable [QGVAR(RangerTimer), 0, true];
23+
_unit setVariable [QGVAR(rangerStart), false, true];
24+
_unit setVariable [QGVAR(rangerTimer), 0, true];

addons/watch/functions/fnc_showRWatch.sqf

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,23 +82,8 @@ private _o2 = _display displayCtrl 22810;
8282
_second ctrlSetAngle [(linearConversion [0, 60, _seconds, 0, 360]), 0.5, 0.5, true];
8383

8484
private _timeValue = _unit getVariable [QGVAR(rangerTimer), 0];
85-
private _active = _unit getVariable [QGVAR(rangerStart), false];
8685

8786
_timer ctrlSetText ([_timeValue, 2, 0] call CBA_fnc_formatNumber);
88-
89-
if (_active) then {
90-
_timeValue = (_timeValue - 1) max 0;
91-
92-
_timer ctrlSetText ([_timeValue, 2, 0] call CBA_fnc_formatNumber);
93-
_unit setVariable [QGVAR(rangerTimer), _timeValue, false];
94-
95-
if (_timeValue == 0) then {
96-
_unit setVariable [QGVAR(rangerStart), false, false];
97-
[QGVAR(playWatchTone), [_unit, QGVAR(watchAlarm)], _unit] call CBA_fnc_targetEvent;
98-
};
99-
} else {
100-
_timer ctrlSetText ([_timeValue, 2, 0] call CBA_fnc_formatNumber);
101-
};
10287
}, 1, [
10388
_unit,
10489
_hour,
@@ -109,4 +94,4 @@ private _o2 = _display displayCtrl 22810;
10994
_altitude,
11095
_hr,
11196
_o2
112-
]] call CBA_fnc_addPerFrameHandler;
97+
]] call CBA_fnc_addPerFrameHandler;

0 commit comments

Comments
 (0)