Added support for customizable treatment location limitation

This commit is contained in:
Glowbal 2015-04-06 14:11:10 +02:00
parent 2657677bd8
commit 10a1108aae
6 changed files with 78 additions and 18 deletions

View File

@ -80,18 +80,6 @@ class ACE_Medical_Actions {
itemConsumed = 0;
litter[] = {};
};
/*class PersonalAidKit: Bandage {
displayName = "";
displayNameProgress = "";
items[] = {"ACE_personalAidKit"};
treatmentLocations[] = {"All"};
requiredMedic = 1;
treatmentTime = 15;
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_fullHeal));
itemConsumed = 0;
animationCaller = "AinvPknlMstpSlayW[wpn]Dnon_medic";
litter[] = { {"All", "", {"ACE_MedicalLitter_gloves"}}, {"All", "", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}, {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}} };
};*/
};
class Advanced {
@ -204,7 +192,7 @@ class ACE_Medical_Actions {
displayName = "";
displayNameProgress = "";
items[] = {"ACE_surgicalKit"};
treatmentLocations[] = {"MedicalFacility", "MedicalVehicle"};
treatmentLocations[] = {QGVAR(useLocation_PAK)};
requiredMedic = QGVAR(medicSetting_SurgicalKit);
treatmentTime = 10;
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_surgicalKit));
@ -216,7 +204,7 @@ class ACE_Medical_Actions {
displayName = "";
displayNameProgress = "";
items[] = {"ACE_personalAidKit"};
treatmentLocations[] = {"All"};
treatmentLocations[] = {QGVAR(useLocation_PAK)};
requiredMedic = QGVAR(medicSetting_PAK);
treatmentTime = 10;
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_fullHeal));

View File

@ -99,6 +99,16 @@ class ACE_Settings {
value = 0;
values[] = {"No", "Yes"};
};
class GVAR(useLocation_PAK) {
typeName = "SCALAR";
value = 3;
values[] = {"Anywhere", "Medical vehicles", "Medical facility", "vehicle & facility", "Disabled"};
};
class GVAR(useLocation_SurgicalKit) {
typeName = "SCALAR";
value = 2;
values[] = {"Anywhere", "Medical vehicles", "Medical facility", "vehicle & facility", "Disabled"};
};
class GVAR(keepLocalSettingsSynced) {
typeName = "BOOL";
value = 1;

View File

@ -204,7 +204,7 @@ class CfgVehicles {
defaultValue = 1800;
};
class medicSetting_PAK {
displayName = "Allow PAK";
displayName = "Allow PAK (Adv)";
description = "Who can use the PAK for full heal?";
typeName = "NUMBER";
class values {
@ -214,7 +214,7 @@ class CfgVehicles {
};
};
class consumeItem_PAK {
displayName = "Remove PAK on use";
displayName = "Remove PAK on use (Adv)";
description = "Should PAK be removed on usage?";
typeName = "NUMBER";
class values {
@ -222,14 +222,30 @@ class CfgVehicles {
class remove { name = "Yes"; value = 1; default = 1; };
};
};
class useLocation_PAK {
displayName = "Locations PAK (Adv)";
description = "Where can the personal aid kit be used?";
typeName = "NUMBER";
class values {
class anywhere { name = "Anywhere"; value = 0; };
class vehicle { name = "Medical Vehicles"; value = 1; ; };
class facility { name = "Medical facility"; value = 2; };
class vehicleAndFacility { name = "Vehicles & facility"; value = 3; default = 1};
class disabled { name = "Disabled"; value = 4;};
};
};
class medicSetting_SurgicalKit: medicSetting_PAK {
displayName = "Allow Surgical kit";
displayName = "Allow Surgical kit (Adv)";
description = "Who can use the surgical kit?";
};
class consumeItem_SurgicalKit: consumeItem_PAK {
displayName = "Remove Surgical kit";
displayName = "Remove Surgical kit (Adv)";
description = "Should Surgical kit be removed on usage?";
};
class useLocation_SurgicalKit: useLocation_PAK {
displayName = "Locations Surgical kit (Adv)";
description = "Where can the Surgical kit be used?";
};
};
class ModuleDescription {

View File

@ -13,6 +13,28 @@ GVAR(heartBeatSounds_Slow) = ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2"];
["medical_woundUpdateRequest", FUNC(onWoundUpdateRequest)] call ace_common_fnc_addEventHandler;
["interactMenuClosed", {[objNull, false] call FUNC(displayPatientInformation); }] call ace_common_fnc_addEventHandler;
["medical_onUnconscious", {
if (local (_this select 0)) then {
_unit = _this select 0;
if (_this select 1) then {
_unit setVariable ["tf_globalVolume", 0.4];
_unit setVariable ["tf_voiceVolume", 0, true];
_unit setVariable ["tf_unable_to_use_radio", true, true];
_unit setVariable ["acre_sys_core_isDisabled", true, true];
_unit setVariable ["acre_sys_core_globalVolume", 0.4];
} else {
_unit setVariable ["tf_globalVolume", 1];
_unit setVariable ["tf_voiceVolume", 1, true];
_unit setVariable ["tf_unable_to_use_radio", true, true];
_unit setVariable ["acre_sys_core_isDisabled", true, true];
_unit setVariable ["acre_sys_core_globalVolume", 1];
};
};
}] call ace_common_fnc_addEventHandler;
// Initialize all effects
_fnc_createEffect = {
private ["_type", "_layer", "_default"];

View File

@ -68,6 +68,18 @@ if ("All" in _locations) exitwith {true};
if (_x == "field") exitwith {_return = true;};
if (_x == "MedicalFacility" && {[_caller, _target] call FUNC(inMedicalFacility)}) exitwith {_return = true;};
if (_x == "MedicalVehicle" && {[_caller, _target] call FUNC(inMedicalVehicle)}) exitwith {_return = true;};
if !(isnil _x) exitwith {
private "_val";
_val = missionNamespace getvariable _x;
if (typeName _val == "SCALAR") then {
_return = switch (_val) {
case 0: {true};
case 1: {[_caller, _target] call FUNC(inMedicalVehicle)};
case 2: {[_caller, _target] call FUNC(inMedicalFacility)};
case 3: {[_caller, _target] call FUNC(inMedicalVehicle) || [_caller, _target] call FUNC(inMedicalFacility)};
};
};
};
}foreach _locations;
_return;

View File

@ -81,6 +81,18 @@ if ("All" in _locations) then {
if (_x == "field") exitwith {_return = true;};
if (_x == "MedicalFacility" && {([_caller] call FUNC(isInMedicalFacility)) || ([_target] call FUNC(isInMedicalFacility))}) exitwith {_return = true;};
if (_x == "MedicalVehicle" && {([vehicle _caller] call FUNC(isMedicalVehicle)) || ([vehicle _target] call FUNC(isMedicalVehicle))}) exitwith {_return = true;};
if !(isnil _x) exitwith {
private "_val";
_val = missionNamespace getvariable _x;
if (typeName _val == "SCALAR") then {
_return = switch (_val) {
case 0: {true};
case 1: {[_caller, _target] call FUNC(inMedicalVehicle)};
case 2: {[_caller, _target] call FUNC(inMedicalFacility)};
case 3: {[_caller, _target] call FUNC(inMedicalVehicle) || [_caller, _target] call FUNC(inMedicalFacility)};
};
};
};
}foreach _locations;
};