fix treatment functionality

This commit is contained in:
Glowbal 2016-09-18 22:58:56 +02:00
parent b74245c323
commit 27314c34b1
10 changed files with 26 additions and 20 deletions

View File

@ -214,7 +214,7 @@ class ACE_Medical_Injuries {
class fractures {
class Femur {
name = CSTRING(Wounds_Femur);
selections[] = {"Head", "Torso"};
selections[] = {"Head", "Body"};
pain = 0.2;
causes[] = {"Bullet", "VehicleCrash", "Backblast", "Explosive", "Shell", "Grenade"};
minDamage = 0.5;

View File

@ -7,9 +7,9 @@ ADDON = false;
[QEGVAR(medical_engine,woundReceived), {
params ["_unit", "_woundedHitPoint", "_receivedDamage", "", "_ammo"];
private _selectionName = EGVAR(medical,SELECTIONS) param [EGVAR(medical,HITPOINTS) find _woundedHitPoint]; // @todo
// private _selectionName = EGVAR(medical,SELECTIONS) select (EGVAR(medical,HITPOINTS) find _woundedHitPoint); // @todo
private _typeOfDamage = _ammo call FUNC(getTypeOfDamage);
[_unit, _selectionName, _receivedDamage, _ammo, _typeOfDamage] call FUNC(woundsHandler); // TODO also support the sqf variant
[_unit, _woundedHitPoint, _receivedDamage, _ammo, _typeOfDamage] call FUNC(woundsHandler); // TODO also support the sqf variant
[_unit, EGVAR(medical,STATE_MACHINE)] call EFUNC(medical,addStateHandler);
}] call CBA_fnc_addEventHandler;

View File

@ -20,6 +20,8 @@
params ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage"];
TRACE_6("ACE_DEBUG: woundshandler",_unit, _selectionName, _damage, _shooter, _typeOfProjectile,_typeOfDamage);
systemChat format["input: %1", _this];
if (_typeOfDamage == "") then {_typeOfDamage = "unknown";};
// Administration for open wounds and ids

View File

@ -21,8 +21,9 @@ private ["_bodyPartn", "_injuryTypeInfo", "_allInjuriesForDamageType", "_allPoss
params ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage"];
TRACE_6("ACE_DEBUG: HandleDamage_WoundsOLD Called",_unit, _selectionName, _damage, _shooter, _typeOfProjectile,_typeOfDamage);
systemChat format["input: %1", _this];
// Convert the selectionName to a number and ensure it is a valid selection.
_bodyPartn = [_selectionName] call EFUNC(medical,selectionNameToNumber);
_bodyPartn = EGVAR(medical,HITPOINTS) find _selectionName; //[_selectionName] call EFUNC(medical,selectionNameToNumber);
if (_bodyPartn < 0) exitWith {};
if (_typeOfDamage == "") then {_typeOfDamage = "unknown";};

View File

@ -60,7 +60,7 @@ _damaged = [false, false, false, false, false, false];
_selectionBloodLoss = [0, 0, 0, 0, 0, 0];
_allInjuryTexts = [];
if ((EGVAR(medical,level) >= 2) ) then { // && {([_target] call EFUNC(medical,hasMedicalEnabled))}
if (EGVAR(medical,level) >= 2) then { // && {([_target] call EFUNC(medical,hasMedicalEnabled))}
_openWounds = _target getVariable [QEGVAR(medical,openWounds), []];
private "_amountOf";
{

View File

@ -12,7 +12,7 @@
* Can Treat <BOOL>
*
* Example:
* [player, cursorTarget, "Head", "SurgicalKit"] call ace_medical_fnc_canTreat
* [player, cursorTarget, "Head", "SurgicalKit"] call ace_medical_treatment_fnc_canTreat
*
* Public: Yes
*/
@ -23,7 +23,7 @@ params ["_caller", "_target", "_selectionName", "_className"];
if !(_target isKindOf "CAManBase") exitWith { false };
private _config = (ConfigFile >> "ACE_Medical_Treatment" >> (["Basic", "Advanced"] select (GVAR(level)>=2)) >> _className);
private _config = (configFile >> "ACE_Medical_Treatment_Actions" >> (["Basic", "Advanced"] select (EGVAR(medical,level)>=2)) >> _className);
if !(isClass _config) exitwith {false};
@ -35,10 +35,11 @@ private _medicRequired = if (isNumber (_config >> "requiredMedic")) then {
} else {
// Check for required class
if (isText (_config >> "requiredMedic")) exitwith {
missionNamespace getVariable [(getText (_config >> "requiredMedic")), 0]
missionNamespace getVariable [getText (_config >> "requiredMedic"), 0];
};
0;
};
if !([_caller, _medicRequired] call EFUNC(medical,isMedic)) exitwith { false };
private _items = getArray (_config >> "items");
@ -61,7 +62,9 @@ if (getText (_config >> "condition") != "") then {
_return = [_caller, _target, _selectionName, _className] call _condition;
};
};
if (!_return) exitwith { false };
if (!_return) exitwith {
false;
};
private _patientStateCondition = if (isText(_config >> "patientStateCondition")) then {
missionNamespace getVariable [getText(_config >> "patientStateCondition"), 0]

View File

@ -17,7 +17,7 @@ params ["_unit"];
while {({_x == "FirstAidKit"} count items _unit) > 0} do {
_unit removeItem "FirstAidKit";
if (GVAR(level) >= 2) then {
if (EGVAR(medical,level) >= 2) then {
_unit addItem "ACE_fieldDressing";
_unit addItem "ACE_packingBandage";
_unit addItem "ACE_morphine";
@ -31,7 +31,7 @@ while {({_x == "FirstAidKit"} count items _unit) > 0} do {
while {({_x == "Medikit"} count items _unit) > 0} do {
_unit removeItem "Medikit";
if (GVAR(level) >= 2) then {
if (EGVAR(medical,level) >= 2) then {
_unit addItemToBackpack "ACE_fieldDressing";
_unit addItemToBackpack "ACE_packingBandage";
_unit addItemToBackpack "ACE_packingBandage";

View File

@ -25,9 +25,9 @@ if (uiNamespace getVariable [QEGVAR(interact_menu,cursorMenuOpened),false]) exit
if !(_target isKindOf "CAManBase") exitWith {false};
private _config = (configFile >> "ACE_Medical_Treatment" >> "Basic" >> _className);
if (GVAR(level) >= 2) then {
_config = (configFile >> "ACE_Medical_Treatment" >> "Advanced" >> _className);
private _config = (configFile >> "ACE_Medical_Treatment_Actions" >> "Basic" >> _className);
if (EGVAR(medical,level) >= 2) then {
_config = (configFile >> "ACE_Medical_Treatment_Actions" >> "Advanced" >> _className);
};
if !(isClass _config) exitwith {false};

View File

@ -57,9 +57,9 @@ if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "")
} forEach _usersOfItems;
// Record specific callback
private _config = (configFile >> "ACE_Medical_Treatment" >> "Basic" >> _className);
if (GVAR(level) >= 2) then {
_config = (configFile >> "ACE_Medical_Treatment" >> "Advanced" >> _className);
private _config = (configFile >> "ACE_Medical_Treatment_Actions" >> "Basic" >> _className);
if (EGVAR(medical,level) >= 2) then {
_config = (configFile >> "ACE_Medical_Treatment_Actions" >> "Advanced" >> _className);
};
private _callback = getText (_config >> "callbackFailure");

View File

@ -52,9 +52,9 @@ if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "")
};
// Record specific callback
private _config = (configFile >> "ACE_Medical_Treatment" >> "Basic" >> _className);
if (GVAR(level) >= 2) then {
_config = (configFile >> "ACE_Medical_Treatment" >> "Advanced" >> _className);
private _config = (configFile >> "ACE_Medical_Treatment_Actions" >> "Basic" >> _className);
if (EGVAR(medical,level) >= 2) then {
_config = (configFile >> "ACE_Medical_Treatment_Actions" >> "Advanced" >> _className);
};
private _callback = getText (_config >> "callbackSuccess");