Compare commits
3 Commits
1bdbdd1273
...
293a050027
| Author | SHA1 | Date | |
|---|---|---|---|
|
293a050027
|
|||
|
d2758b7570
|
|||
|
4fb0ea9a15
|
@@ -29,6 +29,10 @@ class DOUBLES(PREFIX,client) {
|
||||
class bindEventHandlers {};
|
||||
class bindUnconsciousListener {};
|
||||
class bindVehicleActions {};
|
||||
class addGetNearMenPFH {};
|
||||
class addDraw3DPFH {};
|
||||
class registerPFHCode {};
|
||||
class clearPFHCode {};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -36,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 {};
|
||||
@@ -156,8 +161,7 @@ class DOUBLES(PREFIX,triageIcons) {
|
||||
file = "framework\triageIcons\functions";
|
||||
class addCBASettings {preInit=1;};
|
||||
class initClient {};
|
||||
class addDrawIconsPFH {};
|
||||
class addGetEntitiesPFH {};
|
||||
class draw3D {};
|
||||
class updateColors {};
|
||||
};
|
||||
};
|
||||
@@ -166,6 +170,8 @@ class DOUBLES(PREFIX,vehicleFlags) {
|
||||
class functions {
|
||||
file = "framework\vehicleFlags\functions";
|
||||
class initClient {};
|
||||
class addFlagActions {};
|
||||
class draw3D {};
|
||||
class getActionsFlagCategories {};
|
||||
class getVehicleFlagsCfg {};
|
||||
class isClassExcluded {};
|
||||
|
||||
10
framework/client/functions/fn_addDraw3DPFH.sqf
Normal file
10
framework/client/functions/fn_addDraw3DPFH.sqf
Normal file
@@ -0,0 +1,10 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
|
||||
if (!isNil QGVAR(draw3DPFH)) then {
|
||||
[GVAR(draw3DPFH)] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
// add pfh that processes queued code
|
||||
GVAR(draw3DPFH) = [{
|
||||
{call _x; true;} count (localNamespace getVariable [QGVAR(pfhCode), []]);
|
||||
}, 0] call CBA_fnc_addPerFrameHandler;
|
||||
17
framework/client/functions/fn_addGetNearMenPFH.sqf
Normal file
17
framework/client/functions/fn_addGetNearMenPFH.sqf
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
// subroutine to gather nearest 50 units every 5 seconds and store in GVAR(nearMen)
|
||||
// cleanup
|
||||
if (!isNil QGVAR(getNearMenPFH)) then {
|
||||
[GVAR(getNearMenPFH)] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
// add pfh
|
||||
GVAR(getNearMenPFH) = [{
|
||||
localNamespace setVariable [
|
||||
QGVAR(nearMen),
|
||||
(nearestObjects [player,["Man"],50,false]) select {
|
||||
!isNull _x &&
|
||||
player isNotEqualTo _x
|
||||
}
|
||||
];
|
||||
}, 1] call CBA_fnc_addPerFrameHandler;
|
||||
@@ -23,11 +23,27 @@ if (!hasInterface) exitWith {};
|
||||
];
|
||||
private _realPos = nil;
|
||||
// if pos was provided, process
|
||||
if (count _pos > 0) then {
|
||||
if (typeName _pos == "STRING") then {
|
||||
_realPos = [_pos, true] call ACE_common_fnc_getMapPosFromGrid;
|
||||
_realPos set [2, getTerrainHeightASL _realPos];
|
||||
} else {_realPos = _pos;};
|
||||
if (count _pos >= 2) then {
|
||||
switch (typeName _pos) do {
|
||||
case "ARRAY": {
|
||||
// pos is provided as an array
|
||||
_realPos = _pos select [0, 2];
|
||||
_realPos set [2, getTerrainHeightASL _realPos];
|
||||
};
|
||||
case "STRING": {
|
||||
// pos is provided as a string
|
||||
_realPos = [_pos, true] call ACE_common_fnc_getMapPosFromGrid;
|
||||
_realPos set [2, getTerrainHeightASL _realPos];
|
||||
};
|
||||
default {
|
||||
[
|
||||
LEVEL_WARNING,
|
||||
QUOTE(COMPONENT),
|
||||
format["Invalid position for custom microDAGR waypoint: %1", _wpName],
|
||||
[["name", _wpName], ["pos", _pos], ["object", _object]]] call EFUNC(common,log);
|
||||
continue;
|
||||
};
|
||||
};
|
||||
};
|
||||
// if object was provided, process and override any pos
|
||||
if (count _object > 0) then {
|
||||
@@ -53,7 +69,8 @@ if (!hasInterface) exitWith {};
|
||||
};
|
||||
|
||||
[_wpName, _realPos] call ace_microdagr_fnc_deviceAddWaypoint;
|
||||
} forEach _customWaypoints;
|
||||
true;
|
||||
} count _customWaypoints;
|
||||
}] call CBA_fnc_waitUntilAndExecute;
|
||||
|
||||
nil;
|
||||
@@ -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];
|
||||
};
|
||||
|
||||
5
framework/client/functions/fn_clearPFHCode.sqf
Normal file
5
framework/client/functions/fn_clearPFHCode.sqf
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
localNamespace setVariable [QGVAR(pfhCode), []];
|
||||
|
||||
count [];
|
||||
@@ -8,6 +8,11 @@ call FUNC(addZenModules);
|
||||
call FUNC(bindEventHandlers);
|
||||
call FUNC(bindVehicleActions);
|
||||
|
||||
localNamespace setVariable [QGVAR(nearMen), []];
|
||||
call FUNC(addGetNearMenPFH);
|
||||
localNamespace setVariable [QGVAR(pfhCode), []];
|
||||
call FUNC(addDraw3DPFH);
|
||||
|
||||
// add listener that tracks when the player goes unconscious and saves a variable with time
|
||||
call FUNC(bindUnconsciousListener);
|
||||
|
||||
|
||||
9
framework/client/functions/fn_registerPFHCode.sqf
Normal file
9
framework/client/functions/fn_registerPFHCode.sqf
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [["_code", {}, [{}]]];
|
||||
|
||||
private _pfhCode = localNamespace getVariable [QGVAR(pfhCode), []];
|
||||
_pfhCode pushBack _code;
|
||||
localNamespace setVariable [QGVAR(pfhCode), _pfhCode];
|
||||
|
||||
count _pfhCode;
|
||||
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
|
||||
|
||||
@@ -24,10 +24,10 @@ if (_logLevel < DEBUG_MODE) exitWith {};
|
||||
private _hash = createHashMapFromArray _data;
|
||||
|
||||
// Replace square brackets with round brackets to avoid parsing issues.
|
||||
_message regexReplace ['(\[)', "("];
|
||||
_message regexReplace ['(\])', ")"];
|
||||
[_message, "]", ")"] call CBA_fnc_replace;
|
||||
[_message, "[", "("] call CBA_fnc_replace;
|
||||
|
||||
private _json = [_hash] call CBA_fnc_encodeJSON;
|
||||
_log = format ["[%1] [%2] [%3] [%4] :: %5", QUOTE(PREFIX), _component, _fnc_scriptNameParent, _message, _json];
|
||||
private _log = format ["[%1] [%2] [%3] [%4] :: %5", QUOTE(PREFIX), _component, _fnc_scriptNameParent, _message, _json];
|
||||
|
||||
diag_log text _log;
|
||||
@@ -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
|
||||
|
||||
@@ -2,13 +2,6 @@
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
["milsim_logText", {
|
||||
params [["_strArray", [""], [[]]]];
|
||||
{
|
||||
diag_log text _x;
|
||||
} forEach _strArray;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
// make sure the server has finished init
|
||||
waitUntil {!isNil QGVARMAIN(complete)};
|
||||
|
||||
@@ -18,8 +11,6 @@ waitUntil {!isNil QGVARMAIN(complete)};
|
||||
call FUNC(addAARChatHandler);
|
||||
call FUNC(addRespawnChatHandler);
|
||||
call FUNC(setDefaults);
|
||||
call FUNC(checkMissionSettings);
|
||||
|
||||
|
||||
// Initialize a holder for managing local diary records
|
||||
// store records in format:
|
||||
|
||||
@@ -9,16 +9,6 @@ publicVariable QGVARMAIN(baseObjects);
|
||||
// Initializes the Dynamic Groups framework and groups
|
||||
["Initialize", [true]] call BIS_fnc_dynamicGroups;
|
||||
|
||||
if (isDedicated) then {
|
||||
["milsim_logText", {
|
||||
params [["_strArray", [""], [[]]]];
|
||||
{
|
||||
diag_log text _x;
|
||||
} forEach _strArray;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
};
|
||||
|
||||
|
||||
// initialize other modules
|
||||
call EFUNC(common,logMissionInfo);
|
||||
call EFUNC(fbcb2_assets,initServer);
|
||||
|
||||
@@ -10,6 +10,9 @@ private _mapCopyAction =
|
||||
"\a3\ui_f\data\igui\cfg\actions\talk_ca.paa",
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
if (!isPlayer _target) exitWith {
|
||||
format["%1 is not a player", name _target] call CBA_fnc_notify;
|
||||
};
|
||||
format["Copying map markers from %1", name _target] call CBA_fnc_notify;
|
||||
[QGVAR(mapCopyRequest), _this, _target] call CBA_fnc_targetEvent;
|
||||
},
|
||||
|
||||
@@ -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,17 @@ 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,registerPFHCode);
|
||||
@@ -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,
|
||||
|
||||
103
framework/vehicleFlags/functions/fn_addFlagActions.sqf
Normal file
103
framework/vehicleFlags/functions/fn_addFlagActions.sqf
Normal file
@@ -0,0 +1,103 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
private _vehicleFlagsCfg = call FUNC(getVehicleFlagsCfg);
|
||||
|
||||
if (!isClass _vehicleFlagsCfg) exitWith {
|
||||
["WARNING: Vehicle Flags: Vehicle Flags config not found. Vehicle Flags will not be available."] call BIS_fnc_error;
|
||||
};
|
||||
|
||||
private _baseClassesToApplyActionsFor =
|
||||
(_vehicleFlagsCfg >> "baseClassesToApplyActionsFor") call BIS_fnc_getCfgDataArray;
|
||||
private _flagCategoryCfgs = (_vehicleFlagsCfg >> "FlagCategories") call BIS_fnc_returnChildren;
|
||||
|
||||
{ // forEach _baseClassesToApplyActionsFor
|
||||
private _parentClass = _x;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// create the root action
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
private _rootActionID = QGVAR(SetVehicleFlagAction);
|
||||
private _flagRootAction = [
|
||||
_rootActionID, // id
|
||||
"Set Vehicle Flag", // displayed title
|
||||
"\A3\ui_f\data\map\markers\flags\nato_ca.paa", // flag icon
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
// set broadcasted variable of self to indicate we're looking at flags
|
||||
_player setVariable [QGVAR(inFlagMenu), true, true];
|
||||
[{_this setVariable [QGVAR(inFlagMenu), false, true];}, _player, 3] call CBA_fnc_waitAndExecute;
|
||||
true
|
||||
}, // statement
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
// _params params ["_parentActionID", "_flagCategories"];
|
||||
|
||||
// check if vehicle is excluded
|
||||
private _excluded = [typeOf _target] call FUNC(isClassExcluded);
|
||||
if (_excluded || !alive _target) exitWith {false};
|
||||
|
||||
true;
|
||||
}, // condition
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// create the flag category actions (with nested flag actions)
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
params ["_target", "_player", "_params"];
|
||||
_params params ["_rootActionID"];
|
||||
|
||||
private _vehicleFlagsCfg = call FUNC(getVehicleFlagsCfg);
|
||||
if (isNull _vehicleFlagsCfg) exitWith {[]};
|
||||
private _flagCategoryCfgs = (_vehicleFlagsCfg >> "FlagCategories") call BIS_fnc_returnChildren;
|
||||
|
||||
// return category child actions with individual flag actions nested as children
|
||||
[_rootActionID, _flagCategoryCfgs] call FUNC(getActionsFlagCategories);
|
||||
|
||||
}, // child code
|
||||
[_rootActionID], // params
|
||||
nil, // position
|
||||
4, // distance
|
||||
[false, false, false, true, false], // other params - run on hover is true
|
||||
nil // modifier function code
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// add root action to add flags
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
[
|
||||
_parentClass, // parent classname
|
||||
0, // action 0 or self-action 1
|
||||
["ACE_MainActions"], // parent
|
||||
_flagRootAction, // action
|
||||
true // apply to child classes
|
||||
] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// add action to remove flag under the root action
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// create action
|
||||
private _removeFlagAction = [
|
||||
_rootActionID + "_removeflag", // id
|
||||
"Remove Flag", // displayed title
|
||||
"\A3\ui_f\data\map\markers\flags\nato_ca.paa", // flag icon
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
_target forceFlagTexture "";
|
||||
}, // statement
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
alive _target && getForcedFlagTexture _target != "";
|
||||
}, // condition
|
||||
nil // child code
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
// add the action to the vehicle
|
||||
// in this class event handler, this#0 will be the vehicle
|
||||
[
|
||||
_parentClass, // parent classname
|
||||
0, // action 0 or self-action 1
|
||||
["ACE_MainActions", _rootActionID], // parent
|
||||
_removeFlagAction, // action
|
||||
true // apply to child classes
|
||||
] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
} forEach _baseClassesToApplyActionsFor;
|
||||
24
framework/vehicleFlags/functions/fn_draw3D.sqf
Normal file
24
framework/vehicleFlags/functions/fn_draw3D.sqf
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
// we'll use this to display status if nearby players are in the flag menu
|
||||
|
||||
// adds codeblock to common array to be processed per frame
|
||||
private _code = {
|
||||
private _unitsToDraw = (localNamespace getVariable [QEGVAR(client,nearMen), []]) select {
|
||||
(_x getVariable [QGVAR(inFlagMenu), false]) && {
|
||||
// distance within X meters
|
||||
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,registerPFHCode);
|
||||
@@ -2,101 +2,8 @@
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
private _vehicleFlagsCfg = call FUNC(getVehicleFlagsCfg);
|
||||
|
||||
if (!isClass _vehicleFlagsCfg) exitWith {
|
||||
["WARNING: Vehicle Flags: Vehicle Flags config not found. Vehicle Flags will not be available."] call BIS_fnc_error;
|
||||
};
|
||||
|
||||
private _baseClassesToApplyActionsFor =
|
||||
(_vehicleFlagsCfg >> "baseClassesToApplyActionsFor") call BIS_fnc_getCfgDataArray;
|
||||
private _flagCategoryCfgs = (_vehicleFlagsCfg >> "FlagCategories") call BIS_fnc_returnChildren;
|
||||
|
||||
{ // forEach _baseClassesToApplyActionsFor
|
||||
private _parentClass = _x;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// create the root action
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
private _rootActionID = QGVAR(SetVehicleFlagAction);
|
||||
private _flagRootAction = [
|
||||
_rootActionID, // id
|
||||
"Set Vehicle Flag", // displayed title
|
||||
"\A3\ui_f\data\map\markers\flags\nato_ca.paa", // flag icon
|
||||
{true}, // statement
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
// _params params ["_parentActionID", "_flagCategories"];
|
||||
|
||||
// check if vehicle is excluded
|
||||
private _excluded = [typeOf _target] call FUNC(isClassExcluded);
|
||||
if (_excluded || !alive _target) exitWith {false};
|
||||
|
||||
true;
|
||||
}, // condition
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// create the flag category actions (with nested flag actions)
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
params ["_target", "_player", "_params"];
|
||||
_params params ["_rootActionID"];
|
||||
|
||||
private _vehicleFlagsCfg = call FUNC(getVehicleFlagsCfg);
|
||||
if (isNull _vehicleFlagsCfg) exitWith {[]};
|
||||
private _flagCategoryCfgs = (_vehicleFlagsCfg >> "FlagCategories") call BIS_fnc_returnChildren;
|
||||
|
||||
// return category child actions with individual flag actions nested as children
|
||||
[_rootActionID, _flagCategoryCfgs] call FUNC(getActionsFlagCategories);
|
||||
|
||||
}, // child code
|
||||
[_rootActionID], // params
|
||||
nil, // position
|
||||
4, // distance
|
||||
[false, false, false, false, false], // other params
|
||||
nil // modifier function code
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// add root action to add flags
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
[
|
||||
_parentClass, // parent classname
|
||||
0, // action 0 or self-action 1
|
||||
["ACE_MainActions"], // parent
|
||||
_flagRootAction, // action
|
||||
true // apply to child classes
|
||||
] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// add action to remove flag under the root action
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// create action
|
||||
private _removeFlagAction = [
|
||||
_rootActionID + "_removeflag", // id
|
||||
"Remove Flag", // displayed title
|
||||
"\A3\ui_f\data\map\markers\flags\nato_ca.paa", // flag icon
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
_target forceFlagTexture "";
|
||||
}, // statement
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
alive _target && getForcedFlagTexture _target != "";
|
||||
}, // condition
|
||||
nil // child code
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
// add the action to the vehicle
|
||||
// in this class event handler, this#0 will be the vehicle
|
||||
[
|
||||
_parentClass, // parent classname
|
||||
0, // action 0 or self-action 1
|
||||
["ACE_MainActions", _rootActionID], // parent
|
||||
_removeFlagAction, // action
|
||||
true // apply to child classes
|
||||
] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
} forEach _baseClassesToApplyActionsFor;
|
||||
call FUNC(addFlagActions);
|
||||
call FUNC(draw3D);
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
|
||||
Reference in New Issue
Block a user