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 53 commits into
base: dev-Tomcat
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
53 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
aa31799
fix
MiszczuZPolski Jan 9, 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
1 change: 1 addition & 0 deletions addons/ophthalmology/$PBOPREFIX$
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x\kat\addons\ophthalmology
26 changes: 26 additions & 0 deletions addons/ophthalmology/ACE_Medical_Treatment_Actions.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
class ACE_Medical_Treatment_Actions {
class Blink {
displayName = CSTRING(Blink_Display);
displayNameProgress = CSTRING(blink_action);
category = "bandage";
treatmentLocations = 0;
allowedSelections[] = {"Head"};
allowSelfTreatment = 1;
medicRequired = 0;
treatmentTime = 2;
Katalam marked this conversation as resolved.
Show resolved Hide resolved
items[] = {};
condition = QUOTE(missionNamespace getVariable [ARR_2(QQGVAR(enable),true)]);
Katalam marked this conversation as resolved.
Show resolved Hide resolved
callbackSuccess = QFUNC(treatmentAdvanced_blink);
callbackFailure = "";
callbackProgress = "";
consumeItem = 0;
animationPatient = "";
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
animationPatientUnconsciousExcludeOn[] = {"ainjppnemstpsnonwrfldnon"};
animationMedic = "AinvPknlMstpSlayWrflDnon_medicOther";
animationMedicProne = "AinvPpneMstpSlayW[wpn]Dnon_medicOther";
animationMedicSelf = "AinvPknlMstpSlayW[wpn]Dnon_medic";
animationMedicSelfProne = "AinvPpneMstpSlayW[wpn]Dnon_medic";
litter[] = {};
};
};
20 changes: 20 additions & 0 deletions addons/ophthalmology/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
disableModuload = "true";
};
};

class Extended_Init_EventHandlers {
class CAManBase {
class ADDON {
init = QUOTE([ARR_2((_this select 0), false)] call FUNC(init));
};
};
};

class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};
6 changes: 6 additions & 0 deletions addons/ophthalmology/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PREP(handleDustInjury);
PREP(handleDustInjuryEffects);
PREP(handleTime);
PREP(init);
PREP(initKeybinds);
PREP(treatmentAdvanced_blink);
34 changes: 34 additions & 0 deletions addons/ophthalmology/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include "script_component.hpp"

Katalam marked this conversation as resolved.
Show resolved Hide resolved
[QGVAR(handleTime), LINKFUNC(handleTime)] call CBA_fnc_addEventHandler;
Katalam marked this conversation as resolved.
Show resolved Hide resolved

call FUNC(initKeybinds);

// blur effect if not blinked
Katalam marked this conversation as resolved.
Show resolved Hide resolved
GVAR(ppEffectPriority) = 341;
[{
GVAR(ppEffectPriority) = GVAR(ppEffectPriority) + 1;
GVAR(ppBlur) = ppEffectCreate ["DynamicBlur", GVAR(ppEffectPriority)];
GVAR(ppBlur) != -1
}, {
GVAR(ppBlur) ppEffectEnable false;
}] call CBA_fnc_waitUntilAndExecute;

// dust injury
[{
GVAR(ppEffectPriority) = GVAR(ppEffectPriority) + 1;
GVAR(ppBlurDustInjury) = ppEffectCreate ["DynamicBlur", GVAR(ppEffectPriority)];
GVAR(ppBlurDustInjury) != -1
}, {
GVAR(ppBlurDustInjury) ppEffectEnable false;
}] call CBA_fnc_waitUntilAndExecute;

// blink effect
GVAR(ppEffectPriority) = 1111;
[{
GVAR(ppEffectPriority) = GVAR(ppEffectPriority) + 1;
GVAR(ppBlurBlink) = ppEffectCreate ["DynamicBlur", GVAR(ppEffectPriority)];
GVAR(ppBlurBlink) != -1
}, {
GVAR(ppBlurBlink) ppEffectEnable false;
}] call CBA_fnc_waitUntilAndExecute;
91 changes: 91 additions & 0 deletions addons/ophthalmology/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#include "script_component.hpp"

ADDON = false;

PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;

#define CBA_SETTINGS_CAT "KAT - ADV Medical: Ophthalmology"

// Enable Dust Injury
[
QGVAR(enable),
"CHECKBOX",
LLSTRING(SETTING_ENABLE),
[CBA_SETTINGS_CAT, LSTRING(SETTING_SubCategory_Injury)],
[true],
true
] call CBA_Settings_fnc_init;

// Probability to get dust in the eyes
[
QGVAR(probability_dust),
"SLIDER",
[LLSTRING(SETTING_BLINK_EFFECT_INTENSITY)],
[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_BLINK_EFFECT_INTENSITY)],
[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_BLINK_EFFECT_INTENSITY)],
[CBA_SETTINGS_CAT, LSTRING(SETTING_SubCategory_Injury)],
[1, 100, 20, 0],
true
] call CBA_Settings_fnc_init;

// Dust in the eye post process effect intensity
[
QGVAR(dust_effect_intensity),
"SLIDER",
[LLSTRING(SETTING_DUST_EFFECT_INTENSITY)],
[CBA_SETTINGS_CAT, LSTRING(SETTING_SubCategory_Injury)],
[1, 10, 3, 0],
true
] call CBA_Settings_fnc_init;

// Enable manual blinking
[
QGVAR(enableManualBlinking),
"CHECKBOX",
LLSTRING(SETTING_ENABLE_MANUAL_BLINKING),
[CBA_SETTINGS_CAT, LSTRING(SETTING_SubCategory_Manual)],
[false],
true
] call CBA_Settings_fnc_init;

// Time span blinking is needed
[
QGVAR(blink_duration),
"SLIDER",
[LLSTRING(SETTING_BLINK_DURATION)],
[CBA_SETTINGS_CAT, LSTRING(SETTING_SubCategory_Manual)],
[1, 600, 60, 0],
true
] call CBA_Settings_fnc_init;

// Blinking post process effect intensity
[
QGVAR(blink_effect_intensity),
"SLIDER",
[LLSTRING(SETTING_BLINK_EFFECT_INTENSITY)],
[CBA_SETTINGS_CAT, LSTRING(SETTING_SubCategory_Manual)],
[1, 10, 5, 0],
true
] call CBA_Settings_fnc_init;

ADDON = true;
22 changes: 22 additions & 0 deletions addons/ophthalmology/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "script_component.hpp"

class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
requiredVersion = REQUIRED_VERSION;
units[] = {};
weapons[] = {};
magazines[] = { };
requiredAddons[] = {
"kat_main",
"cba_settings"
};
author = "Katalam";
authors[] = {"Katalam"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
};
};

#include "CfgEventHandlers.hpp"
#include "ACE_Medical_Treatment_Actions.hpp"
43 changes: 43 additions & 0 deletions addons/ophthalmology/functions/fnc_handleDustInjury.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include "script_component.hpp"
/*
* Author: Katalam
* Handles the possibility to have dust in the eye.
*
Katalam marked this conversation as resolved.
Show resolved Hide resolved
* Return Value:
* None
*
* Public: No
*/

params ["_player", "_pfhID"];
Katalam marked this conversation as resolved.
Show resolved Hide resolved

if !(GVAR(enable)) exitWith {};

// check headgear and googles for protection
private _safe = false;

if (headgear _unit != "") then {
_safe = getNumber (configFile >> "CfgWeapons" >> headgear _unit >> "ACE_Protection") == 1;
};

// if the headgear is not enough to protect, we check the goggles
if (!_safe) then {
_safe = _player call ACEFUNC(goggles,isGogglesVisible);
};

// if protected, do nothing
if (_safe) exitWith {};


// get a random integer
private _random = floor(random [0, 50, 100]);

// we only need to set the variables
// pp effect will be added through extra pfh
if (_random <= GVAR(probability_dust_heavy)) exitWith {
_player setVariable [QGVAR(dust_injury_heavy), true, true];
};

if (_random <= GVAR(probability_dust)) exitWith {
_player setVariable [QGVAR(dust_injury), true, true];
};
27 changes: 27 additions & 0 deletions addons/ophthalmology/functions/fnc_handleDustInjuryEffects.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "script_component.hpp"
/*
* Author: Katalam
* Handles the effects of having dust in the eyes.
*
Katalam marked this conversation as resolved.
Show resolved Hide resolved
* Return Value:
* None
*
* Public: No
*/

params ["_player", "_pfhID"];
Katalam marked this conversation as resolved.
Show resolved Hide resolved

if !(GVAR(enable)) exitWith {};

private _dustInjury = _player getVariable [QGVAR(dust_injury), false];
private _dustInjuryHeavy = _player getVariable [QGVAR(dust_injury_heavy), false];

// no injuries?
if (!_dustInjury && !_dustInjuryHeavy) exitWith {};

// already enabled?
if (ppEffectEnabled GVAR(ppBlurDustInjury)) exitWith {};

GVAR(ppBlurDustInjury) ppEffectEnable true;
GVAR(ppBlurDustInjury) ppEffectAdjust [GVAR(dust_effect_intensity)];
GVAR(ppBlurDustInjury) ppEffectCommit 30;
23 changes: 23 additions & 0 deletions addons/ophthalmology/functions/fnc_handleTime.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "script_component.hpp"
/*
* Author: Katalam
* Handles the current moment if blinking was needed in the past
* and ands pp effects if needed
*
Katalam marked this conversation as resolved.
Show resolved Hide resolved
* Return Value:
* None
*
* Public: No
*/

params ["_player", "_pfhID"];

if !(GVAR(enableManualBlinking)) exitWith {};

private _lastBlink = _player getVariable [QGVAR(lastBlink), 0];

if (CBA_missionTime > _lastBlink + GVAR(blink_duration)) then {
GVAR(ppBlur) ppEffectEnable true;
GVAR(ppBlur) ppEffectAdjust [GVAR(blink_effect_intensity)];
GVAR(ppBlur) ppEffectCommit GVAR(blink_duration);
};
23 changes: 23 additions & 0 deletions addons/ophthalmology/functions/fnc_init.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "script_component.hpp"
/*
* Author: Katalam
* Will initialize the frame handler for the manual blinking and dust injuries
*
* Return Value:
* None
*
* Public: No
*/

params ["_unit", ["_isRespawn", true]];

if (!local _unit) exitWith {};

if (GVAR(enable)) then {
[FUNC(handleDustInjury), 60, _unit] call CBA_fnc_addPerFrameHandler;
[FUNC(handleDustInjuryEffects), 1, _unit] call CBA_fnc_addPerFrameHandler;
};

if (GVAR(enableManualBlinking)) then {
[FUNC(handleTime), 1, _unit] call CBA_fnc_addPerFrameHandler;
};
35 changes: 35 additions & 0 deletions addons/ophthalmology/functions/fnc_initKeybinds.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "script_component.hpp"
#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(blinking),
{
ACE_PLAYER setVariable [QGVAR(lastBlink), CBA_missionTime];
GVAR(ppBlur) ppEffectEnable false;
GVAR(ppBlur) ppEffectAdjust [0];
GVAR(ppBlur) ppEffectCommit 0;

GVAR(ppBlurBlink) ppEffectEnable true;
GVAR(ppBlurBlink) ppEffectAdjust [0.5];
GVAR(ppBlurBlink) ppEffectCommit 0.5;

[{
GVAR(ppBlurBlink) ppEffectEnable false;
GVAR(ppBlurBlink) ppEffectAdjust [0];
GVAR(ppBlurBlink) ppEffectCommit 0.5;
}, [], 0.1] call CBA_fnc_waitAndExecute;
}, "",
[DIK_TAB, [false, false, false]], false] call CBA_fnc_addKeybind;
// [DIK, [shift, ctrl, alt]]
32 changes: 32 additions & 0 deletions addons/ophthalmology/functions/fnc_treatmentAdvanced_blink.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include "script_component.hpp"
/*
* Author: Katalam
* Handles the possibility to treat dust in the eye with blinking
*
* Return Value:
* None
*
* Public: No
*
*/

params ["_medic", "_patient"];

// get a random integer
private _random = floor(random [0, 50, 100]);
Katalam marked this conversation as resolved.
Show resolved Hide resolved

// heavy dust injury?
if (_patient getVariable [QGVAR(dust_injury_heavy), false]) exitWith {};
// no dust injury?
if !(_patient getVariable [QGVAR(dust_injury), false]) exitWith {};

if (_random <= GVAR(probability_treatment_dust)) then {
_patient setVariable [QGVAR(dust_injury), false, true];
GVAR(ppBlurDustInjury) ppEffectEnable false;
GVAR(ppBlurDustInjury) ppEffectAdjust [0];
GVAR(ppBlurDustInjury) ppEffectCommit 0;

true;
Katalam marked this conversation as resolved.
Show resolved Hide resolved
};

false;
1 change: 1 addition & 0 deletions addons/ophthalmology/functions/script_component.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "\x\kat\addons\ophthalmology\script_component.hpp"
Loading