rework PFH to client module, triageIcons and vehicleFlags point there
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
// subroutine to gather nearest 50 units every 5 seconds and store in GVAR(drawTargets)
|
||||
// cleanup
|
||||
if (!isNil QGVAR(getEntitiesPFH)) then {
|
||||
[GVAR(getEntitiesPFH)] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
// add pfh
|
||||
GVAR(getEntitiesPFH) = [{
|
||||
GVAR(drawTargets) = (
|
||||
(allUnits + allDeadMen) select {
|
||||
_x isKindOf "CAManBase" &&
|
||||
player distance _x < 50 &&
|
||||
!isNull _x &&
|
||||
player isNotEqualTo _x
|
||||
}
|
||||
);
|
||||
}, 10] call CBA_fnc_addPerFrameHandler;
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
|
||||
milsim_fnc_addMedicalOverlayPFH
|
||||
milsim_triageIcons_fnc_draw3D
|
||||
|
||||
Author: IndigoFox
|
||||
|
||||
@@ -14,30 +14,20 @@ Description:
|
||||
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
// Per-frame handler to draw icons
|
||||
// cleanup
|
||||
if (!isNil QGVAR(drawIconsPfh)) then {
|
||||
[GVAR(drawIconsPfh)] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
// add pfh
|
||||
GVAR(drawIconsPfh) = [{
|
||||
|
||||
// adds codeblock to common array to be processed per frame
|
||||
private _code = {
|
||||
// if disabled, skip processing
|
||||
if (!GVAR(setting_enabled)) exitWith {false};
|
||||
// if no targets, skip processing
|
||||
if (count GVAR(drawTargets) == 0) exitWith {false};
|
||||
|
||||
// if the player doesn't have medical perms, skip processing
|
||||
if !([player] call ace_medical_treatment_fnc_isMedic) exitWith {false};
|
||||
|
||||
{
|
||||
private _unit = _x;
|
||||
// distance within X meters
|
||||
if (player distance _unit > GVAR(setting_drawRange)) then {continue};
|
||||
// check unit not null, not conscious, and not in a vehicle
|
||||
if (
|
||||
!(_unit getVariable ["ACE_isUnconscious", false]) ||
|
||||
!isNull (objectParent _unit)
|
||||
) then {continue};
|
||||
|
||||
|
||||
// color based on triage level
|
||||
private _triageLevel = _unit getVariable ["ace_medical_triageLevel", 4];
|
||||
if (_triageLevel == -1) then {continue};
|
||||
@@ -57,6 +47,16 @@ GVAR(drawIconsPfh) = [{
|
||||
true // outline
|
||||
// further params optional, omitted
|
||||
];
|
||||
} forEach GVAR(drawTargets);
|
||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
true;
|
||||
} count (
|
||||
(localNamespace getVariable [QEGVAR(client,nearMen), []]) select {
|
||||
// is unconscious and is NOT in vehicle and is within draw range
|
||||
(_x getVariable ["ACE_isUnconscious", false]) &&
|
||||
isNull (objectParent _x) &&
|
||||
player distance _x <= GVAR(setting_drawRange)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
// add codeblock to common array
|
||||
[_code] call EFUNC(client,addPFHCode);
|
||||
@@ -1,7 +1,8 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
// List of units to draw icons for
|
||||
GVAR(drawTargets) = [];
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
call FUNC(draw3D);
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
|
||||
Reference in New Issue
Block a user