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

Ophthalmology - Add manual blinking and eye injuries #296

Open
wants to merge 61 commits into
base: dev-Tomcat
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
169f604
add: manual blinking
Katalam Apr 24, 2023
cc6eded
fix: style
Katalam Apr 24, 2023
eb972f2
fix: priority handler will now start at 1111
Katalam Apr 24, 2023
69a5c79
fix: disable manual blinking by default
Katalam Apr 24, 2023
bff90bc
add: dust injury
Katalam Apr 24, 2023
56eb58d
fix: tab in init
Katalam Apr 25, 2023
403d936
fix: stringtable
Katalam Apr 25, 2023
20537ed
fix: unit is better than player
Katalam Apr 25, 2023
53ba8be
fix: missing rename of displayname blink
Katalam Apr 25, 2023
25273bd
add: quoted getgvar
Katalam Apr 25, 2023
5d7b8ca
fix: _unit is better than _player
Katalam Apr 25, 2023
eb40d86
feat: eye washing
Katalam Apr 25, 2023
2640791
feat: eye washing is now written in activity log
Katalam Apr 25, 2023
c301a9b
feat: add eye washer as item
Katalam Apr 25, 2023
0db5464
fix: typo displayname eye wash item
Katalam Apr 25, 2023
3e73074
fix: pr comments
Katalam May 1, 2023
9c93c0e
feat: add treatment time to blink action
Katalam May 1, 2023
7c3b0f6
feat: add treatment time to eye wash action
Katalam May 1, 2023
b6d2bc1
feat: add medic required setting to eye wash
Katalam May 1, 2023
0f4a7f2
fix: pp effects should only initialize if used
Katalam May 1, 2023
10d70a7
fix: missing quote statements ace treatment actions
Katalam May 1, 2023
babe2a8
fix: cba setting missing a bracket
Katalam May 1, 2023
eccede9
fix(blink): wrong random weights
Katalam May 2, 2023
6af7176
style
Katalam May 2, 2023
3fe7f99
Merge branch 'dev-Tomcat' into feat/blink
YetheSamartaka Jun 24, 2023
a214b73
Merge branch 'dev-Tomcat' into feat/blink
MiszczuZPolski Mar 8, 2024
772b3ad
Merge branch 'dev-Tomcat' into pr/296
MiszczuZPolski Aug 10, 2024
99ff976
work work work
MiszczuZPolski Aug 10, 2024
ad317fa
Merge branch 'dev-Tomcat' into pr/296
MiszczuZPolski Sep 3, 2024
fba43a0
Merge branch 'dev-Tomcat' into pr/296
MiszczuZPolski Oct 9, 2024
9afa29b
Merge branch 'dev-Tomcat' into pr/296
MiszczuZPolski Dec 27, 2024
40cb8e9
update current
MiszczuZPolski Dec 27, 2024
2b20a9c
blindness effect
MiszczuZPolski Dec 27, 2024
6b52008
rework explosion EH plus re-add blinking effect
MiszczuZPolski Dec 28, 2024
ce522d1
Proper blink animation
mazinskihenry Dec 29, 2024
3dba5f7
Normal dust injury
mazinskihenry Dec 29, 2024
355dff7
Update
mazinskihenry Dec 29, 2024
38b88e4
Update fnc_fullHealLocal.sqf
mazinskihenry Dec 29, 2024
3bdd472
blurBlink
mazinskihenry Dec 29, 2024
afb1e38
clean up
MiszczuZPolski Dec 29, 2024
6cd792f
headers
MiszczuZPolski Dec 29, 2024
5d005c1
Update fnc_handleExplosion.sqf
MiszczuZPolski Dec 29, 2024
9b8de7e
Merge branch 'dev-Tomcat' into pr/296
MiszczuZPolski Jan 5, 2025
a77e556
add eyecovers
MiszczuZPolski Jan 5, 2025
619276e
Setting up eyeshield
mazinskihenry Jan 8, 2025
e4d0f09
Tabs and Stringtables
mazinskihenry Jan 8, 2025
045d247
Update fnc_treatmentAdvanced_eyeShield.sqf
mazinskihenry Jan 8, 2025
8045103
Icon
mazinskihenry Jan 8, 2025
ffe703e
Update CfgWeapons.hpp
mazinskihenry Jan 8, 2025
48801f0
Working response
mazinskihenry Jan 8, 2025
7ee2bee
Headers
mazinskihenry Jan 8, 2025
a5bd186
Update stringtable.xml
mazinskihenry Jan 8, 2025
f871e4c
Update fnc_treatmentAdvanced_eyeShield.sqf
mazinskihenry Jan 8, 2025
aa31799
fix
MiszczuZPolski Jan 9, 2025
3555c26
move to event
MiszczuZPolski Jan 19, 2025
8d48122
Merge branch 'feat/blink' of https://github.com/Katalam/KAM-new into …
mazinskihenry Feb 21, 2025
865c592
Grim Review
mazinskihenry Feb 21, 2025
49065ae
Fixes
mazinskihenry Feb 21, 2025
713ae5b
Grim Second Pass
mazinskihenry Feb 22, 2025
0e8986d
Update fnc_treatmentAdvanced_eyeShield.sqf
mazinskihenry Feb 22, 2025
5d4d46a
Update XEH_PREP.hpp
mazinskihenry Feb 22, 2025
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
87 changes: 5 additions & 82 deletions addons/ophthalmology/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -1,92 +1,15 @@
#include "script_component.hpp"
#include "initKeybinds.inc.sqf"

ADDON = false;

PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;

#define CBA_SETTINGS_CAT "KAT - ADV Medical: Ophthalmology"
#define CBA_SETTINGS_CAT LSTRING(cba_name)

// Enable Dust Injury
[
QGVAR(enable),
"CHECKBOX",
LLSTRING(setting_enable),
[CBA_SETTINGS_CAT, LSTRING(setting_subcategory_injury)],
[true],
true
] call CBA_Settings_fnc_init;
#include "initKeybinds.inc.sqf"
#include "initSettings.inc.sqf"

// Probability to get dust in the eyes
[
QGVAR(probability_dust),
"SLIDER",
[LLSTRING(setting_probability_dust)],
[CBA_SETTINGS_CAT, LSTRING(setting_subcategory_injury)],
[1, 100, 5, 0],
true
] call CBA_Settings_fnc_init;

// Probability to get dust in the eyes which is not treated by blink
[
QGVAR(probability_dust_heavy),
"SLIDER",
[LLSTRING(setting_probability_dust_heavy)],
[CBA_SETTINGS_CAT, LSTRING(setting_subcategory_injury)],
[1, 100, 1, 0],
true
] call CBA_Settings_fnc_init;

// Probability to treat the dust in the eyes with blinking
[
QGVAR(probability_treatment_dust),
"SLIDER",
[LLSTRING(setting_probability_treatment_dust)],
[CBA_SETTINGS_CAT, LSTRING(setting_subcategory_injury)],
[1, 100, 20, 0],
true
] call CBA_Settings_fnc_init;

// Eye Wash treatment time
[
QGVAR(eyewash_treatment_time),
"SLIDER",
[LLSTRING(setting_eyewash_treatment_time)],
[CBA_SETTINGS_CAT, LSTRING(setting_subcategory_manual_blink)],
[1, 10, 2, 0],
true
] call CBA_Settings_fnc_init;

// Eye Wash medic required
[
QGVAR(eyewash_medic_required),
"LIST",
[LLSTRING(setting_eyewash_medic_required)],
[CBA_SETTINGS_CAT, LSTRING(setting_subcategory_manual_blink)],
[[0, 1, 2], ["STR_ACE_Medical_Treatment_Anyone", "STR_ACE_Medical_Treatment_Medics", "STR_ACE_Medical_Treatment_Doctors"], 0],
true
] call CBA_Settings_fnc_init;

// Eye Shield treatment time
[
QGVAR(eyeshield_treatment_time),
"SLIDER",
[LLSTRING(setting_eyeShield_treatment_time)],
[CBA_SETTINGS_CAT, LSTRING(setting_subcategory_manual_blink)],
[1, 10, 2, 0],
true
] call CBA_Settings_fnc_init;


// Eye Shield medic required
[
QGVAR(eyeshield_medic_required),
"LIST",
[LLSTRING(setting_eyeShield_medic_required)],
[CBA_SETTINGS_CAT, LSTRING(setting_subcategory_manual_blink)],
[[0, 1, 2], ["STR_ACE_Medical_Treatment_Anyone", "STR_ACE_Medical_Treatment_Medics", "STR_ACE_Medical_Treatment_Doctors"], 0],
true
] call CBA_Settings_fnc_init;

ADDON = true;
ADDON = true;
50 changes: 21 additions & 29 deletions addons/ophthalmology/functions/fnc_treatmentAdvanced_eyeShield.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,25 @@

params ["_medic", "_patient"];

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

#define leftEyeDisplay 17103
#define rightEyeDisplay 17102

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

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

if ((_eyeInjuries find 0) == 0) then {
_patient linkItem "kat_eyecovers_left";
_activeEye = _display displayCtrl 17103;
private _fnc_applyEyeCover = {
params ["_patient", "_shieldItem", "_eyeDisplay"];

if (hmd _patient != "") then {
_patient addItem (hmd _patient);
};

_patient linkItem _shieldItem;
_activeEye = _display displayCtrl _eyeDisplay;

_activeEye ctrlShow true;
_activeEye ctrlCommit 0;
Expand All @@ -32,40 +41,23 @@ if ((_eyeInjuries find 0) == 0) then {
_this params ["_args", "_pfhID"];
_args params ["_unit", "_activeEye"];

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

private _eyeInjury = _unit getVariable ["kat_ophthalmology_eyeInjuries", [1, 1]];
_unit setVariable ["kat_ophthalmology_eyeInjuries", [(((_eyeInjury select 0) + 0.001) min 1), (_eyeInjury select 1)], true];
private _eyeInjury = _unit getVariable [QGVAR(eyeInjuries), [1, 1]];
_unit setVariable [QGVAR(eyeInjuries), [(((_eyeInjury select 0) + 0.001) min 1), (_eyeInjury select 1)], true];
}, 30, [
_patient,
_activeEye
]] call CBA_fnc_addPerFrameHandler;
};

if ((_eyeInjuries find 0) == 0) then {
[_patient, "kat_eyecovers_left", leftEyeDisplay] call _fnc_applyEyeCover;
} else {
_patient linkItem "kat_eyecovers_right";
_activeEye = _display displayCtrl 17102;

_activeEye ctrlShow true;
_activeEye ctrlCommit 0;

[{
_this params ["_args", "_pfhID"];
_args params ["_unit", "_activeEye"];

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

private _eyeInjury = _unit getVariable ["kat_ophthalmology_eyeInjuries", [1, 1]];
_unit setVariable ["kat_ophthalmology_eyeInjuries", [(_eyeInjury select 0), (((_eyeInjury select 1) + 0.001) min 1)], true];
}, 1, [
_patient,
_activeEye
]] call CBA_fnc_addPerFrameHandler;
[_patient, "kat_eyecovers_right", rightEyeDisplay] call _fnc_applyEyeCover;
};

[_patient, LLSTRING(eyeshield_item)] call ACEFUNC(medical_treatment,addToTriageCard);
Expand Down
29 changes: 29 additions & 0 deletions addons/ophthalmology/initKeybinds.inc.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include "script_component"

Check failure on line 1 in addons/ophthalmology/initKeybinds.inc.sqf

View workflow job for this annotation

GitHub Actions / windows

include not found

not found
#include "\a3\ui_f\hpp\defineDIKCodes.inc"
/*
* Author: Katalam
* Initialize the keybinds.
*
* Return Value:
* None
*
* Public: No
*
* https://community.bistudio.com/wiki/DIK_KeyCodes
*/

if (!hasInterface) exitWith {};

[QUOTE(COMPONENT_BEAUTIFIED), QGVAR(blinking), LLSTRING(blink_action),
{
[0.2, false] call EFUNC(feedback,effectEyeBlink);

private _random = floor(random 100);

if (_random <= GVAR(probability_treatment_dust)) then {
private _dustInjurySeverity = ACE_player getVariable [QGVAR(dustInjurySeverity), 0];
ACE_player setVariable [QGVAR(dustInjurySeverity), ((_dustInjurySeverity - 0.5) max 0), true];
};
}, "",
[DIK_TAB, [false, false, false]], false] call CBA_fnc_addKeybind;
// [DIK, [shift, ctrl, alt]]
82 changes: 82 additions & 0 deletions addons/ophthalmology/initSettings.inc.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// Enable Dust Injury
[
QGVAR(enable),
"CHECKBOX",
LLSTRING(setting_enable),
[CBA_SETTINGS_CAT, LSTRING(setting_subcategory_injury)],
[true],
true
] call CBA_fnc_addSetting;

// Probability to get dust in the eyes
[
QGVAR(probability_dust),
"SLIDER",
[LLSTRING(setting_probability_dust)],
[CBA_SETTINGS_CAT, LSTRING(setting_subcategory_injury)],
[1, 100, 5, 0],
true
] call CBA_fnc_addSetting;

// Probability to get dust in the eyes which is not treated by blink
[
QGVAR(probability_dust_heavy),
"SLIDER",
[LLSTRING(setting_probability_dust_heavy)],
[CBA_SETTINGS_CAT, LSTRING(setting_subcategory_injury)],
[1, 100, 1, 0],
true
] call CBA_fnc_addSetting;

// Probability to treat the dust in the eyes with blinking
[
QGVAR(probability_treatment_dust),
"SLIDER",
[LLSTRING(setting_probability_treatment_dust)],
[CBA_SETTINGS_CAT, LSTRING(setting_subcategory_injury)],
[1, 100, 20, 0],
true
] call CBA_fnc_addSetting;

// Eye Wash treatment time
[
QGVAR(eyewash_treatment_time),
"SLIDER",
[LLSTRING(setting_eyewash_treatment_time)],
[CBA_SETTINGS_CAT, LSTRING(setting_subcategory_manual_blink)],
[1, 10, 2, 0],
true
] call CBA_fnc_addSetting;

// Eye Wash medic required
[
QGVAR(eyewash_medic_required),
"LIST",
[LLSTRING(setting_eyewash_medic_required)],
[CBA_SETTINGS_CAT, LSTRING(setting_subcategory_manual_blink)],
[[0, 1, 2], ["STR_ACE_Medical_Treatment_Anyone", "STR_ACE_Medical_Treatment_Medics", "STR_ACE_Medical_Treatment_Doctors"], 0],
true
] call CBA_fnc_addSetting;

// Eye Shield treatment time
[
QGVAR(eyeshield_treatment_time),
"SLIDER",
[LLSTRING(setting_eyeShield_treatment_time)],
[CBA_SETTINGS_CAT, LSTRING(setting_subcategory_manual_blink)],
[1, 10, 2, 0],
true
] call CBA_fnc_addSetting;


// Eye Shield medic required
[
QGVAR(eyeshield_medic_required),
"LIST",
[LLSTRING(setting_eyeShield_medic_required)],
[CBA_SETTINGS_CAT, LSTRING(setting_subcategory_manual_blink)],
[[0, 1, 2], ["STR_ACE_Medical_Treatment_Anyone", "STR_ACE_Medical_Treatment_Medics", "STR_ACE_Medical_Treatment_Doctors"], 0],
true
] call CBA_fnc_addSetting;

ADDON = true;
Loading