mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
advanced medical JIP improvements
This commit is contained in:
parent
694ab7d51e
commit
f252b2c96f
@ -6,6 +6,7 @@ class CfgVehicles {
|
||||
class ArgumentsBaseUnits {
|
||||
};
|
||||
};
|
||||
class ACE_Module;
|
||||
// TODO localization for all the modules
|
||||
class ACE_moduleMedicalSettings: ACE_Module {
|
||||
scope = 2;
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitwith{};
|
||||
GVAR(enabledFor) = 1; // TODO remove this once we implement settings. Just here to get the vitals working.
|
||||
|
||||
GVAR(heartBeatSounds_Fast) = ["ACE_heartbeat_fast_1", "ACE_heartbeat_fast_2", "ACE_heartbeat_fast_3"];
|
||||
@ -219,24 +218,14 @@ if (isNil QGVAR(level)) then {
|
||||
|
||||
// broadcast injuries to JIP clients in a MP session
|
||||
if (isMultiplayer) then {
|
||||
[QGVAR(onPlayerConnected), "onPlayerConnected", {
|
||||
if (GVAR(level) >= 2) then {
|
||||
if (isNil QGVAR(InjuredCollection)) then {
|
||||
GVAR(InjuredCollection) = [];
|
||||
};
|
||||
|
||||
{
|
||||
_unit = _x;
|
||||
_openWounds = _unit getvariable [QGVAR(openWounds), []];
|
||||
{
|
||||
["medical_propagateWound", [_id], [_unit, _x]] call EFUNC(common,targetEvent);
|
||||
}foreach _openWounds;
|
||||
}foreach GVAR(InjuredCollection);
|
||||
};
|
||||
}, []] call BIS_fnc_addStackedEventHandler;
|
||||
// We are only pulling the wounds for the units in the player group. Anything else will come when the unit interacts with them.
|
||||
if (hasInterface) then {
|
||||
{
|
||||
[_x, player] call FUNC(requestWoundSync);
|
||||
}foreach units group player;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
[
|
||||
{(((_this select 0) getvariable [QGVAR(bloodVolume), 0]) < 65)},
|
||||
{(((_this select 0) getvariable [QGVAR(pain), 0]) > 0.9)},
|
||||
|
@ -89,6 +89,7 @@ PREP(moduleAssignMedicRoles);
|
||||
PREP(moduleAssignMedicalVehicle);
|
||||
PREP(moduleAssignMedicalFacility);
|
||||
PREP(moduleTreatmentConfiguration);
|
||||
PREP(requestWoundSync);
|
||||
|
||||
GVAR(injuredUnitCollection) = [];
|
||||
call FUNC(parseConfigForInjuries);
|
||||
|
@ -18,22 +18,21 @@ _unit = _this select 0;
|
||||
_force = if (count _this > 1) then {_this select 1} else {false};
|
||||
|
||||
if ([_unit] call FUNC(hasMedicalEnabled) || _force) then {
|
||||
if ((_unit getvariable[QGVAR(addedToUnitLoop),false] || !alive _unit) && !_force) exitwith{};
|
||||
|
||||
if !(local _unit) exitwith {
|
||||
[[_unit, _force], QUOTE(DFUNC(addToInjuredCollection)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
};
|
||||
|
||||
if ((_unit getvariable[QGVAR(addedToUnitLoop),false] || !alive _unit) && !_force) exitwith{};
|
||||
_unit setvariable [QGVAR(addedToUnitLoop), true, true];
|
||||
|
||||
if (isNil QGVAR(InjuredCollection)) then {
|
||||
GVAR(InjuredCollection) = [];
|
||||
};
|
||||
GVAR(InjuredCollection) pushback _unit;
|
||||
|
||||
diag_log format["[MEDICAL] Added a unit to loop: %1", _unit];
|
||||
[{
|
||||
private "_unit";
|
||||
_unit = (_this select 0) select 0;
|
||||
if (!alive _unit || !local _unit) then {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
diag_log format["[MEDICAL] Removed a unit from loop: %1", _unit];
|
||||
if (!local _unit) then {
|
||||
if (GVAR(level) >= 2) then {
|
||||
_unit setvariable [QGVAR(heartRate), _unit getvariable [QGVAR(heartRate), 0], true];
|
||||
@ -41,7 +40,6 @@ if ([_unit] call FUNC(hasMedicalEnabled) || _force) then {
|
||||
};
|
||||
_unit setvariable [QGVAR(bloodVolume), _unit getvariable [QGVAR(bloodVolume), 0], true];
|
||||
};
|
||||
GVAR(InjuredCollection) = GVAR(InjuredCollection) - [_unit];
|
||||
} else {
|
||||
[_unit] call FUNC(handleUnitVitals);
|
||||
|
||||
|
@ -21,6 +21,8 @@ GVAR(currentSelectedSelectionN) = if (count _this > 2) then {_this select 2} els
|
||||
|
||||
GVAR(displayPatientInformationTarget) = if (_show) then {_target} else {ObjNull};
|
||||
|
||||
[_target, ACE_player] call FUNC(requestWoundSync);
|
||||
|
||||
if (_show) then {
|
||||
("ACE_MedicalRscDisplayInformation" call BIS_fnc_rscLayer) cutRsc [QGVAR(DisplayInformation),"PLAIN"];
|
||||
|
||||
|
@ -22,4 +22,9 @@ if (GVAR(level) >= 2) then {
|
||||
_unit setvariable [QGVAR(heartRate), 0];
|
||||
_unit setvariable [QGVAR(bloodPressure), [0, 0]];
|
||||
_unit setvariable [QGVAR(airwayStatus), 0];
|
||||
|
||||
_openWounds = _unit getvariable [QGVAR(openWounds), []];
|
||||
{
|
||||
["medical_propagateWound", [_unit, _x]] call EFUNC(common,globalEvent);
|
||||
}foreach _openWounds;
|
||||
};
|
||||
|
@ -19,9 +19,9 @@ _unit = _this select 0;
|
||||
_lastId = _this select 1;
|
||||
_originOfrequest = _this select 2;
|
||||
|
||||
_openWounds = _unit getvariable [QGVAR(openWounds), []];
|
||||
if (count _openWounds > _lastId) then {
|
||||
{
|
||||
["medical_propagateWound", [_originOfrequest], [_unit, _x]] call EFUNC(common,targetEvent);
|
||||
}foreach _openWounds;
|
||||
if (local _unit) then {
|
||||
_openWounds = _unit getvariable [QGVAR(openWounds), []];
|
||||
{
|
||||
["medical_propagateWound", [_originOfrequest], [_unit, _x]] call EFUNC(common,targetEvent);
|
||||
}foreach _openWounds;
|
||||
};
|
||||
|
24
addons/medical/functions/fnc_requestWoundSync.sqf
Normal file
24
addons/medical/functions/fnc_requestWoundSync.sqf
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Ask for the latest wound information.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The target <OBJECT>
|
||||
* 1: object belonging to the caller <OBJECT>
|
||||
*
|
||||
* ReturnValue:
|
||||
* <NIL>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private [ "_target", "_caller", "_openWounds","_lastId"];
|
||||
_target = _this select 0;
|
||||
_caller = _this select 1;
|
||||
|
||||
if (local _target || GVAR(level) < 2) exitwith {}; // if the target is local, we already got the most update to date information
|
||||
if (_target getvariable [QGVAR(isWoundSynced), false]) exitwith {};
|
||||
_target setvariable [QGVAR(isWoundSynced), true];
|
||||
["medical_woundUpdateRequest", [_target], [_target, _lastId, _caller]] call EFUNC(common,targetEvent);
|
Loading…
Reference in New Issue
Block a user