Medical Treatment - Reset canTreatCached on treatment (#7253)

* Medical Treatment - Reset canTreatCached on treatment

* Reset conditionCaches of nearby units

* CAManBase
This commit is contained in:
PabstMirror 2019-12-12 10:25:21 -06:00 committed by GitHub
parent d25047c7c1
commit 9b8cfc27af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 3 deletions

View File

@ -21,10 +21,10 @@ params ["_patient", "_bodyPart", "_bandage"];
TRACE_3("bandageLocal",_patient,_bodyPart,_bandage);
private _partIndex = ALL_BODY_PARTS find toLower _bodyPart;
if (_partIndex < 0) exitWith {false};
if (_partIndex < 0) exitWith {};
private _openWounds = GET_OPEN_WOUNDS(_patient);
if (_openWounds isEqualTo []) exitWith {false};
if (_openWounds isEqualTo []) exitWith {};
// Figure out which injury for this bodypart is the best choice to bandage
// TODO also use up the remainder on left over injuries
@ -77,4 +77,8 @@ if (GVAR(clearTraumaAfterBandage)) then {
};
};
true
if (_amountOf <= 0) then { // Reset treatment condition cache for nearby players if we stopped all bleeding
private _nearPlayers = (_patient nearEntities ["CAManBase", 6]) select {_x call EFUNC(common,isPlayer)};
TRACE_1("clearConditionCaches: bandage",_nearPlayers);
[QEGVAR(interact_menu,clearConditionCaches), [], _nearPlayers] call CBA_fnc_targetEvent;
};

View File

@ -26,3 +26,7 @@ _tourniquets set [_partIndex, CBA_missionTime];
_patient setVariable [VAR_TOURNIQUET, _tourniquets, true];
[_patient] call EFUNC(medical_status,updateWoundBloodLoss);
private _nearPlayers = (_patient nearEntities ["CAManBase", 6]) select {_x call EFUNC(common,isPlayer)};
TRACE_1("clearConditionCaches: tourniquetLocal",_nearPlayers);
[QEGVAR(interact_menu,clearConditionCaches), [], _nearPlayers] call CBA_fnc_targetEvent;

View File

@ -2,6 +2,7 @@
/*
* Author: Glowbal, mharis001
* Removes the tourniquet from the patient on the given body part.
* Note: Patient may not be local
*
* Arguments:
* 0: Medic <OBJECT>
@ -33,6 +34,10 @@ _patient setVariable [VAR_TOURNIQUET, _tourniquets, true];
[_patient] call EFUNC(medical_status,updateWoundBloodLoss);
private _nearPlayers = (_patient nearEntities ["CAManBase", 6]) select {_x call EFUNC(common,isPlayer)};
TRACE_1("clearConditionCaches: tourniquetRemove",_nearPlayers);
[QEGVAR(interact_menu,clearConditionCaches), [], _nearPlayers] call CBA_fnc_targetEvent;
// Add tourniquet item to medic's inventory
// todo: should there be a setting to select who receives the removed tourniquet?
[_medic, "ACE_tourniquet", true] call EFUNC(common,addToInventory);