Added medic, medical vehicle and medical facility modules

This commit is contained in:
Glowbal 2015-03-07 13:25:28 +01:00
parent bf8c9dc6f9
commit 5718649639
5 changed files with 241 additions and 0 deletions

View File

@ -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

View File

@ -78,6 +78,9 @@ PREP(useItem);
PREP(useItems);
PREP(displayPatientInformation);
PREP(moduleMedicalSettings);
PREP(moduleAssignMedicRoles);
PREP(moduleAssignMedicalVehicle);
PREP(moduleAssignMedicalFacility);
GVAR(injuredUnitCollection) = [];
call FUNC(parseConfigForInjuries);

View File

@ -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

View File

@ -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;

View File

@ -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;