Fixed treatment locations

This commit is contained in:
Glowbal 2015-04-06 14:32:37 +02:00
parent 43b3190202
commit 8e176eff55
7 changed files with 29 additions and 18 deletions

View File

@ -192,7 +192,7 @@ class ACE_Medical_Actions {
displayName = "";
displayNameProgress = "";
items[] = {"ACE_surgicalKit"};
treatmentLocations[] = {QGVAR(useLocation_PAK)};
treatmentLocations[] = {QGVAR(useLocation_SurgicalKit)};
requiredMedic = QGVAR(medicSetting_SurgicalKit);
treatmentTime = 10;
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_surgicalKit));

View File

@ -54,6 +54,7 @@ PREP(init);
PREP(isBeingCarried);
PREP(isBeingDragged);
PREP(isInMedicalFacility);
PREP(isInMedicalVehicle);
PREP(isMedic);
PREP(isMedicalVehicle);
PREP(itemCheck);

View File

@ -64,19 +64,23 @@ if (!_return) exitwith {false};
if ("All" in _locations) exitwith {true};
private [ "_medFacility", "_medVeh"];
_medFacility = {([_caller] call FUNC(isInMedicalFacility)) || ([_target] call FUNC(isInMedicalFacility))};
_medVeh = {([_caller] call FUNC(isInMedicalVehicle)) || ([_target] call FUNC(isInMedicalVehicle))};
{
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 (_x == "MedicalFacility" && _medFacility) exitwith {_return = true;};
if (_x == "MedicalVehicle" && _medVeh) exitwith {_return = true;};
if !(isnil _x) exitwith {
private "_val";
_val = missionNamespace getvariable _x;
if (typeName _val == "SCALAR") then {
_return = switch (_val) {
_return = switch (_val) do {
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)};
case 1: _medVeh;
case 2: _medFacility;
case 3: {call _medFacility || call _medVeh};
};
};
};

View File

@ -11,6 +11,8 @@
* Public: Yes
*/
#include "script_component.hpp"
private ["_unit", "_vehicle"];
_unit = _this select 0;
@ -19,5 +21,4 @@ _vehicle = vehicle _unit;
if (_unit == _vehicle) exitWith {false};
if (_unit in [driver _vehicle, gunner _vehicle, commander _vehicle]) exitWith {false};
// @todo: variable names standard?
_vehicle getVariable [QGVAR(isMedic), getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "attendant") == 1]

View File

@ -12,8 +12,7 @@
*/
#include "script_component.hpp"
private ["_veh"];
_veh = _this select 0;
private ["_vehicle"];
_vehicle = _this select 0;
if !(_veh getvariable [QGVAR(isMedicalVehicle), true]) exitwith {false}; // exit in case the false is set.
((getNumber(configFile >> "CfgVehicles" >> typeOf _veh >> QGVAR(isMedicalVehicle)) == 1) || (_veh getvariable [QGVAR(isMedicalVehicle), false]));
_vehicle getVariable [QGVAR(isMedic), getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "attendant") == 1]

View File

@ -32,3 +32,5 @@ if !(_activated) exitWith {};
[_logic, QGVAR(medicSetting_SurgicalKit), "medicSetting_SurgicalKit"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(consumeItem_PAK), "consumeItem_PAK"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(consumeItem_SurgicalKit), "consumeItem_SurgicalKit"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(useLocation_PAK), "useLocation_PAK"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(useLocation_SurgicalKit), "useLocation_SurgicalKit"] call EFUNC(common,readSettingFromModule);

View File

@ -77,19 +77,23 @@ if (!_return) exitwith {false};
if ("All" in _locations) then {
_return = true;
} else {
private [ "_medFacility", "_medVeh"];
_medFacility = {([_caller] call FUNC(isInMedicalFacility)) || ([_target] call FUNC(isInMedicalFacility))};
_medVeh = {([_caller] call FUNC(isInMedicalVehicle)) || ([_target] call FUNC(isInMedicalVehicle))};
{
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 (_x == "MedicalFacility" && _medFacility) exitwith {_return = true;};
if (_x == "MedicalVehicle" && _medVeh) exitwith {_return = true;};
if !(isnil _x) exitwith {
private "_val";
_val = missionNamespace getvariable _x;
if (typeName _val == "SCALAR") then {
_return = switch (_val) {
_return = switch (_val) do {
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)};
case 1: _medVeh;
case 2: _medFacility;
case 3: {call _medFacility || call _medVeh};
};
};
};