mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fix medical status function calls
This commit is contained in:
parent
65f57361a4
commit
697aa5dc08
@ -41,14 +41,14 @@ if (!isNull _instigator) then {
|
||||
|
||||
#ifdef DEBUG_TESTRESULTS
|
||||
private _startDmg = +(_unit getVariable [QGVAR(bodyPartDamage), [-1]]);
|
||||
private _startPain = _unit getVariable [QGVAR(pain), 0];
|
||||
private _startPain = GET_PAIN_TOTAL(_unit);
|
||||
#endif
|
||||
|
||||
[QEGVAR(medical_engine,woundReceived), [_unit, _bodyPart, _damageToAdd, _instigator, _typeOfDamage]] call CBA_fnc_localEvent;
|
||||
|
||||
#ifdef DEBUG_TESTRESULTS
|
||||
private _endDmg = _unit getVariable [QGVAR(bodyPartDamage), [-1]];
|
||||
private _endPain = _unit getVariable [QGVAR(pain), 0];
|
||||
private _endPain = GET_PAIN_TOTAL(_unit);
|
||||
private _typeOfDamageAdj = _typeOfDamage call EFUNC(medical_damage,getTypeOfDamage);
|
||||
private _config = configFile >> "ACE_Medical_Injuries" >> "damageTypes" >> _typeOfDamageAdj;
|
||||
private _selectionSpecific = true;
|
||||
|
@ -24,8 +24,6 @@ TRACE_2("adjustPainLevel",_unit,_desiredPainLevel);
|
||||
|
||||
_desiredPainLevel = _desiredPainLevel * GVAR(painCoefficient);
|
||||
|
||||
private _pain = _unit getVariable [QGVAR(pain), 0];
|
||||
private _pain = GET_PAIN_TOTAL(_unit);
|
||||
|
||||
_pain = 0 max (_pain max _desiredPainLevel) min 1;
|
||||
|
||||
_unit setVariable [QGVAR(pain), _pain];
|
||||
SET_PAIN_TOTAL(_unit,_pain max _desiredPainLevel,false);
|
||||
|
@ -33,7 +33,7 @@
|
||||
_return pushBack "";
|
||||
|
||||
// State:
|
||||
private _hasStableVitals = [_unit] call EFUNC(medical,hasStableVitals);
|
||||
private _hasStableVitals = [_unit] call EFUNC(medical_status,hasStableVitals);
|
||||
private _targetState = [_unit, GVAR(STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState;
|
||||
if (!local _unit) then {_targetState = "NotLocal";};
|
||||
private _color = switch (_targetState) do {case "Default": {"33FF33"}; case "Injured": {"FF3333"}; case "Unconscious": {"FF8833"}; case "CardiacArrest": {"FF33AA"}; default {"555555"}};
|
||||
@ -48,8 +48,8 @@
|
||||
_return pushBack format [" - [Loss: %1] %2", _bloodLoss toFixed 5, _secondsToHeartstop];
|
||||
|
||||
// Heart:
|
||||
private _cardiacOutput = [_unit] call EFUNC(medical,getCardiacOutput);
|
||||
private _heartRate = _unit getVariable [QEGVAR(medical,heartRate), DEFAULT_HEART_RATE];
|
||||
private _cardiacOutput = [_unit] call EFUNC(medical_status,getCardiacOutput);
|
||||
private _heartRate = GET_HEART_RATE(_unit);
|
||||
GET_BLOOD_PRESSURE(_unit) params ["_bpLow", "_bpHigh"];
|
||||
_return pushBack format ["CardiacOutput %1", _cardiacOutput toFixed 5];
|
||||
_return pushBack format [" - [HR: %1] [BP: %2 / %3]", _heartRate toFixed 1, _bpLow toFixed 1, _bpHigh toFixed 1];
|
||||
|
@ -62,7 +62,7 @@ if (_show == 1) then {
|
||||
if (((_target getVariable [QEGVAR(medical,tourniquets), [0,0,0,0,0,0]]) select _selectionN) > 0) then {
|
||||
_genericMessages pushback [localize ELSTRING(medical,Status_Tourniquet_Applied), [0.77, 0.51, 0.08, 1]];
|
||||
};
|
||||
if (EGVAR(medical,showPainInMenu) && {[ACE_player, EGVAR(medical,medicSetting_PainVisualization)] call EFUNC(medical,isMedic)}) then {
|
||||
if (EGVAR(medical,showPainInMenu) && {[ACE_player, EGVAR(medical,medicSetting_PainVisualization)] call EFUNC(medical_status,isMedic)}) then {
|
||||
private _painLevel = GET_PAIN_PERCEIVED(_target);
|
||||
if (_painLevel > 0) then {
|
||||
private _painText = localize ELSTRING(medical,Status_Pain);
|
||||
|
@ -20,6 +20,6 @@ params ["_unit"];
|
||||
|
||||
if (!local _unit) exitWith {};
|
||||
|
||||
_unit setVariable [QGVAR(pain), 0, true];
|
||||
_unit setVariable [QGVAR(heartRate), 0, true];
|
||||
SET_PAIN_TOTAL(_unit,0);
|
||||
SET_HEART_RATE(_unit,0);
|
||||
_unit setVariable [QGVAR(bloodPressure), [0, 0], true];
|
||||
|
@ -50,10 +50,10 @@ if (!alive _unit) exitWith {
|
||||
|
||||
// In case the unit is no longer in an unconscious state, we are going to check if we can already reset the animation
|
||||
if !(_unit getVariable ["ACE_isUnconscious",false]) exitWith {
|
||||
TRACE_7("ACE_DEBUG_Unconscious_PFH",_unit, _args, [_unit] call FUNC(isBeingCarried), [_unit] call FUNC(isBeingDragged), _idPFH, _unit getVariable QGVAR(unconsciousArguments),animationState _unit);
|
||||
TRACE_7("ACE_DEBUG_Unconscious_PFH",_unit, _args, [_unit] call EFUNC(medical_status,isBeingCarried), [_unit] call EFUNC(medical_status,isBeingDragged), _idPFH, _unit getVariable QGVAR(unconsciousArguments),animationState _unit);
|
||||
// TODO, handle this with carry instead, so we can remove the PFH here.
|
||||
// Wait until the unit isn't being carried anymore, so we won't end up with wierd animations
|
||||
if !(([_unit] call FUNC(isBeingCarried)) || ([_unit] call FUNC(isBeingDragged))) then {
|
||||
if !(([_unit] call EFUNC(medical_status,isBeingCarried)) || ([_unit] call EFUNC(medical_status,isBeingDragged))) then {
|
||||
if ("ACE_FakePrimaryWeapon" in (weapons _unit)) then {
|
||||
TRACE_1("Removing fake weapon [on wakeup]",_unit);
|
||||
_unit removeWeapon "ACE_FakePrimaryWeapon";
|
||||
|
@ -60,11 +60,16 @@
|
||||
// - Status macro functions ---------------------------------------------------
|
||||
// These macros provide the same functionality as the functions in the status
|
||||
// component, but are slightly faster (because most are just object variables)
|
||||
#define GET_PAIN_TOTAL(unit) (unit getVariable [QEGVAR(medical_status,pain), 0])
|
||||
#define GET_PAIN_PERCEIVED(unit) ([unit] call EFUNC(medical_status,getPainPerceived)) // Just for consistency
|
||||
#define GET_HEART_RATE(unit) (unit getVariable [QEGVAR(medical_status,heartRate), DEFAULT_HEART_RATE])
|
||||
#define GET_BLOOD_VOLUME(unit) (unit getVariable [QEGVAR(medical_status,bloodVolume), DEFAULT_BLOOD_VOLUME])
|
||||
#define GET_BLOOD_LOSS(unit) ([unit] call EFUNC(medical_status,getBloodLoss)) // Just for consistency
|
||||
#define GET_BLOOD_PRESSURE(unit) ([unit] call EFUNC(medical_status,getBloodPressure)) // Just for consistency
|
||||
#define IS_UNCONSCIOUS(unit) (unit getVariable [QEGVAR(medical_status,isUnconscious), false])
|
||||
#define GET_BLOOD_VOLUME(unit) (unit getVariable [QEGVAR(medical_status,bloodVolume), DEFAULT_BLOOD_VOLUME])
|
||||
#define GET_HEART_RATE(unit) (unit getVariable [QEGVAR(medical_status,heartRate), DEFAULT_HEART_RATE])
|
||||
#define GET_PAIN_PERCEIVED(unit) ([unit] call EFUNC(medical_status,getPainPerceived)) // Just for consistency
|
||||
#define GET_PAIN_TOTAL(unit) (unit getVariable [QEGVAR(medical_status,pain), 0])
|
||||
#define IS_IN_PAIN(unit) (GET_PAIN_PERCEIVED(unit) > 0)
|
||||
#define IS_UNCONSCIOUS(unit) (unit getVariable [QEGVAR(medical_status,isUnconscious), false])
|
||||
// Setters have overloaded versions for locality handling
|
||||
#define SET_HEART_RATE(unit,value) unit setVariable [QEGVAR(medical_status,heartRate), value, true]
|
||||
#define SET_HEART_RATE(unit,value,sync) unit setVariable [QEGVAR(medical_status,heartRate), value, sync]
|
||||
#define SET_PAIN_TOTAL(unit,value) unit setVariable [QEGVAR(medical_status,pain), 0 max (value) min 1, true]
|
||||
#define SET_PAIN_TOTAL(unit,value,sync) unit setVariable [QEGVAR(medical_status,pain), 0 max (value) min 1, sync]
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
private _medic = objNull;
|
||||
{
|
||||
if ((!isPlayer _x) && {[_x] call EFUNC(medical,isMedic)}) exitWith {
|
||||
if ((!isPlayer _x) && {[_x] call EFUNC(medical_status,isMedic)}) exitWith {
|
||||
_medic = _x;
|
||||
};
|
||||
} forEach (units _unit);
|
||||
|
@ -19,10 +19,10 @@
|
||||
// we ignore this here. We need to "notice" the medic that he should
|
||||
// treat other units, or else he won't do anything on his own.
|
||||
|
||||
if ([_this] call EFUNC(medical,isMedic) || {vehicle _this != _this}) exitWith {false};
|
||||
if ([_this] call EFUNC(medical_status,isMedic) || {vehicle _this != _this}) exitWith {false};
|
||||
|
||||
{
|
||||
if ([_x] call EFUNC(medical,isMedic) && {!([_x] call EFUNC(common,isPlayer))}) exitWith {
|
||||
if ([_x] call EFUNC(medical_status,isMedic) && {!([_x] call EFUNC(common,isPlayer))}) exitWith {
|
||||
_this setVariable [QGVAR(assignedMedic), _x];
|
||||
true
|
||||
};
|
||||
|
@ -39,7 +39,7 @@ if (((_target getVariable [QEGVAR(medical,tourniquets), [0, 0, 0, 0, 0, 0]]) sel
|
||||
_genericMessages pushBack [localize ELSTRING(medical,Status_Tourniquet_Applied), [0.77, 0.51, 0.08, 1]];
|
||||
};
|
||||
|
||||
if (EGVAR(medical,showPainInMenu) && {[ACE_player, EGVAR(medical,medicSetting_PainVisualization)] call EFUNC(medical,isMedic)}) then {
|
||||
if (EGVAR(medical,showPainInMenu) && {[ACE_player, EGVAR(medical,medicSetting_PainVisualization)] call EFUNC(medical_status,isMedic)}) then {
|
||||
private _painLevel = GET_PAIN_PERCEIVED(_target);
|
||||
if (_painLevel > 0) then {
|
||||
private _painText = localize ELSTRING(medical,Status_Pain);
|
||||
|
@ -51,7 +51,7 @@ class ACE_Medical_StateMachine {
|
||||
};
|
||||
class WakeUp {
|
||||
targetState = "Injured";
|
||||
condition = QUOTE(_this call FUNC(hasStableVitals));
|
||||
condition = QUOTE(_this call EFUNC(medical_status,hasStableVitals));
|
||||
events[] = {QGVAR(WakeUp)};
|
||||
onTransition = QUOTE([ARR_2(_this,(false))] call FUNC(setUnconsciousStatemachine));
|
||||
};
|
||||
|
@ -21,4 +21,4 @@ _time = _time + random [_time*-0.1, 0, _time*0.1];
|
||||
_unit setVariable [QGVAR(cardiacArrestTime), _time];
|
||||
_unit setVariable [QGVAR(cardiacArrestStart), CBA_missionTime];
|
||||
|
||||
[_unit] call FUNC(setCardiacArrest);
|
||||
[_unit] call EFUNC(medical_status,setCardiacArrest);
|
||||
|
@ -8,7 +8,7 @@ if (!alive _unit) exitWith {};
|
||||
|
||||
// If locality changed, broadcast the last medical state and finish the local loop
|
||||
if (!local _unit) exitWith {
|
||||
_unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE], true];
|
||||
SET_HEART_RATE(_unit,GET_HEART_RATE(_unit));
|
||||
_unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true];
|
||||
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true];
|
||||
};
|
||||
|
@ -8,7 +8,7 @@ if (!alive _unit) exitWith {};
|
||||
|
||||
// If locality changed, broadcast the last medical state and finish the local loop
|
||||
if (!local _unit) exitWith {
|
||||
_unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE], true];
|
||||
SET_HEART_RATE(_unit,GET_HEART_RATE(_unit));
|
||||
_unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true];
|
||||
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true];
|
||||
};
|
||||
|
@ -9,7 +9,7 @@ if (!alive _unit) exitWith {};
|
||||
|
||||
// If locality changed, broadcast the last medical state and finish the local loop
|
||||
if (!local _unit) exitWith {
|
||||
_unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE], true];
|
||||
SET_HEART_RATE(_unit,GET_HEART_RATE(_unit));
|
||||
_unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true];
|
||||
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true];
|
||||
};
|
||||
@ -23,7 +23,7 @@ if (_painLevel > 0) then {
|
||||
|
||||
// Handle spontaneous wakeup from unconsciousness
|
||||
if (GVAR(spontaneousWakeUpChance) > 0) then {
|
||||
if (_unit call FUNC(hasStableVitals)) then {
|
||||
if (_unit call EFUNC(medical_status,hasStableVitals)) then {
|
||||
private _lastWakeUpCheck = _unit getVariable [QGVAR(lastWakeUpCheck), CBA_missionTime];
|
||||
if (CBA_missionTime - _lastWakeUpCheck > SPONTANEOUS_WAKE_UP_INTERVAL) then {
|
||||
TRACE_2("Checking for wake up",_unit,GVAR(spontaneousWakeUpChance));
|
||||
|
@ -16,5 +16,5 @@ params ["_unit"];
|
||||
|
||||
_unit setVariable [QGVAR(inCardiacArrest), false, true];
|
||||
_unit setVariable [QGVAR(cardiacArrestStart), nil];
|
||||
_unit setVariable [QGVAR(heartRate), 40, true];
|
||||
SET_HEART_RATE(_unit,40);
|
||||
_unit setVariable [QGVAR(lastTimeUpdated), CBA_missionTime];
|
||||
|
@ -3,9 +3,7 @@ PREP(getBloodLoss);
|
||||
PREP(getBloodPressure);
|
||||
PREP(getBloodVolumeChange);
|
||||
PREP(getCardiacOutput);
|
||||
PREP(getHeartRate);
|
||||
PREP(getPainPerceived);
|
||||
PREP(getPainTotal);
|
||||
PREP(hasStableVitals);
|
||||
PREP(hasTourniquetAppliedTo);
|
||||
PREP(initUnit);
|
||||
@ -16,9 +14,6 @@ PREP(isInMedicalVehicle);
|
||||
PREP(isInStableCondition);
|
||||
PREP(isMedic);
|
||||
PREP(isMedicalVehicle);
|
||||
PREP(isUnconscious);
|
||||
PREP(setCardiacArrest);
|
||||
PREP(setDead);
|
||||
PREP(setHeartRate);
|
||||
PREP(setPainTotal);
|
||||
PREP(setUnconscious);
|
||||
|
@ -11,7 +11,7 @@
|
||||
* Blood volume change (liters per second) <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* [player, 1, true] call ACE_medical_fnc_getBloodVolumeChange
|
||||
* [player, 1, true] call ACE_medical_status_fnc_getBloodVolumeChange
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
@ -9,7 +9,7 @@
|
||||
* Current cardiac output (liter per second) <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* [player] call ace_medical_fnc_getCardiacOutput
|
||||
* [player] call ace_medical_status_fnc_getCardiacOutput
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -26,8 +26,8 @@
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
private _bloodVolume = ((_unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME]) / DEFAULT_BLOOD_VOLUME) * 100;
|
||||
private _heartRate = _unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE];
|
||||
private _bloodVolume = (GET_BLOOD_VOLUME(_unit) / DEFAULT_BLOOD_VOLUME) * 100;
|
||||
private _heartRate = GET_HEART_RATE(_unit);
|
||||
private _cardiacOutput = ((_bloodVolume / MODIFIER_CARDIAC_OUTPUT) + ((_heartRate / DEFAULT_HEART_RATE) - 1)) / 60;
|
||||
|
||||
(0 max _cardiacOutput)
|
||||
|
@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Get the heart rate of a unit.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Heart Rate <NUMBER>
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
params ["_unit"];
|
||||
|
||||
_unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE]
|
@ -14,7 +14,7 @@
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
private _pain = _unit getVariable [QGVAR(pain), 0];
|
||||
private _pain = GET_PAIN_TOTAL(_unit);
|
||||
private _painSuppress = _unit getVariable [QGVAR(painSuppress), 0];
|
||||
|
||||
(0 max (_pain - _painSuppress) min 1)
|
||||
|
@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Get the total pain level of a unit.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Pain level (0 .. 1) <NUMBER>
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
params ["_unit"];
|
||||
|
||||
_unit getVariable [QGVAR(pain), 0]
|
@ -9,7 +9,7 @@
|
||||
* Has stable vitals <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [player] call ace_medical_fnc_hasStableVitals
|
||||
* [player] call ace_medical_status_fnc_hasStableVitals
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -28,7 +28,7 @@ private _bloodPressure = GET_BLOOD_PRESSURE(_unit);
|
||||
_bloodPressure params ["_bloodPressureL", "_bloodPressureH"];
|
||||
if (_bloodPressureL < 50 || {_bloodPressureH < 60}) exitWith { false };
|
||||
|
||||
private _heartRate = _unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE];
|
||||
private _heartRate = GET_HEART_RATE(_unit);
|
||||
if (_heartRate < 40) exitWith { false };
|
||||
|
||||
true
|
||||
|
@ -10,7 +10,7 @@
|
||||
* Has tourniquet applied <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [player, "leftleg"] call ace_medical_fnc_hasTourniquetAppliedTo
|
||||
* [player, "leftleg"] call ace_medical_status_fnc_hasTourniquetAppliedTo
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
@ -23,7 +23,7 @@ if (damage _unit > 0) then {
|
||||
|
||||
// - Blood and heart ----------------------------------------------------------
|
||||
_unit setVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME, true];
|
||||
_unit setVariable [QGVAR(heartRate), DEFAULT_HEART_RATE, true];
|
||||
SET_HEART_RATE(_unit,DEFAULT_HEART_RATE);
|
||||
_unit setVariable [QGVAR(heartRateAdjustments), [], true];
|
||||
_unit setVariable [QGVAR(bloodPressure), [80, 120], true];
|
||||
_unit setVariable [QGVAR(peripheralResistance), 100, true];
|
||||
@ -33,7 +33,7 @@ _unit setVariable [QGVAR(hasLostBlood), 0, true];
|
||||
_unit setVariable [QGVAR(isBleeding), false, true];
|
||||
|
||||
// - Pain ---------------------------------------------------------------------
|
||||
_unit setVariable [QGVAR(pain), 0, true];
|
||||
SET_PAIN_TOTAL(_unit,0);
|
||||
_unit setVariable [QGVAR(hasPain), false, true];
|
||||
_unit setVariable [QGVAR(painSuppress), 0, true];
|
||||
_unit setVariable [QGVAR(painSuppressAdjustments), [], true];
|
||||
|
@ -9,7 +9,7 @@
|
||||
* Is being carried <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [bob] call ace_medical_fnc_isBeingCarried
|
||||
* [bob] call ace_medical_status_fnc_isBeingCarried
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
@ -9,7 +9,7 @@
|
||||
* Is being dragged <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [bob] call ace_medical_fnc_isBeingDragged
|
||||
* [bob] call ace_medical_status_fnc_isBeingDragged
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
@ -9,7 +9,7 @@
|
||||
* Is in medical facility <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [player] call ace_medical_fnc_isInMedicalFacility
|
||||
* [player] call ace_medical_status_fnc_isInMedicalFacility
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
@ -9,7 +9,7 @@
|
||||
* Is unit in medical vehicle? <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [player] call ace_medical_fnc_isInMedicalVehicle
|
||||
* [player] call ace_medical_status_fnc_isInMedicalVehicle
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
@ -10,7 +10,7 @@
|
||||
* Is in of medic class <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [player] call ace_medical_fnc_isMedic
|
||||
* [player] call ace_medical_status_fnc_isMedic
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
@ -9,7 +9,7 @@
|
||||
* Is in of medic class <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [cursorObject] call ace_medical_fnc_isMedicalVehicle
|
||||
* [cursorObject] call ace_medical_status_fnc_isMedicalVehicle
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Check if the unit is unconscious.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Is unconscious <BOOL>
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
params ["_unit"];
|
||||
|
||||
_unit getVariable [QGVAR(isUnconscious), false]
|
@ -22,7 +22,7 @@ params ["_unit"];
|
||||
if (_unit getVariable [QGVAR(inCardiacArrest), false]) exitWith {};
|
||||
|
||||
_unit setVariable [QGVAR(inCardiacArrest), true, true];
|
||||
_unit setVariable [QGVAR(heartRate), 0, true];
|
||||
SET_HEART_RATE(_unit,0);
|
||||
|
||||
["ace_cardiacArrestEntered", [_unit]] call CBA_fnc_localEvent;
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [bob, "bloodloss"] call ace_medical_fnc_setDead;
|
||||
* [bob, "bloodloss"] call ace_medical_status_fnc_setDead;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Sets the heart rate of a unit.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The Unit <OBJECT>
|
||||
* 1: Heart rate <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
params ["_unit", "_heartRate"];
|
||||
|
||||
_unit setVariable [QGVAR(heartRate), _heartRate];
|
@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Sets the total pain level of a unit.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The Unit <OBJECT>
|
||||
* 1: Pain level (0..1) <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
params ["_unit", "_pain"];
|
||||
|
||||
_unit setVariable [QGVAR(pain), 0 max _pain min 1];
|
@ -13,8 +13,8 @@
|
||||
* Success? <BOOLEAN>
|
||||
*
|
||||
* Example:
|
||||
* [bob, true] call ace_medical_fnc_setUnconscious;
|
||||
* [player, true, 5, true] call ace_medical_fnc_setUnconscious;
|
||||
* [bob, true] call ace_medical_status__fnc_setUnconscious;
|
||||
* [player, true, 5, true] call ace_medical_status_fnc_setUnconscious;
|
||||
*
|
||||
* Public: yes
|
||||
*/
|
||||
|
@ -77,7 +77,7 @@ class GVAR(Actions) {
|
||||
items[] = {"ACE_tourniquet"};
|
||||
treatmentTime = 7;
|
||||
callbackSuccess = QFUNC(treatmentTourniquet);
|
||||
condition = QUOTE(!([ARR_2(_target,_bodyPart)] call EFUNC(medical,hasTourniquetAppliedTo)));
|
||||
condition = QUOTE(!([ARR_2(_target,_bodyPart)] call EFUNC(medical_status,hasTourniquetAppliedTo)));
|
||||
litter[] = {};
|
||||
};
|
||||
class RemoveTourniquet: Tourniquet {
|
||||
@ -85,7 +85,7 @@ class GVAR(Actions) {
|
||||
displayNameProgress = ECSTRING(medical,RemovingTourniquet);
|
||||
items[] = {};
|
||||
callbackSuccess = QFUNC(treatmentTourniquetRemove);
|
||||
condition = QUOTE([ARR_2(_target,_bodyPart)] call EFUNC(medical,hasTourniquetAppliedTo));
|
||||
condition = QUOTE([ARR_2(_target,_bodyPart)] call EFUNC(medical_status,hasTourniquetAppliedTo));
|
||||
};
|
||||
|
||||
// --- syringes
|
||||
@ -282,7 +282,7 @@ class GVAR(Actions) {
|
||||
displayName = ECSTRING(medical,Use_Aid_Kit);
|
||||
displayNameProgress = ECSTRING(medical,TreatmentAction);
|
||||
category = "advanced";
|
||||
condition = QUOTE(_target call EFUNC(medical,isInStableCondition));
|
||||
condition = QUOTE(_target call EFUNC(medical_status,isInStableCondition));
|
||||
items[] = {"ACE_personalAidKit"};
|
||||
treatmentLocations[] = {QEGVAR(medical,useLocation_PAK)};
|
||||
requiredMedic = QEGVAR(medical,medicSetting_PAK);
|
||||
|
@ -48,8 +48,6 @@ PREP(getTriageStatus);
|
||||
PREP(handleBandageOpening);
|
||||
PREP(healTime);
|
||||
PREP(HealTimeMedkit);
|
||||
PREP(isBeingCarried);
|
||||
PREP(isBeingDragged);
|
||||
PREP(onMedicationUsage);
|
||||
|
||||
// items
|
||||
|
@ -18,7 +18,7 @@ params ["_caller", "_target", "_bodyPart"];
|
||||
|
||||
private _bloodPressure = [0, 0];
|
||||
|
||||
if (alive _target && !([_target, _bodyPart] call EFUNC(medical,hasTourniquetAppliedTo))) then {
|
||||
if (alive _target && !([_target, _bodyPart] call EFUNC(medical_status,hasTourniquetAppliedTo))) then {
|
||||
_bloodPressure = GET_BLOOD_PRESSURE(_target);
|
||||
};
|
||||
|
||||
@ -28,7 +28,7 @@ private _logOutPut = ELSTRING(medical,Check_Bloodpressure_NoBloodpressure);
|
||||
_bloodPressure params ["_bloodPressureLow", "_bloodPressureHigh"];
|
||||
|
||||
if (_bloodPressureHigh > 20) then {
|
||||
if (_caller call EFUNC(medical,isMedic)) then {
|
||||
if (_caller call EFUNC(medical_status,isMedic)) then {
|
||||
_bloodPressureOutput = ELSTRING(medical,Check_Bloodpressure_Output_1);
|
||||
_logOutPut = format ["%1/%2", round _bloodPressureHigh, round _bloodPressureLow];
|
||||
} else {
|
||||
|
@ -18,7 +18,7 @@ params ["_caller", "_target", "_bodyPart"];
|
||||
|
||||
private _heartRate = 0;
|
||||
|
||||
if (alive _target && !([_target, _bodyPart] call EFUNC(medical,hasTourniquetAppliedTo))) then {
|
||||
if (alive _target && !([_target, _bodyPart] call EFUNC(medical_status,hasTourniquetAppliedTo))) then {
|
||||
_heartRate = _target getVariable [QEGVAR(medical,heartRate), 80];
|
||||
};
|
||||
|
||||
@ -26,7 +26,7 @@ private _heartRateOutput = ELSTRING(medical,Check_Pulse_Output_5);
|
||||
private _logOutPut = ELSTRING(medical,Check_Pulse_None);
|
||||
|
||||
if (_heartRate > 1.0) then {
|
||||
if (_caller call EFUNC(medical,isMedic)) then {
|
||||
if (_caller call EFUNC(medical_status,isMedic)) then {
|
||||
_heartRateOutput = ELSTRING(medical,Check_Pulse_Output_1);
|
||||
_logOutPut = format ["%1", round(_heartRate)];
|
||||
} else {
|
||||
|
@ -23,11 +23,11 @@ if ([_target] call EFUNC(common,isAwake)) exitWith {
|
||||
[QEGVAR(common,displayTextStructured), [[ELSTRING(medical,CanNotLoaded), _target call EFUNC(common,getName)], 1.5, _caller], _caller] call CBA_fnc_targetEvent;
|
||||
};
|
||||
|
||||
if ([_target] call FUNC(isBeingCarried)) then {
|
||||
if ([_target] call EFUNC(medical_status,isBeingCarried)) then {
|
||||
[_caller, _target] call EFUNC(dragging,dropObject_carry);
|
||||
};
|
||||
|
||||
if ([_target] call FUNC(isBeingDragged)) then {
|
||||
if ([_target] call EFUNC(medical_status,isBeingDragged)) then {
|
||||
[_caller, _target] call EFUNC(dragging,dropObject);
|
||||
};
|
||||
|
||||
|
@ -27,7 +27,7 @@ if (!local _target) exitWith {
|
||||
|
||||
if (alive _target) then {
|
||||
TRACE_1("manually killing with setDead",_target);
|
||||
[_target, true, "buried_alive"] call EFUNC(medical,setDead);
|
||||
[_target, true, "buried_alive"] call EFUNC(medical_status,setDead);
|
||||
};
|
||||
|
||||
private _position = (getPosASL _target) vectorAdd [0, 0, 0.2];
|
||||
|
@ -23,7 +23,7 @@ private _syncValues = (CBA_missionTime - _lastTimeValuesSynced) >= (10 + floor(r
|
||||
|
||||
_unit setVariable [QEGVAR(medical,lastTimeUpdated), CBA_missionTime];
|
||||
if (_deltaT != 0) then {
|
||||
private _change = ([_unit, _deltaT, _syncValues] call EFUNC(medical,getBloodVolumeChange));
|
||||
private _change = ([_unit, _deltaT, _syncValues] call EFUNC(medical_status,getBloodVolumeChange));
|
||||
private _bloodVolume = (_unit getVariable [QEGVAR(medical,bloodVolume), DEFAULT_BLOOD_VOLUME]) + _change;
|
||||
_bloodVolume = 0 max _bloodVolume min DEFAULT_BLOOD_VOLUME;
|
||||
_unit setVariable [QEGVAR(medical,bloodVolume), _bloodVolume, _syncValues];
|
||||
|
@ -52,7 +52,7 @@ if (isNumber (_config >> "requiredMedic")) then {
|
||||
};
|
||||
};
|
||||
|
||||
if !([_caller, _medicRequired] call EFUNC(medical,isMedic)) exitWith {false};
|
||||
if !([_caller, _medicRequired] call EFUNC(medical_status,isMedic)) exitWith {false};
|
||||
|
||||
// check selection
|
||||
private _allowedSelections = getArray (_config >> "allowedSelections") apply {toLower _x};
|
||||
@ -92,8 +92,8 @@ private _locations = getArray (_config >> "treatmentLocations") apply {toLower _
|
||||
if ("all" in _locations) then {
|
||||
_locations = true;
|
||||
} else {
|
||||
private _medFacility = {([_caller] call EFUNC(medical,isInMedicalFacility)) || ([_target] call EFUNC(medical,isInMedicalFacility))};
|
||||
private _medVeh = {([_caller] call EFUNC(medical,isInMedicalVehicle)) || ([_target] call EFUNC(medical,isInMedicalVehicle))};
|
||||
private _medFacility = {([_caller] call EFUNC(medical_status,isInMedicalFacility)) || ([_target] call EFUNC(medical_status,isInMedicalFacility))};
|
||||
private _medVeh = {([_caller] call EFUNC(medical_status,isInMedicalVehicle)) || ([_target] call EFUNC(medical_status,isInMedicalVehicle))};
|
||||
|
||||
{
|
||||
if (_x == "field") exitWith { _locations = true; };
|
||||
|
@ -33,7 +33,7 @@ if ([_medic, _item] call EFUNC(common,hasItem)) exitWith {
|
||||
|
||||
private _return = false;
|
||||
|
||||
if (vehicle _medic != _medic && {vehicle _medic call EFUNC(medical,isMedicalVehicle)}) then {
|
||||
if (vehicle _medic != _medic && {vehicle _medic call EFUNC(medical_status,isMedicalVehicle)}) then {
|
||||
{
|
||||
if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {[_x, _item] call EFUNC(common,hasItem)}) exitWith {
|
||||
_return = true;
|
||||
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Returns if a target is being carried. (from ace_dragging)
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Target Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Is being carried <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [bob] call ACE_medical_treatment_fnc_isBeingCarried
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_target"];
|
||||
|
||||
private "_owner";
|
||||
|
||||
_owner = _target getVariable [QEGVAR(common,owner), objNull];
|
||||
|
||||
if (isNull _owner) exitWith {false};
|
||||
|
||||
(_owner getVariable [QEGVAR(dragging,carriedObject), objNull]) == _target
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Returns if a target is being dragged. (from ace_dragging)
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Target Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Is being dragged <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [bob] call ACE_medical_treatment_fnc_isBeingDragged
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_target"];
|
||||
|
||||
private "_owner";
|
||||
|
||||
_owner = _target getVariable [QEGVAR(common,owner), objNull];
|
||||
|
||||
if (isNull _owner) exitWith {false};
|
||||
|
||||
(_owner getVariable [QEGVAR(dragging,draggedObject), objNull]) == _target
|
@ -33,7 +33,7 @@ if ([_medic, _item] call EFUNC(common,hasItem)) exitWith {
|
||||
|
||||
private _return = [false, objNull];
|
||||
|
||||
if (vehicle _medic != _medic && {vehicle _medic call EFUNC(medical,isMedicalVehicle)}) then {
|
||||
if (vehicle _medic != _medic && {vehicle _medic call EFUNC(medical_status,isMedicalVehicle)}) then {
|
||||
{
|
||||
if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {[_x, _item] call EFUNC(common,hasItem)}) exitWith {
|
||||
["ace_useItem", [_x, _item], _x] call CBA_fnc_targetEvent;
|
||||
|
@ -32,7 +32,7 @@ if (_syncValues) then {
|
||||
_unit setVariable [QGVAR(lastMomentValuesSynced), CBA_missionTime];
|
||||
};
|
||||
|
||||
private _bloodVolume = (_unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME]) + ([_unit, _deltaT, _syncValues] call FUNC(getBloodVolumeChange));
|
||||
private _bloodVolume = (_unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME]) + ([_unit, _deltaT, _syncValues] call EFUNC(medical_status,getBloodVolumeChange));
|
||||
_bloodVolume = 0 max _bloodVolume min DEFAULT_BLOOD_VOLUME;
|
||||
|
||||
// @todo: replace this and the rest of the setVariable with EFUNC(common,setApproximateVariablePublic)
|
||||
@ -98,7 +98,7 @@ private _heartRate = [_unit, _deltaT, _syncValues] call FUNC(updateHeartRate);
|
||||
private _bloodPressure = GET_BLOOD_PRESSURE(_unit);
|
||||
_unit setVariable [QGVAR(bloodPressure), _bloodPressure, _syncValues];
|
||||
|
||||
private _cardiacOutput = [_unit] call FUNC(getCardiacOutput);
|
||||
private _cardiacOutput = [_unit] call EFUNC(medical_status,getCardiacOutput);
|
||||
if (_bloodLoss > BLOOD_LOSS_KNOCK_OUT_THRESHOLD * _cardiacOutput) then {
|
||||
[QGVAR(CriticalVitals), _unit] call CBA_fnc_localEvent;
|
||||
};
|
||||
|
@ -44,7 +44,7 @@ if (!(_adjustment isEqualTo [])) then {
|
||||
_unit setVariable [QGVAR(heartRateAdjustments), _adjustment, _syncValue];
|
||||
};
|
||||
|
||||
private _heartRate = _unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE];
|
||||
private _heartRate = GET_HEART_RATE(_unit);
|
||||
|
||||
if (!(_unit getVariable [QGVAR(inCardiacArrest), false])) then {
|
||||
private _hrChange = 0;
|
||||
@ -75,7 +75,7 @@ if (!(_unit getVariable [QGVAR(inCardiacArrest), false])) then {
|
||||
_heartRate = (_heartRate + _deltaT * _hrChange) max 0;
|
||||
};
|
||||
|
||||
_unit setVariable [QGVAR(heartRate), _heartRate, _syncValue];
|
||||
SET_HEART_RATE(_unit,_heartRate,_syncValue);
|
||||
|
||||
_heartRate
|
||||
|
||||
|
@ -44,8 +44,8 @@ if (!(_adjustment isEqualTo [])) then {
|
||||
};
|
||||
|
||||
// Handle continuous pain reduction
|
||||
private _pain = _unit getVariable [QGVAR(pain), 0];
|
||||
_unit setVariable [QGVAR(pain), 0 max (_pain - _deltaT / PAIN_FADE_TIME), _syncValue];
|
||||
private _pain = GET_PAIN_TOTAL(_unit);
|
||||
_unit setVariable [QEGVAR(medical_status,pain), 0 max (_pain - _deltaT / PAIN_FADE_TIME), _syncValue];
|
||||
|
||||
// Handles simple medication
|
||||
if (!GVAR(advancedMedication)) then {
|
||||
|
Loading…
Reference in New Issue
Block a user