diff --git a/addons/main/script_mod.hpp b/addons/main/script_mod.hpp index e38e71ac4b1..9f5de699214 100644 --- a/addons/main/script_mod.hpp +++ b/addons/main/script_mod.hpp @@ -5,7 +5,7 @@ #define MAJOR 3 #define MINOR 2 -#define PATCHLVL 2 +#define PATCHLVL 3 #define BUILD 0 #define VERSION MAJOR.MINOR.PATCHLVL.BUILD diff --git a/addons/medical/ACE_Medical_Treatments.hpp b/addons/medical/ACE_Medical_Treatments.hpp index 96f5493aece..ea9e03974a6 100644 --- a/addons/medical/ACE_Medical_Treatments.hpp +++ b/addons/medical/ACE_Medical_Treatments.hpp @@ -7,6 +7,7 @@ class ACE_Medical_Actions { category = "bandage"; treatmentLocations[] = {"All"}; allowedSelections[] = {"All"}; + allowSelfTreatment = 1; requiredMedic = 0; treatmentTime = 5; treatmentTimeSelfCoef = 1; @@ -32,6 +33,7 @@ class ACE_Medical_Actions { displayName = CSTRING(Inject_Morphine); displayNameProgress = CSTRING(Injecting_Morphine); allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r"}; + allowSelfTreatment = 1; category = "medication"; treatmentTime = 2; items[] = {"ACE_morphine"}; @@ -43,6 +45,7 @@ class ACE_Medical_Actions { displayName = CSTRING(Inject_Epinephrine); displayNameProgress = CSTRING(Injecting_Epinephrine); allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r"}; + allowSelfTreatment = 1; category = "medication"; requiredMedic = 1; treatmentTime = 3; @@ -55,6 +58,7 @@ class ACE_Medical_Actions { displayName = CSTRING(Transfuse_Blood); displayNameProgress = CSTRING(Transfusing_Blood); allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r"}; + allowSelfTreatment = 0; category = "advanced"; requiredMedic = 1; treatmentTime = 20; @@ -93,7 +97,7 @@ class ACE_Medical_Actions { displayNameProgress = CSTRING(Actions_Diagnosing); category = "examine"; treatmentLocations[] = {"All"}; - allowedSelections[] = {"head"}; + allowedSelections[] = {"head", "body"}; requiredMedic = 0; treatmentTime = 1; items[] = {}; @@ -105,6 +109,29 @@ class ACE_Medical_Actions { itemConsumed = 0; litter[] = {}; }; + class CPR: Bandage { + displayName = CSTRING(Actions_CPR); + displayNameProgress = CSTRING(Actions_PerformingCPR); + category = "advanced"; + treatmentLocations[] = {"All"}; + allowedSelections[] = {"body"}; + allowSelfTreatment = 0; + requiredMedic = 0; + treatmentTime = 15; + items[] = {}; + condition = QUOTE(!([(_this select 1)] call ace_common_fnc_isAwake) && GVAR(enableRevive)>0); + callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_CPR)); + callbackFailure = ""; + callbackProgress = "!([((_this select 0) select 1)] call ace_common_fnc_isAwake)"; + animationPatient = ""; + animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback"; + animationCaller = "AinvPknlMstpSlayWnonDnon_medic"; + animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medic"; + animationCallerSelf = ""; + animationCallerSelfProne = ""; + itemConsumed = 0; + litter[] = {}; + }; }; class Advanced { @@ -115,6 +142,7 @@ class ACE_Medical_Actions { // Which locations can this treatment action be used? Available: Field, MedicalFacility, MedicalVehicle, All. treatmentLocations[] = {"All"}; allowedSelections[] = {"All"}; + allowSelfTreatment = 1; // What is the level of medical skill required for this treatment action? 0 = all soldiers, 1 = medic, 2 = doctor requiredMedic = 0; // The time it takes for a treatment action to complete. Time is in seconds. @@ -188,6 +216,7 @@ class ACE_Medical_Actions { displayName = CSTRING(Actions_Blood4_1000); displayNameProgress = CSTRING(Transfusing_Blood); allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r"}; + allowSelfTreatment = 0; category = "advanced"; items[] = {"ACE_bloodIV"}; requiredMedic = 1; @@ -238,6 +267,7 @@ class ACE_Medical_Actions { category = "advanced"; items[] = {"ACE_surgicalKit"}; treatmentLocations[] = {QGVAR(useLocation_SurgicalKit)}; + allowSelfTreatment = 0; requiredMedic = QGVAR(medicSetting_SurgicalKit); patientStateCondition = QGVAR(useCondition_SurgicalKit); treatmentTime = "(count ((_this select 1) getVariable ['ACE_Medical_bandagedWounds', []]) * 5)"; @@ -253,6 +283,7 @@ class ACE_Medical_Actions { category = "advanced"; items[] = {"ACE_personalAidKit"}; treatmentLocations[] = {QGVAR(useLocation_PAK)}; + allowSelfTreatment = 0; requiredMedic = QGVAR(medicSetting_PAK); patientStateCondition = QGVAR(useCondition_PAK); treatmentTime = QUOTE((_this select 1) call FUNC(treatmentAdvanced_fullHealTreatmentTime)); @@ -297,6 +328,7 @@ class ACE_Medical_Actions { displayName = CSTRING(Check_Response); callbackSuccess = QUOTE(DFUNC(actionCheckResponse)); displayNameProgress = CSTRING(Check_Response_Content); + allowSelfTreatment = 0; }; class RemoveTourniquet: Tourniquet { displayName = CSTRING(Actions_RemoveTourniquet); @@ -313,6 +345,7 @@ class ACE_Medical_Actions { category = "advanced"; treatmentLocations[] = {"All"}; allowedSelections[] = {"body"}; + allowSelfTreatment = 0; requiredMedic = 0; treatmentTime = 15; items[] = {}; @@ -334,6 +367,7 @@ class ACE_Medical_Actions { displayNameProgress = CSTRING(PlacingInBodyBag); category = "advanced"; treatmentLocations[] = {"All"}; + allowSelfTreatment = 0; requiredMedic = 0; treatmentTime = 15; items[] = {"ACE_bodyBag"}; @@ -605,6 +639,7 @@ class ACE_Medical_Advanced { class vehiclecrash { thresholds[] = {{0.25, 5}}; selectionSpecific = 0; + lethalDamage = 0.2; }; class backblast { thresholds[] = {{0, 2},{0.55, 5}, {1, 6}}; @@ -622,6 +657,7 @@ class ACE_Medical_Advanced { class falling { thresholds[] = {{0.1, 1}}; selectionSpecific = 1; + lethalDamage = 0.4; }; class ropeburn { thresholds[] = {{0.1, 1}}; diff --git a/addons/medical/ACE_Settings.hpp b/addons/medical/ACE_Settings.hpp index 910f152292e..b17610b0e35 100644 --- a/addons/medical/ACE_Settings.hpp +++ b/addons/medical/ACE_Settings.hpp @@ -220,7 +220,7 @@ class ACE_Settings { description = CSTRING(menuTypeDescription); typeName = "SCALAR"; value = 0; - values[] = {CSTRING(useSelection)/*, CSTRING(useRadial)*/}; - // isClientSettable = 1; + values[] = {CSTRING(useSelection), CSTRING(useRadial), "Disabled"}; + isClientSettable = 1; }; }; diff --git a/addons/medical/CfgVehicles.hpp b/addons/medical/CfgVehicles.hpp index 350f83b3f7a..4e73e77ee18 100644 --- a/addons/medical/CfgVehicles.hpp +++ b/addons/medical/CfgVehicles.hpp @@ -2,12 +2,12 @@ #define MEDICAL_ACTION_DISTANCE 1.75 class CfgVehicles { - class Logic; class Module_F: Logic { class ArgumentsBaseUnits { }; }; + class ACE_Module; class ACE_moduleMedicalSettings: ACE_Module { scope = 2; @@ -19,6 +19,7 @@ class CfgVehicles { isGlobal = 1; isTriggerActivated = 0; author = ECSTRING(common,ACETeam); + class Arguments { class level { displayName = CSTRING(MedicalSettings_level_DisplayName); @@ -137,6 +138,7 @@ class CfgVehicles { defaultValue = 1; }; }; + class ModuleDescription { description = CSTRING(MedicalSettings_Module_Description); sync[] = {}; @@ -154,6 +156,7 @@ class CfgVehicles { isTriggerActivated = 0; isDisposable = 0; author = ECSTRING(common,ACETeam); + class Arguments { class enableFor { displayName = CSTRING(AdvancedMedicalSettings_enableFor_DisplayName); @@ -256,13 +259,13 @@ class CfgVehicles { defaultValue = 1; }; }; + class ModuleDescription { description = CSTRING(AdvancedMedicalSettings_Module_Description); sync[] = {}; }; }; - class ACE_moduleReviveSettings: ACE_Module { scope = 2; displayName = CSTRING(ReviveSettings_Module_DisplayName); @@ -273,6 +276,7 @@ class CfgVehicles { isGlobal = 1; isTriggerActivated = 0; author = ECSTRING(common,ACETeam); + class Arguments { class enableRevive { displayName = CSTRING(ReviveSettings_enableRevive_DisplayName); @@ -298,11 +302,13 @@ class CfgVehicles { defaultValue = -1; }; }; + class ModuleDescription { description = CSTRING(ReviveSettings_Module_Description); sync[] = {}; }; }; + class ACE_moduleAssignMedicRoles: Module_F { scope = 2; displayName = CSTRING(AssignMedicRoles_Module_DisplayName); @@ -314,6 +320,7 @@ class CfgVehicles { isTriggerActivated = 0; isDisposable = 0; author = ECSTRING(common,ACETeam); + class Arguments { class EnableList { displayName = CSTRING(AssignMedicRoles_EnableList_DisplayName); @@ -342,6 +349,7 @@ class CfgVehicles { }; }; }; + class ModuleDescription { description = CSTRING(AssignMedicRoles_Module_Description); sync[] = {}; @@ -359,6 +367,7 @@ class CfgVehicles { isTriggerActivated = 0; isDisposable = 0; author = ECSTRING(common,ACETeam); + class Arguments { class EnableList { displayName = CSTRING(AssignMedicVehicle_EnableList_DisplayName); @@ -384,11 +393,13 @@ class CfgVehicles { }; }; }; + class ModuleDescription { description = CSTRING(AssignMedicVehicle_Module_Description); sync[] = {}; }; }; + class ACE_moduleAssignMedicalFacility: Module_F { scope = 2; displayName = CSTRING(AssignMedicalFacility_Module_DisplayName); @@ -400,6 +411,7 @@ class CfgVehicles { isTriggerActivated = 0; isDisposable = 0; author = ECSTRING(common,ACETeam); + class Arguments { class enabled { displayName = CSTRING(AssignMedicalFacility_enabled_DisplayName); @@ -407,70 +419,52 @@ class CfgVehicles { typeName = "BOOL"; }; }; + class ModuleDescription { description = CSTRING(AssignMedicalFacility_Module_Description); sync[] = {}; }; }; - #define ARM_LEG_ARMOR_DEFAULT 2 - #define ARM_LEG_ARMOR_BETTER 3 + #define ARM_LEG_ARMOR_DEFAULT 3 + #define ARM_LEG_ARMOR_BETTER 5 #define ARM_LEG_ARMOR_CSAT 4 - class Man; - class CAManBase: Man { - class HitPoints { - class HitHead; - class HitBody; - // "DEACTIVE" DEFAULT HITPOINTS - class HitHands { - armor = 999; //armor = 2; - explosionShielding = 0; //explosionShielding = 1; - material = -1; - minimalHit = 0; - name = ""; - passThrough = 1; - radius = 0; //radius = 0.06; - visual = "injury_hands"; - }; - class HitLegs { - armor = 999; //armor = 2; - explosionShielding = 0; //explosionShielding = 1; - material = -1; - minimalHit = 0; - name = ""; - passThrough = 1; - radius = 0; //radius = 0.08; - visual = "injury_legs"; - }; + class Land; + class Man: Land { + class HitPoints; + }; + class CAManBase: Man { + class HitPoints: HitPoints { // custom hitpoints. addons might want to adjust these accordingly class HitLeftArm { - armor = ARM_LEG_ARMOR_DEFAULT; //2; - explosionShielding = 1; + armor = ARM_LEG_ARMOR_DEFAULT; material = -1; - minimalHit = 0; - name = "hand_l"; + name = "hand_l"; // @todo hopefully these still include the whole arm + hands passThrough = 1; - radius = 0.06; + radius = 0.08; + explosionShielding = 1; visual = "injury_hands"; + minimalHit = 0.01; }; class HitRightArm: HitLeftArm { - name = "hand_r"; + name = "hand_r"; // @todo hopefully these still include the whole arm + hands }; class HitLeftLeg { - armor = ARM_LEG_ARMOR_DEFAULT; //2; - explosionShielding = 1; + armor = ARM_LEG_ARMOR_DEFAULT; material = -1; - minimalHit = 0; name = "leg_l"; passThrough = 1; - radius = 0.08; + radius = 0.1; + explosionShielding = 1; visual = "injury_legs"; + minimalHit = 0.01; }; class HitRightLeg: HitLeftLeg { name = "leg_r"; }; }; + class ACE_SelfActions { #include "ACE_Medical_SelfActions.hpp" }; @@ -529,23 +523,19 @@ class CfgVehicles { class B_Soldier_04_f: B_Soldier_base_F { class HitPoints: HitPoints { - class HitHead: HitHead {}; - class HitBody: HitBody {}; - class HitHands: HitHands {}; - class HitLegs: HitLegs {}; - + class HitHead; + class HitBody; + class HitHands; + class HitLegs; class HitLeftArm: HitLeftArm { armor = ARM_LEG_ARMOR_BETTER; }; - class HitRightArm: HitRightArm { armor = ARM_LEG_ARMOR_BETTER; }; - class HitLeftLeg: HitLeftLeg { armor = ARM_LEG_ARMOR_BETTER; }; - class HitRightLeg: HitRightLeg { armor = ARM_LEG_ARMOR_BETTER; }; @@ -554,23 +544,19 @@ class CfgVehicles { class B_Soldier_05_f: B_Soldier_base_F { class HitPoints: HitPoints { - class HitHead: HitHead {}; - class HitBody: HitBody {}; - class HitHands: HitHands {}; - class HitLegs: HitLegs {}; - + class HitHead; + class HitBody; + class HitHands; + class HitLegs; class HitLeftArm: HitLeftArm { armor = ARM_LEG_ARMOR_BETTER; }; - class HitRightArm: HitRightArm { armor = ARM_LEG_ARMOR_BETTER; }; - class HitLeftLeg: HitLeftLeg { armor = ARM_LEG_ARMOR_BETTER; }; - class HitRightLeg: HitRightLeg { armor = ARM_LEG_ARMOR_BETTER; }; @@ -581,23 +567,19 @@ class CfgVehicles { class I_Soldier_03_F: I_Soldier_base_F { class HitPoints: HitPoints { - class HitHead: HitHead {}; - class HitBody: HitBody {}; - class HitHands: HitHands {}; - class HitLegs: HitLegs {}; - + class HitHead; + class HitBody; + class HitHands; + class HitLegs; class HitLeftArm: HitLeftArm { armor = ARM_LEG_ARMOR_BETTER; }; - class HitRightArm: HitRightArm { armor = ARM_LEG_ARMOR_BETTER; }; - class HitLeftLeg: HitLeftLeg { armor = ARM_LEG_ARMOR_BETTER; }; - class HitRightLeg: HitRightLeg { armor = ARM_LEG_ARMOR_BETTER; }; @@ -606,23 +588,19 @@ class CfgVehicles { class I_Soldier_04_F: I_Soldier_base_F { class HitPoints: HitPoints { - class HitHead: HitHead {}; - class HitBody: HitBody {}; - class HitHands: HitHands {}; - class HitLegs: HitLegs {}; - + class HitHead; + class HitBody; + class HitHands; + class HitLegs; class HitLeftArm: HitLeftArm { armor = ARM_LEG_ARMOR_BETTER; }; - class HitRightArm: HitRightArm { armor = ARM_LEG_ARMOR_BETTER; }; - class HitLeftLeg: HitLeftLeg { armor = ARM_LEG_ARMOR_BETTER; }; - class HitRightLeg: HitRightLeg { armor = ARM_LEG_ARMOR_BETTER; }; @@ -631,61 +609,88 @@ class CfgVehicles { class O_Soldier_base_F: SoldierEB { class HitPoints: HitPoints { - class HitHead: HitHead {}; - class HitBody: HitBody {}; - class HitHands: HitHands {}; - class HitLegs: HitLegs {}; - + class HitHead; + class HitBody; + class HitHands; + class HitLegs; class HitLeftArm: HitLeftArm { armor = ARM_LEG_ARMOR_CSAT; - passThrough = 0.85; }; - class HitRightArm: HitRightArm { armor = ARM_LEG_ARMOR_CSAT; - passThrough = 0.85; }; - class HitLeftLeg: HitLeftLeg { armor = ARM_LEG_ARMOR_CSAT; - passThrough = 0.85; }; - class HitRightLeg: HitRightLeg { armor = ARM_LEG_ARMOR_CSAT; - passThrough = 0.85; }; }; }; class O_Soldier_02_F: O_Soldier_base_F { class HitPoints: HitPoints { - class HitHead: HitHead {}; - class HitBody: HitBody {}; - class HitHands: HitHands {}; - class HitLegs: HitLegs {}; - + class HitHead; + class HitBody; + class HitHands; + class HitLegs; class HitLeftArm: HitLeftArm { armor = ARM_LEG_ARMOR_CSAT; - passThrough = 0.85; }; - class HitRightArm: HitRightArm { armor = ARM_LEG_ARMOR_CSAT; - passThrough = 0.85; }; - class HitLeftLeg: HitLeftLeg { armor = ARM_LEG_ARMOR_CSAT; - passThrough = 0.85; }; + class HitRightLeg: HitRightLeg { + armor = ARM_LEG_ARMOR_CSAT; + }; + }; + }; + class O_officer_F: O_Soldier_base_F { + class HitPoints: HitPoints { + class HitHead; + class HitBody; + class HitHands; + class HitLegs; + class HitLeftArm: HitLeftArm { + armor = ARM_LEG_ARMOR_CSAT; // @todo is that suppossed to be the case? + }; + class HitRightArm: HitRightArm { + armor = ARM_LEG_ARMOR_CSAT; + }; + class HitLeftLeg: HitLeftLeg { + armor = ARM_LEG_ARMOR_CSAT; + }; class HitRightLeg: HitRightLeg { armor = ARM_LEG_ARMOR_CSAT; - passThrough = 0.85; }; }; }; + + class O_Protagonist_VR_F: O_Soldier_base_F { + class HitPoints: HitPoints { + class HitHead; + class HitBody; + class HitHands; + class HitLegs; + class HitLeftArm: HitLeftArm { + armor = 2; + }; + class HitRightArm: HitRightArm { + armor = 2; + }; + class HitLeftLeg: HitLeftLeg { + armor = 2; + }; + class HitRightLeg: HitRightLeg { + armor = 2; + }; + }; + }; + class MapBoard_altis_F; class ACE_bodyBagObject: MapBoard_altis_F { XEH_ENABLED; diff --git a/addons/medical/XEH_init.sqf b/addons/medical/XEH_init.sqf index 0ded7d471f0..acdd50ce82d 100644 --- a/addons/medical/XEH_init.sqf +++ b/addons/medical/XEH_init.sqf @@ -1,10 +1,12 @@ #include "script_component.hpp" -private ["_unit"]; -_unit = _this select 0; +params ["_unit"]; _unit addEventHandler ["HandleDamage", {_this call FUNC(handleDamage)}]; if (local _unit) then { - [_unit] call FUNC(init); + if (!EGVAR(common,settingsInitFinished)) exitWith { + EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(init), [_unit]]; + }; + [_unit] call FUNC(init); }; diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index f9f821eeb3b..e6f7837e24e 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -11,10 +11,9 @@ GVAR(heartBeatSounds_Slow) = ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2"]; ["interactMenuClosed", {[objNull, false] call FUNC(displayPatientInformation); }] call EFUNC(common,addEventHandler); ["medical_onUnconscious", { - if (local (_this select 0)) then { - private ["_unit"]; - _unit = _this select 0; - if (_this select 1) then { + params ["_unit", "_status"]; + if (local _unit) then { + if (_status) then { _unit setVariable ["tf_globalVolume", 0.4]; _unit setVariable ["tf_voiceVolume", 0, true]; _unit setVariable ["tf_unable_to_use_radio", true, true]; @@ -35,10 +34,8 @@ GVAR(heartBeatSounds_Slow) = ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2"]; // Initialize all effects _fnc_createEffect = { - private ["_type", "_layer", "_default", "_effect"]; - _type = _this select 0; - _layer = _this select 1; - _default = _this select 2; + private "_effect"; + params ["_type", "_layer", "_default"]; _effect = ppEffectCreate [_type, _layer]; _effect ppEffectForceInNVG true; @@ -245,30 +242,28 @@ GVAR(lastHeartBeatSound) = ACE_time; }, 0, []] call CBA_fnc_addPerFrameHandler; -if (USE_WOUND_EVENT_SYNC) then { - // broadcast injuries to JIP clients in a MP session - if (isMultiplayer && hasInterface) then { - ["playerChanged", { - EXPLODE_2_PVT(_this,_newPlayer,_oldPlayer); - if (alive _newPlayer) then { - // We are only pulling the wounds for the units in the player group. Anything else will come when the unit interacts with them. - { - [_x, _newPlayer] call FUNC(requestWoundSync); - }foreach units group _newPlayer; - }; - }] call EFUNC(common,addEventhandler); + +["SettingsInitialized", { + if (GVAR(level) == 2) exitwith { + [ + {(((_this select 0) getvariable [QGVAR(bloodVolume), 100]) < 65)}, + {(((_this select 0) getvariable [QGVAR(pain), 0]) - ((_this select 0) getvariable [QGVAR(painSuppress), 0])) > 0.9}, + {(([_this select 0] call FUNC(getBloodLoss)) > 0.25)}, + {((_this select 0) getvariable [QGVAR(inReviveState), false])}, + {((_this select 0) getvariable [QGVAR(inCardiacArrest), false])}, + {((_this select 0) getvariable ["ACE_isDead", false])}, + {(((_this select 0) getvariable [QGVAR(airwayStatus), 100]) < 80)} + ] call FUNC(addUnconsciousCondition); }; -}; -[ - {(((_this select 0) getvariable [QGVAR(bloodVolume), 100]) < 65)}, - {(((_this select 0) getvariable [QGVAR(pain), 0]) - ((_this select 0) getvariable [QGVAR(painSuppress), 0])) > 0.9}, - {(([_this select 0] call FUNC(getBloodLoss)) > 0.25)}, - {((_this select 0) getvariable [QGVAR(inReviveState), false])}, - {((_this select 0) getvariable [QGVAR(inCardiacArrest), false])}, - {((_this select 0) getvariable ["ACE_isDead", false])}, - {(((_this select 0) getvariable [QGVAR(airwayStatus), 100]) < 80)} -] call FUNC(addUnconsciousCondition); + [ + {(((_this select 0) getvariable [QGVAR(bloodVolume), 100]) < 40)}, + {(((_this select 0) getvariable [QGVAR(pain), 0]) - ((_this select 0) getvariable [QGVAR(painSuppress), 0])) > 0.6}, + {(([_this select 0] call FUNC(getBloodLoss)) > 0.1)}, + {((_this select 0) getvariable [QGVAR(inReviveState), false])}, + {((_this select 0) getvariable ["ACE_isDead", false])} + ] call FUNC(addUnconsciousCondition); +}] call EFUNC(common,addEventHandler); // Prevent all types of interaction while unconscious // @todo: probably remove this when CBA keybind hold key works properly diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index 838dce74044..2625bf4b8a1 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -84,6 +84,7 @@ PREP(treatmentAdvanced_medication); PREP(treatmentAdvanced_medicationLocal); PREP(treatmentAdvanced_surgicalKit_onProgress); PREP(treatmentBasic_bandage); +PREP(treatmentBasic_bandageLocal); PREP(treatmentBasic_bloodbag); PREP(treatmentBasic_bloodbagLocal); PREP(treatmentBasic_epipen); diff --git a/addons/medical/XEH_respawn.sqf b/addons/medical/XEH_respawn.sqf index 44060fa15c7..b5b07bf1413 100644 --- a/addons/medical/XEH_respawn.sqf +++ b/addons/medical/XEH_respawn.sqf @@ -1,11 +1,8 @@ #include "script_component.hpp" -private ["_unit"]; - -_unit = _this select 0; - -if !(local _unit) exitWith {}; +params ["_unit"]; +// reset all variables. @todo GROUP respawn? [_unit] call FUNC(init); // Reset captive status for respawning unit diff --git a/addons/medical/functions/fnc_actionCheckBloodPressure.sqf b/addons/medical/functions/fnc_actionCheckBloodPressure.sqf index 646e472f708..889cc90de9c 100644 --- a/addons/medical/functions/fnc_actionCheckBloodPressure.sqf +++ b/addons/medical/functions/fnc_actionCheckBloodPressure.sqf @@ -7,15 +7,12 @@ * 1: The patient * * Return Value: -* NONE +* None * * Public: No */ #include "script_component.hpp" -private ["_caller","_target","_selectionName"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; +params ["_caller", "_target", "_selectionName"]; [[_caller, _target, _selectionName], QUOTE(DFUNC(actionCheckBloodPressureLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ diff --git a/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf b/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf index 92120a280ce..9d061460fee 100644 --- a/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf +++ b/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf @@ -7,25 +7,22 @@ * 1: The patient * * Return Value: - * NONE + * None * * Public: No */ #include "script_component.hpp" -private ["_caller","_target","_selectionName","_bloodPressure","_bloodPressureHigh","_bloodPressureLow", "_logOutPut", "_output"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; +private ["_bloodPressure", "_logOutPut", "_output"]; +params ["_caller", "_target", "_selectionName"]; -_bloodPressure = [_target] call FUNC(getBloodPressure); -if (!alive _target) then { - _bloodPressure = [0,0]; +_bloodPressure = if (!alive _target) then { + [0,0] +} else { + [_target] call FUNC(getBloodPressure) }; - -_bloodPressureHigh = _bloodPressure select 1; -_bloodPressureLow = _bloodPressure select 0; +_bloodPressure params ["_bloodPressureHigh", "_bloodPressureLow"]; _output = ""; _logOutPut = ""; if ([_caller] call FUNC(isMedic)) then { diff --git a/addons/medical/functions/fnc_actionCheckPulse.sqf b/addons/medical/functions/fnc_actionCheckPulse.sqf index f615c69983d..8c2c6cf1091 100644 --- a/addons/medical/functions/fnc_actionCheckPulse.sqf +++ b/addons/medical/functions/fnc_actionCheckPulse.sqf @@ -7,15 +7,13 @@ * 1: The patient * * Return Value: -* NONE +* None * * Public: No */ #include "script_component.hpp" -private ["_caller","_target","_selectionName"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; +params ["_caller","_target", "_selectionName"]; [[_caller, _target, _selectionName], QUOTE(DFUNC(actionCheckPulseLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ + diff --git a/addons/medical/functions/fnc_actionCheckPulseLocal.sqf b/addons/medical/functions/fnc_actionCheckPulseLocal.sqf index f719aad2d8a..94f3e6ad34c 100644 --- a/addons/medical/functions/fnc_actionCheckPulseLocal.sqf +++ b/addons/medical/functions/fnc_actionCheckPulseLocal.sqf @@ -7,17 +7,15 @@ * 1: The patient * * Return Value: - * NONE + * None * * Public: No */ #include "script_component.hpp" -private ["_caller", "_unit", "_selectionName", "_heartRateOutput", "_heartRate", "_logOutPut"]; -_caller = _this select 0; -_unit = _this select 1; -_selectionName = _this select 2; +private ["_heartRateOutput", "_heartRate", "_logOutPut"]; +params ["_caller", "_unit", "_selectionName"]; _heartRate = _unit getvariable [QGVAR(heartRate), 80]; if (!alive _unit) then { diff --git a/addons/medical/functions/fnc_actionCheckResponse.sqf b/addons/medical/functions/fnc_actionCheckResponse.sqf index b5df63047e1..6910545a9da 100644 --- a/addons/medical/functions/fnc_actionCheckResponse.sqf +++ b/addons/medical/functions/fnc_actionCheckResponse.sqf @@ -7,23 +7,17 @@ * 1: The patient * * Return Value: - * NONE + * None * * Public: No */ #include "script_component.hpp" -private ["_caller","_target", "_output"]; -_caller = _this select 0; -_target = _this select 1; +private ["_output"]; +params ["_caller", "_target"]; -_output = ""; -if ([_target] call EFUNC(common,isAwake)) then { - _output = LSTRING(Check_Response_Responsive); -} else { - _output = LSTRING(Check_Response_Unresponsive); -}; +_output = [LSTRING(Check_Response_Unresponsive), LSTRING(Check_Response_Responsive)] select ([_target] call EFUNC(common,isAwake)); ["displayTextStructured", [_caller], [[_output, [_target] call EFUNC(common,getName)], 2, _caller]] call EFUNC(common,targetEvent); diff --git a/addons/medical/functions/fnc_actionDiagnose.sqf b/addons/medical/functions/fnc_actionDiagnose.sqf index 243edbdef8c..5cc0d307daf 100644 --- a/addons/medical/functions/fnc_actionDiagnose.sqf +++ b/addons/medical/functions/fnc_actionDiagnose.sqf @@ -7,16 +7,15 @@ * 1: The patient * * Return Value: -* NONE +* None * * Public: No */ #include "script_component.hpp" -private ["_caller", "_target", "_genericMessages"]; -_caller = _this select 0; -_target = _this select 1; +private "_genericMessages"; +params ["_caller", "_target"]; _genericMessages = [LSTRING(diagnoseMessage)]; diff --git a/addons/medical/functions/fnc_actionLoadUnit.sqf b/addons/medical/functions/fnc_actionLoadUnit.sqf index 03d9a3ef543..42a94997d87 100644 --- a/addons/medical/functions/fnc_actionLoadUnit.sqf +++ b/addons/medical/functions/fnc_actionLoadUnit.sqf @@ -7,20 +7,18 @@ * 1: The patient * * Return Value: - * NONE + * None * * Public: No */ #include "script_component.hpp" -private ["_caller", "_target","_vehicle"]; -_caller = _this select 0; -_target = _this select 1; +private "_vehicle"; +params ["_caller", "_target"]; if ([_target] call EFUNC(common,isAwake)) exitwith { - // TODO localization - ["displayTextStructured", [_caller], [["This person (%1) is awake and cannot be loaded", [_target] call EFUNC(common,getName)], 1.5, _caller]] call EFUNC(common,targetEvent); + ["displayTextStructured", [_caller], [[LSTRING(CanNotLoaded), [_target] call EFUNC(common,getName)], 1.5, _caller]] call EFUNC(common,targetEvent); }; if ([_target] call FUNC(isBeingCarried)) then { [_caller, _target] call EFUNC(dragging,dropObject_carry); diff --git a/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf b/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf index 73f9eeca4db..f416535701f 100644 --- a/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf +++ b/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf @@ -14,9 +14,8 @@ #include "script_component.hpp" -PARAMS_2(_caller,_target); - private ["_position", "_headPos", "_spinePos", "_dirVect", "_direction", "_bodyBag"]; +params ["_caller", "_target"]; if (alive _target) then { [_target, true] call FUNC(setDead); diff --git a/addons/medical/functions/fnc_actionRemoveTourniquet.sqf b/addons/medical/functions/fnc_actionRemoveTourniquet.sqf index a14dbc3bcd2..b920f276f0b 100644 --- a/addons/medical/functions/fnc_actionRemoveTourniquet.sqf +++ b/addons/medical/functions/fnc_actionRemoveTourniquet.sqf @@ -8,17 +8,15 @@ * 2: SelectionName * * Return Value: - * NONE + * None * * Public: Yes */ #include "script_component.hpp" -private ["_caller", "_target", "_part", "_selectionName", "_tourniquets", "_output"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; +private ["_part", "_tourniquets", "_output"]; +params ["_caller", "_target", "_selectionName"]; // grab the required data _part = [_selectionName] call FUNC(selectionNameToNumber); @@ -26,7 +24,7 @@ _tourniquets = _target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; // Check if there is a tourniquet on this bodypart if ((_tourniquets select _part) == 0) exitwith { - _output = "There is no tourniquet on this body part!"; + _output = LSTRING(noTourniquetOnBodyPart); ["displayTextStructured", [_caller], [_output, 1.5, _caller]] call EFUNC(common,targetEvent); }; diff --git a/addons/medical/functions/fnc_actionUnloadUnit.sqf b/addons/medical/functions/fnc_actionUnloadUnit.sqf index a73f32265a4..6bb4f5beedc 100644 --- a/addons/medical/functions/fnc_actionUnloadUnit.sqf +++ b/addons/medical/functions/fnc_actionUnloadUnit.sqf @@ -5,23 +5,20 @@ * Arguments: * 0: The medic * 1: The patient - * 2: Drag after unload + * 2: Drag after unload (default: false) * * Return Value: - * NONE + * None * * Public: No */ #include "script_component.hpp" -private ["_caller", "_target", "_drag"]; -_caller = _this select 0; -_target = _this select 1; -_drag = if (count _this > 2) then {_this select 2} else {false}; +params ["_caller", "_target", ["_drag", false]]; // cannot unload a unit not in a vehicle. if (vehicle _target == _target) exitwith {}; if (([_target] call EFUNC(common,isAwake))) exitwith {}; -["unloadPersonEvent", _target, [_target, vehicle _target]] call EFUNC(common,targetEvent) \ No newline at end of file +["unloadPersonEvent", _target, [_target, vehicle _target]] call EFUNC(common,targetEvent) diff --git a/addons/medical/functions/fnc_addHeartRateAdjustment.sqf b/addons/medical/functions/fnc_addHeartRateAdjustment.sqf index f4516a100c0..7171eee2757 100644 --- a/addons/medical/functions/fnc_addHeartRateAdjustment.sqf +++ b/addons/medical/functions/fnc_addHeartRateAdjustment.sqf @@ -9,18 +9,15 @@ * 3: callback * * Return Value: - * nil + * None * * Public: Yes */ #include "script_component.hpp" -private ["_unit", "_value", "_time", "_adjustment", "_callBack"]; -_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_Param; -_value = [_this, 1, 0, [0]] call BIS_fnc_Param; -_time = [_this, 2, 1, [0]] call BIS_fnc_Param; -_callBack = [_this, 3, {}, [{}]] call BIS_fnc_Param; + +params [["_unit", objNull, [objNull]], ["_value", 0, [0]], ["_time", 1, [0]], ["_callBack", {}, [{}]]]; _adjustment = _unit getvariable [QGVAR(heartRateAdjustments), []]; _adjustment pushback [_value, _time, _callBack]; diff --git a/addons/medical/functions/fnc_addToInjuredCollection.sqf b/addons/medical/functions/fnc_addToInjuredCollection.sqf index 083f949d9d0..0ed9b9747f1 100644 --- a/addons/medical/functions/fnc_addToInjuredCollection.sqf +++ b/addons/medical/functions/fnc_addToInjuredCollection.sqf @@ -6,16 +6,14 @@ * 0: The Unit * * ReturnValue: - * + * None * * Public: Yes */ #include "script_component.hpp" -private ["_unit", "_force"]; -_unit = _this select 0; -_force = if (count _this > 1) then {_this select 1} else {false}; +params ["_unit", ["_force", false]]; if ([_unit] call FUNC(hasMedicalEnabled) || _force) then { @@ -27,13 +25,13 @@ if ([_unit] call FUNC(hasMedicalEnabled) || _force) then { _unit setvariable [QGVAR(addedToUnitLoop), true, true]; [{ - private ["_unit", "_interval"]; - _unit = (_this select 0) select 0; - _interval = ACE_time - ((_this select 0) select 1); + params ["_args", "_idPFH"]; + _args params ["_unit", "_interval"]; + _interval = ACE_time - _interval; (_this select 0) set [1, ACE_time]; - + if (!alive _unit || !local _unit) then { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; if (!local _unit) then { if (GVAR(level) >= 2) then { _unit setvariable [QGVAR(heartRate), _unit getvariable [QGVAR(heartRate), 80], true]; @@ -47,9 +45,12 @@ if ([_unit] call FUNC(hasMedicalEnabled) || _force) then { private "_pain"; _pain = _unit getvariable [QGVAR(pain), 0]; if (_pain > (_unit getvariable [QGVAR(painSuppress), 0])) then { - if (_pain > 0.7 && {random(1) > 0.6}) then { + // This introduces wierd unconscious behaviour for basic medical and possibly also advanced. + // TODO This is disabled as it's considered non critical code. + // We will need to decide if we want unconscious triggered on high pain levels or if we can get rid of this entirely. + /*if (_pain > 0.7 && {random(1) > 0.6}) then { [_unit] call FUNC(setUnconscious); - }; + };*/ [_unit, _pain] call FUNC(playInjuredSound); }; diff --git a/addons/medical/functions/fnc_addToLog.sqf b/addons/medical/functions/fnc_addToLog.sqf index af7d9f3170d..3b071948f30 100644 --- a/addons/medical/functions/fnc_addToLog.sqf +++ b/addons/medical/functions/fnc_addToLog.sqf @@ -9,28 +9,24 @@ * 3: The arguments for localization * * Return Value: - * nil + * None * * Public: Yes */ #include "script_component.hpp" -private ["_unit", "_type", "_message", "_arguments", "_lastNumber", "_moment", "_logVarName", "_log","_newLog", "_logs"]; -_unit = _this select 0; -_type = _this select 1; -_message = _this select 2; -_arguments = _this select 3; +private ["_moment", "_logVarName", "_log","_newLog", "_logs"]; +params ["_unit", "_type", "_message", "_arguments"]; if (!local _unit) exitwith { - [_this, QUOTE(DFUNC(addToLog)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ + [_this, QFUNC(addToLog), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ }; -_lastNumber = date select 4; -_moment = format["%1:%2",date select 3, _lastNumber]; -if (_lastNumber < 10) then { - _moment = format["%1:0%2",date select 3, _lastNumber]; -}; +date params ["", "", "", "_minute", "_hour"]; + +_moment = format [ (["%1:%2", "%1:0%2"] select (_minute < 10)), _hour, _minute]; + _logVarName = format[QGVAR(logFile_%1), _type]; _log = _unit getvariable [_logVarName, []]; @@ -41,10 +37,10 @@ if (count _log >= 8) then { if (_foreachIndex > 0) then { _newLog pushback _x; }; - }foreach _log; + } foreach _log; _log = _newLog; }; -_log pushback [_message,_moment,_type, _arguments]; +_log pushback [_message, _moment, _type, _arguments]; _unit setvariable [_logVarName, _log, true]; ["medical_onLogEntryAdded", [_unit, _type, _message, _arguments]] call EFUNC(common,localEvent); diff --git a/addons/medical/functions/fnc_addToTriageCard.sqf b/addons/medical/functions/fnc_addToTriageCard.sqf index 7495c04a8a3..56b2042bc92 100644 --- a/addons/medical/functions/fnc_addToTriageCard.sqf +++ b/addons/medical/functions/fnc_addToTriageCard.sqf @@ -7,16 +7,15 @@ * 1: The new item classname * * Return Value: - * nil + * None * * Public: Yes */ #include "script_component.hpp" -private ["_unit", "_newItem", "_log", "_inList", "_amount"]; -_unit = _this select 0; -_newItem = _this select 1; +private ["_log", "_inList", "_amount"]; +params ["_unit", "_newItem"]; if (!local _unit) exitwith { [_this, QUOTE(DFUNC(addToTriageList)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ @@ -36,7 +35,7 @@ _amount = 1; _amount = (_info select 1); _inList = true; }; -}foreach _log; +} foreach _log; if (!_inList) then { _log pushback [_newItem, 1, ACE_time]; diff --git a/addons/medical/functions/fnc_addUnconsciousCondition.sqf b/addons/medical/functions/fnc_addUnconsciousCondition.sqf index 579a55ca1f6..6a867088da9 100644 --- a/addons/medical/functions/fnc_addUnconsciousCondition.sqf +++ b/addons/medical/functions/fnc_addUnconsciousCondition.sqf @@ -3,14 +3,13 @@ * Adds new condition for the unconscious state. Conditions are not actively checked for units unless unit is in unconscious state. * * Arguments: - * 0: Code, should return a boolean + * 0-N: Code, should return a boolean * * ReturnValue: - * + * None * * Public: Yes */ - #include "script_component.hpp" if (isnil QGVAR(unconsciousConditions)) then { @@ -21,5 +20,5 @@ if (typeName _this == typeName []) then { if (typeName _x == typeName {}) then { GVAR(unconsciousConditions) pushback _x; }; - }foreach _this; + } foreach _this; }; diff --git a/addons/medical/functions/fnc_addUnloadPatientActions.sqf b/addons/medical/functions/fnc_addUnloadPatientActions.sqf index 13a4177859f..f29b3923f18 100644 --- a/addons/medical/functions/fnc_addUnloadPatientActions.sqf +++ b/addons/medical/functions/fnc_addUnloadPatientActions.sqf @@ -13,8 +13,7 @@ * Public: No */ #include "script_component.hpp" - -EXPLODE_3_PVT(_this,_vehicle,_player,_parameters); +params ["_vehicle", "_player", "_parameters"]; private ["_actions", "_unit"]; _actions = []; diff --git a/addons/medical/functions/fnc_adjustPainLevel.sqf b/addons/medical/functions/fnc_adjustPainLevel.sqf index 7e6ce2d5f1a..df82e06823d 100644 --- a/addons/medical/functions/fnc_adjustPainLevel.sqf +++ b/addons/medical/functions/fnc_adjustPainLevel.sqf @@ -18,10 +18,10 @@ private ["_pain"]; -PARAMS_2(_unit,_addedPain); - +params ["_unit", "_addedPain"]; //Only run on local units: if (!local _unit) exitWith {ERROR("unit is not local");}; +TRACE_3("ACE_DEBUG: adjustPainLevel Called",_unit, _pain, _addedPain); //Ignore if medical system disabled: if (GVAR(level) == 0) exitWith {}; diff --git a/addons/medical/functions/fnc_canAccessMedicalEquipment.sqf b/addons/medical/functions/fnc_canAccessMedicalEquipment.sqf index 4b1940b7e3a..2aecfb9a124 100644 --- a/addons/medical/functions/fnc_canAccessMedicalEquipment.sqf +++ b/addons/medical/functions/fnc_canAccessMedicalEquipment.sqf @@ -14,9 +14,8 @@ #include "script_component.hpp" -private ["_target", "_caller", "_accessLevel", "_return"]; -_caller = _this select 0; -_target = _this select 1; +private ["_accessLevel", "_return"]; +params ["_caller", "_target"]; _accessLevel = _target getvariable [QGVAR(allowSharedEquipmentAccess), -1]; @@ -28,4 +27,4 @@ if (_accessLevel >= 0) then { if (_accessLevel == 2) exitwith { _return = (group _target == group _caller); }; }; -_return; \ No newline at end of file +_return; diff --git a/addons/medical/functions/fnc_canTreat.sqf b/addons/medical/functions/fnc_canTreat.sqf index e0cab954208..ba6ced04865 100644 --- a/addons/medical/functions/fnc_canTreat.sqf +++ b/addons/medical/functions/fnc_canTreat.sqf @@ -16,36 +16,35 @@ #include "script_component.hpp" -private ["_caller", "_target", "_selectionName", "_className", "_config", "_medicRequired", "_items", "_locations", "_return", "_condition", "_patientStateCondition", "_allowedSelections"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_className = _this select 3; +private ["_config", "_medicRequired", "_items", "_locations", "_return", "_condition", "_patientStateCondition", "_allowedSelections"]; +params ["_caller", "_target", "_selectionName", "_className"]; -if !(_target isKindOf "CAManBase") exitWith {false}; +if !(_target isKindOf "CAManBase") exitWith { false }; + + +_config = (ConfigFile >> "ACE_Medical_Actions" >> (["Basic", "Advanced"] select (GVAR(level)>=2)) >> _className); -_config = (ConfigFile >> "ACE_Medical_Actions" >> "Basic" >> _className); -if (GVAR(level)>=2) then { - _config = (ConfigFile >> "ACE_Medical_Actions" >> "Advanced" >> _className); -}; if !(isClass _config) exitwith {false}; +// Allow self treatment check +if (_caller == _target && {getNumber (_config >> "allowSelfTreatment") == 0}) exitwith {false}; + _medicRequired = if (isNumber (_config >> "requiredMedic")) then { getNumber (_config >> "requiredMedic"); } else { // Check for required class if (isText (_config >> "requiredMedic")) exitwith { - missionNamespace getvariable [(getText (_config >> "requiredMedic")), 0]; + missionNamespace getvariable [(getText (_config >> "requiredMedic")), 0] }; 0; }; -if !([_caller, _medicRequired] call FUNC(isMedic)) exitwith {false}; +if !([_caller, _medicRequired] call FUNC(isMedic)) exitwith { false }; _items = getArray (_config >> "items"); -if (count _items > 0 && {!([_caller, _target, _items] call FUNC(hasItems))}) exitwith {false}; +if (count _items > 0 && {!([_caller, _target, _items] call FUNC(hasItems))}) exitwith { false }; _allowedSelections = getArray (_config >> "allowedSelections"); -if !("All" in _allowedSelections || {(_selectionName in _allowedSelections)}) exitwith {false}; +if !("All" in _allowedSelections || {(_selectionName in _allowedSelections)}) exitwith { false }; _return = true; if (getText (_config >> "condition") != "") then { @@ -61,7 +60,7 @@ if (getText (_config >> "condition") != "") then { _return = [_caller, _target, _selectionName, _className] call _condition; }; }; -if (!_return) exitwith {false}; +if (!_return) exitwith { false }; _patientStateCondition = if (isText(_config >> "patientStateCondition")) then { missionNamespace getvariable [getText(_config >> "patientStateCondition"), 0] @@ -71,7 +70,7 @@ _patientStateCondition = if (isText(_config >> "patientStateCondition")) then { if (_patientStateCondition == 1 && {!([_target] call FUNC(isInStableCondition))}) exitwith {false}; _locations = getArray (_config >> "treatmentLocations"); -if ("All" in _locations) exitwith {true}; +if ("All" in _locations) exitwith { true }; private [ "_medFacility", "_medVeh"]; _medFacility = {([_caller] call FUNC(isInMedicalFacility)) || ([_target] call FUNC(isInMedicalFacility))}; @@ -93,6 +92,6 @@ _medVeh = {([_caller] call FUNC(isInMedicalVehicle)) || ([_target] call FUNC(isI }; }; }; -}foreach _locations; +} foreach _locations; _return; diff --git a/addons/medical/functions/fnc_canTreatCached.sqf b/addons/medical/functions/fnc_canTreatCached.sqf index b1dfaf7d124..273da7dc4bf 100644 --- a/addons/medical/functions/fnc_canTreatCached.sqf +++ b/addons/medical/functions/fnc_canTreatCached.sqf @@ -17,6 +17,7 @@ #include "script_component.hpp" #define MAX_DURATION_CACHE 2 +params ["", "_target", "_selection", "_classname"]; // parameters, function, namespace, uid -[_this, DFUNC(canTreat), _this select 1, format[QGVAR(canTreat_%1_%2), _this select 2, _this select 3], MAX_DURATION_CACHE, "clearConditionCaches"] call EFUNC(common,cachedCall); +[_this, DFUNC(canTreat), _target, format [QGVAR(canTreat_%1_%2), _selection, _classname], MAX_DURATION_CACHE, "clearConditionCaches"] call EFUNC(common,cachedCall); diff --git a/addons/medical/functions/fnc_copyDeadBody.sqf b/addons/medical/functions/fnc_copyDeadBody.sqf index 85fea5eafcf..9cd43dada6e 100644 --- a/addons/medical/functions/fnc_copyDeadBody.sqf +++ b/addons/medical/functions/fnc_copyDeadBody.sqf @@ -7,16 +7,15 @@ * 1: The caller * * Return Value: - * OBJECT Returns the copy of the unit. If no copy could be made, returns the oldBody + * Returns the copy of the unit. If no copy could be made, returns the oldBody * * Public: No */ #include "script_component.hpp" -private ["_oldBody","_newUnit","_class","_group","_position","_side", "_caller", "_name"]; -_oldBody = _this select 0; -_caller = _this select 1; +private ["_newUnit", "_class", "_group", "_position", "_side", "_name"]; +params ["_oldBody", "_caller"]; if (alive _oldBody) exitwith {_oldBody}; // we only want to do this for dead bodies diff --git a/addons/medical/functions/fnc_createLitter.sqf b/addons/medical/functions/fnc_createLitter.sqf index a3b71b7f9cb..c234574abc5 100644 --- a/addons/medical/functions/fnc_createLitter.sqf +++ b/addons/medical/functions/fnc_createLitter.sqf @@ -3,11 +3,16 @@ * Spawns litter for the treatment action on the ground around the target * * Arguments: - * 0: The target - * 1: The treatment classname + * 0: The Caller + * 1: The target + * 2: The treatment Selection Name + * 3: The treatment classname + * 4: ? + * 5: Users of Items + * 6: Previous Damage * * Return Value: - * + * None * * Public: No */ @@ -16,13 +21,8 @@ #define MIN_ENTRIES_LITTER_CONFIG 3 -private ["_target", "_className", "_config", "_litter", "_createLitter", "_position", "_createdLitter", "_caller", "_selectionName", "_usersOfItems", "_previousDamage"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_className = _this select 3; -_usersOfItems = _this select 5; -_previousDamage = _this select 6; +private ["_config", "_litter", "_createLitter", "_position", "_createdLitter"]; +params ["_caller", "_target", "_selectionName", "_className", "", "_usersOfItems", "_previousDamage"]; if !(GVAR(allowLitterCreation)) exitwith {}; if (vehicle _caller != _caller || vehicle _target != _target) exitwith {}; @@ -38,25 +38,24 @@ if !(isArray (_config >> "litter")) exitwith {}; _litter = getArray (_config >> "litter"); _createLitter = { - private["_position", "_litterClass", "_direction"]; - + private["_position", "_direction"]; + params ["_unit", "_litterClass"]; // @TODO: handle carriers over water // For now, don't spawn litter if we are over water to avoid floating litter - if(surfaceIsWater (getPos (_this select 0))) exitWith { false }; - - _position = getPosATL (_this select 0); - _position = [_position select 0, _position select 1, 0]; - _litterClass = _this select 1; - if (random(1) >= 0.5) then { - _position = [(_position select 0) + random 1, (_position select 1) + random 1, _position select 2]; + if(surfaceIsWater (getPos _unit)) exitWith { false }; + + _position = getPosATL _unit; + _position params ["_posX", "_posY"]; + _position = if (random(1) >= 0.5) then { + [_posX + random 1, _posY + random 1, 0] } else { - _position = [(_position select 0) - random 1, (_position select 1) - random 1, _position select 2]; + [_posX - random 1, _posY - random 1, 0]; }; _direction = (random 360); // Create the litter, and timeout the event based on the cleanup delay // The cleanup delay for events in MP is handled by the server side - [QGVAR(createLitter), [_litterClass,_position,_direction], 0] call EFUNC(common,syncedEvent); + [QGVAR(createLitter), [_litterClass, _position, _direction], 0] call EFUNC(common,syncedEvent); true }; @@ -65,11 +64,10 @@ _createdLitter = []; { if (typeName _x == "ARRAY") then { if (count _x < MIN_ENTRIES_LITTER_CONFIG) exitwith {}; - private ["_selection", "_litterCondition", "_litterOptions"]; - _selection = _x select 0; + + _x params ["_selection", "_litterCondition", "_litterOptions"]; + if (toLower _selection in [toLower _selectionName, "all"]) then { // in is case sensitve. We can be forgiving here, so lets use toLower. - _litterCondition = _x select 1; - _litterOptions = _x select 2; if (isnil _litterCondition) then { _litterCondition = if (_litterCondition != "") then {compile _litterCondition} else {{true}}; @@ -88,8 +86,8 @@ _createdLitter = []; if (typeName _x == "STRING") then { [_target, _x] call _createLitter; }; - }foreach _litterOptions; + } foreach _litterOptions; }; }; }; -}foreach _litter; \ No newline at end of file +} foreach _litter; diff --git a/addons/medical/functions/fnc_determineIfFatal.sqf b/addons/medical/functions/fnc_determineIfFatal.sqf index bad15dbcadb..10a64d79a6c 100644 --- a/addons/medical/functions/fnc_determineIfFatal.sqf +++ b/addons/medical/functions/fnc_determineIfFatal.sqf @@ -1,19 +1,21 @@ -/** - * fn_determineIfFatal.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: Glowbal + * Determine If Fatal * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * 0: Unit + * 1: Part + * 2: with Damage (default: 0) + * + * Return Value: + * None + * + * Public: No */ - #include "script_component.hpp" -private ["_unit","_part","_damageThreshold", "_withDamage", "_damageBodyPart"]; -_unit = _this select 0; -_part = _this select 1; -_withDamage = if (count _this > 2) then { _this select 2} else {0}; +private ["_damageThreshold", "_damageBodyPart"]; +params ["_unit", "_part", ["_withDamage", 0]]; if (!alive _unit) exitwith {true}; if (_part < 0 || _part > 5) exitwith {false}; @@ -36,7 +38,7 @@ if (_part == 0) exitwith { // Check if damage to body part is higher as damage torso if (_part == 1) exitwith { - (_damageBodyPart >= (_damageThreshold select 1) && {(random(1) > 0.2)}); + (_damageBodyPart >= (_damageThreshold select 1) && {(random(1) > 0.35)}); }; // Check if damage to body part is higher as damage limbs (_damageBodyPart >= (_damageThreshold select 2) && {(random(1) > 0.95)}); diff --git a/addons/medical/functions/fnc_displayPatientInformation.sqf b/addons/medical/functions/fnc_displayPatientInformation.sqf index e1813283182..f73376cb29f 100644 --- a/addons/medical/functions/fnc_displayPatientInformation.sqf +++ b/addons/medical/functions/fnc_displayPatientInformation.sqf @@ -4,10 +4,11 @@ * * Arguments: * 0: The Unit - * 1: Show + * 1: Show (default: true) + * 2: Selection (default: 0) * * ReturnValue: - * nil + * None * * Public: No */ @@ -17,13 +18,11 @@ // Exit for basic medical if (GVAR(level) < 2) exitWith {}; -private ["_target", "_show", "_selectionN", "_amountOfGeneric", "_bandagedwounds", "_logCtrl", "_part", "_partText", "_pointDamage", "_severity", "_total", "_totalIvVolume", "_triageStatus", "_type"]; -_target = _this select 0; -_show = if (count _this > 1) then {_this select 1} else {true}; -_selectionN = if (count _this > 2) then {_this select 2} else {0}; +private ["_amountOfGeneric", "_bandagedwounds", "_logCtrl", "_part", "_partText", "_pointDamage", "_severity", "_total", "_totalIvVolume", "_triageStatus", "_type"]; +params ["_target", ["_show", true], ["_selectionN", 0]]; -GVAR(currentSelectedSelectionN) = if (typeName _selectionN == "SCALAR") then {_selectionN} else {0}; -GVAR(displayPatientInformationTarget) = if (_show) then {_target} else {ObjNull}; +GVAR(currentSelectedSelectionN) = [0, _selectionN] select (IS_SCALAR(_selectionN)); +GVAR(displayPatientInformationTarget) = [ObjNull, _target] select _show; if (USE_WOUND_EVENT_SYNC) then { [_target, ACE_player] call FUNC(requestWoundSync); @@ -34,22 +33,22 @@ if (_show) then { [{ private ["_target", "_display", "_alphaLevel", "_damaged", "_availableSelections", "_openWounds", "_selectionBloodLoss", "_red", "_green", "_blue", "_alphaLevel", "_allInjuryTexts", "_lbCtrl", "_genericMessages"]; - _target = (_this select 0) select 0; - _selectionN = (_this select 0) select 1; + params ["_args", "_idPFH"]; + _args params ["_target", "_selectionN"]; if (GVAR(displayPatientInformationTarget) != _target || GVAR(currentSelectedSelectionN) != _selectionN) exitwith { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; if (ACE_player distance _target > MAX_DISTANCE) exitwith { ("ACE_MedicalRscDisplayInformation" call BIS_fnc_rscLayer) cutText ["","PLAIN"]; - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; ["displayTextStructured", [ACE_player], [[LSTRING(DistanceToFar), [_target] call EFUNC(common,getName)], 1.75, ACE_player]] call EFUNC(common,targetEvent); }; disableSerialization; _display = uiNamespace getvariable QGVAR(DisplayInformation); if (isnil "_display") exitwith { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; _allInjuryTexts = []; @@ -81,7 +80,7 @@ if (_show) then { if !(isnil "_value") then { _totalIvVolume = _totalIvVolume + (_target getvariable [_x, 0]); }; - }foreach GVAR(IVBags); + } foreach GVAR(IVBags); if (_totalIvVolume >= 1) then { _genericMessages pushback [format[localize LSTRING(receivingIvVolume), floor _totalIvVolume], [1, 1, 1, 1]]; }; @@ -92,33 +91,33 @@ if (_show) then { _openWounds = _target getvariable [QGVAR(openWounds), []]; private "_amountOf"; { - _amountOf = _x select 3; + _x params ["", "_x1", "_selectionX", "_amountOf", "_x4"]; // Find how much this bodypart is bleeding if (_amountOf > 0) then { - _damaged set[_x select 2, true]; - _selectionBloodLoss set [(_x select 2), (_selectionBloodLoss select (_x select 2)) + (20 * ((_x select 4) * _amountOf))]; + _damaged set[_selectionX, true]; + _selectionBloodLoss set [_selectionX, (_selectionBloodLoss select _selectionX) + (20 * (_x4 * _amountOf))]; - if (_selectionN == (_x select 2)) then { + if (_selectionN == _selectionX) then { // Collect the text to be displayed for this injury [ Select injury class type definition - select the classname DisplayName (6th), amount of injuries for this] if (_amountOf >= 1) then { // TODO localization - _allInjuryTexts pushback [format["%2x %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6, _amountOf], [1,1,1,1]]; + _allInjuryTexts pushback [format["%2x %1", (GVAR(AllWoundInjuryTypes) select _x1) select 6, _amountOf], [1,1,1,1]]; } else { // TODO localization - _allInjuryTexts pushback [format["Partial %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6], [1,1,1,1]]; + _allInjuryTexts pushback [format["Partial %1", (GVAR(AllWoundInjuryTypes) select _x1) select 6], [1,1,1,1]]; }; }; }; - }foreach _openWounds; + } foreach _openWounds; _bandagedwounds = _target getvariable [QGVAR(bandagedWounds), []]; { - _amountOf = _x select 3; + _x params ["", "", "_selectionX", "_amountOf", "_x4"]; // Find how much this bodypart is bleeding - if !(_damaged select (_x select 2)) then { - _selectionBloodLoss set [(_x select 2), (_selectionBloodLoss select (_x select 2)) + (20 * ((_x select 4) * _amountOf))]; + if !(_damaged select _selectionX) then { + _selectionBloodLoss set [_selectionX, (_selectionBloodLoss select _selectionX) + (20 * (_x4 * _amountOf))]; }; - if (_selectionN == (_x select 2)) then { + if (_selectionN == _selectionX) then { // Collect the text to be displayed for this injury [ Select injury class type definition - select the classname DisplayName (6th), amount of injuries for this] if (_amountOf > 0) then { if (_amountOf >= 1) then { @@ -130,7 +129,7 @@ if (_show) then { }; }; }; - }foreach _bandagedwounds; + } foreach _bandagedwounds; } else { _damaged = [true, true, true, true, true, true]; { @@ -160,7 +159,7 @@ if (_show) then { _availableSelections = [50,51,52,53,54,55]; { - private ["_red", "_green", "_blue"]; + private ["_red", "_green", "_blue", "_total"]; _total = _x; _red = 1; @@ -177,20 +176,22 @@ if (_show) then { }; }; (_display displayCtrl (_availableSelections select _foreachIndex)) ctrlSetTextColor [_red, _green, _blue, 1.0]; - }foreach _selectionBloodLoss; + } foreach _selectionBloodLoss; _lbCtrl = (_display displayCtrl 200); lbClear _lbCtrl; { - _lbCtrl lbAdd (_x select 0); - _lbCtrl lbSetColor [_foreachIndex, _x select 1]; - }foreach _genericMessages; + _x params ["_add", "_color"]; + _lbCtrl lbAdd _add; + _lbCtrl lbSetColor [_foreachIndex, _color]; + } foreach _genericMessages; _amountOfGeneric = count _genericMessages; { - _lbCtrl lbAdd (_x select 0); - _lbCtrl lbSetColor [_foreachIndex + _amountOfGeneric, _x select 1]; - }foreach _allInjuryTexts; + _x params ["_add", "_color"]; + _lbCtrl lbAdd _add; + _lbCtrl lbSetColor [_foreachIndex + _amountOfGeneric, _color]; + } foreach _allInjuryTexts; if (count _allInjuryTexts == 0) then { _lbCtrl lbAdd (localize LSTRING(NoInjuriesBodypart)); }; @@ -202,9 +203,7 @@ if (_show) then { _logs = _target getvariable [QGVAR(logFile_Activity), []]; { // [_message,_moment,_type, _arguments] - _message = _x select 0; - _moment = _x select 1; - _arguments = _x select 3; + _x params ["_message", "_moment", "_type", "_arguments"]; if (isLocalized _message) then { _message = localize _message; }; @@ -213,10 +212,10 @@ if (_show) then { if (typeName _x == "STRING" && {isLocalized _x}) then { _arguments set [_foreachIndex, localize _x]; }; - }foreach _arguments; + } foreach _arguments; _message = format([_message] + _arguments); _logCtrl lbAdd format["%1 %2", _moment, _message]; - }foreach _logs; + } foreach _logs; _triageStatus = [_target] call FUNC(getTriageStatus); (_display displayCtrl 303) ctrlSetText (_triageStatus select 0); diff --git a/addons/medical/functions/fnc_displayTriageCard.sqf b/addons/medical/functions/fnc_displayTriageCard.sqf index c4ed4ad8298..9849242de1c 100644 --- a/addons/medical/functions/fnc_displayTriageCard.sqf +++ b/addons/medical/functions/fnc_displayTriageCard.sqf @@ -4,18 +4,18 @@ * * Arguments: * 0: The unit + * 1: Show (default: true) * * Return Value: - * nil + * None * * Public: Yes */ #include "script_component.hpp" -private ["_target", "_show", "_amount", "_item", "_log", "_message", "_triageCardTexts", "_triageStatus"]; -_target = _this select 0; -_show = if (count _this > 1) then {_this select 1} else {true}; +private ["_amount", "_item", "_log", "_message", "_triageCardTexts", "_triageStatus"]; +params ["_target", ["_show", true]]; GVAR(TriageCardTarget) = if (_show) then {_target} else {ObjNull}; @@ -25,15 +25,16 @@ if (_show) then { [{ private ["_target", "_display", "_alphaLevel", "_alphaLevel", "_lbCtrl"]; - _target = (_this select 0) select 0; + params ["_args", "_idPFH"]; + _args params ["_target"]; if (GVAR(TriageCardTarget) != _target) exitwith { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; disableSerialization; _display = uiNamespace getvariable QGVAR(triageCard); if (isnil "_display") exitwith { - [_this select 1] call CBA_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; _triageCardTexts = []; @@ -44,8 +45,7 @@ if (_show) then { _log = _target getvariable [QGVAR(triageCard), []]; { - _item = _x select 0; - _amount = _x select 1; + _x params ["_item", "_amount"]; _message = _item; if (isClass(configFile >> "CfgWeapons" >> _item)) then { _message = getText(configFile >> "CfgWeapons" >> _item >> "DisplayName"); @@ -55,18 +55,21 @@ if (_show) then { }; }; _triageCardTexts pushback format["%1x - %2", _amount, _message]; - }foreach _log; + } foreach _log; if (count _triageCardTexts == 0) then { _lbCtrl lbAdd (localize LSTRING(TriageCard_NoEntry)); }; { _lbCtrl lbAdd _x; - }foreach _triageCardTexts; + } foreach _triageCardTexts; _triageStatus = [_target] call FUNC(getTriageStatus); - (_display displayCtrl 2000) ctrlSetText (_triageStatus select 0); - (_display displayCtrl 2000) ctrlSetBackgroundColor (_triageStatus select 2); + + _triageStatus params ["_text", "", "_color"]; + + (_display displayCtrl 2000) ctrlSetText _text; + (_display displayCtrl 2000) ctrlSetBackgroundColor _color; }, 0, [_target]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/medical/functions/fnc_dropDownTriageCard.sqf b/addons/medical/functions/fnc_dropDownTriageCard.sqf index 6f30152c5f1..d207c7f9a42 100644 --- a/addons/medical/functions/fnc_dropDownTriageCard.sqf +++ b/addons/medical/functions/fnc_dropDownTriageCard.sqf @@ -3,18 +3,18 @@ * Display triage card for a unit * * Arguments: - * 0: The unit + * 0: Show * * Return Value: - * nil + * None * * Public: Yes */ #include "script_component.hpp" -private ["_show", "_ctrl", "_display", "_idc", "_pos"]; -_show = _this select 0; +private ["_ctrl", "_display", "_idc", "_pos"]; +params ["_show"]; disableSerialization; _display = uiNamespace getvariable QGVAR(triageCard); diff --git a/addons/medical/functions/fnc_getBloodLoss.sqf b/addons/medical/functions/fnc_getBloodLoss.sqf index 1881643d972..a3fdbd5b946 100644 --- a/addons/medical/functions/fnc_getBloodLoss.sqf +++ b/addons/medical/functions/fnc_getBloodLoss.sqf @@ -15,10 +15,9 @@ #define BLOODLOSSRATE_BASIC 0.2 -private ["_unit", "_totalBloodLoss","_tourniquets","_openWounds", "_cardiacOutput", "_internalWounds"]; +private ["_totalBloodLoss","_tourniquets","_openWounds", "_cardiacOutput", "_internalWounds"]; // TODO Only use this calculation if medium or higher, otherwise use vanilla calculations (for basic medical). - -_unit = _this select 0; +params ["_unit"]; _totalBloodLoss = 0; // Advanced medical bloodloss handling @@ -34,16 +33,17 @@ if (GVAR(level) >= 2) then { // (((BLOODLOSS_SMALL_WOUNDS * (_x select 0))) + ((BLOODLOSS_MEDIUM_WOUNDS * (_x select 1))) + ((BLOODLOSS_LARGE_WOUNDS * (_x select 2))) * (_cardiacOutput / DEFAULT_CARDIAC_OUTPUT)); }; - }foreach _openWounds; + } foreach _openWounds; _internalWounds = _unit getvariable [QGVAR(internalWounds), []]; { _totalBloodLoss = _totalBloodLoss + ((_x select 4) * (_x select 3)); - }foreach _internalWounds; + } foreach _internalWounds; // cap the blood loss to be no greater as the current cardiac output //(_totalBloodLoss min _cardiacOutput); } else { - _totalBloodLoss = BLOODLOSSRATE_BASIC * (damage _unit); + { _totalBloodLoss = _totalBloodLoss + _x } forEach (_unit getvariable [QGVAR(bodyPartStatus), []]); + _totalBloodLoss = (_totalBloodLoss / 6) * BLOODLOSSRATE_BASIC; }; _totalBloodLoss * ((_unit getVariable [QGVAR(bleedingCoefficient), GVAR(bleedingCoefficient)]) max 0); diff --git a/addons/medical/functions/fnc_getBloodPressure.sqf b/addons/medical/functions/fnc_getBloodPressure.sqf index f5012c8735f..659949d716b 100644 --- a/addons/medical/functions/fnc_getBloodPressure.sqf +++ b/addons/medical/functions/fnc_getBloodPressure.sqf @@ -6,29 +6,28 @@ * 0: The Unit * * ReturnValue: - * Blood Pressuret ,> + * 0: BloodPressure Low + * 1: BloodPressure High * * Public: No */ #include "script_component.hpp" -/* - Value is taken because with cardic output and resistance at default values, it will put blood pressure High at 120. -*/ +// Value is taken because with cardic output and resistance at default values, it will put blood pressure High at 120. #define MODIFIER_BP_HIGH 0.229 -/* - Value is taken because with cardic output and resistance at default values, it will put blood pressure Low at 80. -*/ +// Value is taken because with cardic output and resistance at default values, it will put blood pressure Low at 80. #define MODIFIER_BP_LOW 0.1524 -private ["_unit", "_bloodPressureLow", "_bloodPressureHigh", "_cardiacOutput", "_resistance"]; -_unit = _this select 0; +private ["_bloodPressureLow", "_bloodPressureHigh", "_cardiacOutput", "_resistance"]; + +params ["_unit"]; + _cardiacOutput = [_unit] call FUNC(getCardiacOutput); _resistance = _unit getvariable [QGVAR(peripheralResistance), 100]; _bloodPressureHigh = (_cardiacOutput * MODIFIER_BP_HIGH) * _resistance; _bloodPressureLow = (_cardiacOutput * MODIFIER_BP_LOW) * _resistance; -[_bloodPressureLow, _bloodPressureHigh]; +[_bloodPressureLow max 0, _bloodPressureHigh max 0] diff --git a/addons/medical/functions/fnc_getBloodVolumeChange.sqf b/addons/medical/functions/fnc_getBloodVolumeChange.sqf index 23eba4a0c7f..3524e15cb5b 100644 --- a/addons/medical/functions/fnc_getBloodVolumeChange.sqf +++ b/addons/medical/functions/fnc_getBloodVolumeChange.sqf @@ -28,10 +28,8 @@ */ #define BLOOD_CHANGE_PER_SECOND 0.0595 - - -private ["_unit","_bloodVolume","_bloodVolumeChange", "_ivVolume"]; -_unit = _this select 0; +private ["_bloodVolume", "_bloodVolumeChange", "_ivVolume"]; +params ["_unit"]; _bloodVolume = _unit getvariable [QGVAR(bloodVolume), 100]; _bloodVolumeChange = -([_unit] call FUNC(getBloodLoss)); @@ -43,13 +41,13 @@ if (_bloodVolume < 100.0) then { _ivVolume = (_unit getvariable [_x, 0]) + IV_CHANGE_PER_SECOND; _unit setvariable [_x,_ivVolume]; }; - }foreach GVAR(IVBags); + } foreach GVAR(IVBags); } else { { if ((_unit getvariable [_x, 0]) > 0) then { _unit setvariable [_x, 0]; // lets get rid of exessive IV volume }; - }foreach GVAR(IVBags); + } foreach GVAR(IVBags); }; _bloodVolumeChange; diff --git a/addons/medical/functions/fnc_getCardiacOutput.sqf b/addons/medical/functions/fnc_getCardiacOutput.sqf index 34d7be33afa..f24aa438ca6 100644 --- a/addons/medical/functions/fnc_getCardiacOutput.sqf +++ b/addons/medical/functions/fnc_getCardiacOutput.sqf @@ -22,7 +22,6 @@ // to limit the amount of complex calculations necessary, we take a set modifier to calculate Stroke Volume. #define MODIFIER_CARDIAC_OUTPUT 19.04761 -private "_unit"; -_unit = _this select 0; +params ["_unit"]; ((_unit getvariable [QGVAR(bloodVolume), 100])/MODIFIER_CARDIAC_OUTPUT) + ((_unit getvariable [QGVAR(heartRate), 80])/80-1); diff --git a/addons/medical/functions/fnc_getHeartRateChange.sqf b/addons/medical/functions/fnc_getHeartRateChange.sqf index 92a2053737b..d46733452ad 100644 --- a/addons/medical/functions/fnc_getHeartRateChange.sqf +++ b/addons/medical/functions/fnc_getHeartRateChange.sqf @@ -15,8 +15,9 @@ #define HEART_RATE_MODIFIER 0.02 -private ["_unit", "_heartRate", "_hrIncrease", "_bloodLoss", "_time", "_values", "_adjustment", "_change", "_callBack", "_bloodVolume"]; -_unit = _this select 0; +private ["_heartRate", "_hrIncrease", "_bloodLoss", "_time", "_values", "_adjustment", "_change", "_callBack", "_bloodVolume"]; +params ["_unit"]; + _hrIncrease = 0; if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then { _heartRate = _unit getvariable [QGVAR(heartRate), 80]; @@ -24,10 +25,8 @@ if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then { _adjustment = _unit getvariable [QGVAR(heartRateAdjustments), []]; { - _values = (_x select 0); + _x params ["_values", "_time", "_callBack"]; if (abs _values > 0) then { - _time = (_x select 1); - _callBack = _x select 2; if (_time <= 0) then { _time = 1; }; @@ -47,7 +46,7 @@ if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then { [_unit] call _callBack; }; - }foreach _adjustment; + } foreach _adjustment; _adjustment = _adjustment - [ObjNull]; _unit setvariable [QGVAR(heartRateAdjustments), _adjustment]; diff --git a/addons/medical/functions/fnc_getTriageStatus.sqf b/addons/medical/functions/fnc_getTriageStatus.sqf index 812c20ed2a9..4dcef530a3f 100644 --- a/addons/medical/functions/fnc_getTriageStatus.sqf +++ b/addons/medical/functions/fnc_getTriageStatus.sqf @@ -6,7 +6,9 @@ * 0: The unit * * Return Value: - * Triage status from the unit. Name, statusID, color > + * 0: Name + * 1: Status ID + * 2: Color > * * Public: Yes */ @@ -14,7 +16,7 @@ #include "script_component.hpp" private ["_unit","_return","_status"]; -_unit = _this select 0; +params ["_unit"]; _status = _unit getvariable [QGVAR(triageLevel), -1]; _return = switch (_status) do { case 1: {[localize LSTRING(Triage_Status_Minor), 1, [0, 0.5, 0, 0.9]]}; @@ -23,4 +25,4 @@ _return = switch (_status) do { case 4: {[localize LSTRING(Triage_Status_Deceased), 4, [0, 0, 0, 0.9]]}; default {[localize LSTRING(Triage_Status_None), 0, [0, 0, 0, 0.9]]}; }; -_return; +_return diff --git a/addons/medical/functions/fnc_getTypeOfDamage.sqf b/addons/medical/functions/fnc_getTypeOfDamage.sqf index d51131ce0c9..7a351e0b77f 100644 --- a/addons/medical/functions/fnc_getTypeOfDamage.sqf +++ b/addons/medical/functions/fnc_getTypeOfDamage.sqf @@ -13,23 +13,19 @@ #include "script_component.hpp" -PARAMS_1(_typeOfProjectile); +params ["_typeOfProjectile"]; -private ["_typeOfDamage"]; -_typeOfDamage = switch (true) do { - case (_typeOfProjectile isKindOf "BulletBase"): {"bullet"}; - case (_typeOfProjectile isKindOf "GrenadeCore"): {"grenade"}; - case (_typeOfProjectile isKindOf "TimeBombCore"): {"explosive"}; - case (_typeOfProjectile isKindOf "MineCore"): {"explosive"}; - case (_typeOfProjectile isKindOf "FuelExplosion"): {"explosive"}; - case (_typeOfProjectile isKindOf "ShellBase"): {"shell"}; - case (_typeOfProjectile isKindOf "RocketBase"): {"explosive"}; - case (_typeOfProjectile isKindOf "MissileBase"): {"explosive"}; - case (_typeOfProjectile isKindOf "LaserBombCore"): {"explosive"}; - case (_typeOfProjectile isKindOf "BombCore"): {"explosive"}; - case (_typeOfProjectile isKindOf "Grenade"): {"grenade"}; - default {toLower _typeOfProjectile}; -}; - -_typeOfDamage +if (_typeOfProjectile isKindOf "BulletBase") exitWith {"bullet"}; +if (_typeOfProjectile isKindOf "ShotgunBase") exitwith {"bullet"}; +if (_typeOfProjectile isKindOf "GrenadeCore") exitWith {"grenade"}; +if (_typeOfProjectile isKindOf "TimeBombCore") exitWith {"explosive"}; +if (_typeOfProjectile isKindOf "MineCore") exitWith {"explosive"}; +if (_typeOfProjectile isKindOf "FuelExplosion") exitWith {"explosive"}; +if (_typeOfProjectile isKindOf "ShellBase") exitWith {"shell"}; +if (_typeOfProjectile isKindOf "RocketBase") exitWith {"explosive"}; +if (_typeOfProjectile isKindOf "MissileBase") exitWith {"explosive"}; +if (_typeOfProjectile isKindOf "LaserBombCore") exitWith {"explosive"}; +if (_typeOfProjectile isKindOf "BombCore") exitWith {"explosive"}; +if (_typeOfProjectile isKindOf "Grenade") exitWith {"grenade"}; +toLower _typeOfProjectile diff --git a/addons/medical/functions/fnc_getUnconsciousCondition.sqf b/addons/medical/functions/fnc_getUnconsciousCondition.sqf index 19d3bdec1d1..c354dd6ebd7 100644 --- a/addons/medical/functions/fnc_getUnconsciousCondition.sqf +++ b/addons/medical/functions/fnc_getUnconsciousCondition.sqf @@ -14,7 +14,7 @@ #include "script_component.hpp" private ["_unit","_return"]; -_unit = _this select 0; +params ["_unit"]; if (isnil QGVAR(unconsciousConditions)) then { GVAR(unconsciousConditions) = []; @@ -25,6 +25,6 @@ _return = false; if (typeName _x == typeName {} && {([_unit] call _x)}) exitwith { _return = true; }; -}foreach GVAR(unconsciousConditions); +} foreach GVAR(unconsciousConditions); -_return; +_return diff --git a/addons/medical/functions/fnc_handleBandageOpening.sqf b/addons/medical/functions/fnc_handleBandageOpening.sqf index a86077cb3bb..4a32adb9e56 100644 --- a/addons/medical/functions/fnc_handleBandageOpening.sqf +++ b/addons/medical/functions/fnc_handleBandageOpening.sqf @@ -18,13 +18,8 @@ #include "script_component.hpp" -private ["_target", "_impact", "_part", "_injuryIndex", "_injury", "_bandage", "_classID", "_className", "_reopeningChance", "_reopeningMinDelay", "_reopeningMaxDelay", "_config", "_woundTreatmentConfig", "_bandagedWounds", "_exist", "_injuryId", "_existingInjury", "_delay", "_openWounds", "_selectedInjury", "_bandagedInjury"]; -_target = _this select 0; -_impact = _this select 1; -_part = _this select 2; -_injuryIndex = _this select 3; -_injury = _this select 4; -_bandage = _this select 5; +private ["_className", "_reopeningChance", "_reopeningMinDelay", "_reopeningMaxDelay", "_config", "_woundTreatmentConfig", "_bandagedWounds", "_exist", "_injuryId", "_existingInjury", "_delay", "_openWounds", "_selectedInjury", "_bandagedInjury"]; +params ["_target", "_impact", "_part", "_injuryIndex", "_injury", "_bandage"]; _classID = _injury select 1; _className = GVAR(woundClassNames) select _classID; @@ -57,8 +52,8 @@ if (isClass (_config >> _className)) then { }; _bandagedWounds = _target getvariable [QGVAR(bandagedWounds), []]; -_exist = false; _injuryType = _injury select 1; +_exist = false; _bandagedInjury = []; { if ((_x select 1) == _injuryType && (_x select 2) == (_injury select 2)) exitwith { @@ -69,7 +64,7 @@ _bandagedInjury = []; _bandagedInjury = _existingInjury; }; -}foreach _bandagedWounds; +} foreach _bandagedWounds; if !(_exist) then { // [ID, classID, bodypart, percentage treated, bloodloss rate] @@ -83,12 +78,8 @@ _target setvariable [QGVAR(bandagedWounds), _bandagedWounds, true]; if (random(1) <= _reopeningChance) then { _delay = _reopeningMinDelay + random(_reopeningMaxDelay - _reopeningMinDelay); [{ - private ["_target", "_impact", "_part", "_injuryIndex", "_bandage", "_injury", "_openWounds", "_selectedInjury","_bandagedWounds","_exist"]; - _target = _this select 0; - _impact = _this select 1; - _part = _this select 2; - _injuryIndex = _this select 3; - _injury = _this select 4; + private ["_bandage", "_openWounds", "_selectedInjury","_bandagedWounds","_exist"]; + params ["_target", "_impact", "_part", "_injuryIndex", "_injury"]; //if (alive _target) then { _openWounds = _target getvariable [QGVAR(openWounds), []]; @@ -108,7 +99,7 @@ if (random(1) <= _reopeningChance) then { _existingInjury set [3, ((_existingInjury select 3) - _impact) max 0]; _bandagedWounds set [_foreachIndex, _existingInjury]; }; - }foreach _bandagedWounds; + } foreach _bandagedWounds; if (_exist) then { _target setvariable [QGVAR(bandagedWounds), _bandagedWounds, true]; diff --git a/addons/medical/functions/fnc_handleCreateLitter.sqf b/addons/medical/functions/fnc_handleCreateLitter.sqf index d7595ec4394..31e65218c26 100644 --- a/addons/medical/functions/fnc_handleCreateLitter.sqf +++ b/addons/medical/functions/fnc_handleCreateLitter.sqf @@ -1,9 +1,22 @@ -//#define DEBUG_MODE_FULL +/* + * Author: Glowbal + * handle Litter Create + * + * Arguments: + * 0: Litter Class + * 1: Position + * 2: Unit + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" if(!hasInterface) exitWith { false }; -PARAMS_3(_litterClass,_position,_direction); +params ["_litterClass", "_position", "_unit"]; private["_litterObject", "_maxLitterCount"]; //IGNORE_PRIVATE_WARNING(_values); @@ -16,9 +29,9 @@ _litterObject = _litterClass createVehicleLocal _position; _litterObject setDir _direction; _litterObject setPosATL _position; // Move the litter next frame to get rid of HORRIBLE spacing, fixes #1112 -[{ (_this select 0) setPosATL (_this select 1); }, [_litterObject, _position]] call EFUNC(common,execNextFrame); - -_maxLitterCount = getArray (configFile >> "ACE_Settings" >> QGVAR(litterSimulationDetail) >> "_values") select GVAR(litterSimulationDetail); +[{ params ["_object", "_pos"]; _object setPosATL _pos; }, [_litterObject, _position]] call EFUNC(common,execNextFrame); + +_maxLitterCount = getArray (configFile >> "ACE_Settings" >> QGVAR(litterSimulationDetail) >> "_values") select GVAR(litterSimulationDetail); if((count GVAR(allCreatedLitter)) > _maxLitterCount ) then { // gank the first litter object, and spawn ours. private["_oldLitter"]; @@ -34,10 +47,11 @@ if(!GVAR(litterPFHRunning) && {GVAR(litterCleanUpDelay) > 0}) then { GVAR(litterPFHRunning) = true; [{ { - if (ACE_time - (_x select 0) >= GVAR(litterCleanUpDelay)) then { + _x params ["_time", "_objects"]; + if (ACE_time - _time >= GVAR(litterCleanUpDelay)) then { { deleteVehicle _x; - } forEach (_x select 1); + } forEach _objects; GVAR(allCreatedLitter) set[_foreachIndex, objNull]; }; } forEach GVAR(allCreatedLitter); @@ -46,8 +60,6 @@ if(!GVAR(litterPFHRunning) && {GVAR(litterCleanUpDelay) > 0}) then { if ( (count GVAR(allCreatedLitter)) == 0) exitwith { [(_this select 1)] call CBA_fnc_removePerFrameHandler; GVAR(litterPFHRunning) = false; - }; + }; }, 30, []] call CBA_fnc_addPerFrameHandler; }; - -true \ No newline at end of file diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index a4e5525276c..1a58e2ed01a 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -1,5 +1,5 @@ -/* - * Author: KoffeinFlummi, Glowbal + /* + * Author: KoffeinFlummi, Glowbal, commy2 * Main HandleDamage EH function. * * Arguments: @@ -14,74 +14,79 @@ * * Public: No */ - #include "script_component.hpp" -private ["_unit", "_selection", "_damage", "_shooter", "_projectile", "_damageReturn", "_typeOfDamage", "_minLethalDamage", "_newDamage", "_typeIndex", "_preventDeath"]; -_unit = _this select 0; -_selection = _this select 1; -_damage = _this select 2; -_shooter = _this select 3; -_projectile = _this select 4; +params ["_unit", "_selection", "_damage", "_shooter", "_projectile"]; +TRACE_5("ACE_DEBUG: HandleDamage Called",_unit, _selection, _damage, _shooter, _projectile); + +// bug, apparently can fire for remote units in special cases +if !(local _unit) exitWith { + TRACE_2("ACE_DEBUG: HandleDamage on remote unit!",_unit, isServer); + nil +}; -if !(local _unit) exitWith {nil}; +private ["_damageReturn", "_typeOfDamage", "_minLethalDamage", "_newDamage", "_typeIndex", "_preventDeath"]; +// bug, assumed fixed, @todo excessive testing, if nothing happens remove if (typeName _projectile == "OBJECT") then { _projectile = typeOf _projectile; _this set [4, _projectile]; }; -// If the damage is being weird, we just tell it to fuck off. -if !(_selection in (GVAR(SELECTIONS) + [""])) exitWith {0}; +TRACE_3("ACE_DEBUG: HandleDamage",_selection,_damage,_unit); + +// If damage is in dummy hitpoints, "hands" and "legs", don't change anything +if (_selection == "hands") exitWith {_unit getHit "hands"}; +if (_selection == "legs") exitWith {_unit getHit "legs"}; + +// If the damage is being weird, we just tell it to fuck off. Ignore: "hands", "legs", "?" +if (_selection != "" && {!(_selection in GVAR(SELECTIONS))}) exitWith {0}; //@todo "neck", "pelvis", "spine1", "spine2", "spine3" // Exit if we disable damage temporarily -_damageOld = damage _unit; -if (_selection in GVAR(SELECTIONS)) then { - _damageOld = _unit getHit _selection; +if !(_unit getVariable [QGVAR(allowDamage), true]) exitWith { + TRACE_3("ACE_DEBUG: HandleDamage damage disabled.",_selection,damage _unit,_unit); + if (_selection == "") then { + damage _unit + } else { + _unit getHit _selection + }; }; -if !(_unit getVariable [QGVAR(allowDamage), true]) exitWith {_damageOld}; // Get return damage _damageReturn = _damage; -if (GVAR(level) < 2) then { - _damageReturn = _this call FUNC(handleDamage_basic); + +_newDamage = _this call FUNC(handleDamage_caching); +// handleDamage_caching may have modified the projectile string +_typeOfDamage = [_projectile] call FUNC(getTypeOfDamage); + +TRACE_3("ACE_DEBUG: HandleDamage caching new damage",_selection,_newDamage,_unit); + +_typeIndex = (GVAR(allAvailableDamageTypes) find _typeOfDamage); +_minLethalDamage = if (_typeIndex >= 0) then { + GVAR(minLethalDamages) select _typeIndex } else { - if !([_unit] call FUNC(hasMedicalEnabled)) exitwith { - // Because of the config changes, we cannot properly disable the medical system for a unit. - // lets use basic for the ACE_time being.. - _damageReturn = _this call FUNC(handleDamage_basic); - }; - _newDamage = _this call FUNC(handleDamage_caching); - // handleDamage_caching may have modified the projectile string - _projectile = _this select 4; - _typeOfDamage = [_projectile] call FUNC(getTypeOfDamage); - - _typeIndex = (GVAR(allAvailableDamageTypes) find _typeOfDamage); - _minLethalDamage = 0.01; - if (_typeIndex >= 0) then { - _minLethalDamage = GVAR(minLethalDamages) select _typeIndex; - }; + 0.01 +}; - if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isNull _shooter} && {_projectile == ""} && {_selection == ""}) then { - if (GVAR(enableVehicleCrashes)) then { - _selection = GVAR(SELECTIONS) select (floor(random(count GVAR(SELECTIONS)))); - }; +if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isNull _shooter} && {_projectile == ""} && {_selection == ""}) then { + if (GVAR(enableVehicleCrashes)) then { + _selection = GVAR(SELECTIONS) select (floor(random(count GVAR(SELECTIONS)))); }; +}; - if ((_minLethalDamage <= _newDamage) && {[_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)}) then { - if ((_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)])) exitwith { - _damageReturn = 0.9; - }; - if ([_unit] call FUNC(setDead)) then { - _damageReturn = 1; - } else { - _damageReturn = _damageReturn min 0.89; - }; +if ((_minLethalDamage <= _newDamage) && {[_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)}) then { + if ((_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)])) exitwith { + _damageReturn = 0.9; + }; + if ([_unit] call FUNC(setDead)) then { + _damageReturn = 1; } else { _damageReturn = _damageReturn min 0.89; }; - +} else { + _damageReturn = _damageReturn min 0.89; }; + [_unit] call FUNC(addToInjuredCollection); if (_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)]) exitWith { @@ -123,4 +128,6 @@ if (((_unit getVariable [QGVAR(enableRevive), GVAR(enableRevive)]) > 0) && {_dam 0.89; }; -_damageReturn; +TRACE_3("ACE_DEBUG: HandleDamage damage return",_selection,_damageReturn,_unit); + +_damageReturn diff --git a/addons/medical/functions/fnc_handleDamage_advanced.sqf b/addons/medical/functions/fnc_handleDamage_advanced.sqf index e617738a905..214d291e865 100644 --- a/addons/medical/functions/fnc_handleDamage_advanced.sqf +++ b/addons/medical/functions/fnc_handleDamage_advanced.sqf @@ -12,23 +12,16 @@ * 6: Type of Damage * * Return Value: - * Nothing + * None * * Public: No */ #include "script_component.hpp" -private ["_unit","_selectionName","_amountOfDamage","_sourceOfDamage","_typeOfProjectile","_typeOfDamage", "_part", "_damageBodyParts", "_newDamage", "_hitPoints"]; -_unit = _this select 0; -_selectionName = _this select 1; -_amountOfDamage = _this select 2; -_sourceOfDamage = _this select 3; -_typeOfProjectile = _this select 4; -_newDamage = _this select 5; +private ["_typeOfProjectile", "_part", "_damageBodyParts", "_hitPoints"]; +params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfProjectile", "_newDamage"]; -// Most likely taking exessive fire damage. Lets exit. -if (isNull _sourceOfDamage && {_typeOfProjectile == ""} && {vehicle _unit == _unit} && {(_selectionName == "head" || isBurning _unit)}) exitwith {}; _part = [_selectionName] call FUNC(selectionNameToNumber); if (_part < 0) exitwith {}; @@ -40,6 +33,7 @@ _damageBodyParts set [_part, (_damageBodyParts select _part) + _newDamage]; _unit setvariable [QGVAR(bodyPartStatus), _damageBodyParts, true]; _typeOfDamage = [_typeOfProjectile] call FUNC(getTypeOfDamage); + [_unit, _selectionName, _newDamage, _typeOfProjectile, _typeOfDamage] call FUNC(handleDamage_assignWounds); // TODO Disabled until implemented fully diff --git a/addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf b/addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf index 3df8a5ce0c6..bac5a32976d 100644 --- a/addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf @@ -6,23 +6,23 @@ * 0: Unit for which the hitpoint damage will be sorted out * * Return Value: - * nil + * None * * Public: No */ #include "script_component.hpp" -PARAMS_1(_unit); +params ["_unit"]; if (!local _unit) exitwith {}; -private ["_bodyStatus", "_headDamage", "_torsoDamage", "_handsDamage", "_legsDamage"]; +private "_bodyStatus"; // ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"] _bodyStatus = _unit getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; -EXPLODE_6_PVT(_bodyStatus,_headDamage,_torsoDamage,_handsDamageR,_handsDamageL,_legsDamageR,_legsDamageL); +_bodyStatus params ["_headDamage", "_torsoDamage", "_handsDamageR", "_handsDamageL", "_legsDamageR", "_legsDamageL"]; _unit setHitPointDamage ["hitHead", _headDamage min 0.95]; _unit setHitPointDamage ["hitBody", _torsoDamage min 0.95]; diff --git a/addons/medical/functions/fnc_handleDamage_airway.sqf b/addons/medical/functions/fnc_handleDamage_airway.sqf index bc220eaad93..8b627faae18 100644 --- a/addons/medical/functions/fnc_handleDamage_airway.sqf +++ b/addons/medical/functions/fnc_handleDamage_airway.sqf @@ -10,19 +10,15 @@ * 4: Type of the damage done * * Return Value: - * None + * None * * Public: No */ #include "script_component.hpp" -private ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage", "_bodyPartn"]; -_unit = _this select 0; -_selectionName = _this select 1; -_amountOfDamage = _this select 2; -_sourceOfDamage = _this select 3; -_typeOfDamage = _this select 4; +private "_bodyPartn"; +params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage"]; _bodyPartn = [_selectionName] call FUNC(selectionNameToNumber); if (_bodyPartn > 1) exitwith {}; diff --git a/addons/medical/functions/fnc_handleDamage_basic.sqf b/addons/medical/functions/fnc_handleDamage_basic.sqf index 04049cfa7c5..43b0852e1bf 100644 --- a/addons/medical/functions/fnc_handleDamage_basic.sqf +++ b/addons/medical/functions/fnc_handleDamage_basic.sqf @@ -1,192 +1,60 @@ /* - * Author: KoffeinFlummi - * Basic HandleDamage EH function. + * Author: KoffeinFlummi, Glowbal + * Handle damage basic medical * * Arguments: - * 0: Unit That Was Hit - * 1: Name Of Hit Selection - * 2: Amount Of Damage - * 3: Shooter - * 4: Projectile - * 5: Current damage to be returned * * Return Value: - * Damage To Be Inflicted + * * * Public: No */ #include "script_component.hpp" -#define LEGDAMAGETRESHOLD1 1 -#define LEGDAMAGETRESHOLD2 1.7 -#define ARMDAMAGETRESHOLD1 1 -#define ARMDAMAGETRESHOLD2 1.7 -#define UNCONSCIOUSNESSTRESHOLD 0.7 +private ["_damageBodyParts", "_cache_params", "_cache_damages"]; +params ["_target"]; +TRACE_1("ACE_DEBUG: HandleDamage_BASIC Called",_target); -private ["_unit", "_selectionName", "_damage", "_shooter", "_projectile", "_damage", "_armdamage", "_hitPoint", "_index", "_legdamage", "_newDamage", "_otherDamage", "_pain", "_restore"]; +_damageBodyParts = _target getvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; +_cache_params = _target getVariable [QGVAR(cachedHandleDamageParams), []]; +_cache_damages = _target getVariable QGVAR(cachedDamages); -_unit = _this select 0; -_selectionName = _this select 1; -_damage = _this select 2; -_shooter = _this select 3; -_projectile = _this select 4; +TRACE_4("ACE_DEBUG: HandleDamage BASIC",_unit, _damageBodyParts,_cache_params,_cache_damages); -// Apply damage treshold / coefficient -_threshold = [ - _unit getVariable [QGVAR(damageThreshold), GVAR(AIDamageThreshold)], - _unit getVariable [QGVAR(damageThreshold), GVAR(playerDamageThreshold)] -] select ([_unit] call EFUNC(common,isPlayer)); -_damage = _damage * (1 / _threshold); +{ + _x params ["_unit","_selectionName","_amountOfDamage","_sourceOfDamage","_typeOfProjectile","_typeOfDamage"]; + if !(isNull _sourceOfDamage && {_typeOfProjectile == ""} && {vehicle _unit == _unit} && {(_selectionName == "head" || isBurning _unit)}) then { + _part = [_selectionName] call FUNC(selectionNameToNumber); + if (_part < 0) exitwith {}; -// This is a new hit, reset variables. -// Note: sometimes handleDamage spans over 2 or even 3 frames. -if (diag_frameno > (_unit getVariable [QGVAR(basic_frameNo), -3]) + 2) then { - _unit setVariable [QGVAR(basic_frameNo), diag_frameno]; - _unit setVariable [QGVAR(isFalling), false]; - _unit setVariable [QGVAR(projectiles), []]; - _unit setVariable [QGVAR(hitPoints), []]; - _unit setVariable [QGVAR(damages), []]; - _unit setVariable [QGVAR(structDamage), 0]; + private ["_newDamage", "_pain"]; + _newDamage = (_cache_damages select _foreachIndex); + _damageBodyParts set [_part, (_damageBodyParts select _part) + _newDamage]; + _unit setvariable [QGVAR(bodyPartStatus), _damageBodyParts]; - if (isnil {_unit getvariable QGVAR(structDamagePFH)}) then { - // Assign orphan structural damage to torso - [{ - private ["_unit", "_damagesum"]; - _unit = (_this select 0) select 0; - if (ACE_diagTime - (_unit getvariable [QGVAR(structDamagePFH),-2]) >= 2) then { - _unit setVariable [QGVAR(structDamagePFH), nil]; - _damagesum = (_unit getHitPointDamage "HitHead") + - (_unit getHitPointDamage "HitBody") + - (_unit getHitPointDamage "HitLeftArm") + - (_unit getHitPointDamage "HitRightArm") + - (_unit getHitPointDamage "HitLeftLeg") + - (_unit getHitPointDamage "HitRightLeg"); - if (_damagesum < 0.06 and damage _unit > 0.06 and alive _unit) then { - _unit setHitPointDamage ["HitBody", damage _unit]; - }; - [(_this select 1)] call cba_fnc_removePerFrameHandler; + if (alive _unit && {!(_unit getvariable ["ACE_isUnconscious", false])}) then { + // If it reaches this, we can assume that the hit did not kill this unit, as this function is called 3 frames after the damage has been passed. + if ([_unit, _part, if (_part > 1) then {_newDamage * 1.3} else {_newDamage * 2}] call FUNC(determineIfFatal)) then { + [_unit, true, 0.5+random(3)] call FUNC(setUnconscious); }; - }, 0, [_unit]] call CBA_fnc_addPerFrameHandler; - }; - _unit setVariable [QGVAR(structDamagePFH), ACE_diagTime]; // Assign starting ACE_time or reset it -}; - -_newDamage = _damage - (damage _unit); -if (_selectionName in GVAR(SELECTIONS)) then { - _newDamage = _damage - (_unit getHitPointDamage (GVAR(HITPOINTS) select (GVAR(SELECTIONS) find _selectionName))); -}; - -_damage = _damage - _newDamage; - - -// Exclude falling damage to everything other than legs and reduce it overall. -if (((velocity _unit) select 2 < -5) and (vehicle _unit == _unit)) then { - _unit setVariable [QGVAR(isFalling), true]; -}; -if (_unit getVariable [QGVAR(isFalling), false] and !(_selectionName in ["", "leg_l", "leg_r"])) exitWith { - (_unit getHitPointDamage (GVAR(HITPOINTS) select (GVAR(SELECTIONS) find _selectionName))) max 0.01; -}; -if (_unit getVariable [QGVAR(isFalling), false]) then { - _newDamage = _newDamage * 0.7; -}; - - -// Make sure there's only one damaged selection per projectile per frame. -if (_selectionName != "" and !(_unit getVariable QGVAR(isFalling))) then { - _cache_projectiles = _unit getVariable QGVAR(projectiles); - _cache_hitpoints = _unit getVariable QGVAR(hitPoints); - _cache_damages = _unit getVariable QGVAR(damages); - if (_projectile in _cache_projectiles) then { - _index = _cache_projectiles find _projectile; - _otherDamage = (_cache_damages select _index); - if (_otherDamage > _newDamage) then { - _newDamage = 0; - } else { - _hitPoint = _cache_hitpoints select _index; - _restore = ((_unit getHitPointDamage _hitPoint) - _otherDamage) max 0; - _unit setHitPointDamage [_hitPoint, _restore]; - // Make entry unfindable - _cache_projectiles set [_index, objNull]; - _cache_projectiles pushBack _projectile; - _cache_hitpoints pushBack (GVAR(HITPOINTS) select (GVAR(SELECTIONS) find _selectionName)); - _cache_damages pushBack _newDamage; }; - } else { - _cache_projectiles pushBack _projectile; - _cache_hitpoints pushBack (GVAR(HITPOINTS) select (GVAR(SELECTIONS) find _selectionName)); - _cache_damages pushBack _newDamage; - }; - _unit setVariable [QGVAR(projectiles), _cache_projectiles]; - _unit setVariable [QGVAR(hitPoints), _cache_hitpoints]; - _unit setVariable [QGVAR(damages), _cache_damages]; -}; - -// Get rid of double structural damage (seriously arma, what the fuck?) -if (_selectionName == "") then { - _cache_structDamage = _unit getVariable QGVAR(structDamage); - if (_newDamage > _cache_structDamage) then { - _unit setVariable [QGVAR(structDamage), _newDamage]; - _newDamage = _newDamage - _cache_structDamage; - } else { - _newDamage = 0; + _pain = _unit getVariable [QGVAR(pain), 0]; + _pain = _pain + (_newDamage / 4) * (1 - (_unit getVariable [QGVAR(morphine), 0])); + _unit setVariable [QGVAR(pain), _pain min 1, true]; }; -}; - -if (_selectionName == "") then { - _damage = _damage + (_unit getVariable QGVAR(structDamage)); -} else { - _damage = _damage + _newDamage; -}; - -// Leg Damage -_legdamage = (_unit getHitPointDamage "HitLeftLeg") + (_unit getHitPointDamage "HitRightLeg"); -if (_selectionName == "leg_l") then { - _legdamage = _damage + (_unit getHitPointDamage "HitRightLeg"); -}; -if (_selectionName == "leg_r") then { - _legdamage = (_unit getHitPointDamage "HitLeftLeg") + _damage; -}; - -if (_legdamage >= LEGDAMAGETRESHOLD1) then { - _unit setHitPointDamage ["HitLegs", 1]; -} else { - _unit setHitPointDamage ["HitLegs", 0]; -}; -// @todo: force prone for completely fucked up legs. - - -// Arm Damage -_armdamage = (_unit getHitPointDamage "HitLeftArm") + (_unit getHitPointDamage "HitRightArm"); -if (_selectionName == "hand_l") then { - _armdamage = _damage + (_unit getHitPointDamage "HitRightArm"); -}; -if (_selectionName == "hand_r") then { - _armdamage = (_unit getHitPointDamage "HitLeftArm") + _damage; -}; - -if (_armdamage >= ARMDAMAGETRESHOLD1) then { - _unit setHitPointDamage ["HitHands", 1]; -} else { - _unit setHitPointDamage ["HitHands", 0]; -}; -// @todo: Drop weapon for full damage. - +}foreach _cache_params; -// Set Pain -if (_selectionName == "") then { - _pain = _unit getVariable [QGVAR(pain), 0]; - _pain = _pain + _newDamage * (1 - (_unit getVariable [QGVAR(morphine), 0])); - _unit setVariable [QGVAR(pain), _pain min 1, true]; -}; +// We broadcast the value across the net here, in order to avoid broadcasting it multiple times earlier in the above code block +_target setvariable [QGVAR(bodyPartStatus), _damageBodyParts, true]; +TRACE_2("ACE_DEBUG: HandleDamage BASIC Broadcast value here",_unit, _target getvariable QGVAR(bodyPartStatus)); -// Unconsciousness -if (_selectionName == "" and - _damage >= UNCONSCIOUSNESSTRESHOLD and - _damage < 1 and - !(_unit getVariable ["ACE_isUnconscious", False] -)) then { - [_unit, true] call FUNC(setUnconscious); -}; +EXPLODE_6_PVT(_damageBodyParts,_headDamage,_torsoDamage,_handsDamageR,_handsDamageL,_legsDamageR,_legsDamageL); +_target setHitPointDamage ["hitHead", _headDamage min 0.95]; +_target setHitPointDamage ["hitBody", _torsoDamage min 0.95]; +_target setHitPointDamage ["hitHands", (_handsDamageR + _handsDamageL) min 0.95]; +_target setHitPointDamage ["hitLegs", (_legsDamageR + _legsDamageL) min 0.95]; -_damage +{ + _target setHitPointDamage [_x, (_damageBodyParts select _foreachIndex) min 0.95]; +}foreach GVAR(HITPOINTS); diff --git a/addons/medical/functions/fnc_handleDamage_caching.sqf b/addons/medical/functions/fnc_handleDamage_caching.sqf index 99816ee2742..41f93b954be 100644 --- a/addons/medical/functions/fnc_handleDamage_caching.sqf +++ b/addons/medical/functions/fnc_handleDamage_caching.sqf @@ -18,13 +18,9 @@ #include "script_component.hpp" -private ["_unit", "_selectionName", "_damage", "_source", "_projectile", "_hitSelections", "_hitPoints", "_impactVelocity", "_newDamage", "_cache_hitpoints", "_cache_projectiles", "_cache_params", "_cache_damages"]; -_unit = _this select 0; -_selectionName = _this select 1; -_damage = _this select 2; -_source = _this select 3; -_projectile = _this select 4; - +private ["_hitSelections", "_hitPoints", "_impactVelocity", "_newDamage", "_cache_hitpoints", "_cache_projectiles", "_cache_params", "_cache_damages"]; +params ["_unit", "_selectionName", "_damage", "_source", "_projectile"]; +TRACE_8("ACE_DEBUG: HandleDamage_Caching Called",_unit, _selectionName, _damage, _source, _projectile,GVAR(SELECTIONS),GVAR(HITPOINTS),damage _unit); _hitSelections = GVAR(SELECTIONS); _hitPoints = GVAR(HITPOINTS); @@ -78,21 +74,23 @@ if (diag_frameno > (_unit getVariable [QGVAR(frameNo_damageCaching), -3]) + 2) t // handle the cached damages 3 frames later [{ private ["_args", "_params"]; - _args = _this select 0; - - if (diag_frameno > (_args select 1) + 2) then { - (_args select 0) setDamage 0; - - _cache_params = (_args select 0) getVariable [QGVAR(cachedHandleDamageParams), []]; - _cache_damages = (_args select 0) getVariable QGVAR(cachedDamages); - { - _params = _x + [_cache_damages select _foreachIndex]; - _params call FUNC(handleDamage_advanced); - }foreach _cache_params; - - [(_args select 0)] call FUNC(handleDamage_advancedSetDamage); - - [(_this select 1)] call cba_fnc_removePerFrameHandler; + params ["_args", "_idPFH"]; + _args params ["_unit", "_frameno"]; + if (diag_frameno > _frameno + 2) then { + _unit setDamage 0; + + if (GVAR(level) < 2 || {!([_unit] call FUNC(hasMedicalEnabled))}) then { + [_unit] call FUNC(handleDamage_basic); + } else { + _cache_params = _unit getVariable [QGVAR(cachedHandleDamageParams), []]; + _cache_damages = _unit getVariable QGVAR(cachedDamages); + { + _params = _x + [_cache_damages select _foreachIndex]; + _params call FUNC(handleDamage_advanced); + } foreach _cache_params; + [_unit] call FUNC(handleDamage_advancedSetDamage); + }; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; }, 0, [_unit, diag_frameno] ] call CBA_fnc_addPerFrameHandler; @@ -152,4 +150,6 @@ if (_selectionName != "") then { _unit setVariable [QGVAR(cachedHandleDamageParams), _cache_params]; }; -_newDamage; +TRACE_8("ACE_DEBUG: HandleDamage_Caching",_unit, _newDamage, _cache_params, _cache_damages, _unit getVariable QGVAR(cachedProjectiles), _unit getVariable QGVAR(cachedHitPoints), _unit getVariable QGVAR(cachedDamages), _unit getVariable QGVAR(cachedHandleDamageParams)); + +_newDamage diff --git a/addons/medical/functions/fnc_handleDamage_fractures.sqf b/addons/medical/functions/fnc_handleDamage_fractures.sqf index 31fa1c88733..46000dbbdff 100644 --- a/addons/medical/functions/fnc_handleDamage_fractures.sqf +++ b/addons/medical/functions/fnc_handleDamage_fractures.sqf @@ -17,12 +17,8 @@ #include "script_component.hpp" -private ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage", "_bodyPartn", "_fractures", "_fractureType"]; -_unit = _this select 0; -_selectionName = _this select 1; -_amountOfDamage = _this select 2; -_sourceOfDamage = _this select 3; -_typeOfDamage = _this select 4; +private ["_bodyPartn", "_fractures", "_fractureType"]; +params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage"]; _bodyPartn = [_selectionName] call FUNC(selectionNameToNumber); _fractureType = 1; diff --git a/addons/medical/functions/fnc_handleDamage_internalInjuries.sqf b/addons/medical/functions/fnc_handleDamage_internalInjuries.sqf index 6ee256a9775..d8d9be1506b 100644 --- a/addons/medical/functions/fnc_handleDamage_internalInjuries.sqf +++ b/addons/medical/functions/fnc_handleDamage_internalInjuries.sqf @@ -10,19 +10,15 @@ * 4: Type of the damage done * * Return Value: - * None + * None * * Public: No */ #include "script_component.hpp" -private ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage", "_bodyPartn"]; -_unit = _this select 0; -_selectionName = _this select 1; -_amountOfDamage = _this select 2; -_sourceOfDamage = _this select 3; -_typeOfDamage = _this select 4; +private "_bodyPartn"; +params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage"]; _bodyPartn = [_selectionName] call FUNC(selectionNameToNumber); // TODO implement internal injuries diff --git a/addons/medical/functions/fnc_handleDamage_wounds.sqf b/addons/medical/functions/fnc_handleDamage_wounds.sqf index 70eeb74f9d1..ae032e6d649 100644 --- a/addons/medical/functions/fnc_handleDamage_wounds.sqf +++ b/addons/medical/functions/fnc_handleDamage_wounds.sqf @@ -10,19 +10,16 @@ * 4: Type of the damage done * * Return Value: - * None + * None * * Public: No */ #include "script_component.hpp" -private ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage", "_bodyPartn", "_injuryTypeInfo", "_allInjuriesForDamageType", "_allPossibleInjuries", "_highestPossibleDamage", "_highestPossibleSpot", "_minDamage", "_openWounds", "_woundID", "_toAddInjury", "_painToAdd", "_bloodLoss", "_bodyPartNToAdd", "_classType", "_damageLevels", "_foundIndex", "_i", "_injury", "_maxDamage", "_pain", "_painLevel", "_selections", "_toAddClassID", "_woundsCreated"]; -_unit = _this select 0; -_selectionName = _this select 1; -_damage = _this select 2; -_typeOfProjectile = _this select 3; -_typeOfDamage = _this select 4; +private ["_bodyPartn", "_injuryTypeInfo", "_allInjuriesForDamageType", "_allPossibleInjuries", "_highestPossibleDamage", "_highestPossibleSpot", "_minDamage", "_openWounds", "_woundID", "_toAddInjury", "_painToAdd", "_bloodLoss", "_bodyPartNToAdd", "_classType", "_damageLevels", "_foundIndex", "_i", "_injury", "_maxDamage", "_pain", "_painLevel", "_selections", "_toAddClassID", "_woundsCreated"]; +params ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage"]; +TRACE_6("ACE_DEBUG: HandleDamage Called",_unit, _selectionName, _damage, _shooter, _typeOfProjectile,_typeOfDamage); // Administration for open wounds and ids _openWounds = _unit getvariable[QGVAR(openWounds), []]; @@ -43,7 +40,7 @@ _foundIndex = -1; if (_x select 1 == _toAddClassID && {_x select 2 == _bodyPartNToAdd}) exitwith { _foundIndex = _foreachIndex; }; - }foreach _openWounds; + } foreach _openWounds; if (_foundIndex < 0) then { // Since it is a new injury, we will have to add it to the open wounds array to store it @@ -53,7 +50,7 @@ _foundIndex = -1; _injury = _openWounds select _foundIndex; _injury set [3, (_injury select 3) + 1]; }; -}foreach _woundsCreated; +} foreach _woundsCreated; _unit setvariable [QGVAR(openWounds), _openWounds, true]; @@ -64,3 +61,4 @@ if (count _woundsCreated > 0) then { _painLevel = _unit getvariable [QGVAR(pain), 0]; _unit setvariable [QGVAR(pain), _painLevel + _painToAdd]; +TRACE_6("ACE_DEBUG: HandleDamage_WoundsOLD",_unit, _painLevel, _painToAdd, _unit getvariable QGVAR(pain), _unit getvariable QGVAR(openWounds),_woundsCreated); diff --git a/addons/medical/functions/fnc_handleDamage_woundsOld.sqf b/addons/medical/functions/fnc_handleDamage_woundsOld.sqf index 1034ba9cae7..dc21012dd6d 100644 --- a/addons/medical/functions/fnc_handleDamage_woundsOld.sqf +++ b/addons/medical/functions/fnc_handleDamage_woundsOld.sqf @@ -17,12 +17,9 @@ #include "script_component.hpp" -private ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage", "_bodyPartn", "_injuryTypeInfo", "_allInjuriesForDamageType", "_allPossibleInjuries", "_highestPossibleDamage", "_highestPossibleSpot", "_minDamage", "_openWounds", "_woundID", "_toAddInjury", "_painToAdd", "_bloodLoss", "_bodyPartNToAdd", "_classType", "_damageLevels", "_foundIndex", "_i", "_injury", "_maxDamage", "_pain", "_painLevel", "_selections", "_toAddClassID", "_woundsCreated"]; -_unit = _this select 0; -_selectionName = _this select 1; -_damage = _this select 2; -_typeOfProjectile = _this select 3; -_typeOfDamage = _this select 4; +private ["_bodyPartn", "_injuryTypeInfo", "_allInjuriesForDamageType", "_allPossibleInjuries", "_highestPossibleDamage", "_highestPossibleSpot", "_minDamage", "_openWounds", "_woundID", "_toAddInjury", "_painToAdd", "_bloodLoss", "_bodyPartNToAdd", "_classType", "_damageLevels", "_foundIndex", "_i", "_injury", "_maxDamage", "_pain", "_painLevel", "_selections", "_toAddClassID", "_woundsCreated"]; +params ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage"]; +TRACE_6("ACE_DEBUG: HandleDamage_WoundsOLD Called",_unit, _selectionName, _damage, _shooter, _typeOfProjectile,_typeOfDamage); // Convert the selectionName to a number and ensure it is a valid selection. _bodyPartn = [_selectionName] call FUNC(selectionNameToNumber); @@ -70,7 +67,7 @@ _allPossibleInjuries = []; _allPossibleInjuries pushback _x; }; }; -}foreach _allInjuriesForDamageType; +} foreach _allInjuriesForDamageType; // No possible wounds available for this damage type or damage amount. if (_highestPossibleSpot < 0) exitwith {}; @@ -98,7 +95,7 @@ _woundsCreated = []; if (_x select 1 == _toAddClassID && {_x select 2 == _bodyPartNToAdd}) exitwith { _foundIndex = _foreachIndex; }; - }foreach _openWounds; + } foreach _openWounds; }; _injury = []; @@ -123,21 +120,15 @@ _woundsCreated = []; _painToAdd = _painToAdd + (_toAddInjury select 3); }; }; -}foreach (_injuryTypeInfo select 0); // foreach damage thresholds +} foreach (_injuryTypeInfo select 0); // foreach damage thresholds -_unit setvariable [QGVAR(openWounds), _openWounds, !USE_WOUND_EVENT_SYNC]; +_unit setvariable [QGVAR(openWounds), _openWounds, true]; // Only update if new wounds have been created if (count _woundsCreated > 0) then { -// _unit setvariable [QGVAR(lastUniqueWoundID), _woundID, true]; -}; - -if (USE_WOUND_EVENT_SYNC) then { - // Broadcast the new injuries across the net in parts. One broadcast per injury. Prevents having to broadcast one massive array of injuries. - { - // ["medical_propagateWound", [_unit, _x]] call EFUNC(common,globalEvent); - }foreach _woundsCreated; + _unit setvariable [QGVAR(lastUniqueWoundID), _woundID, true]; }; _painLevel = _unit getvariable [QGVAR(pain), 0]; _unit setvariable [QGVAR(pain), _painLevel + _painToAdd]; +TRACE_6("ACE_DEBUG: HandleDamage_WoundsOLD",_unit, _painLevel, _painToAdd, _unit getvariable QGVAR(pain), _unit getvariable QGVAR(openWounds),_woundsCreated); diff --git a/addons/medical/functions/fnc_handleKilled.sqf b/addons/medical/functions/fnc_handleKilled.sqf index 5003ec189c3..d6a4440d764 100644 --- a/addons/medical/functions/fnc_handleKilled.sqf +++ b/addons/medical/functions/fnc_handleKilled.sqf @@ -13,8 +13,8 @@ #include "script_component.hpp" -private["_unit", "_openWounds"]; -_unit = _this select 0; +private "_openWounds"; +params ["_unit"]; if (!local _unit) exitwith {}; _unit setvariable [QGVAR(pain), 0]; @@ -22,11 +22,4 @@ if (GVAR(level) >= 2) then { _unit setvariable [QGVAR(heartRate), 0]; _unit setvariable [QGVAR(bloodPressure), [0, 0]]; _unit setvariable [QGVAR(airwayStatus), 0]; - - if (USE_WOUND_EVENT_SYNC) then { - _openWounds = _unit getvariable [QGVAR(openWounds), []]; - { - ["medical_propagateWound", [_unit, _x]] call EFUNC(common,globalEvent); - }foreach _openWounds; - }; }; diff --git a/addons/medical/functions/fnc_handleLocal.sqf b/addons/medical/functions/fnc_handleLocal.sqf index c0f9c152920..50a30e90e8b 100644 --- a/addons/medical/functions/fnc_handleLocal.sqf +++ b/addons/medical/functions/fnc_handleLocal.sqf @@ -15,9 +15,7 @@ #include "script_component.hpp" -private["_unit", "_local"]; -_unit = _this select 0; -_local = _this select 1; +params ["_unit", "_local"]; if (_local) then { if (_unit getvariable[QGVAR(addedToUnitLoop),false]) then { [_unit, true] call FUNC(addToInjuredCollection); diff --git a/addons/medical/functions/fnc_handleUnitVitals.sqf b/addons/medical/functions/fnc_handleUnitVitals.sqf index 0c7113f69ac..fddf5489da0 100644 --- a/addons/medical/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical/functions/fnc_handleUnitVitals.sqf @@ -13,10 +13,9 @@ #include "script_component.hpp" -private ["_unit", "_heartRate","_bloodPressure","_bloodVolume","_painStatus", "_lastTimeValuesSynced", "_syncValues", "_airwayStatus", "_blood", "_bloodPressureH", "_bloodPressureL", "_interval"]; -_unit = _this select 0; -_interval = _this select 1; - +private ["_heartRate","_bloodPressure","_bloodVolume","_painStatus", "_lastTimeValuesSynced", "_syncValues", "_airwayStatus", "_blood"]; +params ["_unit", "_interval"]; +TRACE_3("ACE_DEBUG",_unit,_interval,_unit); if (_interval == 0) exitWith {}; _lastTimeValuesSynced = _unit getvariable [QGVAR(lastMomentValuesSynced), 0]; @@ -30,23 +29,28 @@ _bloodVolume = _bloodVolume max 0; _unit setvariable [QGVAR(bloodVolume), _bloodVolume, _syncValues]; +TRACE_3("ACE_DEBUG",_bloodVolume,_syncValues,_unit); // Set variables for synchronizing information across the net if (_bloodVolume < 100) then { if ((_bloodVolume < 90 && (GVAR(level) == 2)) || _bloodVolume <= 45) then { + TRACE_4("ACE_DEBUG_ADVANCED",_bloodVolume,_unit getVariable QGVAR(hasLostBlood),_syncValues,_unit); if (_unit getvariable [QGVAR(hasLostBlood), 0] != 2) then { _unit setvariable [QGVAR(hasLostBlood), 2, true]; }; } else { + TRACE_4("ACE_DEBUG", _bloodVolume,_unit getVariable QGVAR(hasLostBlood),_syncValues,_unit); if (_unit getvariable [QGVAR(hasLostBlood), 0] != 1) then { _unit setvariable [QGVAR(hasLostBlood), 1, true]; }; } } else { + TRACE_4("ACE_DEBUG",_bloodVolume,_unit getVariable QGVAR(hasLostBlood),_syncValues,_unit); if (_unit getvariable [QGVAR(hasLostBlood), 0] != 0) then { _unit setvariable [QGVAR(hasLostBlood), 0, true]; }; }; +TRACE_3("ACE_DEBUG",[_unit] call FUNC(getBloodLoss),_unit getVariable QGVAR(isBleeding),_unit); if (([_unit] call FUNC(getBloodLoss)) > 0) then { if !(_unit getvariable [QGVAR(isBleeding), false]) then { _unit setvariable [QGVAR(isBleeding), true, true]; @@ -58,6 +62,7 @@ if (([_unit] call FUNC(getBloodLoss)) > 0) then { }; _painStatus = _unit getvariable [QGVAR(pain), 0]; +TRACE_4("ACE_DEBUG",_painStatus,_unit getVariable QGVAR(hasPain),_unit getVariable QGVAR(painSuppress),_unit); if (_painStatus > (_unit getvariable [QGVAR(painSuppress), 0])) then { if !(_unit getvariable [QGVAR(hasPain), false]) then { _unit setvariable [QGVAR(hasPain), true, true]; @@ -69,6 +74,7 @@ if (_painStatus > (_unit getvariable [QGVAR(painSuppress), 0])) then { }; if (GVAR(level) == 1) then { + TRACE_5("ACE_DEBUG_BASIC_VITALS",_painStatus,_unit getVariable QGVAR(hasPain),_unit getVariable QGVAR(morphine),_syncValues,_unit); // reduce pain if (_painStatus > 0) then { _unit setVariable [QGVAR(pain), (_painStatus - 0.001 * _interval) max 0, _syncValues]; @@ -91,6 +97,7 @@ if (GVAR(level) == 1) then { // handle advanced medical, with vitals if (GVAR(level) >= 2) then { + TRACE_6("ACE_DEBUG_ADVANCED_VITALS",_painStatus,_bloodVolume, _unit getVariable QGVAR(hasPain),_unit getVariable QGVAR(morphine),_syncValues,_unit); if (_bloodVolume < 30) exitwith { [_unit] call FUNC(setDead); }; @@ -105,7 +112,7 @@ if (GVAR(level) >= 2) then { // Set the vitals _heartRate = (_unit getvariable [QGVAR(heartRate), 80]) + (([_unit] call FUNC(getHeartRateChange)) * _interval); - _unit setvariable [QGVAR(heartRate), _heartRate, _syncValues]; + _unit setvariable [QGVAR(heartRate), _heartRate max 0, _syncValues]; _bloodPressure = [_unit] call FUNC(getBloodPressure); _unit setvariable [QGVAR(bloodPressure), _bloodPressure, _syncValues]; @@ -114,7 +121,7 @@ if (GVAR(level) >= 2) then { _painReduce = if (_painStatus > 5) then {0.002} else {0.001}; _unit setVariable [QGVAR(pain), (_painStatus - _painReduce * _interval) max 0, _syncValues]; }; - + TRACE_8("ACE_DEBUG_ADVANCED_VITALS",_painStatus,_painReduce,_heartRate,_bloodVolume,_bloodPressure,_interval,_syncValues,_unit); // TODO Disabled until implemented fully // Handle airway /*if (GVAR(setting_allowAirwayInjuries)) then { @@ -140,8 +147,7 @@ if (GVAR(level) >= 2) then { // Check vitals for medical status // TODO check for in revive state instead of variable - _bloodPressureL = _bloodPressure select 0; - _bloodPressureH = _bloodPressure select 1; + _bloodPressure params ["_bloodPressureL", "_bloodPressureH"]; if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then { if (_heartRate < 10 || _bloodPressureH < 30 || _bloodVolume < 20) then { @@ -174,12 +180,13 @@ if (GVAR(level) >= 2) then { // syncing any remaining values if (_syncValues) then { + TRACE_3("ACE_DEBUG_IVBAGS_SYNC",GVAR(IVBags),_syncValues,_unit); { private "_value"; _value = _unit getvariable _x; if !(isnil "_value") then { _unit setvariable [_x,(_unit getvariable [_x, 0]), true]; }; - }foreach GVAR(IVBags); + } foreach GVAR(IVBags); }; }; diff --git a/addons/medical/functions/fnc_hasItem.sqf b/addons/medical/functions/fnc_hasItem.sqf index cfec633b550..df1a3828f5d 100644 --- a/addons/medical/functions/fnc_hasItem.sqf +++ b/addons/medical/functions/fnc_hasItem.sqf @@ -16,19 +16,17 @@ #include "script_component.hpp" private ["_medic", "_patient", "_item", "_return", "_crew"]; -_medic = _this select 0; -_patient = _this select 1; -_item = _this select 2; +params ["_medic", "_patient", "_item"]; if (isnil QGVAR(setting_allowSharedEquipment)) then { GVAR(setting_allowSharedEquipment) = true; }; if (GVAR(setting_allowSharedEquipment) && {[_patient, _item] call EFUNC(common,hasItem)}) exitwith { - true; + true }; if ([_medic, _item] call EFUNC(common,hasItem)) exitwith { - true; + true }; _return = false; @@ -38,7 +36,7 @@ if ((vehicle _medic != _medic) && {[vehicle _medic] call FUNC(isMedicalVehicle)} if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitwith { _return = true; }; - }foreach _crew; + } foreach _crew; }; -_return; +_return diff --git a/addons/medical/functions/fnc_hasItems.sqf b/addons/medical/functions/fnc_hasItems.sqf index ea16edebc42..dd53cb33371 100644 --- a/addons/medical/functions/fnc_hasItems.sqf +++ b/addons/medical/functions/fnc_hasItems.sqf @@ -16,9 +16,7 @@ #include "script_component.hpp" private ["_medic", "_patient", "_items", "_return"]; -_medic = _this select 0; -_patient = _this select 1; -_items = _this select 2; +params ["_medic", "_patient", "_items"]; _return = true; { @@ -31,4 +29,4 @@ _return = true; }; }foreach _items; -_return; +_return diff --git a/addons/medical/functions/fnc_hasMedicalEnabled.sqf b/addons/medical/functions/fnc_hasMedicalEnabled.sqf index 63fddd16b42..cbf40078fd5 100644 --- a/addons/medical/functions/fnc_hasMedicalEnabled.sqf +++ b/addons/medical/functions/fnc_hasMedicalEnabled.sqf @@ -1,21 +1,27 @@ -/** - * fn_hasMedicalEnabled.sqf - * @Descr: Check if unit has CMS enabled. - * @Author: Glowbal + +/* + * Author: Glowbal + * Check if unit has CMS enabled + * + * Arguments: + * 0: unit + * + * Return Value: + * enabled * - * @Arguments: [unit OBJECT] - * @Return: BOOL - * @PublicAPI: true + * Example: + * [Unit] call ace_medical_fnc_hasMedicalEnabled + * + * Public: No */ - #include "script_component.hpp" -private ["_unit", "_medicalEnabled"]; -_unit = _this select 0; +private "_medicalEnabled"; +params ["_unit"]; _medicalEnabled = _unit getvariable QGVAR(enableMedical); if (isnil "_medicalEnabled") exitwith { - (((GVAR(enableFor) == 0 && (isPlayer _unit || (_unit getvariable [QEGVAR(common,isDeadPlayer), false])))) || (GVAR(enableFor) == 1) || GVAR(level) == 1); + (((GVAR(enableFor) == 0 && (isPlayer _unit || (_unit getvariable [QEGVAR(common,isDeadPlayer), false])))) || (GVAR(enableFor) == 1) || GVAR(level) == 1) }; -_medicalEnabled; +_medicalEnabled diff --git a/addons/medical/functions/fnc_hasTourniquetAppliedTo.sqf b/addons/medical/functions/fnc_hasTourniquetAppliedTo.sqf index 6183854e45e..955665233a4 100644 --- a/addons/medical/functions/fnc_hasTourniquetAppliedTo.sqf +++ b/addons/medical/functions/fnc_hasTourniquetAppliedTo.sqf @@ -14,8 +14,6 @@ #include "script_component.hpp" -private ["_target", "_selectionName"]; -_target = _this select 0; -_selectionName = _this select 1; +params ["_target", "_selectionName"]; (((_target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]) select ([_selectionName] call FUNC(selectionNameToNumber))) > 0); diff --git a/addons/medical/functions/fnc_init.sqf b/addons/medical/functions/fnc_init.sqf index 27d80163a54..bd97203f334 100644 --- a/addons/medical/functions/fnc_init.sqf +++ b/addons/medical/functions/fnc_init.sqf @@ -1,5 +1,5 @@ /* - * Author: KoffeinFlummi + * Author: KoffeinFlummi, commy2 * Initializes unit variables. * * Arguments: @@ -10,17 +10,17 @@ * * Public: No */ - #include "script_component.hpp" -private ["_unit", "_allUsedMedication", "_logs"]; - -_unit = _this select 0; +params ["_unit"]; +// basic _unit setVariable [QGVAR(pain), 0, true]; _unit setVariable [QGVAR(morphine), 0, true]; _unit setVariable [QGVAR(bloodVolume), 100, true]; +_unit setVariable ["ACE_isUnconscious", false, true]; +// advanced // tourniquets _unit setvariable [QGVAR(tourniquets), [0,0,0,0,0,0], true]; @@ -59,13 +59,14 @@ _unit setvariable [QGVAR(airwayCollapsed), false]; // generic medical admin _unit setvariable [QGVAR(addedToUnitLoop), false, true]; _unit setvariable [QGVAR(inCardiacArrest), false, true]; -_unit setVariable ["ACE_isUnconscious", false, true]; _unit setvariable [QGVAR(hasLostBlood), 0, true]; _unit setvariable [QGVAR(isBleeding), false, true]; _unit setvariable [QGVAR(hasPain), false, true]; _unit setvariable [QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives), true]; _unit setvariable [QGVAR(painSuppress), 0, true]; +private ["_allUsedMedication", "_logs"]; + // medication _allUsedMedication = _unit getVariable [QGVAR(allUsedMedication), []]; { diff --git a/addons/medical/functions/fnc_isBeingCarried.sqf b/addons/medical/functions/fnc_isBeingCarried.sqf index 6505f8b51a8..b47c5e475fc 100644 --- a/addons/medical/functions/fnc_isBeingCarried.sqf +++ b/addons/medical/functions/fnc_isBeingCarried.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -PARAMS_1(_target); +params ["_target"]; private "_owner"; diff --git a/addons/medical/functions/fnc_isBeingDragged.sqf b/addons/medical/functions/fnc_isBeingDragged.sqf index 4d09ed9e29e..929b48ccb7e 100644 --- a/addons/medical/functions/fnc_isBeingDragged.sqf +++ b/addons/medical/functions/fnc_isBeingDragged.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -PARAMS_1(_target); +params ["_target"]; private "_owner"; diff --git a/addons/medical/functions/fnc_isInMedicalFacility.sqf b/addons/medical/functions/fnc_isInMedicalFacility.sqf index bed660a46a1..34f1cf42441 100644 --- a/addons/medical/functions/fnc_isInMedicalFacility.sqf +++ b/addons/medical/functions/fnc_isInMedicalFacility.sqf @@ -13,8 +13,8 @@ #include "script_component.hpp" -private ["_unit","_eyePos","_objects","_isInBuilding","_medicalFacility"]; -_unit = _this select 0; +private ["_eyePos", "_objects", "_isInBuilding", "_medicalFacility"]; +params ["_unit"]; _eyePos = eyePos _unit; _isInBuilding = false; @@ -42,13 +42,13 @@ _objects = (lineIntersectsWith [_unit modelToWorldVisual [0, 0, (_eyePos select if (((typeOf _x) in _medicalFacility) || (_x getVariable [QGVAR(isMedicalFacility),false])) exitwith { _isInBuilding = true; }; -}foreach _objects; +} foreach _objects; if (!_isInBuilding) then { _objects = position _unit nearObjects 7.5; { if (((typeOf _x) in _medicalFacility) || (_x getVariable [QGVAR(isMedicalFacility),false])) exitwith { _isInBuilding = true; }; - }foreach _objects; + } foreach _objects; }; _isInBuilding; diff --git a/addons/medical/functions/fnc_isInMedicalVehicle.sqf b/addons/medical/functions/fnc_isInMedicalVehicle.sqf index d376ce38248..1f1ff193fd0 100644 --- a/addons/medical/functions/fnc_isInMedicalVehicle.sqf +++ b/addons/medical/functions/fnc_isInMedicalVehicle.sqf @@ -13,9 +13,8 @@ #include "script_component.hpp" -private ["_unit", "_vehicle"]; - -_unit = _this select 0; +private ["_vehicle"]; +params ["_unit"]; _vehicle = vehicle _unit; if (_unit == _vehicle) exitWith {false}; diff --git a/addons/medical/functions/fnc_isInStableCondition.sqf b/addons/medical/functions/fnc_isInStableCondition.sqf index f7c22ed0857..763185640ca 100644 --- a/addons/medical/functions/fnc_isInStableCondition.sqf +++ b/addons/medical/functions/fnc_isInStableCondition.sqf @@ -13,8 +13,8 @@ #include "script_component.hpp" -private ["_unit"]; -_unit = _this select 0; +private ["_openWounds", "_openWounds"]; +params ["_unit"]; if (GVAR(level) <= 1) exitwith { ([_unit] call FUNC(getBloodloss)) == 0; @@ -25,6 +25,6 @@ _openWounds = _unit getvariable [QGVAR(openWounds), []]; { // total bleeding ratio * percentage of injury left _totalBloodLoss = _totalBloodLoss + ((_x select 4) * (_x select 3)); -}foreach _openWounds; +} foreach _openWounds; (_totalBloodLoss == 0); diff --git a/addons/medical/functions/fnc_isMedic.sqf b/addons/medical/functions/fnc_isMedic.sqf index 122d2612385..ca974fb7518 100644 --- a/addons/medical/functions/fnc_isMedic.sqf +++ b/addons/medical/functions/fnc_isMedic.sqf @@ -4,7 +4,7 @@ * * Arguments: * 0: The Unit - * 1: Class + * 1: Class (default: 1) * * ReturnValue: * Is in of medic class @@ -15,8 +15,7 @@ #include "script_component.hpp" private ["_unit", "_class", "_medicN"]; -_unit = _this select 0; -_medicN = if (count _this > 1) then {_this select 1} else {1}; +params ["_unit", ["_medicN", 1]]; _class = _unit getVariable [QGVAR(medicClass), getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "attendant")]; diff --git a/addons/medical/functions/fnc_isMedicalVehicle.sqf b/addons/medical/functions/fnc_isMedicalVehicle.sqf index 5e9283852fd..14499cb241a 100644 --- a/addons/medical/functions/fnc_isMedicalVehicle.sqf +++ b/addons/medical/functions/fnc_isMedicalVehicle.sqf @@ -12,7 +12,6 @@ */ #include "script_component.hpp" -private ["_vehicle"]; -_vehicle = _this select 0; +params ["_vehicle"]; (_vehicle getVariable [QGVAR(medicClass), getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "attendant")]) > 0 diff --git a/addons/medical/functions/fnc_itemCheck.sqf b/addons/medical/functions/fnc_itemCheck.sqf index c903417dfc0..d49e04e774b 100644 --- a/addons/medical/functions/fnc_itemCheck.sqf +++ b/addons/medical/functions/fnc_itemCheck.sqf @@ -6,15 +6,14 @@ * 0: The unit * * ReturnValue: - * nil + * None * * Public: Yes */ #include "script_component.hpp" -private ["_unit"]; -_unit = _this select 0; +params ["_unit"]; while {({_x == "FirstAidKit"} count items _unit) > 0} do { _unit removeItem "FirstAidKit"; diff --git a/addons/medical/functions/fnc_modifyMedicalAction.sqf b/addons/medical/functions/fnc_modifyMedicalAction.sqf index 268ba8e2530..8feaa7bfcae 100644 --- a/addons/medical/functions/fnc_modifyMedicalAction.sqf +++ b/addons/medical/functions/fnc_modifyMedicalAction.sqf @@ -10,17 +10,18 @@ * 3: The action to modify * * ReturnValue: - * nil + * None * * Public: No */ #include "script_component.hpp" -EXPLODE_4_PVT(_this,_target,_player,_selectionN,_actionData); +params ["_target", "_player", "_selectionN", "_actionData"]; + if (GVAR(level) < 2) exitwith { private ["_pointDamage"]; - _pointDamage = _target getHitPointDamage (["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"] select _selectionN); + _pointDamage = (_target getvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]) select _selectionN; if (_pointDamage >= 0.8) exitWith { _actionData set [2, QUOTE(PATHTOF(UI\icons\medical_crossRed.paa))]; @@ -33,8 +34,8 @@ if (GVAR(level) < 2) exitwith { private ["_openWounds", "_amountOf"]; _openWounds = _target getvariable [QGVAR(openWounds), []]; { - _amountOf = _x select 3; - if (_amountOf > 0 && {(_selectionN == (_x select 2))} && {(_x select 4) > 0}) exitwith { + _x params ["", "", "_selectionX", "_amountOf", "_x4"]; + if (_amountOf > 0 && {(_selectionN == _selectionX)} && {_x4 > 0}) exitwith { _actionData set [2, QUOTE(PATHTOF(UI\icons\medical_crossRed.paa))]; }; } foreach _openWounds; diff --git a/addons/medical/functions/fnc_moduleAdvancedMedicalSettings.sqf b/addons/medical/functions/fnc_moduleAdvancedMedicalSettings.sqf index 2960c65b9da..b54196d75ff 100644 --- a/addons/medical/functions/fnc_moduleAdvancedMedicalSettings.sqf +++ b/addons/medical/functions/fnc_moduleAdvancedMedicalSettings.sqf @@ -8,17 +8,14 @@ * 2: activated * * Return Value: - * None + * None * * Public: No */ #include "script_component.hpp" -private ["_logic", "_units", "_activated"]; -_logic = _this select 0; -_units = _this select 1; -_activated = _this select 2; +params ["_logic", "_units", "_activated"]; if !(_activated) exitWith {}; diff --git a/addons/medical/functions/fnc_moduleAssignMedicRoles.sqf b/addons/medical/functions/fnc_moduleAssignMedicRoles.sqf index 1c26eb53d44..e295c55a2ed 100644 --- a/addons/medical/functions/fnc_moduleAssignMedicRoles.sqf +++ b/addons/medical/functions/fnc_moduleAssignMedicRoles.sqf @@ -8,15 +8,15 @@ * 2: activated * * Return Value: - * None + * None * * Public: No */ #include "script_component.hpp" -private ["_logic","_setting","_objects", "_list", "_splittedList", "_nilCheckPassedList", "_parsedList"]; -_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; +private ["_setting", "_objects", "_list", "_splittedList", "_nilCheckPassedList", "_parsedList"]; +params [["_logic", objNull, [objNull]]]; if (!isNull _logic) then { _list = _logic getvariable ["EnableList",""]; @@ -32,7 +32,7 @@ if (!isNull _logic) then { _nilCheckPassedList = _nilCheckPassedList + ","+ _x; }; }; - }foreach _splittedList; + } foreach _splittedList; _list = "[" + _nilCheckPassedList + "]"; _parsedList = [] call compile _list; @@ -47,7 +47,7 @@ if (!isNull _logic) then { }; }; }; - }foreach _objects; + } foreach _objects; }; { if (!isnil "_x") then { @@ -57,7 +57,5 @@ if (!isNull _logic) then { }; }; }; - }foreach _parsedList; + } foreach _parsedList; }; - -true \ No newline at end of file diff --git a/addons/medical/functions/fnc_moduleAssignMedicalFacility.sqf b/addons/medical/functions/fnc_moduleAssignMedicalFacility.sqf index c08d737f4b6..7a219f2559d 100644 --- a/addons/medical/functions/fnc_moduleAssignMedicalFacility.sqf +++ b/addons/medical/functions/fnc_moduleAssignMedicalFacility.sqf @@ -8,15 +8,15 @@ * 2: activated * * Return Value: - * None + * None * * Public: No */ #include "script_component.hpp" -private ["_logic","_setting","_objects"]; -_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; +private ["_setting", "_objects"]; +params [["_logic", objNull, [objNull]]]; if (!isNull _logic) then { _setting = _logic getvariable ["class",0]; _objects = synchronizedObjects _logic; @@ -24,7 +24,7 @@ if (!isNull _logic) then { if (local _x) then { _x setvariable[QGVAR(isMedicalFacility), true, true]; }; - }foreach _objects; + } foreach _objects; }; true; diff --git a/addons/medical/functions/fnc_moduleAssignMedicalVehicle.sqf b/addons/medical/functions/fnc_moduleAssignMedicalVehicle.sqf index af6de73ce14..9744ce5f7be 100644 --- a/addons/medical/functions/fnc_moduleAssignMedicalVehicle.sqf +++ b/addons/medical/functions/fnc_moduleAssignMedicalVehicle.sqf @@ -8,7 +8,7 @@ * 2: activated * * Return Value: - * None + * None * * Public: No */ @@ -16,8 +16,8 @@ #include "script_component.hpp" -private ["_logic","_setting","_objects", "_list", "_splittedList", "_nilCheckPassedList", "_parsedList"]; -_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; +private ["_setting", "_objects", "_list", "_splittedList", "_nilCheckPassedList", "_parsedList"]; +params [["_logic", objNull, [objNull]]]; if (!isNull _logic) then { _list = _logic getvariable ["EnableList",""]; @@ -33,7 +33,7 @@ if (!isNull _logic) then { _nilCheckPassedList = _nilCheckPassedList + ","+ _x; }; }; - }foreach _splittedList; + } foreach _splittedList; _list = "[" + _nilCheckPassedList + "]"; _parsedList = [] call compile _list; @@ -48,7 +48,7 @@ if (!isNull _logic) then { }; }; }; - }foreach _objects; + } foreach _objects; }; { if (!isnil "_x") then { @@ -58,7 +58,5 @@ if (!isNull _logic) then { }; }; }; - }foreach _parsedList; + } foreach _parsedList; }; - -true; diff --git a/addons/medical/functions/fnc_moduleMedicalSettings.sqf b/addons/medical/functions/fnc_moduleMedicalSettings.sqf index 00b7a15fcfd..4e1af0e86cb 100644 --- a/addons/medical/functions/fnc_moduleMedicalSettings.sqf +++ b/addons/medical/functions/fnc_moduleMedicalSettings.sqf @@ -8,17 +8,14 @@ * 2: activated * * Return Value: - * None + * None * * Public: No */ #include "script_component.hpp" -private ["_logic", "_units", "_activated"]; -_logic = _this select 0; -_units = _this select 1; -_activated = _this select 2; +params ["_logic", "_units", "_activated"]; if !(_activated) exitWith {}; diff --git a/addons/medical/functions/fnc_moduleReviveSettings.sqf b/addons/medical/functions/fnc_moduleReviveSettings.sqf index c96b1eb67c8..19aa9579dd6 100644 --- a/addons/medical/functions/fnc_moduleReviveSettings.sqf +++ b/addons/medical/functions/fnc_moduleReviveSettings.sqf @@ -8,17 +8,14 @@ * 2: activated * * Return Value: - * None + * None * * Public: No */ #include "script_component.hpp" -private ["_logic", "_units", "_activated"]; -_logic = _this select 0; -_units = _this select 1; -_activated = _this select 2; +params ["_logic", "_units", "_activated"]; if !(_activated) exitWith {}; diff --git a/addons/medical/functions/fnc_onMedicationUsage.sqf b/addons/medical/functions/fnc_onMedicationUsage.sqf index 904ad3ef88d..db4ba737ea0 100644 --- a/addons/medical/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical/functions/fnc_onMedicationUsage.sqf @@ -11,28 +11,21 @@ * 5: Incompatable medication > * * Return Value: - * NONE + * None * * Public: No */ #include "script_component.hpp" -private ["_target", "_className", "_variable", "_maxDosage", "_timeInSystem", "_incompatabileMeds", "_foundEntry", "_allUsedMedication","_allMedsFromClassname", "_usedMeds", "_hasOverDosed", "_med", "_limit", "_classNamesUsed", "_decreaseAmount", "_viscosityChange", "_viscosityAdjustment", "_medicationConfig", "_onOverDose", "_painReduce"]; -_target = _this select 0; -_className = _this select 1; -_variable = _this select 2; -_maxDosage = _this select 3; -_timeInSystem = _this select 4; -_incompatabileMeds = _this select 5; -_viscosityChange = _this select 6; -_painReduce = _this select 7; +private ["_foundEntry", "_allUsedMedication","_allMedsFromClassname", "_usedMeds", "_hasOverDosed", "_med", "_limit", "_decreaseAmount", "_viscosityAdjustment", "_medicationConfig", "_onOverDose"]; +params ["_target", "_className", "_variable", "_maxDosage", "_timeInSystem", "_incompatabileMeds", "_viscosityChange", "_painReduce"]; _foundEntry = false; _allUsedMedication = _target getvariable [QGVAR(allUsedMedication), []]; { - if (_x select 0 == _variable) exitwith { - _allMedsFromClassname = _x select 1; + _x params ["_variableX", "_allMedsFromClassname"]; + if (_variableX== _variable) exitwith { if !(_className in _allMedsFromClassname) then { _allMedsFromClassname pushback _className; _x set [1, _allMedsFromClassname]; @@ -56,15 +49,14 @@ if (_usedMeds >= floor (_maxDosage + round(random(2))) && _maxDosage >= 1 && GVA _hasOverDosed = 0; { - _med = _x select 0; - _limit = _x select 1; + _x params ["_med", "_limit"]; { - _classNamesUsed = _x select 1; + _x params ["", "_classNamesUsed"]; if ({_x == _med} count _classNamesUsed > _limit) then { _hasOverDosed = _hasOverDosed + 1; }; - }foreach _allUsedMedication; -}foreach _incompatabileMeds; + } foreach _allUsedMedication; +} foreach _incompatabileMeds; if (_hasOverDosed > 0 && GVAR(enableOverdosing)) then { _medicationConfig = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Medication"); @@ -85,16 +77,9 @@ _decreaseAmount = 1 / _timeInSystem; _viscosityAdjustment = _viscosityChange / _timeInSystem; [{ - private ["_args", "_target", "_timeInSystem", "_variable", "_amountDecreased","_decreaseAmount", "_usedMeds", "_viscosityAdjustment", "_painReduce"]; - _args = _this select 0; - _target = _args select 0; - _timeInSystem = _args select 1; - _variable = _args select 2; - _amountDecreased = _args select 3; - _decreaseAmount = _args select 4; - _viscosityAdjustment = _args select 5; - _painReduce = _args select 6; - + params ["_args", "_idPFH"]; + _args params ["_target", "_timeInSystem", "_variable", "_amountDecreased","_decreaseAmount", "_viscosityAdjustment", "_painReduce"]; + private "_usedMeds"; _usedMeds = _target getvariable [_variable, 0]; _usedMeds = _usedMeds - _decreaseAmount; _target setvariable [_variable, _usedMeds]; @@ -106,7 +91,7 @@ _viscosityAdjustment = _viscosityChange / _timeInSystem; _target setvariable [QGVAR(painSuppress), ((_target getvariable [QGVAR(painSuppress), 0]) - _painReduce) max 0]; if (_amountDecreased >= 1 || (_usedMeds <= 0) || !alive _target) then { - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; _args set [3, _amountDecreased]; }, 1, [_target, _timeInSystem, _variable, 0, _decreaseAmount, _viscosityAdjustment, _painReduce / _timeInSystem] ] call CBA_fnc_addPerFrameHandler; diff --git a/addons/medical/functions/fnc_onPropagateWound.sqf b/addons/medical/functions/fnc_onPropagateWound.sqf index 934899eac4e..f8b361ad170 100644 --- a/addons/medical/functions/fnc_onPropagateWound.sqf +++ b/addons/medical/functions/fnc_onPropagateWound.sqf @@ -7,7 +7,7 @@ * 1: injury * * Return Value: - * None + * None * * Public: No */ @@ -15,8 +15,7 @@ #include "script_component.hpp" private ["_unit", "_injury", "_openWounds", "_injuryID", "_exists"]; -_unit = _this select 0; -_injury = _this select 1; +params ["_unit", "_injury"]; if (!local _unit) then { _openWounds = _unit getvariable[QGVAR(openWounds), []]; @@ -28,7 +27,7 @@ if (!local _unit) then { _exists = true; _openWounds set [_foreachIndex, _injury]; }; - }foreach _openWounds; + } foreach _openWounds; if (!_exists) then { _openWounds pushback _injury; diff --git a/addons/medical/functions/fnc_onWoundUpdateRequest.sqf b/addons/medical/functions/fnc_onWoundUpdateRequest.sqf index 3c99496d7b5..091bea7ef81 100644 --- a/addons/medical/functions/fnc_onWoundUpdateRequest.sqf +++ b/addons/medical/functions/fnc_onWoundUpdateRequest.sqf @@ -7,19 +7,18 @@ * 1: Origin object * * ReturnValue: - * + * None * * Public: Yes */ #include "script_component.hpp" private ["_unit", "_openWounds", "_originOfrequest"]; -_unit = _this select 0; -_originOfrequest = _this select 1; +params ["_unit", "_originOfrequest"]; if (local _unit && !(local _originOfrequest)) then { _openWounds = _unit getvariable [QGVAR(openWounds), []]; { ["medical_propagateWound", [_originOfrequest], [_unit, _x]] call EFUNC(common,targetEvent); - }foreach _openWounds; + } foreach _openWounds; }; diff --git a/addons/medical/functions/fnc_parseConfigForInjuries.sqf b/addons/medical/functions/fnc_parseConfigForInjuries.sqf index 1b2db7c278f..764d0bf5911 100644 --- a/addons/medical/functions/fnc_parseConfigForInjuries.sqf +++ b/addons/medical/functions/fnc_parseConfigForInjuries.sqf @@ -3,13 +3,12 @@ * Parse the ACE_Medical_Advanced config for all injury types. * * Arguments: - * + * None * ReturnValue: - * + * None * * Public: No */ - #include "script_component.hpp" private ["_injuriesRootConfig", "_woundsConfig", "_allWoundClasses", "_amountOf", "_entry","_classType", "_selections", "_bloodLoss", "_pain","_minDamage","_causes", "_damageTypesConfig", "_thresholds", "_typeThresholds", "_selectionSpecific", "_selectionSpecificType", "_classDisplayName", "_subClassDisplayName", "_maxDamage", "_subClassmaxDamage", "_defaultMinLethalDamage", "_minLethalDamage", "_allFoundDamageTypes", "_classID", "_configDamageTypes", "_i", "_parseForSubClassWounds", "_subClass", "_subClassConfig", "_subClassbloodLoss", "_subClasscauses", "_subClassminDamage", "_subClasspain", "_subClassselections", "_subClasstype", "_type", "_varName", "_woundTypes"]; @@ -110,7 +109,7 @@ _selectionSpecific = getNumber(_damageTypesConfig >> "selectionSpecific"); if (_type in (_x select 5)) then { _woundTypes pushback _x; }; - }foreach _allWoundClasses; + } foreach _allWoundClasses; _typeThresholds = _thresholds; _selectionSpecificType = _selectionSpecific; if (isClass(_damageTypesConfig >> _x)) then { @@ -130,11 +129,11 @@ _selectionSpecific = getNumber(_damageTypesConfig >> "selectionSpecific"); _minDamageThresholds = _minDamageThresholds + ":"; _amountThresholds = _amountThresholds + ":"; }; - }foreach _typeThresholds; + } foreach _typeThresholds; "ace_medical" callExtension format ["addDamageType,%1,%2,%3,%4,%5", _type, GVAR(minLethalDamages) select _foreachIndex, _minDamageThresholds, _amountThresholds, _selectionSpecificType]; -}foreach _allFoundDamageTypes; +} foreach _allFoundDamageTypes; // Extension loading @@ -142,34 +141,30 @@ _selectionSpecific = getNumber(_damageTypesConfig >> "selectionSpecific"); { private ["_classID", "_className", "_allowedSelections", "_bloodLoss", "_pain", "_minDamage", "_maxDamage", "_causes", "_classDisplayName", "_extensionInput", "_selections", "_causesArray"]; // add shit to addInjuryType - _classID = _x select 0; + _x params ["_classID", "_selections", "_bloodLoss", "_pain", "_damage", "_causesArray", "_classDisplayName"]; + _damage params ["_minDamage", "_maxDamage"]; _className = GVAR(woundClassNames) select _forEachIndex; _allowedSelections = ""; - _selections = _x select 1; { _allowedSelections = _allowedSelections + _x; if (_forEachIndex < (count _selections) - 1) then { _allowedSelections = _allowedSelections + ":"; }; - }foreach _selections; + } foreach _selections; - _bloodLoss = _x select 2; - _pain = _x select 3; - _minDamage = (_x select 4) select 0; - _maxDamage = (_x select 4) select 1; _causes = ""; - _causesArray = (_x select 5); + { _causes = _causes + _x; if (_forEachIndex < (count _causesArray) - 1) then { _causes = _causes + ":"; }; - }foreach _causesArray; + } foreach _causesArray; _classDisplayName = _x select 6; "ace_medical" callExtension format["addInjuryType,%1,%2,%3,%4,%5,%6,%7,%8,%9", _classID, _className, _allowedSelections, _bloodLoss, _pain, _minDamage, _maxDamage, _causes, _classDisplayName]; -}foreach _allWoundClasses; +} foreach _allWoundClasses; "ace_medical" callExtension "ConfigComplete"; diff --git a/addons/medical/functions/fnc_playInjuredSound.sqf b/addons/medical/functions/fnc_playInjuredSound.sqf index 3d41ec70db6..ddf107c840b 100644 --- a/addons/medical/functions/fnc_playInjuredSound.sqf +++ b/addons/medical/functions/fnc_playInjuredSound.sqf @@ -6,9 +6,10 @@ * * Arguments: * 0: The Unit + * 1: Amount of Pain * * ReturnValue: - * + * None * * Public: No */ @@ -16,8 +17,7 @@ #include "script_component.hpp" private ["_unit","_availableSounds_A","_availableSounds_B","_availableSounds_C","_sound", "_pain"]; -_unit = _this select 0; -_pain = _this select 1; +params ["_unit", "_pain"]; if (!local _unit || !GVAR(enableScreams)) exitwith{}; // Lock if the unit is already playing a sound. diff --git a/addons/medical/functions/fnc_requestWoundSync.sqf b/addons/medical/functions/fnc_requestWoundSync.sqf index 74fd3e230da..31cf726214b 100644 --- a/addons/medical/functions/fnc_requestWoundSync.sqf +++ b/addons/medical/functions/fnc_requestWoundSync.sqf @@ -7,16 +7,14 @@ * 1: object belonging to the caller * * ReturnValue: - * + * None * * Public: Yes */ #include "script_component.hpp" -private [ "_target", "_caller"]; -_target = _this select 0; -_caller = _this select 1; +params [ "_target", "_caller"]; if (local _target || GVAR(level) < 2) exitwith {}; // if the target is local, we already got the most update to date information if (_target getvariable [QGVAR(isWoundSynced), false]) exitwith {}; diff --git a/addons/medical/functions/fnc_setCardiacArrest.sqf b/addons/medical/functions/fnc_setCardiacArrest.sqf index c33d83bb405..017befcaad9 100644 --- a/addons/medical/functions/fnc_setCardiacArrest.sqf +++ b/addons/medical/functions/fnc_setCardiacArrest.sqf @@ -7,15 +7,15 @@ * 0: The unit that will be put in cardiac arrest state * * ReturnValue: - * + * None * * Public: yes */ #include "script_component.hpp" -private ["_unit", "_timeInCardiacArrest"]; -_unit = _this select 0; +private "_timeInCardiacArrest"; +params ["_unit"]; if (_unit getvariable [QGVAR(inCardiacArrest),false]) exitwith {}; _unit setvariable [QGVAR(inCardiacArrest), true,true]; @@ -28,20 +28,17 @@ _timeInCardiacArrest = 120 + round(random(600)); [{ private ["_args","_unit","_startTime","_timeInCardiacArrest","_heartRate"]; - _args = _this select 0; - _unit = _args select 0; - _startTime = _args select 1; - _timeInCardiacArrest = _args select 2; + params ["_args", "_idPFH"]; + _args params ["_unit", "_startTime", "_timeInCardiacArrest"]; _heartRate = _unit getvariable [QGVAR(heartRate), 80]; if (_heartRate > 0 || !alive _unit) exitwith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; _unit setvariable [QGVAR(inCardiacArrest), nil,true]; }; if (ACE_time - _startTime >= _timeInCardiacArrest) exitwith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; _unit setvariable [QGVAR(inCardiacArrest), nil,true]; [_unit] call FUNC(setDead); }; }, 1, [_unit, ACE_time, _timeInCardiacArrest] ] call CBA_fnc_addPerFrameHandler; - diff --git a/addons/medical/functions/fnc_setDead.sqf b/addons/medical/functions/fnc_setDead.sqf index 1423d594ad7..c8c81a699ef 100644 --- a/addons/medical/functions/fnc_setDead.sqf +++ b/addons/medical/functions/fnc_setDead.sqf @@ -6,7 +6,7 @@ * 0: The unit that will be killed * * ReturnValue: - * + * None * * Public: yes */ @@ -14,11 +14,7 @@ #include "script_component.hpp" private ["_unit", "_force", "_reviveVal", "_lifesLeft"]; -_unit = _this select 0; -_force = false; -if (count _this >= 2) then { - _force = _this select 1; -}; +params ["_unit", ["_force", false]]; if (!alive _unit) exitwith{true}; if (!local _unit) exitwith { @@ -44,13 +40,13 @@ if (((_reviveVal == 1 && {[_unit] call EFUNC(common,isPlayer)} || _reviveVal == [_unit, true] call FUNC(setUnconscious); [{ - private ["_args","_unit","_startTime"]; - _args = _this select 0; - _unit = _args select 0; + private "_startTime"; + params ["_args", "_idPFH"]; + _args params ["_unit"]; _startTime = _unit getvariable [QGVAR(reviveStartTime), 0]; if (GVAR(maxReviveTime) > 0 && {ACE_time - _startTime > GVAR(maxReviveTime)}) exitwith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; _unit setvariable [QGVAR(inReviveState), nil, true]; _unit setvariable [QGVAR(reviveStartTime), nil]; [_unit, true] call FUNC(setDead); @@ -64,7 +60,7 @@ if (((_reviveVal == 1 && {[_unit] call EFUNC(common,isPlayer)} || _reviveVal == }; _unit setvariable [QGVAR(reviveStartTime), nil]; - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; if (GVAR(level) >= 2) then { if (_unit getvariable [QGVAR(heartRate), 60] > 0) then { diff --git a/addons/medical/functions/fnc_setHitPointDamage.sqf b/addons/medical/functions/fnc_setHitPointDamage.sqf index 18d4fc616e1..f8698a7fe0d 100644 --- a/addons/medical/functions/fnc_setHitPointDamage.sqf +++ b/addons/medical/functions/fnc_setHitPointDamage.sqf @@ -7,10 +7,10 @@ * 0: Unit * 1: HitPoint * 2: Damage - * 3: Disable overall damage adjustment (optional) + * 3: Disable overall damage adjustment (default: false) * * Return Value: - * nil + * None * * Public: Yes */ @@ -22,10 +22,7 @@ #define ARMDAMAGETRESHOLD2 1.7 private ["_unit", "_selection", "_damage", "_selections", "_damages", "_damageOld", "_damageSumOld", "_damageNew", "_damageSumNew", "_damageFinal", "_armdamage", "_legdamage"]; - -_unit = _this select 0; -_selection = _this select 1; -_damage = _this select 2; +params ["_unit", "_selection", "_damage", ["_disabled", false]]; // Unit isn't local, give function to machine where it is. if !(local _unit) exitWith { @@ -33,7 +30,7 @@ if !(local _unit) exitWith { }; // Check if overall damage adjustment is disabled -if (count _this > 3 && {_this select 3}) exitWith { +if (_disabled) exitWith { _unit setHitPointDamage [_selection, _damage]; }; diff --git a/addons/medical/functions/fnc_setUnconscious.sqf b/addons/medical/functions/fnc_setUnconscious.sqf index 7e5cd8c1b74..3de62db9749 100644 --- a/addons/medical/functions/fnc_setUnconscious.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -4,9 +4,9 @@ * * Arguments: * 0: The unit that will be put in an unconscious state - * 1: Set unconsciouns - * 2: Minimum unconscious ACE_time - * 3: Force AI Unconscious (skip random death chance) + * 1: Set unconsciouns (default: true) + * 2: Minimum unconscious ACE_time (default: (round(random(10)+5))) + * 3: Force AI Unconscious (skip random death chance) (default: false) * * ReturnValue: * nil @@ -19,13 +19,10 @@ #include "script_component.hpp" -#define DEFAULT_DELAY (round(random(10)+5)) +#define DEFAULT_DELAY (round(random(10)+5)) -private ["_unit", "_set", "_animState", "_originalPos", "_startingTime","_minWaitingTime", "_force", "_isDead"]; -_unit = _this select 0; -_set = if (count _this > 1) then {_this select 1} else {true}; -_minWaitingTime = if (count _this > 2) then {_this select 2} else {DEFAULT_DELAY}; -_force = if (count _this > 3) then {_this select 3} else {false}; +private ["_animState", "_originalPos", "_startingTime", "_isDead"]; +params ["_unit", ["_set", true], ["_minWaitingTime", DEFAULT_DELAY], ["_force", false]]; // No change, fuck off. (why is there no xor?) if (_set isEqualTo (_unit getVariable ["ACE_isUnconscious", false])) exitWith {}; @@ -97,8 +94,7 @@ if (GVAR(moveUnitsFromGroupOnUnconscious)) then { _anim = [_unit] call EFUNC(common,getDeathAnim); [_unit, _anim, 1, true] call EFUNC(common,doAnimation); [{ - _unit = _this select 0; - _anim = _this select 1; + params ["_unit", "_anim"]; if ((_unit getVariable "ACE_isUnconscious") and (animationState _unit != _anim)) then { [_unit, _anim, 2, true] call EFUNC(common,doAnimation); }; diff --git a/addons/medical/functions/fnc_treatment.sqf b/addons/medical/functions/fnc_treatment.sqf index a319d50440c..5e97e31501d 100644 --- a/addons/medical/functions/fnc_treatment.sqf +++ b/addons/medical/functions/fnc_treatment.sqf @@ -16,11 +16,8 @@ #include "script_component.hpp" -private ["_caller", "_target", "_selectionName", "_className", "_config", "_medicRequired", "_items", "_locations", "_return", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed", "_return", "_usersOfItems", "_consumeItems", "_condition", "_displayText", "_wpn", "_treatmentTimeConfig", "_patientStateCondition", "_allowedSelections"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_className = _this select 3; +private ["_config", "_medicRequired", "_items", "_locations", "_return", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed", "_return", "_usersOfItems", "_consumeItems", "_condition", "_displayText", "_wpn", "_treatmentTimeConfig", "_patientStateCondition", "_allowedSelections"]; +params ["_caller", "_target", "_selectionName", "_className"]; // If the cursorMenu is open, the loading bar will fail. If we execute the function one frame later, it will work fine if (uiNamespace getVariable [QEGVAR(interact_menu,cursorMenuOpened),false]) exitwith { @@ -37,6 +34,9 @@ if (GVAR(level) >= 2) then { }; if !(isClass _config) exitwith {false}; +// Allow self treatment check +if (_caller == _target && {getNumber (_config >> "allowSelfTreatment") == 0}) exitwith {false}; + _medicRequired = if (isNumber (_config >> "requiredMedic")) then { getNumber (_config >> "requiredMedic"); } else { @@ -107,7 +107,7 @@ if ("All" in _locations) then { }; }; }; - }foreach _locations; + } foreach _locations; }; if !(_return) exitwith {false}; @@ -180,7 +180,7 @@ if (vehicle _caller == _caller && {_callerAnim != ""}) then { TRACE_1("Weapon Deployed, breaking out first",(stance _caller)); [_caller, "", 0] call EFUNC(common,doAnimation); }; - + if ((stance _caller) == "STAND") then { switch (_wpn) do {//If standing, end in a crouched animation based on their current weapon case ("rfl"): {_caller setvariable [QGVAR(treatmentPrevAnimCaller), "AmovPknlMstpSrasWrflDnon"];}; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf b/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf index ade74a6ccb6..f09de600ae5 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf @@ -16,12 +16,7 @@ #include "script_component.hpp" -private ["_caller", "_target", "_selectionName", "_className", "_items"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_className = _this select 3; -_items = _this select 4; +params ["_caller", "_target", "_selectionName", "_className", "_items"]; if (alive _target && {(_target getvariable [QGVAR(inCardiacArrest), false] || _target getvariable [QGVAR(inReviveState), false])}) then { [[_caller, _target], QUOTE(DFUNC(treatmentAdvanced_CPRLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ diff --git a/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf index a7c8ea67441..818640ca073 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf @@ -14,9 +14,8 @@ #include "script_component.hpp" -private ["_caller","_target", "_reviveStartTime"]; -_caller = _this select 0; -_target = _this select 1; +private "_reviveStartTime"; +param ["_caller","_target"]; if (_target getvariable [QGVAR(inReviveState), false]) then { _reviveStartTime = _target getvariable [QGVAR(reviveStartTime),0]; @@ -25,7 +24,7 @@ if (_target getvariable [QGVAR(inReviveState), false]) then { }; }; -if ((random 1) >= 0.6) then { +if (GVAR(level) > 1 && {(random 1) >= 0.6}) then { _target setvariable [QGVAR(inCardiacArrest), nil,true]; _target setvariable [QGVAR(heartRate), 40]; _target setvariable [QGVAR(bloodPressure), [50,70]]; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf b/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf index 1278994a11b..aa3669c2277 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf @@ -7,7 +7,8 @@ * 1: The patient * 2: SelectionName * 3: Treatment classname - * + * 4: Item + * 5: specific Spot (default: -1) * * Return Value: * Succesful treatment started @@ -16,15 +17,7 @@ */ #include "script_component.hpp" - -private ["_caller", "_target", "_selectionName", "_className", "_items", "_specificSpot"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_className = _this select 3; -_items = _this select 4; - -_specificSpot = if (count _this > 6) then {_this select 6} else {-1}; +params ["_caller", "_target", "_selectionName", "_className", "_items", "", ["_specificSpot", -1]]; if !([_target] call FUNC(hasMedicalEnabled)) exitwith { _this call FUNC(treatmentBasic_bandage); diff --git a/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf index d6c490d3c62..abf09385b21 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf @@ -15,19 +15,16 @@ #include "script_component.hpp" -private ["_target", "_bandage", "_part", "_selectionName", "_openWounds", "_config", "_effectiveness","_mostEffectiveInjury", "_mostEffectiveSpot", "_woundEffectivenss", "_mostEffectiveInjury", "_impact", "_exit", "_specificClass", "_classID", "_effectivenessFound", "_className", "_hitPoints", "_hitSelections", "_point", "_woundTreatmentConfig"]; -_target = _this select 0; -_bandage = _this select 1; -_selectionName = _this select 2; -_specificClass = if (count _this > 3) then {_this select 3} else { -1 }; +private ["_openWounds", "_config", "_effectiveness","_mostEffectiveInjury", "_mostEffectiveSpot", "_woundEffectivenss", "_mostEffectiveInjury", "_impact", "_exit", "_classID", "_effectivenessFound", "_className", "_hitPoints", "_hitSelections", "_point", "_woundTreatmentConfig"]; +params ["_target", "_bandage", "_selectionName", ["_specificClass", -1]]; // Ensure it is a valid bodypart _part = [_selectionName] call FUNC(selectionNameToNumber); -if (_part < 0) exitwith {}; +if (_part < 0) exitwith {false}; // Get the open wounds for this unit _openWounds = _target getvariable [QGVAR(openWounds), []]; -if (count _openWounds == 0) exitwith {}; // nothing to do here! +if (count _openWounds == 0) exitwith {false}; // nothing to do here! // Get the default effectiveness for the used bandage _config = (ConfigFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Bandaging"); @@ -43,10 +40,11 @@ _effectivenessFound = -1; _mostEffectiveInjury = _openWounds select 0; _exit = false; { + _x params ["", "_classID", "_partX"]; + TRACE_2("OPENWOUND: ", _target, _x); // Only parse injuries that are for the selected bodypart. - if (_x select 2 == _part) then { + if (_partX == _part) then { _woundEffectivenss = _effectiveness; - _classID = (_x select 1); // Select the classname from the wound classname storage _className = GVAR(woundClassNames) select _classID; @@ -59,6 +57,7 @@ _exit = false; }; }; + TRACE_2("Wound classes: ", _specificClass, _classID); if (_specificClass == _classID) exitwith { _effectivenessFound = _woundEffectivenss; _mostEffectiveSpot = _foreachIndex; @@ -74,7 +73,7 @@ _exit = false; }; }; if (_exit) exitwith {}; -}foreach _openWounds; +} foreach _openWounds; if (_effectivenessFound == -1) exitwith {}; // Seems everything is patched up on this body part already.. @@ -96,12 +95,11 @@ if (_impact > 0 && {GVAR(enableAdvancedWounds)}) then { }; // If all wounds have been bandaged, we will reset all damage to 0, so the unit is not showing any blood on the model anymore. -if (GVAR(healHitPointAfterAdvBandage) && {{(_x select 2) == _part && {_x select 3 > 0}}count _openWounds == 0}) then { +if (GVAR(healHitPointAfterAdvBandage) && {{(_x select 2) == _part && {((_x select 4) * (_x select 3)) > 0}}count _openWounds == 0}) then { _hitSelections = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]; _hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; _point = _hitPoints select (_hitSelections find _selectionName); - [_target, _point, 0] call FUNC(setHitPointDamage); - // _target setvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0], true]; + _target setHitPointDamage [_point, 0]; }; true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_fullHeal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_fullHeal.sqf index 37627a8c5d7..a26876568de 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_fullHeal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_fullHeal.sqf @@ -10,12 +10,7 @@ #include "script_component.hpp" -private ["_target", "_caller", "_selectionName", "_className", "_items"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_className = _this select 3; -_items = _this select 4; +params ["_caller", "_target", "_selectionName", "_className", "_items"]; // TODO replace by event system [[_caller, _target], QUOTE(DFUNC(treatmentAdvanced_fullHealLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ diff --git a/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf index df7594921d5..ed5eb0858db 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf @@ -10,9 +10,8 @@ #include "script_component.hpp" -private ["_target", "_caller", "_allUsedMedication"]; -_caller = _this select 0; -_target = _this select 1; +private "_allUsedMedication"; +params ["_caller", "_target"]; if (alive _target) exitwith { @@ -64,7 +63,7 @@ if (alive _target) exitwith { _allUsedMedication = _target getVariable [QGVAR(allUsedMedication), []]; { _target setvariable [_x select 0, nil]; - }foreach _allUsedMedication; + } foreach _allUsedMedication; // Resetting damage _target setDamage 0; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_fullHealTreatmentTime.sqf b/addons/medical/functions/fnc_treatmentAdvanced_fullHealTreatmentTime.sqf index 108bdd4a5de..a0539948eae 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_fullHealTreatmentTime.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_fullHealTreatmentTime.sqf @@ -15,12 +15,12 @@ */ #include "script_component.hpp" -private ["_target", "_totalDamage"]; -_target = _this; +private "_totalDamage"; + _totalDamage = 0; { _totalDamage = _totalDamage + _x; -} forEach (_target getVariable [QGVAR(bodyPartStatus), []]); +} forEach (_this getVariable [QGVAR(bodyPartStatus), []]); (10 max (_totalDamage * 10) min 120) diff --git a/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf b/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf index 0b401a73cc5..b5b0af1401c 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf @@ -17,12 +17,7 @@ #include "script_component.hpp" -private ["_caller", "_target", "_selectionName", "_className", "_items"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_className = _this select 3; -_items = _this select 4; +params ["_caller", "_target", "_selectionName", "_className", "_items"]; [[_target, _className], QUOTE(DFUNC(treatmentAdvanced_medicationLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ @@ -32,7 +27,7 @@ _items = _this select 4; [_target, "activity", LSTRING(Activity_usedItem), [[_caller] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _x >> "displayName")]] call FUNC(addToLog); [_target, "activity_view", LSTRING(Activity_usedItem), [[_caller] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _x >> "displayName")]] call FUNC(addToLog); }; -}foreach _items; +} foreach _items; true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf index c4ba840398f..00a4fae8d95 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf @@ -15,9 +15,8 @@ #include "script_component.hpp" -private ["_target", "_className", "_currentInSystem", "_medicationConfig", "_painReduce", "_hrIncreaseLow", "_hrIncreaseNorm", "_hrIncreaseHigh", "_maxDose", "_inCompatableMedication", "_timeInSystem", "_heartRate", "_pain", "_resistance", "_hrCallback", "_varName", "_viscosityChange"]; -_target = _this select 0; -_className = _this select 1; +private ["_currentInSystem", "_medicationConfig", "_painReduce", "_hrIncreaseLow", "_hrIncreaseNorm", "_hrIncreaseHigh", "_maxDose", "_inCompatableMedication", "_timeInSystem", "_heartRate", "_pain", "_resistance", "_hrCallback", "_varName", "_viscosityChange"]; +params ["_target", "_className"]; // We have added a new dose of this medication to our system, so let's increase it _varName = format[QGVAR(%1_inSystem), _className]; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_surgicalKit_onProgress.sqf b/addons/medical/functions/fnc_treatmentAdvanced_surgicalKit_onProgress.sqf index c0e1037027f..aadcb40d45b 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_surgicalKit_onProgress.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_surgicalKit_onProgress.sqf @@ -1,23 +1,30 @@ /* * Author: BaerMitUmlaut - * Handles treatment via surgical kit per frame. + * Handles treatment via surgical kit per frame + * + * Arguments: + * 0: Arguments + * 0: Caller + * 1: Target + * 1: Elapsed Time + * 2: Total Time + * + * Return Value: + * Succesful treatment started * * Public: No */ - #include "script_component.hpp" -private ["_args", "_target", "_caller", "_elapsedTime", "_totalTime", "_bandagedWounds"]; -_args = _this select 0; -_caller = _args select 0; -_target = _args select 1; -_elapsedTime = _this select 1; -_totalTime = _this select 2; + +private "_bandagedWounds"; +params ["_args", "_elapsedTime", "_totalTime"]; +_args params ["_caller", "_target"]; _bandagedWounds = _target getVariable [QGVAR(bandagedWounds), []]; //In case two people stitch up one patient and the last wound has already been closed we can stop already -if (count _bandagedWounds == 0) exitWith {false}; +if (count _bandagedWounds == 0) exitWith { false }; //Has enough time elapsed that we can close another wound? if ((_totalTime - _elapsedTime) <= (((count _bandagedWounds) - 1) * 5)) then { @@ -25,4 +32,4 @@ if ((_totalTime - _elapsedTime) <= (((count _bandagedWounds) - 1) * 5)) then { _target setVariable [QGVAR(bandagedWounds), _bandagedWounds, true]; }; -true \ No newline at end of file +true diff --git a/addons/medical/functions/fnc_treatmentBasic_bandage.sqf b/addons/medical/functions/fnc_treatmentBasic_bandage.sqf index 75b0b6bfdde..04cace08afa 100644 --- a/addons/medical/functions/fnc_treatmentBasic_bandage.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_bandage.sqf @@ -9,7 +9,7 @@ * 3: Treatment classname * * Return Value: - * nil + * None * * Public: No */ @@ -17,19 +17,7 @@ #include "script_component.hpp" #define BANDAGEHEAL 0.8 -private ["_caller", "_target","_selection","_className","_target","_hitSelections","_hitPoints","_point", "_damage"]; -_caller = _this select 0; -_target = _this select 1; -_selection = _this select 2; -_className = _this select 3; +private ["_hitSelections", "_hitPoints", "_point", "_damage"]; +params ["_caller", "_target", "_selection", "_className"]; -if (_selection == "all") then { - _target setDamage ((damage _target - BANDAGEHEAL) max 0); -} else { - _hitSelections = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]; - _hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; - _point = _hitPoints select (_hitSelections find _selection); - - _damage = ((_target getHitPointDamage _point) - BANDAGEHEAL) max 0; - [_target, _point, _damage] call FUNC(setHitPointDamage); -}; +[[_target, _selection], QUOTE(DFUNC(treatmentBasic_bandageLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ diff --git a/addons/medical/functions/fnc_treatmentBasic_bandageLocal.sqf b/addons/medical/functions/fnc_treatmentBasic_bandageLocal.sqf new file mode 100644 index 00000000000..37c9f3ef158 --- /dev/null +++ b/addons/medical/functions/fnc_treatmentBasic_bandageLocal.sqf @@ -0,0 +1,43 @@ +/* + * Author: Glowbal + * Handles the bandage of a patient. + * + * Arguments: + * 0: The patient + * 1: Treatment classname + * + * + * Return Value: + * Succesful treatment started + * + * Public: No + */ + +#include "script_component.hpp" +#define BANDAGEHEAL 0.8 + +params ["_target", "_selectionName"]; + +_damageBodyParts = _target getvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; + +// Ensure it is a valid bodypart +_part = [_selectionName] call FUNC(selectionNameToNumber); +if (_part < 0) exitwith {false}; + +if ((_damageBodyParts select _part) > 0) then { + _damageBodyParts set [_part, ((_damageBodyParts select _part) - BANDAGEHEAL) max 0]; + _target setvariable [QGVAR(bodyPartStatus), _damageBodyParts, true]; + TRACE_2("ACE_DEBUG: Treatment BASIC Bandage Broadcast value here",_unit, _target getvariable QGVAR(bodyPartStatus)); +}; + +EXPLODE_6_PVT(_damageBodyParts,_headDamage,_torsoDamage,_handsDamageR,_handsDamageL,_legsDamageR,_legsDamageL); +_target setHitPointDamage ["hitHead", _headDamage min 0.95]; +_target setHitPointDamage ["hitBody", _torsoDamage min 0.95]; +_target setHitPointDamage ["hitHands", (_handsDamageR + _handsDamageL) min 0.95]; +_target setHitPointDamage ["hitLegs", (_legsDamageR + _legsDamageL) min 0.95]; + +{ + _target setHitPointDamage [_x, (_damageBodyParts select _foreachIndex) min 0.95]; +}foreach GVAR(HITPOINTS); + +true; diff --git a/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf b/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf index 7cfb65a9099..5700d351cb4 100644 --- a/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf @@ -9,16 +9,13 @@ * 3: Treatment classname * * Return Value: - * nil + * None * * Public: No */ #include "script_component.hpp" -private ["_caller", "_target", "_treatmentClassname"]; -_caller = _this select 0; -_target = _this select 1; -_treatmentClassname = _this select 3; +params ["_caller", "_target", "_treatmentClassname"]; [[_target, _treatmentClassname], QUOTE(DFUNC(treatmentBasic_bloodbagLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ diff --git a/addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf b/addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf index 08057c9492b..64ba6e031b2 100644 --- a/addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf @@ -15,7 +15,7 @@ #include "script_component.hpp" #define BLOODBAGHEAL 70 -PARAMS_2(_target,_treatmentClassname); +params ["_target", "_treatmentClassname"]; private ["_blood", "_bloodAdded"]; diff --git a/addons/medical/functions/fnc_treatmentBasic_epipen.sqf b/addons/medical/functions/fnc_treatmentBasic_epipen.sqf index bdfb95fb2a8..d387e91f891 100644 --- a/addons/medical/functions/fnc_treatmentBasic_epipen.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_epipen.sqf @@ -9,17 +9,13 @@ * 3: Treatment classname * * Return Value: - * nil + * None * * Public: No */ - #include "script_component.hpp" -private ["_caller", "_target","_className"]; -_caller = _this select 0; -_target = _this select 1; -_className = _this select 3; +params ["_caller", "_target","_className"]; [_target, false] call FUNC(setUnconscious); diff --git a/addons/medical/functions/fnc_treatmentBasic_morphine.sqf b/addons/medical/functions/fnc_treatmentBasic_morphine.sqf index 048b3147814..87559d0dd22 100644 --- a/addons/medical/functions/fnc_treatmentBasic_morphine.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_morphine.sqf @@ -9,7 +9,7 @@ * 3: Treatment classname * * Return Value: - * nil + * None * * Public: No */ @@ -17,8 +17,6 @@ #include "script_component.hpp" #define MORPHINEHEAL 0.4 -private ["_caller", "_target"]; -_caller = _this select 0; -_target = _this select 1; +params ["_caller", "_target"]; [[_target], QUOTE(DFUNC(treatmentBasic_morphineLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ diff --git a/addons/medical/functions/fnc_treatmentBasic_morphineLocal.sqf b/addons/medical/functions/fnc_treatmentBasic_morphineLocal.sqf index 9dddf743e26..780196819b6 100644 --- a/addons/medical/functions/fnc_treatmentBasic_morphineLocal.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_morphineLocal.sqf @@ -7,7 +7,7 @@ * 1: The patient * * Return Value: - * nil + * None * * Public: No */ @@ -15,8 +15,8 @@ #include "script_component.hpp" #define MORPHINEHEAL 0.4 -private ["_target", "_morphine", "_pain"]; -_target = _this select 0; +private ["_morphine", "_pain"]; +params ["_target"]; // reduce pain, pain sensitivity _morphine = ((_target getVariable [QGVAR(morphine), 0]) + MORPHINEHEAL) min 1; diff --git a/addons/medical/functions/fnc_treatmentIV.sqf b/addons/medical/functions/fnc_treatmentIV.sqf index e0c4d20ed68..2a7bbc6adfd 100644 --- a/addons/medical/functions/fnc_treatmentIV.sqf +++ b/addons/medical/functions/fnc_treatmentIV.sqf @@ -8,26 +8,23 @@ * 2: SelectionName * 3: Treatment classname * - * * Return Value: - * + * Succesful treatment started * * Public: Yes */ #include "script_component.hpp" -private ["_caller", "_target", "_selectionName", "_className", "_items", "_removeItem"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_className = _this select 3; -_items = _this select 4; +private "_removeItem"; +params ["_caller", "_target", "_selectionName", "_className", "_items"]; -if (count _items == 0) exitwith {}; +if (count _items == 0) exitwith {false}; _removeItem = _items select 0; [[_target, _className], QUOTE(DFUNC(treatmentIVLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ [_target, _removeItem] call FUNC(addToTriageCard); [_target, "activity", LSTRING(Activity_gaveIV), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); [_target, "activity_view", LSTRING(Activity_gaveIV), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message + +true diff --git a/addons/medical/functions/fnc_treatmentIVLocal.sqf b/addons/medical/functions/fnc_treatmentIVLocal.sqf index 9abb5fda2f2..37cba2ad1b4 100644 --- a/addons/medical/functions/fnc_treatmentIVLocal.sqf +++ b/addons/medical/functions/fnc_treatmentIVLocal.sqf @@ -8,16 +8,15 @@ * * * Return Value: - * nil + * None * * Public: Yes */ #include "script_component.hpp" -private ["_target", "_treatmentClassname", "_config", "_volumeAdded", "_typeOf", "_varName", "_bloodVolume"]; -_target = _this select 0; -_treatmentClassname = _this select 1; +private ["_config", "_volumeAdded", "_typeOf", "_varName", "_bloodVolume"]; +params ["_target", "_treatmentClassname"]; _bloodVolume = _target getvariable [QGVAR(bloodVolume), 100]; if (_bloodVolume >= 100) exitwith {}; diff --git a/addons/medical/functions/fnc_treatmentTourniquet.sqf b/addons/medical/functions/fnc_treatmentTourniquet.sqf index 148ed062522..2a169a50d04 100644 --- a/addons/medical/functions/fnc_treatmentTourniquet.sqf +++ b/addons/medical/functions/fnc_treatmentTourniquet.sqf @@ -10,7 +10,7 @@ * * * Return Value: - * + * Succesful treatment started * * Public: No */ @@ -24,7 +24,7 @@ _selectionName = _this select 2; _className = _this select 3; _items = _this select 4; -if (count _items == 0) exitwith {}; +if (count _items == 0) exitwith {false}; _part = [_selectionName] call FUNC(selectionNameToNumber); if (_part == 0 || _part == 1) exitwith { @@ -47,4 +47,4 @@ _removeItem = _items select 0; [_target, "activity_view", LSTRING(Activity_appliedTourniquet), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message -true; +true diff --git a/addons/medical/functions/fnc_treatmentTourniquetLocal.sqf b/addons/medical/functions/fnc_treatmentTourniquetLocal.sqf index 5108bf8433c..d1ffd34e4b8 100644 --- a/addons/medical/functions/fnc_treatmentTourniquetLocal.sqf +++ b/addons/medical/functions/fnc_treatmentTourniquetLocal.sqf @@ -7,16 +7,14 @@ * 1: Item used classname * * Return Value: - * nil + * None * * Public: No */ #include "script_component.hpp" -private ["_target", "_tourniquetItem", "_part", "_tourniquets", "_applyingTo", "_selectionName"]; -_target = _this select 0; -_tourniquetItem = _this select 1; -_selectionName = _this select 2; +private ["_tourniquets", "_part", "_applyingTo"]; +params ["_target", "_tourniquetItem", "_selectionName"]; [_target] call FUNC(addToInjuredCollection); @@ -29,24 +27,21 @@ _tourniquets set[_part, _applyingTo]; _target setvariable [QGVAR(tourniquets), _tourniquets, true]; [{ - private ["_args","_target","_applyingTo","_part", "_tourniquets", "_time"]; - _args = _this select 0; - _target = _args select 0; - _applyingTo = _args select 1; - _part = _args select 2; - _time = _args select 3; + params ["_args", "_idPFH"]; + _args params ["_target", "_applyingTo", "_part", "_time"]; + if (!alive _target) exitwith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; _tourniquets = _target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; if !((_tourniquets select _part) == _applyingTo) exitwith { // Tourniquet has been removed - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; if (ACE_time - _time > 120) then { _target setvariable [QGVAR(pain), (_target getvariable [QGVAR(pain), 0]) + 0.005]; }; }, 5, [_target, _applyingTo, _part, ACE_time] ] call CBA_fnc_addPerFrameHandler; -true; +true diff --git a/addons/medical/functions/fnc_treatment_failure.sqf b/addons/medical/functions/fnc_treatment_failure.sqf index 8a5d7843010..e943485e0e4 100644 --- a/addons/medical/functions/fnc_treatment_failure.sqf +++ b/addons/medical/functions/fnc_treatment_failure.sqf @@ -10,21 +10,16 @@ * 4: Items available > * * Return Value: - * nil + * None * * Public: No */ #include "script_component.hpp" -private ["_args", "_caller", "_target","_selectionName","_className","_config","_callback", "_usersOfItems", "_weaponSelect", "_lastAnim"]; - -_args = _this select 0; -_caller = _args select 0; -_target = _args select 1; -_selectionName = _args select 2; -_className = _args select 3; -_usersOfItems = _args select 5; +private ["_config", "_callback", "_weaponSelect", "_lastAnim"]; +params ["_args"]; +_args params ["_caller", "_target", "_selectionName", "_className", "_items", "_usersOfItems"]; if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { _caller removeWeapon "ACE_FakePrimaryWeapon"; @@ -33,14 +28,14 @@ if (vehicle _caller == _caller) then { _lastAnim = _caller getvariable [QGVAR(treatmentPrevAnimCaller), ""]; //Don't play another medic animation (when player is rapidily treating) TRACE_2("Reseting to old animation", animationState player, _lastAnim); - switch (true) do { - case (_lastAnim == "AinvPknlMstpSlayWrflDnon_medic"): {_lastAnim = "AmovPknlMstpSrasWrflDnon"}; - case (_lastAnim == "AinvPpneMstpSlayWrflDnon_medic"): {_lastAnim = "AmovPpneMstpSrasWrflDnon"}; - case (_lastAnim == "AinvPknlMstpSlayWnonDnon_medic"): {_lastAnim = "AmovPknlMstpSnonWnonDnon"}; - case (_lastAnim == "AinvPpneMstpSlayWpstDnon_medic"): {_lastAnim = "AinvPpneMstpSlayWpstDnon"}; - case (_lastAnim == "AinvPknlMstpSlayWpstDnon_medic"): {_lastAnim = "AmovPknlMstpSrasWpstDnon"}; + switch (toLower _lastAnim) do { + case "ainvpknlmstpslaywrfldnon_medic": {_lastAnim = "AmovPknlMstpSrasWrflDnon"}; + case "ainvppnemstpslaywrfldnon_medic": {_lastAnim = "AmovPpneMstpSrasWrflDnon"}; + case "ainvpknlmstpslaywnondnon_medic": {_lastAnim = "AmovPknlMstpSnonWnonDnon"}; + case "ainvppnemstpslaywpstdnon_medic": {_lastAnim = "AinvPpneMstpSlayWpstDnon"}; + case "ainvpknlmstpslaywpstdnon_medic": {_lastAnim = "AmovPknlMstpSrasWpstDnon"}; }; - [_caller, _lastAnim, 1] call EFUNC(common,doAnimation); + [_caller, _lastAnim, 2] call EFUNC(common,doAnimation); }; _caller setvariable [QGVAR(treatmentPrevAnimCaller), nil]; @@ -57,8 +52,9 @@ if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "") }; { - (_x select 0) addItem (_x select 1); -}foreach _usersOfItems; + _x params ["_unit", "_item"]; + _unit addItem _item; +} foreach _usersOfItems; // Record specific callback _config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className); @@ -67,10 +63,10 @@ if (GVAR(level) >= 2) then { }; _callback = getText (_config >> "callbackFailure"); -if (isNil _callback) then { - _callback = compile _callback; +_callback = if (isNil _callback) then { + compile _callback } else { - _callback = missionNamespace getvariable _callback; + missionNamespace getvariable _callback }; _args call _callback; diff --git a/addons/medical/functions/fnc_treatment_success.sqf b/addons/medical/functions/fnc_treatment_success.sqf index f5cb9baf715..bf183e24dbe 100644 --- a/addons/medical/functions/fnc_treatment_success.sqf +++ b/addons/medical/functions/fnc_treatment_success.sqf @@ -10,19 +10,16 @@ * 4: Items available > * * Return Value: - * nil + * None * * Public: No */ #include "script_component.hpp" -private ["_args", "_caller", "_target","_selectionName","_className","_config","_callback", "_weaponSelect", "_lastAnim"]; -_args = _this select 0; -_caller = _args select 0; -_target = _args select 1; -_selectionName = _args select 2; -_className = _args select 3; +private ["_config", "_callback", "_weaponSelect", "_lastAnim"]; +params ["_args"]; +_args params ["_caller", "_target","_selectionName","_className", "_items", "_usersOfItems"]; if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { _caller removeWeapon "ACE_FakePrimaryWeapon"; @@ -31,14 +28,14 @@ if (vehicle _caller == _caller) then { _lastAnim = _caller getvariable [QGVAR(treatmentPrevAnimCaller), ""]; //Don't play another medic animation (when player is rapidily treating) TRACE_2("Reseting to old animation", animationState player, _lastAnim); - switch (true) do { - case (_lastAnim == "AinvPknlMstpSlayWrflDnon_medic"): {_lastAnim = "AmovPknlMstpSrasWrflDnon"}; - case (_lastAnim == "AinvPpneMstpSlayWrflDnon_medic"): {_lastAnim = "AmovPpneMstpSrasWrflDnon"}; - case (_lastAnim == "AinvPknlMstpSlayWnonDnon_medic"): {_lastAnim = "AmovPknlMstpSnonWnonDnon"}; - case (_lastAnim == "AinvPpneMstpSlayWpstDnon_medic"): {_lastAnim = "AinvPpneMstpSlayWpstDnon"}; - case (_lastAnim == "AinvPknlMstpSlayWpstDnon_medic"): {_lastAnim = "AmovPknlMstpSrasWpstDnon"}; + switch (tolower _lastAnim) do { + case "ainvpknlmstpslaywrfldnon_medic": {_lastAnim = "AmovPknlMstpSrasWrflDnon"}; + case "ainvppnemstpslaywrfldnon_medic": {_lastAnim = "AmovPpneMstpSrasWrflDnon"}; + case "ainvpknlmstpslaywnondnon_medic": {_lastAnim = "AmovPknlMstpSnonWnonDnon"}; + case "ainvppnemstpslaywpstdnon_medic": {_lastAnim = "AinvPpneMstpSlayWpstDnon"}; + case "ainvpknlmstpslaywpstdnon_medic": {_lastAnim = "AmovPknlMstpSrasWpstDnon"}; }; - [_caller, _lastAnim, 1] call EFUNC(common,doAnimation); + [_caller, _lastAnim, 2] call EFUNC(common,doAnimation); }; _caller setvariable [QGVAR(treatmentPrevAnimCaller), nil]; diff --git a/addons/medical/functions/fnc_unconsciousPFH.sqf b/addons/medical/functions/fnc_unconsciousPFH.sqf index 5b1ca04d2d4..0e8c424ca3f 100644 --- a/addons/medical/functions/fnc_unconsciousPFH.sqf +++ b/addons/medical/functions/fnc_unconsciousPFH.sqf @@ -13,21 +13,17 @@ * 1: PFEH ID * * ReturnValue: - * nil + * None * * Public: yes */ - #include "script_component.hpp" private ["_unit", "_minWaitingTime", "_slotInfo", "_hasMovedOut", "_parachuteCheck", "_args", "_originalPos", "_startingTime", "_awakeInVehicleAnimation", "_oldVehicleAnimation", "_vehicle"]; -_args = _this select 0; -_unit = _args select 0; -_originalPos = _args select 1; -_startingTime = _args select 2; -_minWaitingTime = _args select 3; -_hasMovedOut = _args select 4; -_parachuteCheck = _args select 5; +params ["_args", "_idPFH"]; +_args params ["_unit", "_originalPos", "_startingTime", "_minWaitingTime", "_hasMovedOut", "_parachuteCheck"]; + +TRACE_6("ACE_DEBUG_Unconscious_PFH",_unit, _originalPos, _startingTime, _minWaitingTime, _hasMovedOut, _parachuteCheck); if (!alive _unit) exitwith { if ("ACE_FakePrimaryWeapon" in (weapons _unit)) then { @@ -45,11 +41,14 @@ if (!alive _unit) exitwith { [_unit, "isUnconscious"] call EFUNC(common,unmuteUnit); ["medical_onUnconscious", [_unit, false]] call EFUNC(common,globalEvent); - [(_this select 1)] call cba_fnc_removePerFrameHandler; + TRACE_3("ACE_DEBUG_Unconscious_Exit",_unit, (!alive _unit) , QGVAR(unconscious)); + + [_idPFH] call CBA_fnc_removePerFrameHandler; }; // In case the unit is no longer in an unconscious state, we are going to check if we can already reset the animation if !(_unit getvariable ["ACE_isUnconscious",false]) exitwith { + TRACE_7("ACE_DEBUG_Unconscious_PFH",_unit, _args, [_unit] call FUNC(isBeingCarried), [_unit] call FUNC(isBeingDragged), _idPFH, _unit getvariable QGVAR(unconsciousArguments),animationState _unit); // TODO, handle this with carry instead, so we can remove the PFH here. // Wait until the unit isn't being carried anymore, so we won't end up with wierd animations if !(([_unit] call FUNC(isBeingCarried)) || ([_unit] call FUNC(isBeingDragged))) then { @@ -57,7 +56,7 @@ if !(_unit getvariable ["ACE_isUnconscious",false]) exitwith { TRACE_1("Removing fake weapon [on wakeup]",_unit); _unit removeWeapon "ACE_FakePrimaryWeapon"; }; - + if (vehicle _unit == _unit) then { if (animationState _unit == "AinjPpneMstpSnonWrflDnon") then { [_unit,"AinjPpneMstpSnonWrflDnon_rolltofront", 2] call EFUNC(common,doAnimation); @@ -99,7 +98,7 @@ if !(_unit getvariable ["ACE_isUnconscious",false]) exitwith { ["medical_onUnconscious", [_unit, false]] call EFUNC(common,globalEvent); // EXIT PFH - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; if (!_hasMovedOut) then { // Reset the unit back to the previous captive state. @@ -130,13 +129,15 @@ if (_parachuteCheck) then { }; if (!local _unit) exitwith { + TRACE_6("ACE_DEBUG_Unconscious_PFH",_unit, _args, _startingTime, _minWaitingTime, _idPFH, _unit getvariable QGVAR(unconsciousArguments)); _args set [3, _minWaitingTime - (ACE_time - _startingTime)]; _unit setvariable [QGVAR(unconsciousArguments), _args, true]; - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [_idPFH] call CBA_fnc_removePerFrameHandler; }; // Ensure we are waiting at least a minimum period before checking if we can wake up the unit again, allows for temp knock outs if ((ACE_time - _startingTime) >= _minWaitingTime) exitwith { + TRACE_2("ACE_DEBUG_Unconscious_Temp knock outs",_unit, [_unit] call FUNC(getUnconsciousCondition)); if (!([_unit] call FUNC(getUnconsciousCondition))) then { _unit setvariable ["ACE_isUnconscious", false, true]; }; diff --git a/addons/medical/functions/fnc_useItem.sqf b/addons/medical/functions/fnc_useItem.sqf index 750ea0452f0..770d8b6ea7d 100644 --- a/addons/medical/functions/fnc_useItem.sqf +++ b/addons/medical/functions/fnc_useItem.sqf @@ -8,17 +8,16 @@ * 2: Item * * ReturnValue: - * + * 0: success + * 1: Unit * * Public: Yes */ #include "script_component.hpp" -private ["_medic", "_patient", "_item", "_return","_crew"]; -_medic = _this select 0; -_patient = _this select 1; -_item = _this select 2; +private ["_return","_crew"]; +params ["_medic", "_patient", "_item"]; if (isnil QGVAR(setting_allowSharedEquipment)) then { GVAR(setting_allowSharedEquipment) = true; @@ -42,7 +41,7 @@ if ([vehicle _medic] call FUNC(isMedicalVehicle) && {vehicle _medic != _medic}) _return = [true, _x]; [[_x, _item], QUOTE(EFUNC(common,useItem)), _x] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ }; - }foreach _crew; + } foreach _crew; }; -_return; +_return diff --git a/addons/medical/functions/fnc_useItems.sqf b/addons/medical/functions/fnc_useItems.sqf index fbaa3240221..0d937c0938b 100644 --- a/addons/medical/functions/fnc_useItems.sqf +++ b/addons/medical/functions/fnc_useItems.sqf @@ -8,7 +8,7 @@ * 2: Items > * * ReturnValue: - * + * None * * Public: Yes */ @@ -16,9 +16,7 @@ #include "script_component.hpp" private ["_medic", "_patient", "_items", "_itemUsedInfo", "_itemsUsedBy"]; -_medic = _this select 0; -_patient = _this select 1; -_items = _this select 2; +params ["_medic", "_patient", "_items"]; _itemsUsedBy = []; { @@ -27,7 +25,7 @@ _itemsUsedBy = []; { _itemUsedInfo = [_medic, _patient, _x] call FUNC(useItem); if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; - }foreach _x; + } foreach _x; }; // handle required item @@ -35,6 +33,6 @@ _itemsUsedBy = []; _itemUsedInfo = [_medic, _patient, _x] call FUNC(useItem); if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]}; }; -}foreach _items; +} foreach _items; [count _items == count _itemsUsedBy, _itemsUsedBy]; diff --git a/addons/medical/script_component.hpp b/addons/medical/script_component.hpp index 939a811a41e..54aea5beb9c 100644 --- a/addons/medical/script_component.hpp +++ b/addons/medical/script_component.hpp @@ -1,6 +1,9 @@ #define COMPONENT medical #include "\z\ace\addons\main\script_mod.hpp" +#define DEBUG_ENABLED_MEDICAL true +#define DEBUG_SETTINGS_MEDICAL true + #ifdef DEBUG_ENABLED_MEDICAL #define DEBUG_MODE_FULL #endif diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index f91b4ad7897..89b1df20c1d 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -3726,5 +3726,10 @@ Distance to %1 has become to far for treatment %1 odszedł zbyt daleko, nie można kontynuować leczenia + + This person (%1) is awake and cannot be loaded + + + There is no tourniquet on this body part! diff --git a/addons/medical_menu/XEH_preInit.sqf b/addons/medical_menu/XEH_preInit.sqf index c231c7df6eb..65ac88e245c 100644 --- a/addons/medical_menu/XEH_preInit.sqf +++ b/addons/medical_menu/XEH_preInit.sqf @@ -3,6 +3,7 @@ ADDON = false; PREP(onMenuOpen); +PREP(onMenuClose); PREP(openMenu); PREP(canOpenMenu); diff --git a/addons/medical_menu/functions/fnc_onMenuClose.sqf b/addons/medical_menu/functions/fnc_onMenuClose.sqf new file mode 100644 index 00000000000..4300089a4a6 --- /dev/null +++ b/addons/medical_menu/functions/fnc_onMenuClose.sqf @@ -0,0 +1,21 @@ +/* + * Author: joko // Jonas + * Handle medical menu closed + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_medical_menu_onMenuClosed + * + * Public: No + */ +#include "script_component.hpp" + +if (EGVAR(interact_menu,menuBackground)==1) then {[QGVAR(id), false] call EFUNC(common,blurScreen);}; +if (EGVAR(interact_menu,menuBackground)==2) then {(uiNamespace getVariable [QEGVAR(interact_menu,menuBackground), displayNull]) closeDisplay 0;}; + +[GVAR(MenuPFHID)] call CBA_fnc_removePerFrameHandler; diff --git a/addons/medical_menu/functions/fnc_onMenuOpen.sqf b/addons/medical_menu/functions/fnc_onMenuOpen.sqf index 164353fe737..9f0acfbeb63 100644 --- a/addons/medical_menu/functions/fnc_onMenuOpen.sqf +++ b/addons/medical_menu/functions/fnc_onMenuOpen.sqf @@ -22,6 +22,9 @@ params ["_display"]; if (isNil "_display") exitwith {}; +if (EGVAR(interact_menu,menuBackground)==1) then {[QGVAR(id), true] call EFUNC(common,blurScreen);}; +if (EGVAR(interact_menu,menuBackground)==2) then {0 cutRsc[QEGVAR(interact_menu,menuBackground), "PLAIN", 1, false];}; + if (isNil QGVAR(LatestDisplayOptionMenu)) then { GVAR(LatestDisplayOptionMenu) = "triage"; } else { diff --git a/addons/medical_menu/functions/fnc_updateInformationLists.sqf b/addons/medical_menu/functions/fnc_updateInformationLists.sqf index 70903347b54..ecd700e43a1 100644 --- a/addons/medical_menu/functions/fnc_updateInformationLists.sqf +++ b/addons/medical_menu/functions/fnc_updateInformationLists.sqf @@ -33,6 +33,6 @@ _amountOfGeneric = count _genericMessages; _lbCtrl lbSetColor [_forEachIndex + _amountOfGeneric, _color]; } forEach _allInjuryTexts; -if !(_allInjuryTexts isEqualTo []) then { +if (_allInjuryTexts isEqualTo []) then { _lbCtrl lbAdd localize ELSTRING(medical,NoInjuriesBodypart); }; diff --git a/addons/medical_menu/functions/fnc_updateUIInfo.sqf b/addons/medical_menu/functions/fnc_updateUIInfo.sqf index 7dee2d5123d..b493b5026ea 100644 --- a/addons/medical_menu/functions/fnc_updateUIInfo.sqf +++ b/addons/medical_menu/functions/fnc_updateUIInfo.sqf @@ -105,11 +105,12 @@ if (EGVAR(medical,level) >= 2) then { } forEach _bandagedwounds; } else { _damaged = [true, true, true, true, true, true]; + { - _selectionBloodLoss set [_forEachIndex, _target getHitPointDamage _x]; + _selectionBloodLoss set [_forEachIndex, _x]; - if (_target getHitPointDamage _x > 0 && _forEachIndex == _selectionN) then { - _pointDamage = _target getHitPointDamage _x; + if (_x > 0 && _forEachIndex == _selectionN) then { + _pointDamage = _x; _severity = switch (true) do { case (_pointDamage > 0.5): {localize ELSTRING(medical,HeavilyWounded)}; case (_pointDamage > 0.1): {localize ELSTRING(medical,LightlyWounded)}; @@ -125,7 +126,7 @@ if (EGVAR(medical,level) >= 2) then { ] select _forEachIndex); _allInjuryTexts pushBack [format ["%1 %2", _severity, toLower _part], [1,1,1,1]]; }; - } forEach ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; + } forEach (_target getvariable [QEGVAR(medical,bodyPartStatus), [0,0,0,0,0,0]]); }; [_selectionBloodLoss, _display] call FUNC(updateBodyImage); diff --git a/addons/medical_menu/ui/menu.hpp b/addons/medical_menu/ui/menu.hpp index ab078d4c72b..342f0230a2a 100644 --- a/addons/medical_menu/ui/menu.hpp +++ b/addons/medical_menu/ui/menu.hpp @@ -3,10 +3,10 @@ class GVAR(medicalMenu) { idd = 314412; movingEnable = true; - onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(medicalMenu)), _this select 0)]; [ARR_2(QUOTE(QGVAR(id)), true)] call EFUNC(common,blurScreen); [_this select 0] call FUNC(onMenuOpen);); - onUnload = QUOTE([ARR_2(QUOTE(QGVAR(id)), false)] call EFUNC(common,blurScreen); [GVAR(MenuPFHID)] call CBA_fnc_removePerFrameHandler;); + onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(medicalMenu)), _this select 0)]; [_this select 0] call FUNC(onMenuOpen);); + onUnload = QUOTE([] call FUNC(onMenuClose)); class controlsBackground { - class HeaderBackground: ACE_gui_backgroundBase{ + class HeaderBackground: ACE_gui_backgroundBase { idc = -1; SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; diff --git a/addons/protection/$PBOPREFIX$ b/addons/protection/$PBOPREFIX$ deleted file mode 100644 index 7ba9736ebe6..00000000000 --- a/addons/protection/$PBOPREFIX$ +++ /dev/null @@ -1 +0,0 @@ -z\ace\addons\protection \ No newline at end of file diff --git a/addons/protection/CfgVehicles.hpp b/addons/protection/CfgVehicles.hpp deleted file mode 100644 index bce583e2ec8..00000000000 --- a/addons/protection/CfgVehicles.hpp +++ /dev/null @@ -1,5 +0,0 @@ - -class CfgVehicles { - #include - #include -}; diff --git a/addons/protection/CfgWeapons.hpp b/addons/protection/CfgWeapons.hpp deleted file mode 100644 index 3f706fed41f..00000000000 --- a/addons/protection/CfgWeapons.hpp +++ /dev/null @@ -1,4 +0,0 @@ - -class CfgWeapons { - #include -}; diff --git a/addons/protection/FixHelmets.hpp b/addons/protection/FixHelmets.hpp deleted file mode 100644 index eb2c515e504..00000000000 --- a/addons/protection/FixHelmets.hpp +++ /dev/null @@ -1,230 +0,0 @@ - -// INTEGER -#define HELMET_ARMOR_NO_PROTECTION 0 - -// FLOAT, 0-1 -#define HELMET_PASSTHROUGH_NO_PROTECTION 1 - -/*class InventoryItem_Base_F; -class HeadgearItem: InventoryItem_Base_F { - armor = 0; - passThrough = 1; -}; - -class H_HelmetB: ItemCore { - class ItemInfo: HeadgearItem { - //mass = 40; - armor = 4; - passThrough = 0.5; - }; -}; - -class H_HelmetB_camo: H_HelmetB { - class ItemInfo: HeadgearItem { - //mass = 40; - armor = 4; - passThrough = 0.5; - }; -}; - -class H_HelmetB_light: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 30; - armor = 3; - passThrough = 0.5; - }; -}; - -class H_Booniehat_khk: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 10; - armor = 0; - passThrough = 1; - }; -}; - -class H_HelmetB_plain_mcamo: H_HelmetB {}; - -class H_HelmetSpecB: H_HelmetB_plain_mcamo { - class ItemInfo: ItemInfo { - //mass = 50; - armor = 5; - passThrough = 0.5; - }; -}; - -class H_HelmetIA: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 40; - armor = 4; - passThrough = 0.5; - }; -}; - -class H_Cap_red: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 4; - armor = 0; - passThrough = 1; - }; -}; - -class H_Cap_headphones: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 8; - armor = 0; - passThrough = 1; - }; -}; - -class H_HelmetCrew_B: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 40; - armor = 4; - passThrough = 0.5; - }; -}; - -class H_PilotHelmetFighter_B: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 50; - armor = 5; - passThrough = 0.5; - }; -}; - -class H_PilotHelmetHeli_B: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 30; - armor = 3; - passThrough = 0.5; - }; -}; - -class H_CrewHelmetHeli_B: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 30; - armor = 3; - passThrough = 0.5; - }; -}; - -class H_HelmetO_ocamo: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 50; - armor = 5; - passThrough = 0.5; - }; -}; - -class H_HelmetLeaderO_ocamo: H_HelmetO_ocamo { - class ItemInfo: ItemInfo { - //mass = 60; - armor = 6; - passThrough = 0.5; - }; -}; - -class H_MilCap_ocamo: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 6; - armor = 0; - passThrough = 1; - }; -}; - -class H_BandMask_blk: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 8; - armor = 0; - passThrough = 1; - }; -}; - -class H_HelmetSpecO_ocamo: H_HelmetO_ocamo { - class ItemInfo: ItemInfo { - //mass = 40; - armor = 4; - passThrough = 0.5; - }; -}; - -class H_Bandanna_surfer: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 8; - armor = 0; - passThrough = 1; - }; -}; - -class H_Shemag_khk: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 6; - armor = 0; - passThrough = 1; - }; -}; - -class H_ShemagOpen_khk: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 6; - armor = 0; - passThrough = 1; - }; -}; - -class H_Beret_blk: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 6; - armor = 0; - passThrough = 1; - }; -}; - -class H_Beret_02: H_Beret_blk { - class ItemInfo: ItemInfo { - //mass = 6; - armor = 0; - passThrough = 1; - }; -}; - -class H_Watchcap_blk: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 6; - armor = 0; - passThrough = 1; - }; -}; - -class H_TurbanO_blk: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 8; - armor = 0; - passThrough = 1; - }; -}; - -class H_StrawHat: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 6; - armor = 0; - passThrough = 1; - }; -}; - -class H_Hat_blue: H_HelmetB { - class ItemInfo: ItemInfo { - //mass = 6; - armor = 0; - passThrough = 1; - }; -}; - -class H_RacingHelmet_1_F: H_HelmetB_camo { - class ItemInfo: ItemInfo { - //mass = 50; - armor = 5; - passThrough = 0.5; - }; -};*/ diff --git a/addons/protection/FixUniforms.hpp b/addons/protection/FixUniforms.hpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/addons/protection/FixVests.hpp b/addons/protection/FixVests.hpp deleted file mode 100644 index f3d1ad2b3d5..00000000000 --- a/addons/protection/FixVests.hpp +++ /dev/null @@ -1,303 +0,0 @@ - -class ItemCore; -class VestItem; - -class Vest_Camo_Base: ItemCore { - class ItemInfo: VestItem { - /*containerClass = "Supply0"; - mass = 0; - armor = 0; - passThrough = 1;*/ - }; -}; -class Vest_NoCamo_Base: ItemCore { - class ItemInfo: VestItem { - /*containerClass = "Supply0"; - mass = 0; - armor = 0; - passThrough = 1;*/ - }; -}; - -// belts -class V_Rangemaster_belt: Vest_NoCamo_Base { - class ItemInfo: ItemInfo { - /*containerClass = "Supply40"; - mass = 10; - armor = 0; - passThrough = 1;*/ - }; -}; - -// bandolliers -class V_BandollierB_khk: Vest_Camo_Base { - class ItemInfo: ItemInfo { - /*containerClass = "Supply80"; - mass = 15; - armor = 0;*/ - passThrough = 0.85; //1; - }; -}; -/*class V_BandollierB_cbr: V_BandollierB_khk { - class ItemInfo: ItemInfo {}; -}; -class V_BandollierB_rgr: V_BandollierB_khk { - class ItemInfo: ItemInfo {}; -}; -class V_BandollierB_blk: V_BandollierB_khk { - class ItemInfo: ItemInfo {}; -}; -class V_BandollierB_oli: V_BandollierB_khk { - class ItemInfo: ItemInfo {}; -};*/ - -// plate carriers -class V_PlateCarrier1_rgr: Vest_NoCamo_Base { // lite - class ItemInfo: ItemInfo { - /*containerClass = "Supply140"; - mass = 80;*/ - armor = 8; //20; - passThrough = 0.75; //0.5; - }; -}; -class V_PlateCarrier2_rgr: V_PlateCarrier1_rgr { // heavy - class ItemInfo: ItemInfo { - /*containerClass = "Supply140"; - mass = 100;*/ - armor = 12; //30; - passThrough = 0.75; //0.5; - }; -}; -class V_PlateCarrier3_rgr: Vest_NoCamo_Base { // heavy (us) - class ItemInfo: ItemInfo { - /*containerClass = "Supply140"; - mass = 100;*/ - armor = 12; //30; - passThrough = 0.75; //0.5; - }; -}; -class V_PlateCarrierGL_rgr: Vest_NoCamo_Base { // lite (gl) - class ItemInfo: ItemInfo { - containerClass = "Supply160"; //"Supply140"; - /*mass = 100;*/ - armor = 8; //100; - passThrough = 0.75; //0.7; - }; -}; -class V_PlateCarrier1_blk: Vest_Camo_Base { // heavy (black) - class ItemInfo: ItemInfo { - /*containerClass = "Supply140";*/ - mass = 100; //80; - armor = 12; //20; - passThrough = 0.75; //0.5; - }; -}; -class V_PlateCarrierSpec_rgr: Vest_NoCamo_Base { // lite (special) - class ItemInfo: ItemInfo { - /*containerClass = "Supply100"; - mass = 120;*/ - armor = 16; //40; - passThrough = 0.75; //0.1; - }; -}; - -// chestrigs -/*class V_Chestrig_khk: Vest_Camo_Base { - class ItemInfo: ItemInfo { - containerClass = "Supply140"; - mass = 20; - armor = 0; - passThrough = 1; - }; -}; -class V_Chestrig_rgr: V_Chestrig_khk {}; -class V_Chestrig_blk: V_Chestrig_khk {}; -class V_Chestrig_oli: Vest_Camo_Base { - class ItemInfo: ItemInfo { - containerClass = "Supply140"; - mass = 20; - armor = 0; - passThrough = 1; - }; -};*/ - -// tactical vests -class V_TacVest_khk: Vest_Camo_Base { - class ItemInfo: ItemInfo { - /*containerClass = "Supply100"; - mass = 40;*/ - armor = 8; //20; - /*passThrough = 1;*/ - }; -}; -class V_TacVest_brn: V_TacVest_khk {}; -class V_TacVest_oli: V_TacVest_khk {}; -class V_TacVest_blk: V_TacVest_khk {}; -class V_TacVest_camo: Vest_Camo_Base { - class ItemInfo: ItemInfo { - /*containerClass = "Supply100"; - mass = 40;*/ - armor = 8; //20; - /*passThrough = 1;*/ - }; -}; -class V_TacVest_blk_POLICE: Vest_Camo_Base { - class ItemInfo: ItemInfo { - /*containerClass = "Supply100";*/ - mass = 40; //60; - armor = 8; //100; - passThrough = 1; //0.7; - }; -}; -class V_TacVestIR_blk: Vest_NoCamo_Base { // raven vest - class ItemInfo: VestItem { - /*containerClass = "Supply100"; - mass = 50;*/ - armor = 8; //20; - passThrough = 0.85; //0.5; - }; -}; -class V_TacVestCamo_khk: Vest_Camo_Base { - class ItemInfo: VestItem { - /*containerClass = "Supply100"; - mass = 40;*/ - armor = 8; //20; - /*passThrough = 1;*/ - }; -}; - -// harnesses -class V_HarnessO_brn: Vest_NoCamo_Base { - class ItemInfo: ItemInfo { - /*containerClass = "Supply160"; - mass = 30; - armor = 0;*/ - passThrough = 0.85; //0.5; - }; -}; -class V_HarnessOGL_brn: Vest_NoCamo_Base { // gl - class ItemInfo: ItemInfo { - /*containerClass = "Supply120"; - mass = 20; - armor = 0;*/ - passThrough = 0.85; //0.5; - }; -}; -class V_HarnessO_gry: V_HarnessO_brn { - class ItemInfo: ItemInfo { - /*containerClass = "Supply160"; - mass = 30; - armor = 0;*/ - passThrough = 0.85; //0.5; - }; -}; -class V_HarnessOGL_gry: V_HarnessO_gry { // gl - class ItemInfo: ItemInfo { - /*containerClass = "Supply120"; - mass = 20; - armor = 0;*/ - passThrough = 0.85; //0.5; - }; -}; -class V_HarnessOSpec_brn: V_HarnessO_brn { - class ItemInfo: VestItem { - /*containerClass = "Supply160"; - mass = 30; - armor = 0;*/ - passThrough = 0.85; //0.5; - }; -}; -class V_HarnessOSpec_gry: V_HarnessO_gry { - class ItemInfo: ItemInfo { - /*containerClass = "Supply160"; - mass = 30; - armor = 0;*/ - passThrough = 0.85; //0.5; - }; -}; - -// indep plate carriers -class V_PlateCarrierIA1_dgtl: Vest_NoCamo_Base { // lite - class ItemInfo: VestItem { - /*containerClass = "Supply120"; - mass = 60;*/ - armor = 8; //20; - passThrough = 0.75; //0.5; - }; -}; -class V_PlateCarrierIA2_dgtl: V_PlateCarrierIA1_dgtl { // heavy - class ItemInfo: VestItem { - /*containerClass = "Supply120"; - mass = 80;*/ - armor = 12; //30; - passThrough = 0.75; //0.5; - }; -}; -class V_PlateCarrierIAGL_dgtl: V_PlateCarrierIA2_dgtl { // heavy (gl) - class ItemInfo: VestItem { - containerClass = "Supply140"; //"Supply120"; - mass = 100; //80; - armor = 12; //100; - passThrough = 0.75; //0.7; - }; -}; - -// rebreather -/*class V_RebreatherB: Vest_Camo_Base { - class ItemInfo: ItemInfo { - containerClass = "Supply0"; - mass = 80; - armor = 20; - passThrough = 1; - }; -}; -class V_RebreatherIR: V_RebreatherB {}; -class V_RebreatherIA: V_RebreatherB {};*/ - -// more plate carriers -class V_PlateCarrier_Kerry: V_PlateCarrier1_rgr { // lighter - class ItemInfo: ItemInfo { - /*containerClass = "Supply140"; - mass = 80;*/ - armor = 8; //30; - passThrough = 0.75; //0.5; - }; -}; -class V_PlateCarrierL_CTRG: V_PlateCarrier1_rgr { // lite - class ItemInfo: ItemInfo { - /*containerClass = "Supply140"; - mass = 80;*/ - armor = 8; //20; - passThrough = 0.75; //0.5; - }; -}; -class V_PlateCarrierH_CTRG: V_PlateCarrier2_rgr { // heavy - class ItemInfo: ItemInfo { - /*containerClass = "Supply140"; - mass = 100;*/ - armor = 12; //30; - passThrough = 0.75; //0.5; - }; -}; - -// another tactical vest -class V_I_G_resistanceLeader_F: V_TacVest_camo { - class ItemInfo: ItemInfo {}; -}; - -// press vest -class V_Press_F: Vest_Camo_Base { - class ItemInfo: ItemInfo { - /*containerClass = "Supply40"; - mass = 20;*/ - armor = 8; //0; ? - /*passThrough = 1;*/ - }; -}; - -// marksman dlc -/*class V_PlateCarrierGL_blk: V_PlateCarrierGL_rgr {}; -class V_PlateCarrierGL_mtp: V_PlateCarrierGL_rgr {}; -class V_PlateCarrierSpec_blk: V_PlateCarrierSpec_rgr {}; -class V_PlateCarrierSpec_mtp: V_PlateCarrierSpec_rgr {}; -class V_PlateCarrierIAGL_oli: V_PlateCarrierIAGL_dgtl {};*/ diff --git a/addons/protection/README.md b/addons/protection/README.md deleted file mode 100644 index a6def1a1bcd..00000000000 --- a/addons/protection/README.md +++ /dev/null @@ -1,12 +0,0 @@ -ace_protection -============== - -Fixes and tweaks the protection values of body armour. - - -## Maintainers - -The people responsible for merging changes to this component or answering potential questions. - -- [KoffeinFlummi](https://github.com/KoffeinFlummi) -- [commy2](https://github.com/commy2) diff --git a/addons/protection/config.cpp b/addons/protection/config.cpp deleted file mode 100644 index bb4ef3f7395..00000000000 --- a/addons/protection/config.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "script_component.hpp" - -class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_common"}; - author[] = {"commy2"}; - authorUrl = "https://github.com/commy2"; - VERSION_CONFIG; - }; -}; - -#include "CfgVehicles.hpp" -#include "CfgWeapons.hpp" diff --git a/addons/protection/script_component.hpp b/addons/protection/script_component.hpp deleted file mode 100644 index 1b2774a8ef3..00000000000 --- a/addons/protection/script_component.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#define COMPONENT protection -#include "\z\ace\addons\main\script_mod.hpp" - -#ifdef DEBUG_ENABLED_PROTECTION - #define DEBUG_MODE_FULL -#endif - -#ifdef DEBUG_ENABLED_PROTECTION - #define DEBUG_SETTINGS DEBUG_ENABLED_PROTECTION -#endif - -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file