Compare commits
27 Commits
3.1.0
...
1ac1664faf
| Author | SHA1 | Date | |
|---|---|---|---|
|
1ac1664faf
|
|||
|
e395fa9c16
|
|||
|
4ced508005
|
|||
|
7e4af79fed
|
|||
|
754d7356e1
|
|||
|
e9fc5cfe21
|
|||
| 445cb5e75d | |||
| 09a800ab01 | |||
|
723aebcbf5
|
|||
|
|
6f5affd283 | ||
| dbe5473dad | |||
|
7630efeb4d
|
|||
|
12dd0fc83c
|
|||
|
|
3b06fe717b | ||
|
|
d9dfee0c7b | ||
| 1f1552bd53 | |||
| c912e730ac | |||
|
0301758e28
|
|||
|
|
85e9af6a73 | ||
|
|
32d8589733 | ||
|
|
bc9b20a89d | ||
| 61d3e2faf1 | |||
| 544039efbf | |||
|
15f7225a5f
|
|||
| a3da783d06 | |||
|
18435194a7
|
|||
|
9fc926619e
|
20
CHANGELOG.md
20
CHANGELOG.md
@@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project badly attempts [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [3.1.3] - 2024-01-10
|
||||
|
||||
|
||||
### Changed
|
||||
- Merge triage-status-draw3d to fix draw overlay for medics
|
||||
|
||||
## [3.1.2] - 2024-01-04
|
||||
|
||||
### Added
|
||||
- Add forgotten code file file for medical overlay
|
||||
|
||||
### Changed
|
||||
- Merge update-flag-exclusions branch to fix issues with vehicles not applying flag
|
||||
|
||||
## [3.1.1] - 2024-01-04
|
||||
|
||||
### Changed
|
||||
- Spelling Fixes
|
||||
- Update class binding for vehicle flag interaction
|
||||
|
||||
## [3.1.0] - 2023-12-17
|
||||
|
||||
### Added
|
||||
|
||||
@@ -32,6 +32,7 @@ class milsim
|
||||
class bindEventHandlers { postInit = 1; };
|
||||
class bindVehicleActions { postInit = 1; };
|
||||
class addClientStatsPFH {};
|
||||
class addMedicalOverlayPFH { postInit = 1; };
|
||||
class calculateClientStats {};
|
||||
class initVehicleFlags { postInit = 1; };
|
||||
class bindEmptyGroupGarbageCleanup { postInit = 1; };
|
||||
@@ -63,4 +64,12 @@ class milsim
|
||||
class mapMarkerToString {}; //needs refactor
|
||||
class stringToMapMarker {}; //needs refactor
|
||||
};
|
||||
};
|
||||
|
||||
class milsim_respawn {
|
||||
class functions {
|
||||
file = "functions\respawn";
|
||||
class init { postInit = 1; };
|
||||
class showReinsertQueueNotification {};
|
||||
};
|
||||
};
|
||||
@@ -8,7 +8,7 @@ _cpsPFH = [
|
||||
},
|
||||
"milsim_client_cps_interval" call CBA_settings_fnc_get,
|
||||
[],
|
||||
{ diag_log text format ["[MILSIM] (client) PFH loaded with interval %1 seconds", "milsim_client_cps_interval" call CBA_settings_fnc_get ], },
|
||||
{ diag_log text format ["[MILSIM] (client) PFH loaded with interval %1 seconds", "milsim_client_cps_interval" call CBA_settings_fnc_get ] },
|
||||
{ diag_log text format ["[MILSIM] (client) PFH unloaded"] },
|
||||
{ "milsim_client_cps_enable" call CBA_settings_fnc_get },
|
||||
{ false },
|
||||
|
||||
99
functions/client/fn_addMedicalOverlayPFH.sqf
Normal file
99
functions/client/fn_addMedicalOverlayPFH.sqf
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
|
||||
milsim_fnc_addMedicalOverlayPFH
|
||||
|
||||
Author: IndigoFox
|
||||
|
||||
Description:
|
||||
Affects players with medical permissions. Will see a 3D colored dot over nearby (5-10m)
|
||||
unconscious players who are not in a vehicle
|
||||
which indicates their current ACE Triage Card status.
|
||||
Designed to increase efficiency of CCPs.
|
||||
|
||||
*/
|
||||
|
||||
// Force setting if CBA doesn't work?
|
||||
if (isNil "milsim_client_medState3D_enabled") then {
|
||||
milsim_client_medState3D_enabled = true;
|
||||
};
|
||||
if (isNil "milsim_client_medState3D_drawRange") then {
|
||||
milsim_client_medState3D_drawRange = 10;
|
||||
};
|
||||
|
||||
// List of units to draw icons for
|
||||
milsim_client_medState3D_drawTargets = [];
|
||||
|
||||
// ACE Triage colors, for consistency across UIs and functions
|
||||
// #define TRIAGE_COLOR_NONE 0.5, 0.5, 0.5, 0.1
|
||||
// #define TRIAGE_COLOR_MINIMAL 0, 0.5, 0, 0.9
|
||||
// #define TRIAGE_COLOR_DELAYED 1, 0.84, 0, 0.9
|
||||
// #define TRIAGE_COLOR_IMMEDIATE 1, 0, 0, 0.9
|
||||
// #define TRIAGE_COLOR_DECEASED 0, 0, 0, 0.9
|
||||
|
||||
// ACE Triage colors, for consistency across UIs and functions
|
||||
milsim_client_medState3D_colors = [
|
||||
[0, 0.5, 0, 0.9], // TRIAGE_COLOR_MINIMAL
|
||||
[1, 0.84, 0, 0.9], // TRIAGE_COLOR_DELAYED
|
||||
[1, 0, 0, 0.9], // TRIAGE_COLOR_IMMEDIATE
|
||||
[0.15, 0.15, 0.15, 0.9], // TRIAGE_COLOR_DECEASED
|
||||
[0.5, 0.5, 0.5, 0] // TRIAGE_COLOR_NONE
|
||||
];
|
||||
|
||||
// Per-frame handler to draw icons
|
||||
// cleanup
|
||||
if (!isNil "milsim_client_medState3D_pfh") then {
|
||||
[milsim_client_medState3D_pfh] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
// add pfh
|
||||
milsim_client_medState3D_pfh = [{
|
||||
// if disabled, skip processing
|
||||
if (!milsim_client_medState3D_enabled) exitWith {false};
|
||||
// if no targets, skip processing
|
||||
if (count milsim_client_medState3D_drawTargets == 0) exitWith {false};
|
||||
if !([player] call ace_medical_treatment_fnc_isMedic) exitWith {false};
|
||||
{
|
||||
// distance within 10 meters
|
||||
if (player distance _x > milsim_client_medState3D_drawRange) then {continue};
|
||||
// check unit not null, not conscious, and not in a vehicle
|
||||
if (
|
||||
!(_x getVariable ["ACE_isUnconscious", false]) ||
|
||||
!isNull (objectParent _x)
|
||||
) then {continue};
|
||||
|
||||
// color based on triage level
|
||||
private _triageLevel = _x getVariable ["ace_medical_triageLevel", -1];
|
||||
if (_triageLevel == -1) then {continue};
|
||||
private _color = milsim_client_medState3D_colors select (
|
||||
(_x getVariable ["ace_medical_triageLevel", -1]) -1
|
||||
);
|
||||
// draw position, slightly above the prone unit
|
||||
private _drawPos = (visiblePosition _x) vectorAdd [0, 0, 0.5];
|
||||
// draw icon
|
||||
drawIcon3D [
|
||||
"\A3\ui_f\data\map\markers\military\dot_CA.paa", // icon texture
|
||||
_color, // color
|
||||
_drawPos, // position AGL
|
||||
1, // width
|
||||
1, // height
|
||||
0 // angle
|
||||
// further params optional, omitted
|
||||
];
|
||||
} forEach milsim_client_medState3D_drawTargets;
|
||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
// subroutine to gather nearest 50 units every 5 seconds and store in milsim_client_medState3D_drawTargets
|
||||
// cleanup
|
||||
if (!isNil "milsim_client_medState3D_drawTargetsPfh") then {
|
||||
[milsim_client_medState3D_drawTargetsPfh] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
// add pfh
|
||||
milsim_client_medState3D_drawTargetsPfh = [{
|
||||
milsim_client_medState3D_drawTargets = (
|
||||
(allUnits + allDeadMen) select {
|
||||
_x isKindOf "CAManBase" &&
|
||||
player distance _x < 50 &&
|
||||
!isNull _x &&
|
||||
player isNotEqualTo _x
|
||||
}
|
||||
);
|
||||
}, 5, false] call CBA_fnc_addPerFrameHandler;
|
||||
@@ -80,111 +80,146 @@ milsim_vehicleflag_options = [
|
||||
];
|
||||
|
||||
|
||||
private _appliedParentClasses = [
|
||||
"LandVehicle",
|
||||
"Helicopter"
|
||||
];
|
||||
|
||||
["AllVehicles", "InitPost", {
|
||||
private _flagActionID = "SetVehicleFlag";
|
||||
private _flagMasterAction = [
|
||||
_flagActionID, // id
|
||||
"Set Vehicle Flag", // displayed title
|
||||
"\A3\ui_f\data\map\markers\flags\nato_ca.paa", // flag icon
|
||||
{true}, // statement
|
||||
{true}, // condition
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
private _flagActionID = _params#0;
|
||||
private _actions = [];
|
||||
private _modelsWithoutFlagProxies = [
|
||||
"TF373_SOAR_MH47G_Base", // MH-47G Chinook
|
||||
"RHS_MELB_base", // MELB AH-6M/MH-6M/H-6M Little Bird
|
||||
"USAF_C17", // C17 Globemaster III
|
||||
"USAF_C130J", // C130J Super Hercules
|
||||
"USAF_AC130U", // AC130 Spooky II
|
||||
"ej_UH60M_base", // UH-60M Black Hawk + DAP variants
|
||||
"rhsusf_fmtv_base" // M1083A1P2 variants + SOV SOCOM variants
|
||||
];
|
||||
|
||||
{
|
||||
private _parentClass = _x;
|
||||
[_parentClass, "InitPost", {
|
||||
private _flagActionID = "SetVehicleFlag";
|
||||
private _flagMasterAction = [
|
||||
_flagActionID, // id
|
||||
"Set Vehicle Flag", // displayed title
|
||||
"\A3\ui_f\data\map\markers\flags\nato_ca.paa", // flag icon
|
||||
{true}, // statement
|
||||
{
|
||||
_x params ["_flagCategory", "_flagOptions"];
|
||||
// diag_log format ["NewFlagCategory: %1 %2", _flagCategory, _flagOptions];
|
||||
params ["_target", "_player", "_params"];
|
||||
private _modelsWithoutFlagProxies = _params select 1;
|
||||
|
||||
// check if hierarchy includes any of the models without flag proxies
|
||||
private _excluded = false;
|
||||
{
|
||||
if (_excluded) exitWith {false};
|
||||
_excluded = _target isKindOf _x;
|
||||
} forEach _modelsWithoutFlagProxies;
|
||||
if (_excluded) exitWith {false};
|
||||
|
||||
|
||||
private _flagCategoryOption = [
|
||||
_flagActionID + "_" + _flagCategory, // id
|
||||
_flagCategory, // displayed title
|
||||
(_flagOptions#0#1) get "Texture", // flag icon
|
||||
{true}, // statement
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
alive _target;
|
||||
// true;
|
||||
}, // condition
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
_params params ["_flagActionID", "_flagCategoryID", "_flagOptions"];
|
||||
private _categoryOptions = [];
|
||||
// check if vehicle is alive
|
||||
alive _target;
|
||||
}, // condition
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
private _flagActionID = _params#0;
|
||||
private _actions = [];
|
||||
{
|
||||
_x params ["_flagCategory", "_flagOptions"];
|
||||
// diag_log format ["NewFlagCategory: %1 %2", _flagCategory, _flagOptions];
|
||||
|
||||
private _flagCategoryOption = [
|
||||
_flagActionID + "_" + _flagCategory, // id
|
||||
_flagCategory, // displayed title
|
||||
(_flagOptions#0#1) get "Texture", // flag icon
|
||||
{true}, // statement
|
||||
{
|
||||
_x params ["_flagOptionID", "_flagOptionData"];
|
||||
// diag_log format ["NewFlagOption: %1 %2", _flagOptionID, _flagOptionData];
|
||||
private _newFlagOption = [
|
||||
_flagActionID + "_" + _flagCategory + "_" + _flagOptionID, // id
|
||||
_flagOptionData get "Title", // displayed title
|
||||
_flagOptionData get "Texture", // flag icon
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
_target forceFlagTexture (_params select 2);
|
||||
}, // statement
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
alive _target;
|
||||
// true;
|
||||
}, // condition
|
||||
nil, // child code
|
||||
[_flagActionID, _flagCategoryID, getMissionPath (_flagOptionData get "Texture")], // params
|
||||
nil, // position
|
||||
4, // distance
|
||||
[false, false, false, false, false] // other params
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
_categoryOptions pushBack [_newFlagOption, [], _target];
|
||||
} forEach _flagOptions;
|
||||
_categoryOptions;
|
||||
}, // child code
|
||||
[_flagActionID, _flagCategoryID, _flagOptions], // params
|
||||
nil, // position
|
||||
4, // distance
|
||||
[false, false, false, false, false], // other params
|
||||
nil // modifier function code
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
params ["_target", "_player", "_params"];
|
||||
alive _target;
|
||||
// true;
|
||||
}, // condition
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
_params params ["_flagActionID", "_flagCategoryID", "_flagOptions"];
|
||||
private _categoryOptions = [];
|
||||
{
|
||||
_x params ["_flagOptionID", "_flagOptionData"];
|
||||
// diag_log format ["NewFlagOption: %1 %2", _flagOptionID, _flagOptionData];
|
||||
private _newFlagOption = [
|
||||
_flagActionID + "_" + _flagCategory + "_" + _flagOptionID, // id
|
||||
_flagOptionData get "Title", // displayed title
|
||||
_flagOptionData get "Texture", // flag icon
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
_target forceFlagTexture (_params select 2);
|
||||
}, // statement
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
alive _target;
|
||||
// true;
|
||||
}, // condition
|
||||
nil, // child code
|
||||
[_flagActionID, _flagCategoryID, getMissionPath (_flagOptionData get "Texture")], // params
|
||||
nil, // position
|
||||
4, // distance
|
||||
[false, false, false, false, false] // other params
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
_categoryOptions pushBack [_newFlagOption, [], _target];
|
||||
} forEach _flagOptions;
|
||||
_categoryOptions;
|
||||
}, // child code
|
||||
[_flagActionID, _flagCategoryID, _flagOptions], // params
|
||||
nil, // position
|
||||
4, // distance
|
||||
[false, false, false, false, false], // other params
|
||||
nil // modifier function code
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
_actions pushBack [_flagCategoryOption, [], _target];
|
||||
} forEach milsim_vehicleflag_options;
|
||||
_actions pushBack [_flagCategoryOption, [], _target];
|
||||
} forEach milsim_vehicleflag_options;
|
||||
|
||||
_actions;
|
||||
}, // child code
|
||||
[_flagActionID], // params
|
||||
nil, // position
|
||||
4, // distance
|
||||
[false, false, false, false, false], // other params
|
||||
nil // modifier function code
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
_actions;
|
||||
}, // child code
|
||||
[_flagActionID, _modelsWithoutFlagProxies], // params
|
||||
nil, // position
|
||||
4, // distance
|
||||
[false, false, false, false, false], // other params
|
||||
nil // modifier function code
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
// add action to add flag
|
||||
[
|
||||
(_this select 0), // object
|
||||
0, // action 0 or self-action 1
|
||||
["ACE_MainActions"], // parent
|
||||
_flagMasterAction // action
|
||||
] call ace_interact_menu_fnc_addActionToObject;
|
||||
|
||||
|
||||
// add action to remove flag
|
||||
private _removeFlagAction = [
|
||||
_flagActionID + "_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
|
||||
{true}, // condition
|
||||
nil // child code
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
[
|
||||
(_this select 0), // object
|
||||
0, // action 0 or self-action 1
|
||||
["ACE_MainActions", _flagActionID], // parent
|
||||
_removeFlagAction // action
|
||||
] call ace_interact_menu_fnc_addActionToObject;
|
||||
// add action to add flag
|
||||
[
|
||||
(_this select 0), // object
|
||||
0, // action 0 or self-action 1
|
||||
["ACE_MainActions"], // parent
|
||||
_flagMasterAction // action
|
||||
] call ace_interact_menu_fnc_addActionToObject;
|
||||
|
||||
}, true, [], true] call CBA_fnc_addClassEventHandler;
|
||||
|
||||
// add action to remove flag
|
||||
private _removeFlagAction = [
|
||||
_flagActionID + "_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;
|
||||
|
||||
[
|
||||
(_this select 0), // object
|
||||
0, // action 0 or self-action 1
|
||||
["ACE_MainActions", _flagActionID], // parent
|
||||
_removeFlagAction // action
|
||||
] call ace_interact_menu_fnc_addActionToObject;
|
||||
|
||||
}, true, [], true] call CBA_fnc_addClassEventHandler;
|
||||
} forEach _appliedParentClasses;
|
||||
|
||||
nil;
|
||||
@@ -11,7 +11,7 @@ _text = composeText [_text, parseText "<t align='left' size='2'>Asset</t><t alig
|
||||
_assigned = _x select 2;
|
||||
_available = 0; //count (getMarkerPos "respawn_west" nearEntities [ _asset, 2000] );
|
||||
|
||||
_homes = allMissionObjects "ModuleRespawnPosition_F";
|
||||
_homes = allMissionObjects "ModuleRespawnPosition_F";
|
||||
|
||||
{
|
||||
_home = _x;
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
_text = "
|
||||
<font size='24' color='#ff0000'>=======------ Mission Data Set ------=======</font>
|
||||
<br/><br/>
|
||||
<font color='#00FF00' size='16'>RIPTIDE</font><br/>
|
||||
<font color='#00FF00' size='16'>SPARTAN</font><br/>
|
||||
Command
|
||||
<br/><br/>
|
||||
<font color='#00FF00' size='16'>ONI</font><br/>
|
||||
<font color='#00FF00' size='16'>BLACKJACK</font><br/>
|
||||
Alpha Platoon
|
||||
<br/><br/>
|
||||
<font color='#00FF00' size='16'>GOLIATH</font><br/>
|
||||
<font color='#00FF00' size='16'>ZOOMER</font><br/>
|
||||
Echo
|
||||
<br/><br/>
|
||||
<font color='#00FF00' size='16'>TIGER</font><br/>
|
||||
RRC
|
||||
<br/><br/>
|
||||
<font color='#00FF00' size='16'>BLACKFOOT/font><br/>
|
||||
<font color='#00FF00' size='16'>BLACKFOOT</font><br/>
|
||||
Weapons Squad
|
||||
<br/><br/>
|
||||
";
|
||||
|
||||
274
functions/respawn/fn_init.sqf
Normal file
274
functions/respawn/fn_init.sqf
Normal file
@@ -0,0 +1,274 @@
|
||||
|
||||
// if a player files for reinsert using self-interaction
|
||||
// they're added to the queue along with their nearest base location and the time they filed
|
||||
// if a player's time in the queue exceeds the configured timeout, a message will be posted every 5 minutes on a cycle based around
|
||||
// the player's time in the queue stating how long they have been waiting, their name, and their group's name
|
||||
|
||||
// execute for all
|
||||
if (isNil "milsim_respawn_setting_reinsertion_maxRangeToReady") then {
|
||||
// configured in CBA settings
|
||||
milsim_respawn_setting_reinsertion_maxRangeToReady = 400; // distance in meters from a base at which players can ready up for pickup. players removed from the queue if they move further away than this distance
|
||||
};
|
||||
milsim_respawn_bases = allMissionObjects "ModuleRespawnPosition_F"; // array of all respawn modules in the mission
|
||||
|
||||
|
||||
// on the server, initialize the queue and register the CBA event handler by which players can ready up
|
||||
if (isServer) then {
|
||||
// register queue
|
||||
milsim_respawn_reinsertionQueue = [];
|
||||
publicVariable "milsim_respawn_reinsertionQueue";
|
||||
|
||||
milsim_respawn_reinsertionOverTimeoutLastNotificationTime = 0;
|
||||
|
||||
// register event handlers
|
||||
["milsim_respawn_fileReinsertRequest", {
|
||||
params ["_unit", "_closestBaseName", "_time"];
|
||||
milsim_respawn_reinsertionQueue pushBackUnique [_unit, _closestBaseName, _time];
|
||||
diag_log text format [
|
||||
"[milsim] (respawn_reinsertion) ADDED name=%1 playerUID=%2 filedAtBase=%3",
|
||||
name _unit,
|
||||
getPlayerUID _unit,
|
||||
_closestBaseName
|
||||
];
|
||||
publicVariable "milsim_respawn_reinsertionQueue";
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
["milsim_respawn_removeReinsertRequest", {
|
||||
params ["_unit"];
|
||||
private _unitArrs = milsim_respawn_reinsertionQueue select {_x#0 isEqualTo _unit};
|
||||
if (count _unitArrs isEqualTo 0) exitWith {};
|
||||
|
||||
milsim_respawn_reinsertionQueue = milsim_respawn_reinsertionQueue - _unitArrs;
|
||||
// sort _unitArrs by time in queue, descending
|
||||
[_unitArrs, [], {
|
||||
_x#2
|
||||
}, "DESCEND"] call BIS_fnc_sortBy;
|
||||
(_unitArrs#0) params ["_unit", "_baseName", "_timeFiled"]; // _unitArr = [unit, baseName, timeInQueue]
|
||||
private _timeInQueue = diag_tickTime - (_timeFiled);
|
||||
diag_log text format ["[milsim] (respawn_reinsertion) REMOVED BY REQUEST name=%1 playerUID=%2 filedAtBase=%3 inQueue=%4s",
|
||||
name _unit,
|
||||
getPlayerUID _unit,
|
||||
_baseName,
|
||||
_timeInQueue
|
||||
];
|
||||
publicVariable "milsim_respawn_reinsertionQueue";
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
|
||||
|
||||
[{
|
||||
// every 60 seconds, revalidate any players in the queue
|
||||
// compare their distance to the nearest base, and remove them if they're too far away (or dead)
|
||||
private _stillValid = [];
|
||||
{
|
||||
_x params ["_player", "_baseName", "_timeFiled"]; // _unitArr = [unit, baseName, timeInQueue]
|
||||
private _nearestDistance = 99999;
|
||||
{
|
||||
private _baseLocation = _x;
|
||||
private _distanceFromBase = _player distance _baseLocation;
|
||||
if (_distanceFromBase < _nearestDistance) then {
|
||||
_nearestDistance = _distanceFromBase;
|
||||
};
|
||||
} forEach milsim_respawn_bases;
|
||||
|
||||
private _nearBase = _nearestDistance < milsim_respawn_setting_reinsertion_maxRangeToReady;
|
||||
|
||||
if (_nearBase && alive _player) then {
|
||||
_stillValid pushBackUnique _x;
|
||||
} else {
|
||||
diag_log text format [
|
||||
"[milsim] (respawn_reinsertion) REMOVED AUTOMATICALLY name=%1 playerUID=%2 filedAtBase=%3 nearestBaseDistance=%4m inQueue=%5s",
|
||||
name _player,
|
||||
getPlayerUID _player,
|
||||
_baseName,
|
||||
_nearestDistance,
|
||||
diag_tickTime - _timeFiled
|
||||
];
|
||||
};
|
||||
} forEach milsim_respawn_reinsertionQueue;
|
||||
|
||||
// broadcast new list to all machines
|
||||
milsim_respawn_reinsertionQueue = _stillValid;
|
||||
publicVariable "milsim_respawn_reinsertionQueue";
|
||||
|
||||
|
||||
// if at least 1 player in the queue has been waiting longer than the configured timeout,
|
||||
// show a notification to all players if the last notification was more than 5 minutes ago
|
||||
private _needNotification =
|
||||
diag_tickTime - milsim_respawn_reinsertionOverTimeoutLastNotificationTime > 60*5; // if last notification was more than 5 minutes ago
|
||||
if (_needNotification) then {
|
||||
private _timeout = missionNamespace getVariable ["milsim_respawn_setting_reinsertion_timeout", 60*20]; // default 20 minutes
|
||||
private _timeoutPlayers = milsim_respawn_reinsertionQueue select {alive (_x#0) && (diag_tickTime - (_x#2)) > _timeout};
|
||||
if (count _timeoutPlayers > 0) then {
|
||||
// sort _timeoutPlayers by time in queue, descending
|
||||
_timeoutPlayers = [_timeoutPlayers, [], {
|
||||
_x#2
|
||||
}, "DESCEND"] call BIS_fnc_sortBy;
|
||||
private _playerLines = _timeoutPlayers apply {
|
||||
private _timeInQueue = diag_tickTime - (_x#2);
|
||||
private _groupId = groupID (_x#0);
|
||||
[format [
|
||||
"%1: %2 [%2s]",
|
||||
_groupId,
|
||||
name (_x#0),
|
||||
[_timeInQueue, "MM:SS"] call BIS_fnc_secondsToString
|
||||
], 0.8, [0.8, 0.8, 0.8, 1]];
|
||||
};
|
||||
["Players are still waiting for Re-insert!", _playerLines] remoteExec ["CBA_fnc_notify", -2];
|
||||
|
||||
milsim_respawn_reinsertionOverTimeoutLastNotificationTime = diag_tickTime;
|
||||
|
||||
diag_log text format [
|
||||
"[milsim] (respawn_reinsertion) PLAYERS WAITING LONGER THAN %1s: %2",
|
||||
_timeout,
|
||||
_timeoutPlayers apply {
|
||||
format[
|
||||
"%1: %2 [%3]",
|
||||
groupID (_x#0),
|
||||
name _x#0,
|
||||
diag_tickTime - (_x#2)
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
};
|
||||
};
|
||||
}, 60] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
|
||||
|
||||
// if a player, register the ACE self-interaction to ready up
|
||||
if (hasInterface) then {
|
||||
|
||||
// ACE SELF-INTERACTIONS FOR FILING AND RESCINDING REINSERT REQUESTS NEAR BASE - ALL PLAYERS
|
||||
localNamespace setVariable ["milsim_respawn_fileForReinsertClassesAdded", []];
|
||||
|
||||
private _addReinsertRequestSelfActions = {
|
||||
params ["_type"]; // string of the object's classname
|
||||
if (!(_type isKindOf "CAManBase")) exitWith {};
|
||||
|
||||
if (
|
||||
(localNamespace getVariable ["milsim_respawn_fileForReinsertClassesAdded", []])
|
||||
find _type != -1
|
||||
) exitWith {};
|
||||
|
||||
private _fileForReinsertAction = [
|
||||
"milsim_respawn_fileReinsertRequest",
|
||||
"File Re-insert Request",
|
||||
"\A3\ui_f\data\igui\cfg\simpleTasks\types\takeoff_ca.paa",
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
private _closestBase = [milsim_respawn_bases, _player] call BIS_fnc_nearestPosition;
|
||||
private _closestBaseName = _closestBase getVariable ["name", ""];
|
||||
if (_closestBaseName == "") then {_closestBaseName = format["near %1", text (nearestLocation [_closestBase, ""])]};
|
||||
["milsim_respawn_fileReinsertRequest", [_player, _closestBaseName, diag_tickTime]] call CBA_fnc_serverEvent;
|
||||
[["Re-insert Request Filed"], [format["Pickup at %1", _closestBaseName]]] call CBA_fnc_notify;
|
||||
},
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
private _closestBase = [milsim_respawn_bases, _player] call BIS_fnc_nearestPosition;
|
||||
|
||||
missionNamespace getVariable ["milsim_respawn_setting_reinsertion_enabled", true] &&
|
||||
(_player distance _closestBase < milsim_respawn_setting_reinsertion_maxRangeToReady) &&
|
||||
not (_player in ((missionNamespace getVariable ["milsim_respawn_reinsertionQueue", []]) apply {_x#0}))
|
||||
}
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
[_type, 1, ["ACE_SelfActions"], _fileForReinsertAction, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
private _removeFileForReinsertAction = [
|
||||
"milsim_respawn_removeReinsertRequest",
|
||||
"Remove Re-insert Request",
|
||||
"\A3\ui_f\data\igui\cfg\simpleTasks\types\land_ca.paa",
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
["milsim_respawn_removeReinsertRequest", [_player]] call CBA_fnc_serverEvent;
|
||||
"Re-insert Request Rescinded" call CBA_fnc_notify;
|
||||
},
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
|
||||
missionNamespace getVariable ["milsim_respawn_setting_reinsertion_enabled", true] &&
|
||||
(_player in ((missionNamespace getVariable ["milsim_respawn_reinsertionQueue", []]) apply {_x#0}))
|
||||
}
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
[_type, 1, ["ACE_SelfActions"], _removeFileForReinsertAction, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
private _classesActionsAddedTo = (localNamespace getVariable ["milsim_respawn_fileForReinsertClassesAdded", []]);
|
||||
_classesActionsAddedTo pushBackUnique _type;
|
||||
localNamespace setVariable ["milsim_respawn_fileForReinsertClassesAdded", _classesActionsAddedTo];
|
||||
};
|
||||
|
||||
[typeOf player] call _addReinsertRequestSelfActions;
|
||||
|
||||
["ace_interact_menu_newControllableObject", {
|
||||
_thisArgs params ["_fnc"];
|
||||
_this call _fnc;
|
||||
}, [_addReinsertRequestSelfActions]] call CBA_fnc_addEventHandlerArgs;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
// PILOTS ONLY
|
||||
// ACE SELF-INTERACTIONS FOR CHECKING REINSERT QUEUE - ONLY FOR PILOTS
|
||||
localNamespace setVariable ["milsim_respawn_checkReinsertQueueClassesAdded", []];
|
||||
localNamespace setVariable ["milsim_respawn_lastReinsertQueueCheck", diag_tickTime];
|
||||
|
||||
private _addCheckReinsertQueueSelfAction = {
|
||||
params ["_type"]; // string of the object's classname
|
||||
if (!(_type isKindOf "CAManBase")) exitWith {};
|
||||
if (!(_type in ["B_Helipilot_F", "B_helicrew_F"])) exitWith {};
|
||||
|
||||
if (
|
||||
(localNamespace getVariable ["milsim_respawn_checkReinsertQueueClassesAdded", []])
|
||||
find _type != -1
|
||||
) exitWith {};
|
||||
|
||||
private _checkReinsertQueueAction = [
|
||||
"milsim_respawn_checkReinsertQueue",
|
||||
"[PILOT] Check Re-insert Queue",
|
||||
"\A3\ui_f\data\igui\cfg\simpleTasks\types\land_ca.paa",
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
// reset last check time
|
||||
localNamespace setVariable ["milsim_respawn_lastReinsertQueueCheck", diag_tickTime];
|
||||
|
||||
call milsim_respawn_fnc_showReinsertQueueNotification;
|
||||
},
|
||||
{
|
||||
missionNamespace getVariable ["milsim_respawn_setting_reinsertion_enabled", true]
|
||||
} // always allow
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
[_type, 1, ["ACE_SelfActions"], _checkReinsertQueueAction, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
private _classesActionsAddedTo = (localNamespace getVariable ["milsim_respawn_checkReinsertQueueClassesAdded", []]);
|
||||
_classesActionsAddedTo pushBackUnique _type;
|
||||
localNamespace setVariable ["milsim_respawn_checkReinsertQueueClassesAdded", _classesActionsAddedTo];
|
||||
};
|
||||
|
||||
[typeOf player] call _addCheckReinsertQueueSelfAction;
|
||||
|
||||
["ace_interact_menu_newControllableObject", {
|
||||
_thisArgs params ["_fnc"];
|
||||
_this call _fnc;
|
||||
}, [_addCheckReinsertQueueSelfAction]] call CBA_fnc_addEventHandlerArgs;
|
||||
|
||||
|
||||
// ADD TIMER FOR PILOTS - IF REINSERT LIST NOT CHECKED FOR 20 MINUTES, SHOW NOTIFICATION AUTOMATICALLY
|
||||
if ((typeOf player) in ["B_Helipilot_F", "B_helicrew_F"]) then {
|
||||
[{
|
||||
if (not (
|
||||
missionNamespace getVariable ["milsim_respawn_setting_reinsertion_enabled", true] &&
|
||||
missionNamespace getVariable ["milsim_respawn_setting_reinsertion_pilotForcedCheckEnabled", true]
|
||||
)) exitWith {};
|
||||
private _lastCheck = localNamespace getVariable ["milsim_respawn_lastReinsertQueueCheck", diag_tickTime];
|
||||
if (
|
||||
diag_tickTime - _lastCheck <
|
||||
missionNamespace getVariable ["milsim_respawn_setting_reinsertion_pilotForcedCheckInterval", 60*20]
|
||||
) exitWith {}; // if last check was less than X minutes ago, skip
|
||||
|
||||
// if last check was greater than 20 minutes ago, we'll prompt the notification now and reset the timer
|
||||
localNamespace setVariable ["milsim_respawn_lastReinsertQueueCheck", diag_tickTime];
|
||||
|
||||
call milsim_respawn_fnc_showReinsertQueueNotification;
|
||||
}, 30] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
/////////////////////////////////////////////////////
|
||||
};
|
||||
40
functions/respawn/fn_showReinsertQueueNotification.sqf
Normal file
40
functions/respawn/fn_showReinsertQueueNotification.sqf
Normal file
@@ -0,0 +1,40 @@
|
||||
private _par = [["Players Awaiting Reinsert", 1.2, [1,0.64,0,1]]];
|
||||
private _baseNames = (missionNamespace getVariable ["milsim_respawn_reinsertionQueue", []]) apply {_x#1};
|
||||
{
|
||||
private _baseName = _x;
|
||||
private _peopleAtThisBase = (missionNamespace getVariable ["milsim_respawn_reinsertionQueue", []]) select {
|
||||
_x#1 isEqualTo _baseName
|
||||
} apply {
|
||||
[name (_x#0), 0.7, [1,1,1,1]];
|
||||
};
|
||||
|
||||
private _playerCountText = "";
|
||||
switch (count _peopleAtThisBase) do {
|
||||
case 0: {
|
||||
_playerCountText = "No players";
|
||||
};
|
||||
case 1: {
|
||||
_playerCountText = "1 player";
|
||||
};
|
||||
default {
|
||||
_playerCountText = format ["%1 players", count _peopleAtThisBase];
|
||||
};
|
||||
};
|
||||
|
||||
_par pushBack [
|
||||
format ["Location: %1 (%2)",
|
||||
_baseName,
|
||||
_playerCountText
|
||||
],
|
||||
1,
|
||||
[0,1,0,1]
|
||||
];
|
||||
|
||||
{
|
||||
_par pushBack _x;
|
||||
} forEach _peopleAtThisBase;
|
||||
} forEach _baseNames;
|
||||
|
||||
_par call CBA_fnc_notify;
|
||||
|
||||
true;
|
||||
@@ -3,7 +3,7 @@ params [
|
||||
["_player", objNull, [objNull]]
|
||||
];
|
||||
|
||||
if (!isPlayer _player) exitWith { diag_log("exitWith inventotry")};
|
||||
if (!isPlayer _player) exitWith { diag_log("exitWith logPlayerInventory")};
|
||||
|
||||
_items = [];
|
||||
_items append uniformItems _player;
|
||||
@@ -13,6 +13,9 @@ _items pushback hmd _player;
|
||||
_items pushback binocular _player;
|
||||
_items append primaryWeaponItems _player;
|
||||
|
||||
_noncompliant = [];
|
||||
_unlisted = [];
|
||||
|
||||
{
|
||||
_item = _x;
|
||||
_modes = getArray(configfile >> "CfgWeapons" >> _item >> "visionMode");
|
||||
@@ -26,15 +29,28 @@ _items append primaryWeaponItems _player;
|
||||
_restrictedItemList = ["A3_GPNVG18b_REC_TI","A3_GPNVG18_REC_TI","A3_GPNVG18b_TI","A3_GPNVG18_TI","A3_GPNVG18b_REC_BLK_TI","A3_GPNVG18_REC_BLK_TI","A3_GPNVG18b_BLK_TI","A3_GPNVG18_BLK_TI","NVGogglesB_gry_F","NVGogglesB_grn_F","NVGogglesB_blk_F","optic_Nightstalker","rhsusf_acc_anpas13gv1","Tier1_ANPVS10_Tan","rhsusf_acc_anpvs27","optic_tws_mg","optic_tws"];
|
||||
|
||||
if ( _x in _restrictedItemList ) then {
|
||||
diag_log text format["[MILSIM] (logPlayerInventory): %1 has a restricted inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _item >> "displayName" )];
|
||||
} else if ((count _modes) isNotEqualTo 0) then {
|
||||
_noncompliant pushBackUnique _item;
|
||||
};
|
||||
|
||||
if ((count _modes) isNotEqualTo 0) then {
|
||||
_modes = _modes apply { toLower _x };
|
||||
if ( "ti" in _modes ) then {
|
||||
diag_log text format["[MILSIM] (logPlayerInventory): %1 has an unlisted thermal item: %2", name _player, getText( configfile >> "CfgWeapons" >> _item >> "displayName" )];
|
||||
_unlisted pushBackUnique _item;
|
||||
};
|
||||
} else {
|
||||
diag_log text format["[MILSIM] (logPlayerInventory): %1 inventory in compliance", name _player];
|
||||
}
|
||||
};
|
||||
|
||||
} forEach _items;
|
||||
|
||||
{
|
||||
diag_log text format["[MILSIM] (logPlayerInventory): %1 has a restricted inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )];
|
||||
} forEach _noncompliant;
|
||||
|
||||
{
|
||||
diag_log text format["[MILSIM] (logPlayerInventory): %1 has an unlisted thermal item: %2", name _player, getText( configfile >> "CfgWeapons" >> _x >> "displayName" )];
|
||||
} forEach _unlisted;
|
||||
|
||||
if (((count _noncompliant) isEqualTo 0) && ((count _unlisted) isEqualTo 0)) then {
|
||||
diag_log text format["[MILSIM] (logPlayerInventory): %1 inventory in compliance", name _player];
|
||||
};
|
||||
|
||||
nil
|
||||
@@ -6,7 +6,7 @@
|
||||
"milsim_sideChat",
|
||||
"CHECKBOX",
|
||||
"Side Chat Text Enabled",
|
||||
["17th Battallion", "Side Chat"],
|
||||
["17th Battalion", "Side Chat"],
|
||||
false,
|
||||
true,
|
||||
{
|
||||
@@ -25,7 +25,7 @@
|
||||
"milsim_server_cps_enable",
|
||||
"CHECKBOX",
|
||||
"CPS Metrics Enabled",
|
||||
["17th Battallion", "Server Metrics"],
|
||||
["17th Battalion", "Server Metrics"],
|
||||
true,
|
||||
true,
|
||||
{
|
||||
@@ -40,7 +40,7 @@
|
||||
"milsim_server_cps_interval",
|
||||
"TIME",
|
||||
"Metrics Interval",
|
||||
["17th Battallion", "Server Metrics"],
|
||||
["17th Battalion", "Server Metrics"],
|
||||
[60,300,120],
|
||||
true,
|
||||
{
|
||||
@@ -71,7 +71,7 @@
|
||||
"milsim_client_cps_enable",
|
||||
"CHECKBOX",
|
||||
"CPS Metrics Enabled",
|
||||
["17th Battallion", "Client Metrics"],
|
||||
["17th Battalion", "Client Metrics"],
|
||||
true,
|
||||
true,
|
||||
{
|
||||
@@ -86,7 +86,7 @@
|
||||
"milsim_client_cps_interval",
|
||||
"TIME",
|
||||
"CPS Metrics Interval",
|
||||
["17th Battallion", "Client Metrics"],
|
||||
["17th Battalion", "Client Metrics"],
|
||||
[60,300,120],
|
||||
true,
|
||||
{
|
||||
@@ -104,6 +104,94 @@
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
//---------------------
|
||||
// Medical Overlay
|
||||
//---------------------
|
||||
|
||||
[
|
||||
"milsim_client_medState3D_enabled", // variable
|
||||
"CHECKBOX", // type
|
||||
["Enable 3D Triage Card State", "Draws a colored dot over units within 10m indicating current ACE Triage State"], // title
|
||||
["17th Battalion", "Medical"], // category
|
||||
true // default value
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
"milsim_client_medState3D_drawRange", // variable
|
||||
"LIST", // type
|
||||
["Range To Draw Icons", "Determines range at which dots are visible"], // title
|
||||
["17th Battalion", "Medical"], // category
|
||||
[[2, 4, 6, 8, 10], ["2", "4", "6", "8", "10"], 4] // option values, option labels, default index
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
|
||||
//---------------------
|
||||
// Respawn Settings
|
||||
[
|
||||
"milsim_respawn_setting_reinsertion_enabled", // variable
|
||||
"CHECKBOX", // type
|
||||
["Enabled", "Whether or not players can file for reinsert and pilots can check the reinsert queue"], // title
|
||||
["17th Battalion", "Re-insert Queue"], // category
|
||||
true, // default value
|
||||
true, // global setting
|
||||
{
|
||||
params ["_value"];
|
||||
diag_log format["[milsim] (respawn_reinsertion) enabled set to %1", _value];
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
"milsim_respawn_setting_reinsertion_maxRangeToReady", // variable
|
||||
"SLIDER", // type
|
||||
["Max Request Filing Range", "Maximum distance from a respawn point a player can be to ready up"], // title
|
||||
["17th Battalion", "Re-insert Queue"], // category
|
||||
[0, 1000, 400, 0, false], // [_min, _max, _default, _trailingDecimals, _isPercentage]
|
||||
true, // global setting
|
||||
{
|
||||
params ["_value"];
|
||||
diag_log format["[milsim] (respawn_reinsertion) maxRangeToReady set to %1", _value];
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
"milsim_respawn_setting_reinsertion_pilotForcedCheckEnabled", // variable
|
||||
"CHECKBOX", // type
|
||||
["Enabled", "Whether or not pilots are forced to view the contents of the reinsertion queue per interval"], // title
|
||||
["17th Battalion", "Re-insert Queue"], // category
|
||||
true, // default value
|
||||
true, // global setting
|
||||
{
|
||||
params ["_value"];
|
||||
diag_log format["[milsim] (respawn_reinsertion) pilotForcedCheckEnabled set to %1", _value];
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
"milsim_respawn_setting_reinsertion_pilotForcedCheckInterval", // variable
|
||||
"SLIDER", // type
|
||||
["Pilot Check Interval", "Pilots will be force shown the queue if they haven't checked it in X seconds"], // title
|
||||
["17th Battalion", "Re-insert Queue"], // category
|
||||
[60*10, 60*30, 60*20, 0, false], // [_min, _max, _default, _trailingDecimals, _isPercentage
|
||||
true,
|
||||
{
|
||||
params ["_value"];
|
||||
diag_log format["[milsim] (respawn_reinsertion) pilotForcedCheckInterval set to %1", _value];
|
||||
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
"milsim_respawn_setting_reinsertion_timeout", // variable
|
||||
"SLIDER", // type
|
||||
["Request Timeout", "How long should at least one person be waiting before prompting a global notification."], // title
|
||||
["17th Battalion", "Re-insert Queue"], // category
|
||||
[60*10, 60*30, 60*20, 0, false], // [_min, _max, _default, _trailingDecimals, _isPercentage
|
||||
true,
|
||||
{
|
||||
params ["_value"];
|
||||
diag_log format["[milsim] (respawn_reinsertion) timeout set to %1", _value];
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
diag_log text "[MILSIM] (settings) Custom CBA settings initialized";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user