First set up clean up for medical rewrite

This commit is contained in:
Glowbal 2016-09-18 12:05:36 +02:00
parent 0c43c83b3d
commit 811e1cd598
15 changed files with 14 additions and 295 deletions

View File

@ -1,45 +0,0 @@
/*
* Author: Glowbal
* Action for diagnosing in basic medical
*
* Arguments:
* 0: The medic <OBJECT>
* 1: The patient <OBJECT>
*
* 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;

View File

@ -1,29 +0,0 @@
/*
* Author: Glowbal
* Action for loading an unconscious or dead unit in the nearest vechile
*
* Arguments:
* 0: The medic <OBJECT>
* 1: The patient <OBJECT>
*
* 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);

View File

@ -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
};

View File

@ -1,33 +0,0 @@
/*
* Author: BaerMitUmlaut
* Handles treatment via surgical kit per frame
*
* Arguments:
* 0: Arguments <ARRAY>
* 0: Caller <OBJECT>
* 1: Target <OBJECT>
* 1: Elapsed Time <NUMBER>
* 2: Total Time <NUMBER>
*
* Return Value:
* Succesful treatment started <BOOL>
*
* 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

View File

@ -1,20 +0,0 @@
/*
* Author: KoffeinFlummi
* Callback when the epipen treatment is complete
*
* Arguments:
* 0: The medic <OBJECT>
* 1: The patient <OBJECT>
* 2: Selection Name <STRING>
* 3: Treatment classname <STRING>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
params ["_caller", "_target","_className"];
[_target, false] call FUNC(setUnconscious);

View File

@ -1,34 +0,0 @@
/*
* Author: Glowbal
* Patient IV Treatment callback
*
* Arguments:
* 0: The medic <OBJECT>
* 1: The patient <OBJECT>
* 2: SelectionName <STRING>
* 3: Treatment classname <STRING>
*
* Return Value:
* Succesful treatment started <BOOL>
*
* 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

View File

@ -1,38 +0,0 @@
/*
* Author: Glowbal
* IV Treatment local callback
*
* Arguments:
* 0: The medic <OBJECT>
* 1: Treatment classname <STRING>
*
*
* 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];

View File

@ -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];

View File

@ -14,7 +14,6 @@
#include "script_component.hpp"
private "_genericMessages";
params ["_caller", "_target"];
private _genericMessages = [ELSTRING(medical,diagnoseMessage), [_target] call EFUNC(common,getName)];

View File

@ -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;

View File

@ -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
};

View File

@ -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 };

View File

@ -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];
};

View File

@ -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 {

View File

@ -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];