adds drawicon3d wrapper from Hizumi and status for vflag use
This commit is contained in:
@@ -31,7 +31,7 @@ class DOUBLES(PREFIX,client) {
|
||||
class bindVehicleActions {};
|
||||
class addGetNearMenPFH {};
|
||||
class addDraw3DPFH {};
|
||||
class addPFHCode {};
|
||||
class registerPFHCode {};
|
||||
class clearPFHCode {};
|
||||
};
|
||||
};
|
||||
@@ -40,15 +40,16 @@ class DOUBLES(PREFIX,common) {
|
||||
class functions {
|
||||
file = "framework\common\functions";
|
||||
class addCBASettings { preInit = 1; };
|
||||
class logMissionInfo {};
|
||||
class addPlayerInfoToArray {};
|
||||
class checkPlayerInventory {};
|
||||
class createOrUpdateDiaryRecord {};
|
||||
class draw3DIconStatus {};
|
||||
class getApprovedAssetsCfg {};
|
||||
class getBattalionCfg {};
|
||||
class getNameOfBase {};
|
||||
class getNearestBase {};
|
||||
class log {};
|
||||
class checkPlayerInventory {};
|
||||
class logMissionInfo {};
|
||||
class logSettingChanged {};
|
||||
class padString {};
|
||||
class recurseSubclasses {};
|
||||
|
||||
@@ -7,20 +7,19 @@ player addEventHandler["Respawn",
|
||||
params ["_unit", "_corpse"];
|
||||
private _killer = _corpse getVariable ["ace_medical_causeOfDeath", "#scripted"];
|
||||
if (_killer == "respawn_button") then {
|
||||
private _timeWentUnconscious = _unit getVariable [QGVARMAIN(lastTimeKnockedOut), -1];
|
||||
private _durationSpentUnconscious = diag_tickTime - _timeWentUnconscious;
|
||||
private _timeWentUnconscious = _corpse getVariable [QGVARMAIN(lastTimeKnockedOut), -1];
|
||||
private _durationSpentUnconscious = -1;
|
||||
if (_timeWentUnconscious > -1) then {
|
||||
_durationSpentUnconscious = diag_tickTime - _timeWentUnconscious;
|
||||
};
|
||||
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"RESPAWNED WHILE UNCONSCIOUS",
|
||||
[_unit, [[
|
||||
"durationSpentUnconscious",
|
||||
(if (_timeWentUnconscious > - 1) then {
|
||||
_durationSpentUnconscious
|
||||
} else {
|
||||
-1
|
||||
})
|
||||
]]] call EFUNC(common,addPlayerInfoToArray)
|
||||
[_unit, [
|
||||
["durationSpentUnconscious", _durationSpentUnconscious]
|
||||
]] call EFUNC(common,addPlayerInfoToArray)
|
||||
] remoteExec [QEFUNC(common,log), 2];
|
||||
// format["%1 was unconscious then clicked the respawn button", name _unit] remoteExec["systemChat", 0];
|
||||
};
|
||||
|
||||
54
framework/common/functions/fn_draw3DIconStatus.sqf
Normal file
54
framework/common/functions/fn_draw3DIconStatus.sqf
Normal 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
|
||||
|
||||
@@ -9,21 +9,19 @@ if (!hasInterface) exitWith {};
|
||||
player setDamage 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
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"CHAT COMMAND RESPAWN",
|
||||
[player, [[
|
||||
"durationSpentUnconscious",
|
||||
(if (_timeWentUnconscious > - 1) then {
|
||||
_durationSpentUnconscious
|
||||
} else {
|
||||
-1
|
||||
})
|
||||
]]] call EFUNC(common,addPlayerInfoToArray)
|
||||
[player, [
|
||||
["durationSpentUnconscious", _durationSpentUnconscious]
|
||||
]] call EFUNC(common,addPlayerInfoToArray)
|
||||
] remoteExec [QEFUNC(common,log), 2];
|
||||
|
||||
// systemChat to all remote machines
|
||||
|
||||
@@ -47,6 +47,7 @@ private _code = {
|
||||
true // outline
|
||||
// further params optional, omitted
|
||||
];
|
||||
|
||||
true;
|
||||
} count (
|
||||
(localNamespace getVariable [QEGVAR(client,nearMen), []]) select {
|
||||
@@ -59,4 +60,4 @@ private _code = {
|
||||
};
|
||||
|
||||
// add codeblock to common array
|
||||
[_code] call EFUNC(client,addPFHCode);
|
||||
[_code] call EFUNC(client,registerPFHCode);
|
||||
@@ -4,37 +4,21 @@
|
||||
|
||||
// adds codeblock to common array to be processed per frame
|
||||
private _code = {
|
||||
{
|
||||
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 {
|
||||
private _unitsToDraw = (localNamespace getVariable [QEGVAR(client,nearMen), []]) select {
|
||||
(_x getVariable [QGVAR(inFlagMenu), false]) && {
|
||||
// distance within X meters
|
||||
player distance _x <= 10 ||
|
||||
player distance _x <= 15 ||
|
||||
// check unit not in a vehicle
|
||||
isNull (objectParent _x)
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
[
|
||||
_unitsToDraw,
|
||||
"",
|
||||
"Setting vehicle flag...",
|
||||
[0.9, 0.9, 0.9, 1]
|
||||
] call EFUNC(common,draw3dIconStatus);
|
||||
};
|
||||
|
||||
// add codeblock to common array
|
||||
[_code] call EFUNC(client,addPFHCode);
|
||||
[_code] call EFUNC(client,registerPFHCode);
|
||||
Reference in New Issue
Block a user