From 811e1cd59815be1944b158dc615a82e5ece06780 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 18 Sep 2016 12:05:36 +0200 Subject: [PATCH] First set up clean up for medical rewrite --- .../medical/functions/fnc_actionDiagnose.sqf | 45 ------------ .../medical/functions/fnc_actionLoadUnit.sqf | 29 -------- .../fnc_treatmentAdvanced_fullHealLocal.sqf | 70 ------------------- ...eatmentAdvanced_surgicalKit_onProgress.sqf | 33 --------- .../functions/fnc_treatmentBasic_epipen.sqf | 20 ------ addons/medical/functions/fnc_treatmentIV.sqf | 34 --------- .../functions/fnc_treatmentIVLocal.sqf | 38 ---------- .../functions/fnc_handleDamage.sqf | 4 +- .../functions/fnc_actionDiagnose.sqf | 1 - .../functions/fnc_actionLoadUnit.sqf | 4 +- .../fnc_treatmentAdvanced_fullHealLocal.sqf | 8 +-- ...eatmentAdvanced_surgicalKit_onProgress.sqf | 4 +- .../functions/fnc_treatmentBasic_epipen.sqf | 4 -- .../functions/fnc_treatmentIV.sqf | 5 +- .../functions/fnc_treatmentIVLocal.sqf | 10 +-- 15 files changed, 14 insertions(+), 295 deletions(-) delete mode 100644 addons/medical/functions/fnc_actionDiagnose.sqf delete mode 100644 addons/medical/functions/fnc_actionLoadUnit.sqf delete mode 100644 addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf delete mode 100644 addons/medical/functions/fnc_treatmentAdvanced_surgicalKit_onProgress.sqf delete mode 100644 addons/medical/functions/fnc_treatmentBasic_epipen.sqf delete mode 100644 addons/medical/functions/fnc_treatmentIV.sqf delete mode 100644 addons/medical/functions/fnc_treatmentIVLocal.sqf diff --git a/addons/medical/functions/fnc_actionDiagnose.sqf b/addons/medical/functions/fnc_actionDiagnose.sqf deleted file mode 100644 index d86d90db7d..0000000000 --- a/addons/medical/functions/fnc_actionDiagnose.sqf +++ /dev/null @@ -1,45 +0,0 @@ -/* -* Author: Glowbal -* Action for diagnosing in basic medical -* -* Arguments: -* 0: The medic -* 1: The patient -* -* Return Value: -* None -* -* Public: No -*/ - -#include "script_component.hpp" - -params ["_caller", "_target"]; - -private _genericMessages = [LSTRING(diagnoseMessage), [_target] call EFUNC(common,getName)]; - -if (alive _target) then { - _genericMessages pushBack LSTRING(diagnoseAlive); -} else { - _genericMessages pushBack LSTRING(diagnoseDead); -}; - -if (_target getVariable[QGVAR(hasLostBlood), 0] > 0) then { - if (_target getVariable[QGVAR(hasLostBlood), 0] > 1) then { - _genericMessages pushBack LSTRING(lostBloodALot); - } else { - _genericMessages pushBack LSTRING(lostBlood); - }; -} else { - _genericMessages pushBack LSTRING(noBloodloss); -}; - -if (alive _target) then { - if (_target getVariable[QGVAR(hasPain), false]) then { - _genericMessages pushBack LSTRING(inPain); - } else { - _genericMessages pushBack LSTRING(noPain); - }; -}; - -[QEGVAR(common,displayTextStructured), [_genericMessages, 3.0, _caller], [_caller]] call CBA_fnc_targetEvent; diff --git a/addons/medical/functions/fnc_actionLoadUnit.sqf b/addons/medical/functions/fnc_actionLoadUnit.sqf deleted file mode 100644 index 55a7a9ba51..0000000000 --- a/addons/medical/functions/fnc_actionLoadUnit.sqf +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Author: Glowbal - * Action for loading an unconscious or dead unit in the nearest vechile - * - * Arguments: - * 0: The medic - * 1: The patient - * - * Return Value: - * None - * - * Public: No - */ - -#include "script_component.hpp" - -params ["_caller", "_target"]; - -if ([_target] call EFUNC(common,isAwake)) exitWith { - [QEGVAR(common,displayTextStructured), [[LSTRING(CanNotLoaded), [_target] call EFUNC(common,getName)], 1.5, _caller], [_caller]] call CBA_fnc_targetEvent; -}; -if ([_target] call FUNC(isBeingCarried)) then { - [_caller, _target] call EFUNC(dragging,dropObject_carry); -}; -if ([_target] call FUNC(isBeingDragged)) then { - [_caller, _target] call EFUNC(dragging,dropObject); -}; - -private _vehicle = [_caller, _target] call EFUNC(common,loadPerson); diff --git a/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf deleted file mode 100644 index 7517f235e7..0000000000 --- a/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf +++ /dev/null @@ -1,70 +0,0 @@ -/** - * fn_healLocal.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -params ["_caller", "_target"]; - -if (alive _target) exitWith { - - _target setVariable [QGVAR(pain), 0, true]; - _target setVariable [QGVAR(morphine), 0, true]; - _target setVariable [QGVAR(bloodVolume), 100, true]; - - // tourniquets - _target setVariable [QGVAR(tourniquets), [0,0,0,0,0,0], true]; - - // wounds and injuries - _target setVariable [QGVAR(openWounds), [], true]; - _target setVariable [QGVAR(bandagedWounds), [], true]; - _target setVariable [QGVAR(internalWounds), [], true]; - - // vitals - _target setVariable [QGVAR(heartRate), 80]; - _target setVariable [QGVAR(heartRateAdjustments), []]; - _target setVariable [QGVAR(bloodPressure), [80, 120]]; - _target setVariable [QGVAR(peripheralResistance), 100]; - - // fractures - _target setVariable [QGVAR(fractures), []]; - - // IVs - _target setVariable [QGVAR(ivBags), nil, true]; - - // damage storage - _target setVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0], true]; - - // airway - _target setVariable [QGVAR(airwayStatus), 100, true]; - _target setVariable [QGVAR(airwayOccluded), false, true]; - _target setVariable [QGVAR(airwayCollapsed), false, true]; - - // generic medical admin - _target setVariable [QGVAR(addedToUnitLoop), false, true]; - _target setVariable [QGVAR(inCardiacArrest), false, true]; - _target setVariable [QGVAR(inReviveState), false, true]; - _target setVariable ["ACE_isUnconscious", false, true]; - _target setVariable [QGVAR(hasLostBlood), 0, true]; - _target setVariable [QGVAR(isBleeding), false, true]; - _target setVariable [QGVAR(hasPain), false, true]; - _target setVariable [QGVAR(painSuppress), 0, true]; - - // medication - private _allUsedMedication = _target getVariable [QGVAR(allUsedMedication), []]; - { - _target setVariable [_x select 0, nil]; - } forEach _allUsedMedication; - - // Resetting damage - _target setDamage 0; - - [_target, "activity", LSTRING(Activity_fullHeal), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); - [_target, "activity_view", LSTRING(Activity_fullHeal), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message -}; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_surgicalKit_onProgress.sqf b/addons/medical/functions/fnc_treatmentAdvanced_surgicalKit_onProgress.sqf deleted file mode 100644 index 0a1e48288f..0000000000 --- a/addons/medical/functions/fnc_treatmentAdvanced_surgicalKit_onProgress.sqf +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Author: BaerMitUmlaut - * Handles treatment via surgical kit per frame - * - * Arguments: - * 0: Arguments - * 0: Caller - * 1: Target - * 1: Elapsed Time - * 2: Total Time - * - * Return Value: - * Succesful treatment started - * - * Public: No - */ -#include "script_component.hpp" - -params ["_args", "_elapsedTime", "_totalTime"]; -_args params ["_caller", "_target"]; - -private _bandagedWounds = _target getVariable [QGVAR(bandagedWounds), []]; - -//In case two people stitch up one patient and the last wound has already been closed we can stop already -if (count _bandagedWounds == 0) exitWith { false }; - -//Has enough time elapsed that we can close another wound? -if ((_totalTime - _elapsedTime) <= (((count _bandagedWounds) - 1) * 5)) then { - _bandagedWounds deleteAt 0; - _target setVariable [QGVAR(bandagedWounds), _bandagedWounds, true]; -}; - -true diff --git a/addons/medical/functions/fnc_treatmentBasic_epipen.sqf b/addons/medical/functions/fnc_treatmentBasic_epipen.sqf deleted file mode 100644 index 1abee1cd58..0000000000 --- a/addons/medical/functions/fnc_treatmentBasic_epipen.sqf +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Author: KoffeinFlummi - * Callback when the epipen treatment is complete - * - * Arguments: - * 0: The medic - * 1: The patient - * 2: Selection Name - * 3: Treatment classname - * - * Return Value: - * None - * - * Public: No - */ -#include "script_component.hpp" - -params ["_caller", "_target","_className"]; - -[_target, false] call FUNC(setUnconscious); diff --git a/addons/medical/functions/fnc_treatmentIV.sqf b/addons/medical/functions/fnc_treatmentIV.sqf deleted file mode 100644 index 7b16fad650..0000000000 --- a/addons/medical/functions/fnc_treatmentIV.sqf +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Author: Glowbal - * Patient IV Treatment callback - * - * Arguments: - * 0: The medic - * 1: The patient - * 2: SelectionName - * 3: Treatment classname - * - * Return Value: - * Succesful treatment started - * - * Public: Yes - */ - -#include "script_component.hpp" - -params ["_caller", "_target", "_selectionName", "_className", "_items"]; - -if (_items isEqualTo []) exitWith {false}; - -_items params ["_removeItem"]; -if (local _target) then { - [QGVAR(treatmentIVLocal), [_target, _className]] call CBA_fnc_localEvent; -} else { - [QGVAR(treatmentIVLocal), [_target, _className], _target] call CBA_fnc_targetEvent; -}; - -[_target, _removeItem] call FUNC(addToTriageCard); -[_target, "activity", LSTRING(Activity_gaveIV), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); -[_target, "activity_view", LSTRING(Activity_gaveIV), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message - -true diff --git a/addons/medical/functions/fnc_treatmentIVLocal.sqf b/addons/medical/functions/fnc_treatmentIVLocal.sqf deleted file mode 100644 index 1324d5aac2..0000000000 --- a/addons/medical/functions/fnc_treatmentIVLocal.sqf +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Author: Glowbal - * IV Treatment local callback - * - * Arguments: - * 0: The medic - * 1: Treatment classname - * - * - * Return Value: - * None - * - * Public: Yes - */ - -#include "script_component.hpp" - -params ["_target", "_treatmentClassname"]; - -private _bloodVolume = _target getVariable [QGVAR(bloodVolume), 100]; -if (_bloodVolume >= 100) exitWith {}; - -// Find the proper attributes for the used IV -private _config = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "IV"); -private _volumeAdded = getNumber (_config >> "volume"); -private _typeOf = getText (_config >> "type"); - -if (isClass (_config >> _treatmentClassname)) then { - _config = (_config >> _treatmentClassname); - if (isNumber (_config >> "volume")) then { _volumeAdded = getNumber (_config >> "volume");}; - if (isText (_config >> "type")) then { _typeOf = getText (_config >> "type"); }; -} else { - ERROR("IV Treatment Classname not found"); -}; - -private _bloodBags = _target getVariable [QGVAR(ivBags), []]; -_bloodBags pushBack [_volumeAdded]; // Future BagType: [_volumeAdded, _typeOf] -_target setVariable [QGVAR(ivBags), _bloodBags, true]; diff --git a/addons/medical_engine/functions/fnc_handleDamage.sqf b/addons/medical_engine/functions/fnc_handleDamage.sqf index 3ca62ee2a9..b57e30b005 100644 --- a/addons/medical_engine/functions/fnc_handleDamage.sqf +++ b/addons/medical_engine/functions/fnc_handleDamage.sqf @@ -12,6 +12,8 @@ */ #include "script_component.hpp" +#define DAMAGE_STRUCTURAL QGVAR(newDamage$#structural) + params ["_unit", "_selection", "_damage", "_shooter", "_ammo", "_hitPointIndex"]; //diag_log _this; @@ -49,7 +51,7 @@ if (_hitPoint isEqualTo "ace_hdbracket") exitWith { private _damageHead = (_unit getVariable [QGVAR(newDamage$HitHead), 0]) max _damageFace max _damageNeck; // --- Body - private _damageStructural = _unit getVariable [QGVAR(newDamage$#structural), 0]; + private _damageStructural = _unit getVariable [DAMAGE_STRUCTURAL, 0]; private _damagePelvis = _unit getVariable [QGVAR(newDamage$HitPelvis), 0]; private _damageAbdomen = _unit getVariable [QGVAR(newDamage$HitAbdomen), 0]; private _damageDiaphragm = _unit getVariable [QGVAR(newDamage$HitDiaphragm), 0]; diff --git a/addons/medical_treatment/functions/fnc_actionDiagnose.sqf b/addons/medical_treatment/functions/fnc_actionDiagnose.sqf index 22ab98b490..e9e098fdb3 100644 --- a/addons/medical_treatment/functions/fnc_actionDiagnose.sqf +++ b/addons/medical_treatment/functions/fnc_actionDiagnose.sqf @@ -14,7 +14,6 @@ #include "script_component.hpp" -private "_genericMessages"; params ["_caller", "_target"]; private _genericMessages = [ELSTRING(medical,diagnoseMessage), [_target] call EFUNC(common,getName)]; diff --git a/addons/medical_treatment/functions/fnc_actionLoadUnit.sqf b/addons/medical_treatment/functions/fnc_actionLoadUnit.sqf index 1fc6149d8c..b71e8a7101 100644 --- a/addons/medical_treatment/functions/fnc_actionLoadUnit.sqf +++ b/addons/medical_treatment/functions/fnc_actionLoadUnit.sqf @@ -14,7 +14,6 @@ #include "script_component.hpp" -private "_vehicle"; params ["_caller", "_target"]; if ([_target] call EFUNC(common,isAwake)) exitWith { @@ -27,4 +26,5 @@ if ([_target] call FUNC(isBeingDragged)) then { [_caller, _target] call EFUNC(dragging,dropObject); }; -_vehicle = [_caller, _target] call EFUNC(common,loadPerson); +private _vehicle = [_caller, _target] call EFUNC(common,loadPerson); +_vehicle; diff --git a/addons/medical_treatment/functions/fnc_treatmentAdvanced_fullHealLocal.sqf b/addons/medical_treatment/functions/fnc_treatmentAdvanced_fullHealLocal.sqf index 2f60d47470..e76c27a35c 100644 --- a/addons/medical_treatment/functions/fnc_treatmentAdvanced_fullHealLocal.sqf +++ b/addons/medical_treatment/functions/fnc_treatmentAdvanced_fullHealLocal.sqf @@ -36,9 +36,7 @@ if (alive _target) exitWith { _target setVariable [QEGVAR(medical,fractures), []]; // IVs - _target setVariable [QEGVAR(medical,salineIVVolume), 0]; - _target setVariable [QEGVAR(medical,plasmaIVVolume), 0]; - _target setVariable [QEGVAR(medical,bloodIVVolume), 0]; + _target setVariable [QEGVAR(medical,ivBags), nil, true]; // damage storage _target setVariable [QEGVAR(medical,bodyPartStatus), [0,0,0,0,0,0], true]; @@ -67,6 +65,6 @@ if (alive _target) exitWith { // Resetting damage _target setDamage 0; - [_target, "activity", ELSTRING(medical,Activity_fullHeal), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); - [_target, "activity_view", ELSTRING(medical,Activity_fullHeal), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message + [_target, "activity", LSTRING(Activity_fullHeal), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); + [_target, "activity_view", LSTRING(Activity_fullHeal), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message }; diff --git a/addons/medical_treatment/functions/fnc_treatmentAdvanced_surgicalKit_onProgress.sqf b/addons/medical_treatment/functions/fnc_treatmentAdvanced_surgicalKit_onProgress.sqf index 94702ee9c3..37dd7c1e74 100644 --- a/addons/medical_treatment/functions/fnc_treatmentAdvanced_surgicalKit_onProgress.sqf +++ b/addons/medical_treatment/functions/fnc_treatmentAdvanced_surgicalKit_onProgress.sqf @@ -16,12 +16,10 @@ */ #include "script_component.hpp" - -private "_bandagedWounds"; params ["_args", "_elapsedTime", "_totalTime"]; _args params ["_caller", "_target"]; -_bandagedWounds = _target getVariable [QEGVAR(medical,bandagedWounds), []]; +private _bandagedWounds = _target getVariable [QEGVAR(medical,bandagedWounds), []]; //In case two people stitch up one patient and the last wound has already been closed we can stop already if (count _bandagedWounds == 0) exitWith { false }; diff --git a/addons/medical_treatment/functions/fnc_treatmentBasic_epipen.sqf b/addons/medical_treatment/functions/fnc_treatmentBasic_epipen.sqf index 7a27fd8c04..e65a3fe483 100644 --- a/addons/medical_treatment/functions/fnc_treatmentBasic_epipen.sqf +++ b/addons/medical_treatment/functions/fnc_treatmentBasic_epipen.sqf @@ -18,7 +18,3 @@ params ["_caller", "_target","_className"]; [_target, false] call EFUNC(medical,setUnconscious); - -if (_target getVariable [QEGVAR(medical,inReviveState), false]) then { - _target setVariable [QEGVAR(medical,inReviveState), nil, true]; -}; diff --git a/addons/medical_treatment/functions/fnc_treatmentIV.sqf b/addons/medical_treatment/functions/fnc_treatmentIV.sqf index 2378f2bfca..7bfd2b1e76 100644 --- a/addons/medical_treatment/functions/fnc_treatmentIV.sqf +++ b/addons/medical_treatment/functions/fnc_treatmentIV.sqf @@ -16,12 +16,11 @@ #include "script_component.hpp" -private "_removeItem"; params ["_caller", "_target", "_selectionName", "_className", "_items"]; -if (count _items == 0) exitWith {false}; +if (_items isEqualTo []) exitWith {false}; -_removeItem = _items select 0; +_items params ["_removeItem"]; if (local _target) then { [QGVAR(treatmentIVLocal), [_target, _className]] call CBA_fnc_localEvent; } else { diff --git a/addons/medical_treatment/functions/fnc_treatmentIVLocal.sqf b/addons/medical_treatment/functions/fnc_treatmentIVLocal.sqf index e00200b33e..65a0b3e633 100644 --- a/addons/medical_treatment/functions/fnc_treatmentIVLocal.sqf +++ b/addons/medical_treatment/functions/fnc_treatmentIVLocal.sqf @@ -33,10 +33,6 @@ if (isClass (_config >> _treatmentClassname)) then { ERROR("IV Treatment Classname not found"); }; -private _varName = format["ACE_Medical_IVVolume_%1",_typeOf]; -_target setVariable [_varName, (_target getVariable [_varName, 0]) + _volumeAdded, true]; - -if !(_varName in EGVAR(medical,IVBags)) then { - EGVAR(medical,IVBags) pushBack _varName; - publicVariable QEGVAR(medical,IVBags) -}; +private _bloodBags = _target getVariable [QEGVAR(medical,ivBags), []]; +_bloodBags pushBack [_volumeAdded]; // Future BagType: [_volumeAdded, _typeOf] +_target setVariable [QEGVAR(medical,ivBags), _bloodBags, true];