From f3228841763c360c88ba118786ce105bac0895ae Mon Sep 17 00:00:00 2001 From: Glowbal Date: Fri, 6 Mar 2015 22:54:44 +0100 Subject: [PATCH] Added medical settings module --- addons/medical/ACE_Settings.hpp | 17 ++++ addons/medical/CfgFactionClasses.hpp | 6 ++ addons/medical/CfgVehicles.hpp | 82 +++++++++++++++++++ addons/medical/XEH_postInit.sqf | 4 +- addons/medical/config.cpp | 2 + addons/medical/functions/fnc_canTreat.sqf | 2 +- .../fnc_displayPatientInformation.sqf | 2 +- addons/medical/functions/fnc_getBloodLoss.sqf | 2 +- .../functions/fnc_getUnconsciousCondition.sqf | 2 +- addons/medical/functions/fnc_handleDamage.sqf | 4 +- .../functions/fnc_handleUnitVitals.sqf | 2 +- addons/medical/functions/fnc_treatment.sqf | 2 +- .../functions/fnc_treatment_failure.sqf | 2 +- .../functions/fnc_treatment_success.sqf | 2 +- 14 files changed, 119 insertions(+), 12 deletions(-) create mode 100644 addons/medical/ACE_Settings.hpp create mode 100644 addons/medical/CfgFactionClasses.hpp diff --git a/addons/medical/ACE_Settings.hpp b/addons/medical/ACE_Settings.hpp new file mode 100644 index 0000000000..9aff92449f --- /dev/null +++ b/addons/medical/ACE_Settings.hpp @@ -0,0 +1,17 @@ +class ACE_Settings { + class GVAR(level) { + value = 1; + typeName = "SCALAR"; + values[] = {"Disabled", "Basic", "Advanced"}; + }; + class GVAR(medicSetting) { + value = 1; + typeName = "SCALAR"; + values[] = {"Disabled", "Normal", "Advanced"}; + }; + class GVAR(enableFor) { + value = 0; + typeName = "SCALAR"; + values[] = {"Players only", "Players and AI"}; + }; +}; diff --git a/addons/medical/CfgFactionClasses.hpp b/addons/medical/CfgFactionClasses.hpp new file mode 100644 index 0000000000..e98b1f84ec --- /dev/null +++ b/addons/medical/CfgFactionClasses.hpp @@ -0,0 +1,6 @@ +class CfgFactionClasses { + class NO_CATEGORY; + class ADDON: NO_CATEGORY { + displayName = "ACE Medical"; + }; +}; diff --git a/addons/medical/CfgVehicles.hpp b/addons/medical/CfgVehicles.hpp index 7dd4397ff1..2e7400927a 100644 --- a/addons/medical/CfgVehicles.hpp +++ b/addons/medical/CfgVehicles.hpp @@ -1,5 +1,87 @@ class CfgVehicles { + + class Logic; + class Module_F: Logic { + class ArgumentsBaseUnits { + }; + }; + class ACE_moduleMedicalSettings: Module_F { + scope = 2; + displayName = "Medical Settings [ACE]"; + icon = QUOTE(PATHTOF(data\ACE_medical_module.paa)); + category = "ACE_medical"; + function = QUOTE(DFUNC(moduleMedicalSettings)); + functionPriority = 1; + isGlobal = 1; + isTriggerActivated = 0; + author = "Glowbal"; + class Arguments { + class level { + displayName = "Medical Level"; + description = "What is the medical simulation level?"; + typeName = "NUMBER"; + class values { + class disable { + name = "Disabled"; + value = -1; + }; + class normal { + name = "Basic"; + value = 0; + default = 1; + }; + class full { + name = "Advanced"; + value = 1; + }; + }; + }; + class medicSetting { + displayName = "Medics setting"; + description = "What is the level of detail prefered for medics?"; + typeName = "NUMBER"; + class values { + class disable { + name = "Disable medics"; + value = -1; + }; + class normal { + name = "Normal"; + value = 0; + default = 1; + }; + class full { + name = "Advanced"; + value = 1; + }; + }; + }; + class enableFor { + displayName = "Enabled for"; + description = "Select what units the medical system will be enabled for"; + typeName = "NUMBER"; + class values { + class playableUnits { + name = "Players only"; + value = 0; + default = 1; + }; + class playableUnitsAndAI { + name = "Players and AI"; + value = 1; + }; + }; + }; + }; + class ModuleDescription { + description = "Provides a medical system for both players and AI."; + sync[] = {}; + }; + }; + + + #define ARM_LEG_ARMOR_DEFAULT 2 #define ARM_LEG_ARMOR_BETTER 3 #define ARM_LEG_ARMOR_CSAT 4 diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index 5ec0547be8..267577c0a2 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -141,7 +141,7 @@ if (isNil QGVAR(level)) then { // HEARTRATE BASED EFFECTS [{ _heartRate = ACE_player getVariable [QGVAR(heartRate), 70]; - if (GVAR(level) == 0) then { + if (GVAR(level) == 1) then { _heartRate = 60 + 40 * (ACE_player getVariable [QGVAR(pain), 0]); }; if (_heartRate <= 0) exitwith {}; @@ -200,7 +200,7 @@ if (isNil QGVAR(level)) then { }; }; - if (GVAR(level) > 0 && {_heartRate > 0}) then { + if (GVAR(level) >= 2 && {_heartRate > 0}) then { _minTime = 60 / _heartRate; if (time - GVAR(lastHeartBeatSound) > _minTime) then { GVAR(lastHeartBeatSound) = time; diff --git a/addons/medical/config.cpp b/addons/medical/config.cpp index 0449a7e17b..2ec4f596c3 100644 --- a/addons/medical/config.cpp +++ b/addons/medical/config.cpp @@ -13,8 +13,10 @@ class CfgPatches { }; #include "CfgEventHandlers.hpp" +#include "CfgFactionClasses.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" #include "CFgSounds.hpp" #include "ACE_Medical_Treatments.hpp" +#include "ACE_Settings.hpp" #include "UI\RscTitles.hpp" diff --git a/addons/medical/functions/fnc_canTreat.sqf b/addons/medical/functions/fnc_canTreat.sqf index 2260a2750b..c5e711972e 100644 --- a/addons/medical/functions/fnc_canTreat.sqf +++ b/addons/medical/functions/fnc_canTreat.sqf @@ -23,7 +23,7 @@ _selectionName = _this select 2; _className = _this select 3; _config = (ConfigFile >> "ACE_Medical_Treatments" >> "Basic" >> _className); -if (GVAR(level)>=1) then { +if (GVAR(level)>=2) then { _config = (ConfigFile >> "ACE_Medical_Treatments" >> "Advanced" >> _className); }; if !(isClass _config) exitwith {false}; diff --git a/addons/medical/functions/fnc_displayPatientInformation.sqf b/addons/medical/functions/fnc_displayPatientInformation.sqf index dd13193bed..44fb955610 100644 --- a/addons/medical/functions/fnc_displayPatientInformation.sqf +++ b/addons/medical/functions/fnc_displayPatientInformation.sqf @@ -51,7 +51,7 @@ if (_show) then { }; _selectionBloodLoss = [0,0,0,0,0,0]; - if (GVAR(level) >= 1) then { + if (GVAR(level) >= 2) then { _openWounds = _target getvariable [QGVAR(openWounds), []]; private "_amountOf"; { diff --git a/addons/medical/functions/fnc_getBloodLoss.sqf b/addons/medical/functions/fnc_getBloodLoss.sqf index 5d731f4754..371cce1b3a 100644 --- a/addons/medical/functions/fnc_getBloodLoss.sqf +++ b/addons/medical/functions/fnc_getBloodLoss.sqf @@ -18,7 +18,7 @@ private ["_totalBloodLoss","_tourniquets","_openWounds", "_value", "_cardiacOutp _totalBloodLoss = 0; // Advanced medical bloodloss handling -if (GVAR(level) >= 1) then { +if (GVAR(level) >= 2) then { _tourniquets = _this getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; _openWounds = _this getvariable [QGVAR(openWounds), []]; //_cardiacOutput = [_this] call FUNC(getCardiacOutput); diff --git a/addons/medical/functions/fnc_getUnconsciousCondition.sqf b/addons/medical/functions/fnc_getUnconsciousCondition.sqf index 69ff9744d0..83955f7bd1 100644 --- a/addons/medical/functions/fnc_getUnconsciousCondition.sqf +++ b/addons/medical/functions/fnc_getUnconsciousCondition.sqf @@ -16,7 +16,7 @@ private ["_unit","_return"]; _unit = _this select 0; -if (GVAR(level) == 0) exitwith {true}; +if (GVAR(level) == 1) exitwith {true}; if (isnil QGVAR(unconsciousConditions)) then { GVAR(unconsciousConditions) = []; }; diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index 266caf7604..959dce7b50 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -38,11 +38,11 @@ _hitSelections = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]; if !(_selection in (_hitSelections + [""])) exitWith {0}; _damageReturn = _damage; -if (GVAR(level) == 0) then { +if (GVAR(level) == 1) then { _damageReturn = (_this + [_damageReturn]) call FUNC(handleDamage_basic); }; -if (GVAR(level) >= 1) then { +if (GVAR(level) >= 2) then { [_unit, _selection, _damage, _source, _projectile, _damageReturn] call FUNC(handleDamage_caching); if (_damageReturn > 0.9) then { diff --git a/addons/medical/functions/fnc_handleUnitVitals.sqf b/addons/medical/functions/fnc_handleUnitVitals.sqf index b666e78914..6702a14cfd 100644 --- a/addons/medical/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical/functions/fnc_handleUnitVitals.sqf @@ -68,7 +68,7 @@ if ([_unit] call EFUNC(common,isAwake)) then { }; // handle advanced medical, with vitals -if ((missionNamespace getvariable[QGVAR(level), 0]) > 0) exitwith { +if (GVAR(level) >= 2) exitwith { // Set the vitals _heartRate = (_unit getvariable [QGVAR(heartRate), 0]) + ([_unit] call FUNC(getHeartRateChange)); diff --git a/addons/medical/functions/fnc_treatment.sqf b/addons/medical/functions/fnc_treatment.sqf index 44bb0749d5..e867ae5021 100644 --- a/addons/medical/functions/fnc_treatment.sqf +++ b/addons/medical/functions/fnc_treatment.sqf @@ -25,7 +25,7 @@ _className = _this select 3; if !(_target isKindOf "CAManBase") exitWith {false}; _config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className); -if (GVAR(level) >= 1) then { +if (GVAR(level) >= 2) then { _config = (configFile >> "ACE_Medical_Actions" >> "Advanced" >> _className); }; if !(isClass _config) exitwith {false}; diff --git a/addons/medical/functions/fnc_treatment_failure.sqf b/addons/medical/functions/fnc_treatment_failure.sqf index 6174956934..e60b4d9bad 100644 --- a/addons/medical/functions/fnc_treatment_failure.sqf +++ b/addons/medical/functions/fnc_treatment_failure.sqf @@ -35,7 +35,7 @@ _caller setvariable [QGVAR(treatmentPrevAnimCaller), nil]; // Record specific callback _config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className); -if (GVAR(level) >= 1) then { +if (GVAR(level) >= 2) then { _config = (configFile >> "ACE_Medical_Actions" >> "Advanced" >> _className); }; diff --git a/addons/medical/functions/fnc_treatment_success.sqf b/addons/medical/functions/fnc_treatment_success.sqf index 878aaa01b7..fa553c168d 100644 --- a/addons/medical/functions/fnc_treatment_success.sqf +++ b/addons/medical/functions/fnc_treatment_success.sqf @@ -35,7 +35,7 @@ _caller setvariable [QGVAR(treatmentPrevAnimCaller), nil]; // Record specific callback _config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className); -if (GVAR(level) >= 1) then { +if (GVAR(level) >= 2) then { _config = (configFile >> "ACE_Medical_Actions" >> "Advanced" >> _className); };