Tourniquets block medication until released

Close #2704
This commit is contained in:
PabstMirror 2016-02-03 14:40:26 -06:00
parent 4612652f8c
commit 3cc10a27ce
6 changed files with 44 additions and 4 deletions

View File

@ -10,6 +10,10 @@ GVAR(heartBeatSounds_Slow) = ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2"];
["medical_woundUpdateRequest", FUNC(onWoundUpdateRequest)] call EFUNC(common,addEventHandler);
["interactMenuClosed", {[objNull, false] call FUNC(displayPatientInformation); }] call EFUNC(common,addEventHandler);
//Treatment EventHandlers:
["medical_advMedication", FUNC(treatmentAdvanced_medicationLocal)] call EFUNC(common,addEventHandler);
["medical_onUnconscious", {
params ["_unit", "_status"];
if (local _unit) then {

View File

@ -17,6 +17,7 @@
private ["_part", "_tourniquets", "_output"];
params ["_caller", "_target", "_selectionName"];
TRACE_3("params",_caller,_target,_selectionName);
// grab the required data
_part = [_selectionName] call FUNC(selectionNameToNumber);
@ -34,3 +35,20 @@ _target setVariable [QGVAR(tourniquets), _tourniquets, true];
// Adding the tourniquet item to the caller
_caller addItem "ACE_tourniquet";
//Handle all injected medications now that blood is flowing:
private _delayedMedications = _target getVariable [QGVAR(occludedMedications), []];
private _removed = [];
TRACE_2("meds",_part,_delayedMedications);
{
_x params ["", "", "_medPartNum"];
if (_part == _medPartNum) then {
TRACE_1("delayed medication call after tourniquet removeal",_x);
["medical_advMedication", [_target], _x] call EFUNC(common,targetEvent);
_removed pushBack _x;
};
} forEach _delayedMedications;
if ((count _removed) > 0) then {
_delayedMedications = _delayedMedications - _removed;
_target setVariable [QGVAR(occludedMedications), _delayedMedications, true];
};

View File

@ -24,6 +24,9 @@ _unit setVariable ["ACE_isUnconscious", false, true];
// tourniquets
_unit setVariable [QGVAR(tourniquets), [0,0,0,0,0,0], true];
//Delayed Medications (from tourniquets)
_unit setVariable [QGVAR(occludedMedications), nil, true];
// wounds and injuries
_unit setVariable [QGVAR(openWounds), [], true];
_unit setVariable [QGVAR(bandagedWounds), [], true];

View File

@ -20,6 +20,7 @@
private ["_foundEntry", "_allUsedMedication","_allMedsFromClassname", "_usedMeds", "_hasOverDosed", "_med", "_limit", "_decreaseAmount", "_viscosityAdjustment", "_medicationConfig", "_onOverDose"];
params ["_target", "_className", "_variable", "_maxDosage", "_timeInSystem", "_incompatabileMeds", "_viscosityChange", "_painReduce"];
TRACE_8("params",_target,_className,_variable,_maxDosage,_timeInSystem,_incompatabileMeds,_viscosityChange,_painReduce);
_foundEntry = false;
_allUsedMedication = _target getVariable [QGVAR(allUsedMedication), []];

View File

@ -7,7 +7,7 @@
* 1: The patient <OBJECT>
* 2: SelectionName <STRING>
* 3: Treatment classname <STRING>
*
* 4: Items Used <ARRAY>
*
* Return Value:
* Succesful treatment started <BOOL>
@ -18,8 +18,11 @@
#include "script_component.hpp"
params ["_caller", "_target", "_selectionName", "_className", "_items"];
TRACE_5("params",_caller,_target,_selectionName,_className,_items);
[[_target, _className], QUOTE(DFUNC(treatmentAdvanced_medicationLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
private _part = [_selectionName] call FUNC(selectionNameToNumber);
["medical_advMedication", [_target], [_target, _className, _part]] call EFUNC(common,targetEvent);
{
if (_x != "") then {

View File

@ -5,7 +5,7 @@
* Arguments:
* 0: The patient <OBJECT>
* 1: Treatment classname <STRING>
*
* 2: Injection Site Part Number <NUMBER>
*
* Return Value:
* Succesful treatment started <BOOL>
@ -16,7 +16,18 @@
#include "script_component.hpp"
private ["_currentInSystem", "_medicationConfig", "_painReduce", "_hrIncreaseLow", "_hrIncreaseNorm", "_hrIncreaseHigh", "_maxDose", "_inCompatableMedication", "_timeInSystem", "_heartRate", "_pain", "_resistance", "_hrCallback", "_varName", "_viscosityChange"];
params ["_target", "_className"];
params ["_target", "_className", "_partNumber"];
TRACE_3("params",_target,_className,_partNumber);
private _tourniquets = _target getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]];
if ((_tourniquets select _partNumber) > 0) exitWith {
TRACE_1("unit has tourniquets blocking blood flow on injection site",_tourniquets);
private _delayedMedications = _target getVariable [QGVAR(occludedMedications), []];
_delayedMedications pushBack _this;
_target setVariable [QGVAR(occludedMedications), _delayedMedications, true];
true
};
// We have added a new dose of this medication to our system, so let's increase it
_varName = format[QGVAR(%1_inSystem), _className];