Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions addons/ophthalmology/ACE_Medical_Treatment_Actions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,13 @@ class ACE_Medical_Treatment_Actions {
condition = QFUNC(eyeShieldCondition);
callbackSuccess = QFUNC(treatmentAdvanced_eyeShield);
};
class RemoveEyeShield: EyeWash {
displayName = CSTRING(eyeshieldRemove_display);
displayNameProgress = CSTRING(eyeshieldRemove_action);
medicRequired = 0;
treatmentTime = QGVAR(eyeshield_treatment_time);
items[] = {};
condition = QFUNC(eyeShieldRemoveCondition);
callbackSuccess = QFUNC(treatmentAdvanced_eyeShieldRemove);
};
};
5 changes: 5 additions & 0 deletions addons/ophthalmology/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
PREP(eyeShieldCondition);
PREP(eyeShieldRemoveCondition);
PREP(fullHealLocal);
PREP(gui_updateInjuryListPart);
PREP(handleDustInjury);
PREP(handleExplosion);
PREP(handleRespawn);
PREP(init);
PREP(severeEyeInjuryPFH);
PREP(treatmentAdvanced_eyeShield);
PREP(treatmentAdvanced_eyeShieldLocal);
PREP(treatmentAdvanced_eyeShieldRemove);
PREP(treatmentAdvanced_eyeShieldRemoveLocal);
PREP(treatmentAdvanced_eyewash);
3 changes: 3 additions & 0 deletions addons/ophthalmology/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ if (!hasInterface) exitWith {};

}] call CBA_fnc_addEventHandler;

[QGVAR(eyeShield), LINKFUNC(treatmentAdvanced_eyeShieldLocal)] call CBA_fnc_addEventHandler;
[QGVAR(eyeShieldRemove), LINKFUNC(treatmentAdvanced_eyeShieldRemoveLocal)] call CBA_fnc_addEventHandler;

[QACEGVAR(medical_treatment,fullHealLocalMod), LINKFUNC(fullHealLocal)] call CBA_fnc_addEventHandler;
[QACEGVAR(medical_gui,updateInjuryListPart), LINKFUNC(gui_updateInjuryListPart)] call CBA_fnc_addEventHandler;
[QEGVAR(misc,handleRespawn), LINKFUNC(handleRespawn)] call CBA_fnc_addEventHandler;
2 changes: 1 addition & 1 deletion addons/ophthalmology/functions/fnc_eyeShieldCondition.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ params ["_medic", "_patient"];
private _eyeInjuries = _patient getVariable [QGVAR(eyeInjuries), [1, 1]];
private _eyeInjurySevere = _patient getVariable [QGVAR(eyeInjurySevere), false];

if (_eyeInjurySevere && (({_x == 0} count _eyeInjuries) == 1)) exitWith {
if (_eyeInjurySevere && (({_x != 1} count _eyeInjuries) == 1)) exitWith {
true
};

Expand Down
21 changes: 21 additions & 0 deletions addons/ophthalmology/functions/fnc_eyeShieldRemoveCondition.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "..\script_component.hpp"
/*
* Author: Mazinski
* Sets condition for the Eye Shield
*
* Return Value:
* Boolean
*
* Example:
* [bob, patient] call kat_ophthalmology_fnc_eyeShieldCondition
*
* Public: No
*/

params ["_medic", "_patient"];

if ((hmd _patient == "kat_eyecovers_left") || (hmd _patient == "kat_eyecovers_right")) exitWith {
true
};

false
58 changes: 58 additions & 0 deletions addons/ophthalmology/functions/fnc_severeEyeInjuryPFH.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#include "..\script_component.hpp"
/*
* Author: Mazinski
* Handles severe eye damage
*
* Return Value:
* None
*
* Example:
* [patient] call kat_ophthalmology_fnc_treatmentAdvanced_severeEyeInjuryPFH
*
* Public: No
*/

params ["_patient"];

// Approximately 8 minutes to fully re-heal a damaged eye using the eyeshield
[{
params ["_args", "_pfhID"];
_args params ["_patient", "_activeEye", "_shieldItem"];

private _active = false;
private _activeEye = 0;

#define IDC_LEFT_EYE_CONTROL 17103
#define IDC_RIGHT_EYE_CONTROL 17102

if ((hmd _patient) == "kat_eyecovers_left") then {
_active = true;
private _display = uiNamespace getVariable ["KAT_EyeShield", displayNull];
private _activeEye = _display displayCtrl IDC_LEFT_EYE_CONTROL;

_activeEye ctrlShow true;
_activeEye ctrlCommit 0;
};

if ((hmd _patient) == "kat_eyecovers_right") then {
_active = true;
_activeEye = 1;
private _display = uiNamespace getVariable ["KAT_EyeShield", displayNull];
private _activeEye = _display displayCtrl IDC_RIGHT_EYE_CONTROL;

_activeEye ctrlShow true;
_activeEye ctrlCommit 0;
};

if (_active) then {
private _eyeInjury = _patient getVariable [QGVAR(eyeInjuries), [1, 1]];
_eyeInjury set [_activeEye, ((_eyeInjury select _activeEye) + 0.002)];
_patient setVariable [QGVAR(eyeInjuries), _eyeInjury, true];
} else {
"KAT_EyeShield" cutText ["","PLAIN",0,true];
};
}, 1, [
_patient,
_activeEye,
_shieldItem
]] call CBA_fnc_addPerFrameHandler;
54 changes: 2 additions & 52 deletions addons/ophthalmology/functions/fnc_treatmentAdvanced_eyeShield.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -11,57 +11,7 @@
*
* Public: No
*/

params ["_medic", "_patient"];

private _eyeInjuries = _patient getVariable [QGVAR(eyeInjuries), [1, 1]];

#define IDC_LEFT_EYE_CONTROL 17103
#define IDC_RIGHT_EYE_CONTROL 17102

"KAT_EyeShield" cutRsc ["KAT_EyeShield", "PLAIN", 0, true];


private _fnc_applyEyeCover = {
params ["_patient", "_shieldItem", "_eyeDisplay"];

// If patient has NVGs on, move them to the patient's inventory
if (hmd _patient != "") then {
_patient addItem (hmd _patient);
};

private _display = uiNamespace getVariable ["KAT_EyeShield", displayNull];
private _activeEye = _display displayCtrl _eyeDisplay;

_patient linkItem _shieldItem;

_activeEye ctrlShow true;
_activeEye ctrlCommit 0;

// Approximately 8 minutes to fully re-heal a damaged eye using the eyeshield
[{
params ["_args", "_pfhID"];
_args params ["_patient", "_activeEye", "_shieldItem"];

if ((hmd _patient) != _shieldItem) exitWith {
_pfhID call CBA_fnc_removePerFrameHandler;
"KAT_EyeShield" cutText ["","PLAIN",0,true];
};

private _eyeInjury = _patient getVariable [QGVAR(eyeInjuries), [1, 1]];
_patient setVariable [QGVAR(eyeInjuries), [(((_eyeInjury select 0) + 0.002) min 1), (_eyeInjury select 1)], true];
}, 1, [
_patient,
_activeEye,
_shieldItem
]] call CBA_fnc_addPerFrameHandler;
};

if ((_eyeInjuries select 0) == 0) then {
[_patient, "kat_eyecovers_left", IDC_LEFT_EYE_CONTROL] call _fnc_applyEyeCover;
} else {
[_patient, "kat_eyecovers_right", IDC_RIGHT_EYE_CONTROL] call _fnc_applyEyeCover;
};
params ["_medic", "_patient"];

[_patient, LLSTRING(eyeshield_item)] call ACEFUNC(medical_treatment,addToTriageCard);
[_patient, "activity", ACELSTRING(medical_treatment,Activity_usedItem), [[_medic] call ACEFUNC(common,getName), LLSTRING(eyeshield_item)]] call ACEFUNC(medical_treatment,addToLog);
[QGVAR(eyeShield), [_medic, _patient], _patient] call CBA_fnc_targetEvent;
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#include "..\script_component.hpp"
/*
* Author: Mazinski
* Handles the placement of the eye shield
*
* Return Value:
* None
*
* Example:
* [bob, patient] call kat_ophthalmology_fnc_treatmentAdvanced_eyeShieldLocal
*
* Public: No
*/

params ["_medic", "_patient"];

private _eyeInjuries = _patient getVariable [QGVAR(eyeInjuries), [1, 1]];

#define IDC_LEFT_EYE_CONTROL 17103
#define IDC_RIGHT_EYE_CONTROL 17102

"KAT_EyeShield" cutRsc ["KAT_EyeShield", "PLAIN", 0, true];


private _fnc_applyEyeCover = {
params ["_patient", "_shieldItem", "_eyeDisplay"];

// If patient has NVGs on, move them to the patient's inventory
if (hmd _patient != "") then {
_patient addItem (hmd _patient);
};

private _display = uiNamespace getVariable ["KAT_EyeShield", displayNull];
private _activeEye = _display displayCtrl _eyeDisplay;

_patient linkItem _shieldItem;

_activeEye ctrlShow true;
_activeEye ctrlCommit 0;

// Approximately 8 minutes to fully re-heal a damaged eye using the eyeshield
[{
params ["_args", "_pfhID"];
_args params ["_patient", "_activeEye", "_shieldItem"];

if ((hmd _patient) != _shieldItem) exitWith {
_pfhID call CBA_fnc_removePerFrameHandler;
"KAT_EyeShield" cutText ["","PLAIN",0,true];
};

private _eyeInjury = _patient getVariable [QGVAR(eyeInjuries), [1, 1]];
_patient setVariable [QGVAR(eyeInjuries), [(((_eyeInjury select 0) + 0.002) min 1), (_eyeInjury select 1)], true];
}, 1, [
_patient,
_activeEye,
_shieldItem
]] call CBA_fnc_addPerFrameHandler;
};

if ((_eyeInjuries select 0) == 0) then {
[_patient, "kat_eyecovers_left", IDC_LEFT_EYE_CONTROL] call _fnc_applyEyeCover;
} else {
[_patient, "kat_eyecovers_right", IDC_RIGHT_EYE_CONTROL] call _fnc_applyEyeCover;
};

[_patient, LLSTRING(eyeshield_item)] call ACEFUNC(medical_treatment,addToTriageCard);
[_patient, "activity", ACELSTRING(medical_treatment,Activity_usedItem), [[_medic] call ACEFUNC(common,getName), LLSTRING(eyeshield_item)]] call ACEFUNC(medical_treatment,addToLog);
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "..\script_component.hpp"
/*
* Author: Mazinski
* Handles the placement of the eye shield
*
* Return Value:
* None
*
* Example:
* [bob, patient] call kat_ophthalmology_fnc_treatmentAdvanced_eyeShield
*
* Public: No
*/

params ["_medic", "_patient"];

[QGVAR(eyeShieldRemove), [_medic, _patient], _patient] call CBA_fnc_targetEvent;
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "..\script_component.hpp"
/*
* Author: Mazinski
* Removes the eye shield from a patient
*
* Return Value:
* None
*
* Example:
* [bob, patient] call kat_ophthalmology_fnc_treatmentAdvanced_eyeShieldRemoveLocal
*
* Public: No
*/

params ["_medic", "_patient"];

_patient unassignItem (hmd _patient);
Loading