adds drawicon3d wrapper from Hizumi and status for vflag use

This commit is contained in:
2024-02-15 15:13:04 -08:00
parent 4fb0ea9a15
commit d2758b7570
7 changed files with 90 additions and 53 deletions

View File

@@ -31,7 +31,7 @@ class DOUBLES(PREFIX,client) {
class bindVehicleActions {}; class bindVehicleActions {};
class addGetNearMenPFH {}; class addGetNearMenPFH {};
class addDraw3DPFH {}; class addDraw3DPFH {};
class addPFHCode {}; class registerPFHCode {};
class clearPFHCode {}; class clearPFHCode {};
}; };
}; };
@@ -40,15 +40,16 @@ class DOUBLES(PREFIX,common) {
class functions { class functions {
file = "framework\common\functions"; file = "framework\common\functions";
class addCBASettings { preInit = 1; }; class addCBASettings { preInit = 1; };
class logMissionInfo {};
class addPlayerInfoToArray {}; class addPlayerInfoToArray {};
class checkPlayerInventory {};
class createOrUpdateDiaryRecord {}; class createOrUpdateDiaryRecord {};
class draw3DIconStatus {};
class getApprovedAssetsCfg {}; class getApprovedAssetsCfg {};
class getBattalionCfg {}; class getBattalionCfg {};
class getNameOfBase {}; class getNameOfBase {};
class getNearestBase {}; class getNearestBase {};
class log {}; class log {};
class checkPlayerInventory {}; class logMissionInfo {};
class logSettingChanged {}; class logSettingChanged {};
class padString {}; class padString {};
class recurseSubclasses {}; class recurseSubclasses {};

View File

@@ -7,20 +7,19 @@ player addEventHandler["Respawn",
params ["_unit", "_corpse"]; params ["_unit", "_corpse"];
private _killer = _corpse getVariable ["ace_medical_causeOfDeath", "#scripted"]; private _killer = _corpse getVariable ["ace_medical_causeOfDeath", "#scripted"];
if (_killer == "respawn_button") then { if (_killer == "respawn_button") then {
private _timeWentUnconscious = _unit getVariable [QGVARMAIN(lastTimeKnockedOut), -1]; private _timeWentUnconscious = _corpse getVariable [QGVARMAIN(lastTimeKnockedOut), -1];
private _durationSpentUnconscious = diag_tickTime - _timeWentUnconscious; private _durationSpentUnconscious = -1;
if (_timeWentUnconscious > -1) then {
_durationSpentUnconscious = diag_tickTime - _timeWentUnconscious;
};
[ [
LEVEL_INFO, LEVEL_INFO,
QUOTE(COMPONENT), QUOTE(COMPONENT),
"RESPAWNED WHILE UNCONSCIOUS", "RESPAWNED WHILE UNCONSCIOUS",
[_unit, [[ [_unit, [
"durationSpentUnconscious", ["durationSpentUnconscious", _durationSpentUnconscious]
(if (_timeWentUnconscious > - 1) then { ]] call EFUNC(common,addPlayerInfoToArray)
_durationSpentUnconscious
} else {
-1
})
]]] call EFUNC(common,addPlayerInfoToArray)
] remoteExec [QEFUNC(common,log), 2]; ] remoteExec [QEFUNC(common,log), 2];
// format["%1 was unconscious then clicked the respawn button", name _unit] remoteExec["systemChat", 0]; // format["%1 was unconscious then clicked the respawn button", name _unit] remoteExec["systemChat", 0];
}; };

View File

@@ -0,0 +1,54 @@
#include "..\script_component.hpp"
if (!hasInterface) exitWith {};
params [
["_drawTargets", [], [[]]],
["_icon", "", [""]],
["_text", "", [""]],
["_color", [], [[]]]
];
if (count _drawTargets isEqualTo 0) exitWith {};
_cameraPos = positionCameraToWorld [0,0,0];
_cameraPosASL = AGLToASL _cameraPos;
{
_target = _x;
_visible = [objNull, "VIEW"] checkVisibility [_cameraPosASL, eyePos _target];
if ( _visible isEqualTo 0 ) exitWith {};
_objectPos = (_target modelToWorldVisual (_target selectionPosition "pilot"));
_distance = (visiblePosition _target) vectorDiff _cameraPos;
_scale = 0;
_heightOffset = 0;
_heightScaling = 0.012;
if ( _icon isNotEqualTo "") then {
_heightOffset = 0.065;
_scale = 1;
_heightScaling = 0.075;
};
_drawPos = _objectPos vectorAdd [0, 0, (0.18 + _heightOffset) + (vectorMagnitude _distance * _heightScaling)];
drawIcon3D [
_icon,
_color,
_drawPos,
_scale,
_scale,
0,
_text,
2,
0.025
];
true;
} count _drawTargets;
nil

View File

@@ -9,21 +9,19 @@ if (!hasInterface) exitWith {};
player setDamage 1; player setDamage 1;
private _timeWentUnconscious = player getVariable [QGVARMAIN(lastTimeKnockedOut), -1]; private _timeWentUnconscious = player getVariable [QGVARMAIN(lastTimeKnockedOut), -1];
private _durationSpentUnconscious = diag_tickTime - _timeWentUnconscious; private _durationSpentUnconscious = -1;
if (_timeWentUnconscious > - 1) then {
_durationSpentUnconscious = diag_tickTime - _timeWentUnconscious;
};
// log to server RPT // log to server RPT
[ [
LEVEL_INFO, LEVEL_INFO,
QUOTE(COMPONENT), QUOTE(COMPONENT),
"CHAT COMMAND RESPAWN", "CHAT COMMAND RESPAWN",
[player, [[ [player, [
"durationSpentUnconscious", ["durationSpentUnconscious", _durationSpentUnconscious]
(if (_timeWentUnconscious > - 1) then { ]] call EFUNC(common,addPlayerInfoToArray)
_durationSpentUnconscious
} else {
-1
})
]]] call EFUNC(common,addPlayerInfoToArray)
] remoteExec [QEFUNC(common,log), 2]; ] remoteExec [QEFUNC(common,log), 2];
// systemChat to all remote machines // systemChat to all remote machines

View File

@@ -47,6 +47,7 @@ private _code = {
true // outline true // outline
// further params optional, omitted // further params optional, omitted
]; ];
true; true;
} count ( } count (
(localNamespace getVariable [QEGVAR(client,nearMen), []]) select { (localNamespace getVariable [QEGVAR(client,nearMen), []]) select {
@@ -59,4 +60,4 @@ private _code = {
}; };
// add codeblock to common array // add codeblock to common array
[_code] call EFUNC(client,addPFHCode); [_code] call EFUNC(client,registerPFHCode);

View File

@@ -4,37 +4,21 @@
// adds codeblock to common array to be processed per frame // adds codeblock to common array to be processed per frame
private _code = { private _code = {
{ private _unitsToDraw = (localNamespace getVariable [QEGVAR(client,nearMen), []]) select {
private _unit = _x;
// color based on triage level
private _color = [0.9, 0.9, 0.9, 1]; // default color
// draw position, slightly above the prone unit
private _drawPos = (visiblePosition _unit) vectorAdd [0, 0, 0.5];
// draw icon
drawIcon3D [
"", // icon texture
_color, // color
_drawPos, // position AGL
1, // width
1, // height
0, // angle
"Setting vehicle flag...", // text
true // outline
// further params optional, omitted
];
true;
} count (
(localNamespace getVariable [QEGVAR(client,nearMen), []]) select {
(_x getVariable [QGVAR(inFlagMenu), false]) && { (_x getVariable [QGVAR(inFlagMenu), false]) && {
// distance within X meters // distance within X meters
player distance _x <= 10 || player distance _x <= 15 ||
// check unit not in a vehicle // check unit not in a vehicle
isNull (objectParent _x) isNull (objectParent _x)
} }
} };
); [
_unitsToDraw,
"",
"Setting vehicle flag...",
[0.9, 0.9, 0.9, 1]
] call EFUNC(common,draw3dIconStatus);
}; };
// add codeblock to common array // add codeblock to common array
[_code] call EFUNC(client,addPFHCode); [_code] call EFUNC(client,registerPFHCode);