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

Medical Update (SAM Splint) #6412

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8f9e836
SAM Splint / Cast update
mgkid3310 Jun 28, 2018
a705c63
show SAM Splint on medical menu
mgkid3310 Jun 28, 2018
2d3a5b0
Actions display update
mgkid3310 Jun 28, 2018
410a341
add eventhandler
mgkid3310 Jun 28, 2018
b51c853
fix variable names
mgkid3310 Jun 28, 2018
67dfd56
use space instead of tab
mgkid3310 Jun 28, 2018
78459aa
remove tabs
mgkid3310 Jun 28, 2018
4db3b4a
fix issues
mgkid3310 Jun 28, 2018
e27fb89
use private keyword
mgkid3310 Jun 28, 2018
61327bd
fixed issues
mgkid3310 Jun 29, 2018
925ca6f
remove Cast & improve splint
mgkid3310 Jun 29, 2018
d1fdf22
fixed wrong porting
mgkid3310 Jun 29, 2018
672fa6a
remove unused script
mgkid3310 Jun 29, 2018
cdc19ff
use params command
mgkid3310 Jun 29, 2018
27a1da1
use DFUNC() instead of FUNC()
mgkid3310 Jun 30, 2018
0d7fc24
use private command to declare variable
mgkid3310 Jul 1, 2018
747902b
removed unnecessary characters
mgkid3310 Jul 1, 2018
acd216f
broadcast only when list is changed
mgkid3310 Jul 7, 2018
f9e8582
fix wrong variable name
mgkid3310 Jul 7, 2018
e26af32
make logic simpler
mgkid3310 Jul 7, 2018
5f6752e
fix logic
mgkid3310 Jul 7, 2018
5ff17d2
fix target array
mgkid3310 Jul 7, 2018
9a344fe
use macros for indexes
mgkid3310 Jul 9, 2018
834b808
remove UI work
mgkid3310 Jul 24, 2018
f583a5b
treat splint on init/fullheal
mgkid3310 Jul 24, 2018
ca8c48f
change condition expression
mgkid3310 Jul 25, 2018
5e21b42
remove remains of ui work
mgkid3310 Jul 25, 2018
7ba2cde
optimize functions
mgkid3310 Jul 26, 2018
05d6fcb
update header
mgkid3310 Jul 27, 2018
c49209d
update icon & model
mgkid3310 Jul 28, 2018
90a0e42
add hiddenSelectionsTextures
mgkid3310 Jul 28, 2018
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
29 changes: 28 additions & 1 deletion addons/medical/ACE_Medical_Actions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,13 @@ class ACE_ArmLeft {
statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'RemoveTourniquet')] call DFUNC(treatment));
EXCEPTIONS
};
class samSplint: fieldDressing {
displayName = CSTRING(apply_samSplint);
condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'SAMSplint')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'SAMSplint')] call DFUNC(treatment));
EXCEPTIONS
icon = ""; // need icon
};
};
class ACE_ArmRight {
displayName = ECSTRING(interaction,ArmRight);
Expand Down Expand Up @@ -494,7 +501,13 @@ class ACE_ArmRight {
statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'RemoveTourniquet')] call DFUNC(treatment));
EXCEPTIONS
};

class samSplint: fieldDressing {
displayName = CSTRING(apply_samSplint);
condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'SAMSplint')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'SAMSplint')] call DFUNC(treatment));
EXCEPTIONS
icon = ""; // need icon
};
};
class ACE_LegLeft {
displayName = ECSTRING(interaction,LegLeft);
Expand Down Expand Up @@ -641,6 +654,13 @@ class ACE_LegLeft {
statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'RemoveTourniquet')] call DFUNC(treatment));
EXCEPTIONS
};
class samSplint: fieldDressing {
displayName = CSTRING(apply_samSplint);
condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'SAMSplint')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'SAMSplint')] call DFUNC(treatment));
EXCEPTIONS
icon = ""; // need icon
};
};
class ACE_LegRight {
displayName = ECSTRING(interaction,LegRight);
Expand Down Expand Up @@ -786,4 +806,11 @@ class ACE_LegRight {
statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'RemoveTourniquet')] call DFUNC(treatment));
EXCEPTIONS
};
class samSplint: fieldDressing {
displayName = CSTRING(apply_samSplint);
condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'SAMSplint')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'SAMSplint')] call DFUNC(treatment));
EXCEPTIONS
icon = ""; // need icon
};
};
28 changes: 28 additions & 0 deletions addons/medical/ACE_Medical_SelfActions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,13 @@ class Medical {
exceptions[] = {"isNotInside", "isNotSwimming"};
statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'RemoveTourniquet')] call DFUNC(treatment));
};
class samSplint: fieldDressing {
displayName = CSTRING(apply_samSplint);
condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'SAMSplint')] call DFUNC(canTreatCached));
exceptions[] = {"isNotInside", "isNotSwimming"};
statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'SAMSplint')] call DFUNC(treatment));
icon = ""; // need icon
};
};
class ACE_ArmRight {
displayName = ECSTRING(interaction,ArmRight);
Expand Down Expand Up @@ -337,6 +344,13 @@ class Medical {
exceptions[] = {"isNotInside", "isNotSwimming"};
statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'RemoveTourniquet')] call DFUNC(treatment));
};
class samSplint: fieldDressing {
displayName = CSTRING(apply_samSplint);
condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'SAMSplint')] call DFUNC(canTreatCached));
exceptions[] = {"isNotInside", "isNotSwimming"};
statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'SAMSplint')] call DFUNC(treatment));
icon = ""; // need icon
};
};
class ACE_LegLeft {
displayName = ECSTRING(interaction,LegLeft);
Expand Down Expand Up @@ -427,6 +441,13 @@ class Medical {
exceptions[] = {"isNotInside", "isNotSwimming"};
statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'RemoveTourniquet')] call DFUNC(treatment));
};
class samSplint: fieldDressing {
displayName = CSTRING(apply_samSplint);
condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'SAMSplint')] call DFUNC(canTreatCached));
exceptions[] = {"isNotInside", "isNotSwimming"};
statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'SAMSplint')] call DFUNC(treatment));
icon = ""; // need icon
};
};
class ACE_LegRight {
displayName = ECSTRING(interaction,LegRight);
Expand Down Expand Up @@ -516,5 +537,12 @@ class Medical {
exceptions[] = {"isNotInside", "isNotSwimming"};
statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'RemoveTourniquet')] call DFUNC(treatment));
};
class samSplint: fieldDressing {
displayName = CSTRING(apply_samSplint);
condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'SAMSplint')] call DFUNC(canTreatCached));
exceptions[] = {"isNotInside", "isNotSwimming"};
statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'SAMSplint')] call DFUNC(treatment));
icon = ""; // need icon
};
};
};
47 changes: 47 additions & 0 deletions addons/medical/ACE_Medical_Treatments.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class ACE_Medical_Actions {
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_bandage));
callbackFailure = "";
callbackProgress = "";
treatmentType = "Bandage";

animationPatient = "";
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
Expand All @@ -40,6 +41,8 @@ class ACE_Medical_Actions {
treatmentTime = 2;
items[] = {"ACE_morphine"};
callbackSuccess = QUOTE(DFUNC(treatmentBasic_morphine));
treatmentType = "Injection";
treatmentDisplay = "Morphine";
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
litter[] = { {"All", "", {"ACE_MedicalLitter_morphine"}} };
};
Expand All @@ -53,6 +56,8 @@ class ACE_Medical_Actions {
treatmentTime = 3;
items[] = {"ACE_epinephrine"};
callbackSuccess = QUOTE(DFUNC(treatmentBasic_epipen));
treatmentType = "Injection";
treatmentDisplay = "Epinephrine";
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
litter[] = { {"All", "", {"ACE_MedicalLitter_epinephrine"}} };
treatmentLocations[] = {QGVAR(useLocation_basicEpi)};
Expand All @@ -68,6 +73,8 @@ class ACE_Medical_Actions {
items[] = {"ACE_bloodIV"};
// callbackSuccess = QUOTE(DFUNC(treatmentBasic_bloodbag));
callbackSuccess = QUOTE(DFUNC(treatmentIV));
treatmentType = "Injection";
treatmentDisplay = "IV";
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
litter[] = {};
};
Expand All @@ -91,6 +98,8 @@ class ACE_Medical_Actions {
callbackSuccess = QUOTE(DFUNC(actionPlaceInBodyBag));
callbackFailure = "";
callbackProgress = "";
treatmentType = "Others";
treatmentDisplay = "Placing in Bodybag";
animationPatient = "";
animationPatientUnconscious = "";
itemConsumed = 1;
Expand All @@ -108,6 +117,8 @@ class ACE_Medical_Actions {
callbackSuccess = QUOTE(DFUNC(actionDiagnose));
callbackFailure = "";
callbackProgress = "";
treatmentType = "none";
treatmentDisplay = "";
animationPatient = "";
animationCaller = ""; // TODO
itemConsumed = 0;
Expand All @@ -127,6 +138,8 @@ class ACE_Medical_Actions {
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_CPR));
callbackFailure = "";
callbackProgress = "!([((_this select 0) select 1)] call ace_common_fnc_isAwake)";
treatmentType = "Others";
treatmentDisplay = "Performing CPR";
animationPatient = "";
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
animationCaller = "AinvPknlMstpSlayWnonDnon_medic";
Expand Down Expand Up @@ -159,6 +172,7 @@ class ACE_Medical_Actions {
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_bandage));
callbackFailure = "";
callbackProgress = "";
treatmentType = "Bandage";
itemConsumed = 1;
animationPatient = "";
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
Expand Down Expand Up @@ -201,6 +215,7 @@ class ACE_Medical_Actions {
items[] = {"ACE_tourniquet"};
treatmentTime = 4;
callbackSuccess = QUOTE(DFUNC(treatmentTourniquet));
treatmentType = "TourniquetOn";
condition = QUOTE(!([ARR_2(_this select 1, _this select 2)] call FUNC(hasTourniquetAppliedTo)));
litter[] = {};
};
Expand All @@ -212,24 +227,29 @@ class ACE_Medical_Actions {
items[] = {"ACE_morphine"};
treatmentTime = 3;
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_medication));
treatmentType = "Injection";
treatmentDisplay = "Morphine";
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
litter[] = { {"All", "", {"ACE_MedicalLitter_morphine"}} };
};
class Adenosine: Morphine {
displayName = CSTRING(Inject_Adenosine);
displayNameProgress = CSTRING(Injecting_Adenosine);
treatmentDisplay = "Adenosine";
items[] = {"ACE_adenosine"};
litter[] = { {"All", "", {"ACE_MedicalLitter_adenosine"}} };
};
class Atropine: Morphine {
displayName = CSTRING(Inject_Atropine);
displayNameProgress = CSTRING(Injecting_Atropine);
treatmentDisplay = "Atropine";
items[] = {"ACE_atropine"};
litter[] = { {"All", "", {"ACE_MedicalLitter_atropine"}} };
};
class Epinephrine: Morphine {
displayName = CSTRING(Inject_Epinephrine);
displayNameProgress = CSTRING(Injecting_Epinephrine);
treatmentDisplay = "Epinephrine";
items[] = {"ACE_epinephrine"};
litter[] = { {"All", "", {"ACE_MedicalLitter_epinephrine"}} };
};
Expand All @@ -243,6 +263,8 @@ class ACE_Medical_Actions {
requiredMedic = 1;
treatmentTime = 7;
callbackSuccess = QUOTE(DFUNC(treatmentIV));
treatmentType = "Injection";
treatmentDisplay = "IV";
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
litter[] = {};
};
Expand Down Expand Up @@ -294,6 +316,8 @@ class ACE_Medical_Actions {
treatmentTime = "(count ((_this select 1) getVariable ['ACE_Medical_bandagedWounds', []]) * 5)";
callbackSuccess = "";
callbackProgress = QUOTE(DFUNC(treatmentAdvanced_surgicalKit_onProgress));
treatmentType = "Others";
treatmentDisplay = "Using SurgicalKit";
itemConsumed = QGVAR(consumeItem_SurgicalKit);
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
litter[] = { {"All", "", {"ACE_MedicalLitter_gloves"} }};
Expand All @@ -309,6 +333,8 @@ class ACE_Medical_Actions {
patientStateCondition = QGVAR(useCondition_PAK);
treatmentTime = QUOTE((_this select 1) call FUNC(treatmentAdvanced_fullHealTreatmentTime));
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_fullHeal));
treatmentType = "Others";
treatmentDisplay = "Using PAK";
itemConsumed = QGVAR(consumeItem_PAK);
animationPatient = "";
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
Expand All @@ -334,6 +360,8 @@ class ACE_Medical_Actions {
callbackSuccess = QUOTE(DFUNC(actionCheckPulse));
callbackFailure = "";
callbackProgress = "";
treatmentType = "none";
treatmentDisplay = "";
animationPatient = "";
animationCaller = ""; // TODO
animationCallerProne = "";
Expand All @@ -357,6 +385,7 @@ class ACE_Medical_Actions {
items[] = {};
treatmentTime = 2.5;
callbackSuccess = QUOTE(DFUNC(actionRemoveTourniquet));
treatmentType = "TourniquetOff";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These still belong to the UI part don't they?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, forgot those. Will remove them tonight.

condition = QUOTE([ARR_2(_this select 1, _this select 2)] call FUNC(hasTourniquetAppliedTo));
displayNameProgress = CSTRING(RemovingTourniquet);
litter[] = {};
Expand All @@ -375,6 +404,8 @@ class ACE_Medical_Actions {
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_CPR));
callbackFailure = "";
callbackProgress = "!([((_this select 0) select 1)] call ace_common_fnc_isAwake)";
treatmentType = "Others";
treatmentDisplay = "Performing CPR";
animationPatient = "";
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
animationCaller = "AinvPknlMstpSlayWnonDnon_medic";
Expand All @@ -397,11 +428,27 @@ class ACE_Medical_Actions {
callbackSuccess = QUOTE(DFUNC(actionPlaceInBodyBag));
callbackFailure = "";
callbackProgress = "";
treatmentType = "Others";
treatmentDisplay = "Placing in Bodybag";
animationPatient = "";
animationPatientUnconscious = "";
itemConsumed = 1;
litter[] = {};
};
class SAMSplint: fieldDressing {
displayName = CSTRING(apply_samSplint);
displayNameProgress = CSTRING(applying_samSplint);
allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r"};
allowSelfTreatment = 0;
requiredMedic = 0;
items[] = {"ACE_samSplint"};
treatmentTime = 10;
callbackSuccess = QUOTE(DFUNC(treatmentSAMSplint));
treatmentType = "Others";
treatmentDisplay = "Applying SAM Splint";
condition = "[_this select 1, _this select 2] call ace_medical_fnc_canTreatSAMSplint";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could just be call ace_medical_fnc_canTreatSAMSplint and let _this be passed implicitly. Rather than taking it apart (select) and then putting it back together (the array) just to take it apart again inside the function (params).

Copy link
Member

@TheMagnetar TheMagnetar Jul 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or condition = QFUNC(canTreatSAMSplint);
and the same with callBackSuccess = QFUNC(treatmentSAMSplint);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Roger, will have this fixed by tonight. Would it be better to use 'private _target = _this select 1' since the caller (0th item of _this array) or just accept all 4 items via 'params'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used QUOTE([ARR_2(_this select 1, _this select 2)] call FUNC(canTreatSAMSplint));, similar to tourniquet and other treatments.

litter[] = {};
};
};
};

Expand Down
12 changes: 12 additions & 0 deletions addons/medical/CfgWeapons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,16 @@ class CfgWeapons {
mass = 7;
};
};
class ACE_samSplint: ACE_ItemCore {
scope = 2;
author = ECSTRING(common,ACETeam);
displayName = CSTRING(samSplint_display);
picture = ""; // need icon
model = ""; // need model
descriptionShort = CSTRING(samSplint_short);
descriptionUse = CSTRING(samSplint_use);
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 2;
};
};
};
7 changes: 7 additions & 0 deletions addons/medical/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ PREP(bodyCleanupLoop);
PREP(canAccessMedicalEquipment);
PREP(canTreat);
PREP(canTreatCached);
PREP(canTreatSAMSplint);
PREP(clearExpired);
PREP(clearFinished);
PREP(determineIfFatal);
PREP(getBloodLoss);
PREP(getBloodPressure);
Expand Down Expand Up @@ -94,6 +97,10 @@ PREP(treatmentBasic_morphine);
PREP(treatmentBasic_morphineLocal);
PREP(treatmentIV);
PREP(treatmentIVLocal);
PREP(treatmentSAMSplint);
PREP(treatmentSAMSplintDamaged);
PREP(treatmentSAMSplintLocal);
PREP(treatmentSAMSplintTimeout);
PREP(treatmentTourniquet);
PREP(treatmentTourniquetLocal);
PREP(useItem);
Expand Down
5 changes: 4 additions & 1 deletion addons/medical/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ GVAR(heartBeatSounds_Slow) = ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2"];
[QGVAR(treatmentBasic_morphineLocal), DFUNC(treatmentBasic_morphineLocal)] call CBA_fnc_addEventHandler;
[QGVAR(treatmentIVLocal), DFUNC(treatmentIVLocal)] call CBA_fnc_addEventHandler;
[QGVAR(treatmentTourniquetLocal), DFUNC(treatmentTourniquetLocal)] call CBA_fnc_addEventHandler;
[QGVAR(actionPlaceInBodyBag), FUNC(actionPlaceInBodyBag)] call CBA_fnc_addEventHandler;
[QGVAR(actionPlaceInBodyBag), DFUNC(actionPlaceInBodyBag)] call CBA_fnc_addEventHandler;
[QGVAR(treatmentOrthopedicCastLocal), DFUNC(treatmentOrthopedicCastLocal)] call CBA_fnc_addEventHandler;
[QGVAR(treatmentSAMSplintLocal), DFUNC(treatmentSAMSplintLocal)] call CBA_fnc_addEventHandler;


//Handle Deleting Bodies and creating litter on Server:
if (isServer) then {
Expand Down
38 changes: 38 additions & 0 deletions addons/medical/functions/fnc_canTreatSAMSplint.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Author: Orbis2358
* Check if can treat Splint
*
* Arguments:
* 0: The patient <OBJECT>
* 1: SelectionName <STRING>
*
* Return Value:
* None
*
* Example:
* [patient, "SelectionName"] call ace_medical_fnc_canTreatSAMSplint
*
* Public: Yes
*/

#include "script_component.hpp"

params ["_target", "_part"];

if !(_part isEqualType 0) then {
_part = [_part] call FUNC(selectionNameToNumber);
};

private _damage = _target getVariable [QGVAR(bodyPartStatus), [0, 0, 0, 0, 0, 0]];
private _hasDamage = (_damage select _part) > 0;

private _sam = _target getVariable [QGVAR(samSplint), [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]];
private _hasSAM = ((_sam select _part) select 0) > 0;

private _tourniquets = _target getVariable [QGVAR(tourniquets), [0, 0, 0, 0, 0, 0]];
private _hasTourniquet = (_tourniquets select _part) != 0;

private _openWounds = _target getVariable [QGVAR(openWounds), []];
private _bleedingWound = {((_x select 2) isEqualTo _part) && ((_x select 4) * (_x select 3) > 0)} count _openWounds > 0;

(_hasDamage && !_hasSAM && (_hasTourniquet || !_bleedingWound))
Loading