mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
merge
This commit is contained in:
commit
68228e9fef
@ -135,4 +135,5 @@ voiper
|
||||
VyMajoris(W-Cephei)<vycanismajoriscsa@gmail.com>
|
||||
Winter <simon@agius-muscat.net>
|
||||
xrufix
|
||||
Zakant <Zakant@gmx.de>
|
||||
zGuba
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Use this in INIT and RESPAWN eh scripts, because ACE_player isn't reset yet.
|
||||
*
|
||||
* Arguments:
|
||||
* NONE.
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* Player controlled unit <OBJECT>
|
||||
|
@ -26,8 +26,6 @@
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
if (_unit getVariable [QGVAR(inCardiacArrest), false]) exitWith { 0 };
|
||||
|
||||
private _bloodVolume = ((_unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME]) / DEFAULT_BLOOD_VOLUME) * 100;
|
||||
private _heartRate = _unit getVariable [QGVAR(heartRate), DEFAULT_HEART_RATE];
|
||||
private _cardiacOutput = ((_bloodVolume / MODIFIER_CARDIAC_OUTPUT) + ((_heartRate / DEFAULT_HEART_RATE) - 1)) / 60;
|
||||
|
@ -27,4 +27,3 @@ _unit setVariable [QGVAR(heartRate), 0, true];
|
||||
["ace_cardiacArrestEntered", [_unit]] call CBA_fnc_localEvent;
|
||||
|
||||
[_unit, true] call FUNC(setUnconsciousStatemachine);
|
||||
|
||||
|
@ -248,10 +248,11 @@ class GVAR(Actions) {
|
||||
requiredMedic = 0;
|
||||
treatmentTime = 15;
|
||||
items[] = {};
|
||||
condition = QUOTE(!(_target call EFUNC(common,isAwake)));
|
||||
condition = QUOTE(!(_target call EFUNC(common,isAwake)) && {!(_target getVariable [ARR_2('GVAR(receiveCPR)', false)])});
|
||||
callbackSuccess = QFUNC(treatmentCPR);
|
||||
callbackFailure = "";
|
||||
callbackProgress = QUOTE(!([(_this select 0) select 1] call EFUNC(common,isAwake)));
|
||||
callbackFailure = QFUNC(treatmentCPR_failure);
|
||||
callbackProgress = QFUNC(treatmentCPR_progress);
|
||||
callbackStart = QFUNC(treatmentCPR_start);
|
||||
animationPatient = "";
|
||||
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
|
||||
animationCaller = "AinvPknlMstpSlayW[wpn]Dnon_medic";
|
||||
|
@ -23,4 +23,11 @@ class ACE_Settings {
|
||||
typeName = "SCALAR";
|
||||
value = 0;
|
||||
};
|
||||
class EGVAR(medical,CPRcreatesPulse) {
|
||||
category = ECSTRING(medical,Category_Medical);
|
||||
displayName = CSTRING(CPRcreatesPulse);
|
||||
description = CSTRING(CPRcreatesPulse_Description);
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
};
|
||||
};
|
||||
|
@ -20,6 +20,9 @@ PREP(treatment_success);
|
||||
|
||||
PREP(treatmentBandage);
|
||||
PREP(treatmentBandageLocal);
|
||||
PREP(treatmentCPR_failure);
|
||||
PREP(treatmentCPR_progress);
|
||||
PREP(treatmentCPR_start);
|
||||
PREP(treatmentCPR);
|
||||
PREP(treatmentCPRLocal);
|
||||
PREP(treatmentFullHeal);
|
||||
@ -46,6 +49,7 @@ PREP(healTime);
|
||||
PREP(isBeingCarried);
|
||||
PREP(isBeingDragged);
|
||||
PREP(onMedicationUsage);
|
||||
PREP(calculateBlood);
|
||||
|
||||
// items
|
||||
PREP(checkItems);
|
||||
|
30
addons/medical_treatment/functions/fnc_calculateBlood.sqf
Normal file
30
addons/medical_treatment/functions/fnc_calculateBlood.sqf
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Author: Zakant
|
||||
* Calculate the blood lost and blood volume for a unit. Used from CPR to simulate a heart rate while in cardiac arrest.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params["_unit"];
|
||||
|
||||
// We will just simulate blood flow for now!
|
||||
private _lastTimeUpdated = _unit getVariable [QEGVAR(medical,lastTimeUpdated), CBA_missionTime];
|
||||
private _deltaT = CBA_missionTime - _lastTimeUpdated;
|
||||
|
||||
private _lastTimeValuesSynced = _unit getVariable [QEGVAR(medical,lastMomentValuesSynced), 0];
|
||||
private _syncValues = (CBA_missionTime - _lastTimeValuesSynced) >= (10 + floor(random(10)));
|
||||
|
||||
_unit setVariable [QEGVAR(medical,lastTimeUpdated), CBA_missionTime];
|
||||
if (_deltaT != 0) then {
|
||||
private _change = ([_unit, _deltaT, _syncValues] call EFUNC(medical,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];
|
||||
};
|
@ -179,6 +179,19 @@ if (isArray (_config >> "sounds")) then {
|
||||
];
|
||||
};
|
||||
|
||||
private _startCallback = getText (_config >> "callbackStart");
|
||||
if (isNil _startCallback) then {
|
||||
_startCallback = compile _startCallback;
|
||||
} else {
|
||||
_startCallback = missionNamespace getVariable _startCallback;
|
||||
};
|
||||
|
||||
if !(_startCallback isEqualType {}) then {
|
||||
_startCallback = {TRACE_1("startCallback was NOT code",_startCallback)};
|
||||
};
|
||||
|
||||
[_caller, _target, _bodyPart, _className, _items, _usersOfItems] call _startCallback;
|
||||
|
||||
// start treatment
|
||||
[
|
||||
_treatmentTime,
|
||||
|
@ -18,6 +18,10 @@
|
||||
|
||||
params ["_caller", "_target", "_selectionName", "_className", "_items"];
|
||||
|
||||
_target setVariable [QEGVAR(medical,heartRate), 0, true];
|
||||
_target setVariable [QGVAR(receiveCPR), false, true]; // CPR finished
|
||||
[_target] call FUNC(calculateBlood);
|
||||
|
||||
if (alive _target && {_target getVariable [QEGVAR(medical,inCardiacArrest), false]}) then {
|
||||
[_target, "activity_view", ELSTRING(medical,Activity_cpr), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Author: Zakant
|
||||
* Handles the failure of the CPR treatment.
|
||||
*
|
||||
* 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)) || {_target getVariable [QEGVAR(medical,inCardiacArrest), false]}) then {
|
||||
_target setVariable [QEGVAR(medical,heartRate), 0, true];
|
||||
};
|
||||
_target setVariable [QGVAR(receiveCPR), false, true];
|
||||
[_target] call FUNC(calculateBlood);
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Author: Zakant
|
||||
* Handles the progress of the CPR treatment.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Arguments <ARRAY>
|
||||
* 0: Caller <OBJECT>
|
||||
* 1: Target <OBJECT>
|
||||
* 1: Elapsed Time <NUMBER>
|
||||
* 2: Total Time <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* May Treatment continue <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_args", "_elapsedTime", "_totalTime"];
|
||||
_args params ["_caller", "_target"];
|
||||
|
||||
// If the patient awakes by mysterious force, no cpr is needed!
|
||||
if (_target call EFUNC(common,isAwake)) exitWith {false};
|
||||
if (!(_target getVariable [QEGVAR(medical,inCardiacArrest), false])) exitWith {false};
|
||||
|
||||
[_target] call FUNC(calculateBlood); // Calculate blood volume. If their is no pulse, nothing happens!
|
||||
|
||||
(alive _target) // CPR may only proceed if the patient is not dead
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Author: Zakant
|
||||
* Handles the start of the CPR treatment.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The medic <OBJECT>
|
||||
* 1: The patient <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_caller", "_target"];
|
||||
|
||||
_target setVariable [QGVAR(receiveCPR), true, true]; // Target receives CPR
|
||||
if (EGVAR(medical,CPRcreatesPulse) && {_target getVariable [QEGVAR(medical,heartRate), 80] == 0}) then {
|
||||
_target setVariable [QEGVAR(medical,heartRate), round (30 + random [-5, 0, 5]) , true]; // And we have a (random) pulse
|
||||
};
|
||||
|
||||
_target setVariable [QEGVAR(medical,lastTimeUpdated), CBA_missionTime, true];
|
@ -27,6 +27,14 @@
|
||||
<Italian>Abilita la creazione della barella dopo trattamento</Italian>
|
||||
<Japanese>治療を始めると、医療廃棄物の作成を有効化する</Japanese>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Medical_Treatment_CPRcreatesPulse">
|
||||
<English>CPR creates pulse</English>
|
||||
<German>HLW erzeugt einen Puls</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Medical_Treatment_CPRcreatesPulse_Description">
|
||||
<English>CPR will create a pulse for the patient while performing</English>
|
||||
<German>HLW erzeugt während der Behandlung beim Patienten einen Puls</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Medical_Treatment_litterSimulationDetail">
|
||||
<English>Litter Simulation Detail</English>
|
||||
<Polish>Detale zużytych medykamentów</Polish>
|
||||
|
Loading…
Reference in New Issue
Block a user