added support for adjustable settings for consumeItem and medicalLevel

This commit is contained in:
Glowbal 2015-04-04 21:20:24 +02:00
parent 93d9088410
commit 1d33ce52b3
4 changed files with 54 additions and 13 deletions

View File

@ -205,10 +205,10 @@ class ACE_Medical_Actions {
displayNameProgress = "";
items[] = {"ACE_surgicalKit"};
treatmentLocations[] = {"MedicalFacility", "MedicalVehicle"};
requiredMedic = 2;
treatmentTime = 15;
requiredMedic = QGVAR(medicSetting_SurgicalKit);
treatmentTime = 10;
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_surgicalKit));
itemConsumed = 0;
itemConsumed = QGVAR(consumeItem_SurgicalKit);
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
litter[] = { {"All", "", {"ACE_MedicalLitter_gloves"} }};
};
@ -217,10 +217,10 @@ class ACE_Medical_Actions {
displayNameProgress = "";
items[] = {"ACE_personalAidKit"};
treatmentLocations[] = {"All"};
requiredMedic = 1;
treatmentTime = 15;
requiredMedic = QGVAR(medicSetting_PAK);
treatmentTime = 10;
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_fullHeal));
itemConsumed = 0;
itemConsumed = QGVAR(consumeItem_PAK);
animationPatient = "";
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
animationCaller = "AinvPknlMstpSlayWnonDnon_medic";
@ -260,12 +260,12 @@ class ACE_Medical_Actions {
displayNameProgress = "Performing CPR";
treatmentLocations[] = {"All"};
requiredMedic = 0;
treatmentTime = 25;
treatmentTime = 15;
items[] = {};
condition = "((_this select 1) getvariable ['ACE_medical_inCardiacArrest', false])";
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_CPR));
callbackFailure = "";
callbackProgress = "";
callbackProgress = "((_this select 1) getvariable ['ACE_medical_inCardiacArrest', false])";
animationPatient = "";
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
animationCaller = "AinvPknlMstpSlayWnonDnon_medic";

View File

@ -76,4 +76,20 @@ class ACE_Settings {
typeName = "BOOL";
value = true;
};
class GVAR(medicSetting_PAK) {
typeName = "SCALAR";
value = 1;
};
class GVAR(medicSetting_SurgicalKit) {
typeName = "SCALAR";
value = 1;
};
class GVAR(consumeItem_PAK) {
typeName = "SCALAR";
value = 0;
};
class GVAR(consumeItem_SurgicalKit) {
typeName = "SCALAR";
value = 0;
};
};

View File

@ -30,7 +30,15 @@ if (GVAR(level)>=2) then {
};
if !(isClass _config) exitwith {false};
_medicRequired = getNumber (_config >> "requiredMedic");
_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];
};
0;
};
if !([_caller, _medicRequired] call FUNC(isMedic)) exitwith {false};
_items = getArray (_config >> "items");

View File

@ -16,7 +16,7 @@
#include "script_component.hpp"
private ["_caller", "_target", "_selectionName", "_className", "_config", "_availableLevels", "_medicRequired", "_items", "_locations", "_return", "_callbackSuccess", "_callbackFailure", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed", "_return", "_usersOfItems"];
private ["_caller", "_target", "_selectionName", "_className", "_config", "_availableLevels", "_medicRequired", "_items", "_locations", "_return", "_callbackSuccess", "_callbackFailure", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed", "_return", "_usersOfItems", "_consumeItems"];
_caller = _this select 0;
_target = _this select 1;
_selectionName = _this select 2;
@ -30,8 +30,16 @@ if (GVAR(level) >= 2) then {
};
if !(isClass _config) exitwith {false};
// Check for required class
_medicRequired = getNumber (_config >> "requiredMedic");
_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];
};
0;
};
if !([_caller, _medicRequired] call FUNC(isMedic)) exitwith {false};
// Check item
@ -72,7 +80,16 @@ if ("All" in _locations) then {
if !(_return) exitwith {false};
_usersOfItems = [];
if (getNumber (_config >> "itemConsumed") > 0) then {
_consumeItems = if (isNumber (_config >> "itemConsumed")) then {
getNumber (_config >> "itemConsumed");
} else {
// Check for required class
if (isText (_config >> "itemConsumed")) exitwith {
missionNamespace getvariable [(getText (_config >> "itemConsumed")), 0];
};
0;
};
if (_consumeItems > 0) then {
_usersOfItems = ([_caller, _target, _items] call FUNC(useItems)) select 1;
};