diff --git a/addons/medical/CfgVehicles.hpp b/addons/medical/CfgVehicles.hpp index 93235fd02f..efa661fb65 100644 --- a/addons/medical/CfgVehicles.hpp +++ b/addons/medical/CfgVehicles.hpp @@ -6,6 +6,7 @@ class CfgVehicles { class ArgumentsBaseUnits { }; }; + // TODO localization for all the modules class ACE_moduleMedicalSettings: Module_F { scope = 2; displayName = "Medical Settings [ACE]"; @@ -80,7 +81,103 @@ class CfgVehicles { }; }; + class ACE_moduleAssignMedicRoles: Module_F { + scope = 2; + displayName = "Set Medic Class [ACE]"; + icon = QUOTE(PATHTOF(ui\moduleIcon.paa)); + category = "ACE_medical"; + function = QUOTE(FUNC(moduleAssignMedicRoles)); + functionPriority = 10; + isGlobal = 2; + isTriggerActivated = 0; + isDisposable = 0; + author = "Glowbal"; + class Arguments { + class EnableList { + displayName = "List"; + description = "List of unit names that will be classified as medic, separated by commas."; + defaultValue = ""; + }; + class role { + displayName = "Is Medic"; + description = "Medics allow for more advanced treatment in case of Advanced Medic roles enabled"; + typeName = "NUMBER"; + class values { + class none { + name = "None"; + value = 0; + }; + class medic { + name = "Regular medic"; + value = 1; + default = 1; + }; + class doctor { + name = "Doctor (Only Advanced Medics)"; + value = 1; + default = 1; + }; + }; + }; + }; + class ModuleDescription { + description = "Assigns the ACE medic class to a unit"; // Short description, will be formatted as structured text + sync[] = {}; + }; + }; + class ACE_moduleAssignMedicRoles: Module_F { + scope = 2; + displayName = "Set Medic Class [ACE]"; + icon = QUOTE(PATHTOF(ui\moduleIcon.paa)); + category = "ACE_medical"; + function = QUOTE(FUNC(moduleAssignMedicRoles)); + functionPriority = 10; + isGlobal = 2; + isTriggerActivated = 0; + isDisposable = 0; + author = "Glowbal"; + class Arguments { + class EnableList { + displayName = "List"; + description = "List of unit names that will be classified as medic, separated by commas."; + defaultValue = ""; + }; + class enabled { + displayName = "Is Medical Vehicle"; + description = "Whatever or not the objects in the list will be a medical vehicle."; + typeName = "BOOL"; + defaultValue = true; + }; + }; + class ModuleDescription { + description = "Assigns the ACE medic class to a unit"; // Short description, will be formatted as structured text + sync[] = {}; + }; + }; + class ACE_moduleAssignMedicalFacility: Module_F { + scope = 2; + displayName = "Set Medical Facility [ACE]"; + icon = QUOTE(PATHTOF(ui\moduleIcon.paa)); + category = "ACE_medical"; + function = QUOTE(FUNC(moduleAssignMedicalFacility)); + functionPriority = 10; + isGlobal = 2; + isTriggerActivated = 0; + isDisposable = 0; + author = "Glowbal"; + class Arguments { + class enabled { + displayName = "Is Medical Facility"; + description = "Registers an object as a medical facility for CMS"; + typeName = "BOOL"; + }; + }; + class ModuleDescription { + description = "Defines an object as a medical facility for CMS. This allows for more advanced treatments. Can be used on buildings and vehicles. "; + sync[] = {}; + }; + }; #define ARM_LEG_ARMOR_DEFAULT 2 #define ARM_LEG_ARMOR_BETTER 3 diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index 5e508e96f5..2ffe7a56fc 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -78,6 +78,9 @@ PREP(useItem); PREP(useItems); PREP(displayPatientInformation); PREP(moduleMedicalSettings); +PREP(moduleAssignMedicRoles); +PREP(moduleAssignMedicalVehicle); +PREP(moduleAssignMedicalFacility); GVAR(injuredUnitCollection) = []; call FUNC(parseConfigForInjuries); diff --git a/addons/medical/functions/fnc_moduleAssignMedicRoles.sqf b/addons/medical/functions/fnc_moduleAssignMedicRoles.sqf new file mode 100644 index 0000000000..9a7e8f3259 --- /dev/null +++ b/addons/medical/functions/fnc_moduleAssignMedicRoles.sqf @@ -0,0 +1,58 @@ +/** + * fn_assignMedicRoles.sqf + * @Descr: N/A + * @Author: Glowbal + * + * @Arguments: [] + * @Return: + * @PublicAPI: false + */ + +#include "script_component.hpp" + +private ["_logic","_setting","_objects", "_list", "_splittedList", "_nilCheckPassedList", "_parsedList"]; +_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; + +if (!isNull _logic) then { + _list = _logic getvariable ["EnableList",""]; + + _splittedList = [_list, ","] call BIS_fnc_splitString; + _nilCheckPassedList = ""; + { + _x = [_x] call EFUNC(common,stringRemoveWhiteSpace); + if !(isnil _x) then { + if (_nilCheckPassedList == "") then { + _nilCheckPassedList = _x; + } else { + _nilCheckPassedList = _nilCheckPassedList + ","+ _x; + }; + }; + }foreach _splittedList; + + _list = "[" + _nilCheckPassedList + "]"; + _parsedList = [] call compile _list; + _setting = _logic getvariable ["role",0]; + _objects = synchronizedObjects _logic; + if (!(_objects isEqualTo []) && _parsedList isEqualTo []) then { + { + if (!isnil "_x") then { + if (typeName _x == typeName objNull) then { + if (local _x) then { + _x setvariable [QGVAR(medicClass), _setting, true]; + }; + }; + }; + }foreach _objects; + }; + { + if (!isnil "_x") then { + if (typeName _x == typeName objNull) then { + if (local _x) then { + _x setvariable [QGVAR(medicClass), _setting, true]; + }; + }; + }; + }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 new file mode 100644 index 0000000000..fab4f63446 --- /dev/null +++ b/addons/medical/functions/fnc_moduleAssignMedicalFacility.sqf @@ -0,0 +1,25 @@ +/** + * fn_assignMedicalFacility.sqf + * @Descr: Register synchronized objects from passed object as a medical facility for CMS. + * @Author: Glowbal + * + * @Arguments: [logic OBJECT] + * @Return: BOOL + * @PublicAPI: true + */ + +#include "script_component.hpp" + +private ["_logic","_setting","_objects"]; +_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; +if (!isNull _logic) then { + _setting = _logic getvariable ["class",0]; + _objects = synchronizedObjects _logic; + { + if (local _x) then { + _x setvariable[QGVAR(isMedicalFacility), true, true]; + }; + }foreach _objects; +}; + +true; diff --git a/addons/medical/functions/fnc_moduleAssignMedicalVehicle.sqf b/addons/medical/functions/fnc_moduleAssignMedicalVehicle.sqf new file mode 100644 index 0000000000..51ae6019c6 --- /dev/null +++ b/addons/medical/functions/fnc_moduleAssignMedicalVehicle.sqf @@ -0,0 +1,58 @@ +/** + * fn_assignMedicalVehicle.sqf + * @Descr: N/A + * @Author: Glowbal + * + * @Arguments: [] + * @Return: + * @PublicAPI: false + */ + +#include "script_component.hpp" + +private ["_logic","_setting","_objects", "_list", "_splittedList", "_nilCheckPassedList", "_parsedList"]; +_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; + +if (!isNull _logic) then { + _list = _logic getvariable ["EnableList",""]; + + _splittedList = [_list, ","] call BIS_fnc_splitString; + _nilCheckPassedList = ""; + { + _x = [_x] call EFUNC(common,stringRemoveWhiteSpace); + if !(isnil _x) then { + if (_nilCheckPassedList == "") then { + _nilCheckPassedList = _x; + } else { + _nilCheckPassedList = _nilCheckPassedList + ","+ _x; + }; + }; + }foreach _splittedList; + + _list = "[" + _nilCheckPassedList + "]"; + _parsedList = [] call compile _list; + _setting = _logic getvariable ["enabled", false]; + _objects = synchronizedObjects _logic; + if (!(_objects isEqualTo []) && _parsedList isEqualTo []) then { + { + if (!isnil "_x") then { + if (typeName _x == typeName objNull) then { + if (local _x) then { + _x setvariable [QGVAR(isMedicalVehicle), _setting, true]; + }; + }; + }; + }foreach _objects; + }; + { + if (!isnil "_x") then { + if (typeName _x == typeName objNull) then { + if (local _x) then { + _x setvariable [QGVAR(isMedicalVehicle), _setting, true]; + }; + }; + }; + }foreach _parsedList; + }; + +true;