Compare commits
27 Commits
c45f778188
...
4.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e5d50828b | ||
| f8af54aa06 | |||
|
|
2c733f77df | ||
| 8ed6b8a5c6 | |||
| 1d7e1ede37 | |||
| 363016d778 | |||
|
442cb0b0b2
|
|||
|
2db018103c
|
|||
|
fba423e38d
|
|||
|
7268d8fd50
|
|||
|
3217ec487d
|
|||
|
7c903d1021
|
|||
|
|
bbe798734a | ||
|
|
e372563e58 | ||
|
|
8283f19b77 | ||
| 644de22b32 | |||
|
dfd79c0d70
|
|||
|
5d3c28b807
|
|||
| 02e97b3e0e | |||
| aa640d31a3 | |||
|
c44247061a
|
|||
|
8a27abe6c5
|
|||
|
91b982e06e
|
|||
|
0a64d9e170
|
|||
|
f588ffa4a0
|
|||
|
f450f4611b
|
|||
|
4cfa159ee9
|
39
CHANGELOG.md
39
CHANGELOG.md
@@ -4,7 +4,34 @@ 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.2] - 2024-02-01
|
||||
## [4.0.0] - 2024-02-07
|
||||
|
||||
Version 4 marks a massive rewrite due in whole to @IndigoFox by updating the internals of the framework into CBA macros and functions.
|
||||
|
||||
### Added
|
||||
|
||||
- Added ability for FBCB2 Assets to locate themselves on player local map
|
||||
- Added various framework utitily functions
|
||||
- Added ability for mission maker to allow spawning of resupply boxes from arsenal boxes
|
||||
- Added CBA settings for resupply box spawning
|
||||
- Added additional vehicle flags
|
||||
- Addded Zeus module to fill vehicle ace cargo inventory with tracks/tires
|
||||
|
||||
### Changed
|
||||
|
||||
- Documented purpose of `missionSeries` parameter in `mission_settings.hpp`
|
||||
- Moved internal functions into new framework directory structure
|
||||
- Moved FBCB2 internal data structure into multiple defintion files
|
||||
- Moved resupply boxes internal data structures into their own definiton file
|
||||
- Moved player inventory internal data structure into its own defintion file
|
||||
- Moved vehicle flags internal data structure into its own defitinion file
|
||||
- Use player's preferred ACE color settings for medical triage icons
|
||||
|
||||
### Deleted
|
||||
|
||||
- Leftover resupply box code from before version 3.2.0 update
|
||||
|
||||
## [3.2.0] - 2024-02-01
|
||||
|
||||
### Added
|
||||
|
||||
@@ -62,7 +89,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
- Lowered garbage collection times and range for dead bodies
|
||||
|
||||
|
||||
## [3.0] - 2023-05-03
|
||||
## [3.0.0] - 2023-05-03
|
||||
|
||||
### Added
|
||||
|
||||
@@ -79,7 +106,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
|
||||
- Remove `CfgRemoteExec` from `description.ext` as it has been deprecated as of Arma v1.54
|
||||
|
||||
## [2.2] - 2023-04-23
|
||||
## [2.2.0] - 2023-04-23
|
||||
|
||||
### Added
|
||||
|
||||
@@ -93,7 +120,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
|
||||
- Force `sideChat` CBA setting to 'disabled' on mission start by default
|
||||
|
||||
## [2.1] - 2023-04-12
|
||||
## [2.1.0] - 2023-04-12
|
||||
|
||||
### Added
|
||||
|
||||
@@ -103,7 +130,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
- Allow `#admin` to enable or disable `sideChat` via CBA setting on a per mission file basis.
|
||||
`Escape -> Configure -> Addon Options -> Server -> 17th Battalion -> Enable Side Chat`
|
||||
|
||||
## [2.0] -2023-04-12
|
||||
## [2.0.0] -2023-04-12
|
||||
|
||||
### Added
|
||||
|
||||
@@ -113,7 +140,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
|
||||
- mission.jpg to correct dimensions and optimize
|
||||
|
||||
## [1.9] - 2023-03-07
|
||||
## [1.9.0] - 2023-03-07
|
||||
|
||||
### Added
|
||||
|
||||
|
||||
81
README.md
81
README.md
@@ -1,22 +1,27 @@
|
||||
# Installation Instructions
|
||||
|
||||
Once your mission has been created and saved in the Arma 3 Eden Editor, download the latest mission template zip and copy its contents to the folder where your mission file lives.
|
||||
The only file which should be pre-existing in your mission folder is `mission.sqm`, once freshly saved from Arma 3's EDEN Editor.
|
||||
|
||||
The only file which should be pre-existing in your mission folder is `mission.sqm`
|
||||
Download the latest mission template zip from the [latest release](https://17th-gs.iceberg-gaming.com:5443/hizumi/MissionTemplate/releases/latest) and copy its contents to the folder where your mission file lives.
|
||||
|
||||
Once copied, the final structure should appear similar to the following:
|
||||
```markdown
|
||||
├── functions/
|
||||
├── aaFrameworkUtils/
|
||||
├── defines/
|
||||
├── framework/
|
||||
├── images/
|
||||
├── scripts/
|
||||
├── sounds/
|
||||
├── textures/
|
||||
├── CHANGELOG.md
|
||||
├── description.ext
|
||||
├── mission_settings.hpp
|
||||
├── mission.jpg
|
||||
├── mission.sqm
|
||||
├── mission_settings.hpp
|
||||
```
|
||||
|
||||
> **Note:** If you're building a mission for use and not actively developing code, the `aaFrameworkUtils` and `framework\x` directories **should be deleted**. *These are for the purposes of development and add size bloat to the mission download when players connect to your mission.*
|
||||
|
||||
After the requisite configuration file edits have been made, your mission is ready to be packed into a pbo for deployment.
|
||||
|
||||
# Files
|
||||
@@ -40,14 +45,22 @@ The contents of the lower half of the file are where the mission maker is able t
|
||||
This file will be displayed the client mission loading screen.
|
||||
File should remain small *(under 300KiB)* and should optimally be `1024px by 512px` in resolution
|
||||
|
||||
## defines/
|
||||
|
||||
This directory contains the definition files use by the framework in various places. *Contents should not be edited*
|
||||
|
||||
## framework/
|
||||
|
||||
This directory contains the code for the mission framework. **Contents must not be edited.**
|
||||
|
||||
## images/
|
||||
|
||||
This directory is for organizational purposes for any images you wish to use in your mission
|
||||
|
||||
## scripts/
|
||||
|
||||
This directory is for organizational purposes for any custom scripts you wish to use in your mission.
|
||||
> **Note**: Scripts may need to be edited to account for their new location
|
||||
This directory is for organizational purposes for any custom scripts you wish to use in your mission.
|
||||
> **Note:** Scripts may need to be edited to account for their new location
|
||||
|
||||
## sounds/
|
||||
|
||||
@@ -56,4 +69,58 @@ This directory is for organizational purposes for any custom scripts you wish to
|
||||
|
||||
## textures/
|
||||
|
||||
This directory is for organizational purposes for textures files used by mission scripts
|
||||
This directory is for organizational purposes for textures files used by mission scripts.
|
||||
|
||||
|
||||
# Development Notes
|
||||
|
||||
All modules are broken apart as such in /framework. Client and server inits are managed in /framework/init.
|
||||
|
||||
Pay attention to framework/script_mod.hpp prior to deployment of releases, as the debug settings within will determine what is logged during prod missions.
|
||||
|
||||
CfgFunctions is sensitive to the folder/script_component.hpp of each module.
|
||||
|
||||
### `defines` Directory
|
||||
|
||||
This directory contains a number of hpp files used to define constants throughout the framework. These should ONLY be edited by or with the supervision of a developer to reflect format battalion-wide changes.
|
||||
|
||||
- `ApprovedAssets.hpp`: Contains subclasses for approved aerial assets with their assigned callsigns. Used primarily in `fbcb2_assets`.
|
||||
- `BattalionInfo.hpp`: Used for representing Battalion structure, element callsigns, and radio frequency assignments. Used primarily in `fbcb2_main`.
|
||||
- `DisallowedEquipment.hpp`: Contains flagged item classnames by category that players may not use, or may use only in specific roles. Used to monitor and enforce equipment restrictions.
|
||||
- `SignalColors.hpp`: Contains smoke/flare/chemlight colors and what they represent in the field. Used primarily in `fbcb2_main` for the Signal Colors diary record.
|
||||
- `SupplyCrates.hpp`: Contains the types, contents, and metadata for all supply crate types in the `resupply` module.
|
||||
- `VehicleFlags.hpp`: Defines system information, flag categories, and flag options used to populate ACE3 interaction menus for vehicles. Used by the `vehicleFlags` module.
|
||||
|
||||
|
||||
### Modules List
|
||||
|
||||
*Within `framework`:*
|
||||
|
||||
- `ambience`:
|
||||
- Adds ambient flak capabilities.
|
||||
- `client`:
|
||||
- Contains core client-side event handlers and actions that don't fit into other modules.
|
||||
- `common`:
|
||||
- Contains common functions and variables used by multiple modules.
|
||||
- `fbcb2_main`:
|
||||
- Contains the main FBCB2 functionality and initialization code. Populates the briefing/diary with mission information.
|
||||
- `fbcb2_assets`:
|
||||
- A subcomponent of `fbcb2_main`. Used to gather, display, and manage diary records as intel for assets near known bases.
|
||||
- `init`:
|
||||
- Contains core initialization functions. Both server and client inits across all modules are managed here.
|
||||
- `mapcopy`:
|
||||
- Gives players the ability to copy each other's maps.
|
||||
- `performance`:
|
||||
- Contains functionality for monitoring and logging performance data.
|
||||
- `reinsert`:
|
||||
- Provides a reinsertion queue system for players and pilots to maximize efficiency of the reinsertion process.
|
||||
- `resupply`:
|
||||
- Provides a Zeus module and standalone function to spawn pre-equipped supply crates onto the battlefield.
|
||||
- Supply crate definitions are stored in `defines/SupplyCrates.hpp`.
|
||||
- Optionally, allows players to spawn supply crates from arsenal boxes.
|
||||
- `triageIcons`:
|
||||
- For those with medical permissions (`ace_medical`), provides a configurable 3D icon over unconscious units indicating their current ACE Triage Card status.
|
||||
- `vehicleFlags`:
|
||||
- Provides an ACE3 interaction menu that allows players to attach and remove flags from vehicles.
|
||||
- Flags are defined in `defines/VehicleFlags.hpp`.
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define RRC_CALLSIGN TIGER
|
||||
#define MEDIC_CALLSIGN LIFELINE
|
||||
#define ALPHA_CALLSIGN BLACKJACK
|
||||
#define ECHO_CALLSIGN ZOOMER
|
||||
#define ECHO_CALLSIGN FIREBRAND
|
||||
#define WPN_CALLSIGN BLACKFOOT
|
||||
|
||||
// Define the frequencies for the Battalion
|
||||
@@ -229,8 +229,8 @@ class BattalionInfo {
|
||||
};
|
||||
};
|
||||
|
||||
class Attack {
|
||||
callsign = CALLSIGN_ELEMENT(ECHO_CALLSIGN, ATTACK);
|
||||
class Armor {
|
||||
callsign = CALLSIGN_ELEMENT(ECHO_CALLSIGN, ARMOR);
|
||||
textColor = LVL4_TEXT_COLOR;
|
||||
frequencies[] = {
|
||||
{"Contact", {}, {FREQ_ECHO_GROUND, FREQ_ECHO_FLIGHT_CAS}},
|
||||
|
||||
44
defines/SignalColors.hpp
Normal file
44
defines/SignalColors.hpp
Normal file
@@ -0,0 +1,44 @@
|
||||
class SignalColors {
|
||||
class White {
|
||||
name = "White";
|
||||
hexCode = "#FFFFFF";
|
||||
usage = "Concealment, Light";
|
||||
itemExamples[] = {"SmokeShell", "1Rnd_Smoke_Grenade_shell", "ACE_Chemlight_White"};
|
||||
};
|
||||
class Green {
|
||||
name = "Green";
|
||||
hexCode = "#00FF00";
|
||||
usage = "Friendly Forces";
|
||||
itemExamples[] = {"SmokeShellGreen", "1Rnd_SmokeGreen_Grenade_shell", "Chemlight_green"};
|
||||
};
|
||||
class Blue {
|
||||
name = "Blue";
|
||||
hexCode = "#0000FF";
|
||||
usage = "LZ Marking";
|
||||
itemExamples[] = {"SmokeShellBlue", "1Rnd_SmokeBlue_Grenade_shell", "Chemlight_blue"};
|
||||
};
|
||||
class Red {
|
||||
name = "Red";
|
||||
hexCode = "#FF0000";
|
||||
usage = "Enemy Location";
|
||||
itemExamples[] = {"SmokeShellRed", "1Rnd_SmokeRed_Grenade_shell", "Chemlight_red"};
|
||||
};
|
||||
class Orange {
|
||||
name = "Orange";
|
||||
hexCode = "#FFA500";
|
||||
usage = "Resupply Marker";
|
||||
itemExamples[] = {"SmokeShellOrange", "1Rnd_SmokeOrange_Grenade_shell", "ACE_Chemlight_Orange"};
|
||||
};
|
||||
class Yellow {
|
||||
name = "Yellow";
|
||||
hexCode = "#FFFF00";
|
||||
usage = "Medical Emergency";
|
||||
itemExamples[] = {"SmokeShellYellow", "1Rnd_SmokeYellow_Grenade_shell", "Chemlight_yellow"};
|
||||
};
|
||||
class Purple {
|
||||
name = "Purple";
|
||||
hexCode = "#800080";
|
||||
usage = "Broken Arrow - 100m radius";
|
||||
itemExamples[] = {"SmokeShellPurple", "1Rnd_SmokePurple_Grenade_shell"};
|
||||
};
|
||||
};
|
||||
@@ -125,5 +125,40 @@ class VehicleFlags {
|
||||
texture = "textures\flags_misc\flag_redcross_co.paa";
|
||||
};
|
||||
};
|
||||
|
||||
class BuiltIn {
|
||||
actionID = "flag_builtin";
|
||||
actionTitle = "Built-In";
|
||||
class BlueFlag {
|
||||
actionID = "flag_builtin_blue";
|
||||
actionTitle = "Blue Flag";
|
||||
texture = "\A3\Data_F\Flags\flag_blue_CO.paa";
|
||||
};
|
||||
class GreenFlag {
|
||||
actionID = "flag_builtin_green";
|
||||
actionTitle = "Green Flag";
|
||||
texture = "\A3\Data_F\Flags\flag_green_CO.paa";
|
||||
};
|
||||
class RedFlag {
|
||||
actionID = "flag_builtin_red";
|
||||
actionTitle = "Red Flag";
|
||||
texture = "\A3\Data_F\Flags\flag_red_CO.paa";
|
||||
};
|
||||
class WhiteFlag {
|
||||
actionID = "flag_builtin_white";
|
||||
actionTitle = "White Flag";
|
||||
texture = "\A3\Data_F\Flags\flag_white_CO.paa";
|
||||
};
|
||||
class NATOFlag {
|
||||
actionID = "flag_builtin_nato";
|
||||
actionTitle = "NATO Flag";
|
||||
texture = "\A3\Data_F\Flags\flag_NATO_CO.paa";
|
||||
};
|
||||
class UNFlag {
|
||||
actionID = "flag_builtin_un";
|
||||
actionTitle = "UN Flag";
|
||||
texture = "\A3\Data_F\Flags\Flag_uno_CO.paa";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -17,11 +17,13 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "mission_settings.hpp"
|
||||
#include "framework\script_mod.hpp"
|
||||
#include "defines\ApprovedAssets.hpp"
|
||||
#include "defines\BattalionInfo.hpp"
|
||||
#include "defines\DisallowedEquipment.hpp"
|
||||
#include "defines\SupplyCrates.hpp"
|
||||
#include "defines\VehicleFlags.hpp"
|
||||
#include "defines\SignalColors.hpp"
|
||||
|
||||
//-------------------------------------------MISSION INFO--------------------------------------------------------------------
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -92,10 +94,9 @@ class Params
|
||||
};
|
||||
|
||||
|
||||
class cfgFunctions
|
||||
{
|
||||
#include "functions\CfgFunctions.hpp"
|
||||
};
|
||||
// CfgFunctions
|
||||
#include "framework\CfgFunctions.hpp"
|
||||
|
||||
|
||||
|
||||
class CfgDebriefingSections {
|
||||
|
||||
180
framework/CfgFunctions.hpp
Normal file
180
framework/CfgFunctions.hpp
Normal file
@@ -0,0 +1,180 @@
|
||||
#include "script_mod.hpp"
|
||||
|
||||
class CfgFunctions {
|
||||
|
||||
class DOUBLES(PREFIX,init) {
|
||||
class functions {
|
||||
file = "framework\init\functions";
|
||||
class initServer { postInit = 1;};
|
||||
class initClient { postInit = 1;};
|
||||
class setDefaults { postInit = 1; };
|
||||
class addAARChatHandler { postInit = 1; };
|
||||
class addRespawnChatHandler { postInit = 1; };
|
||||
};
|
||||
};
|
||||
|
||||
class PREFIX {
|
||||
class ambience {
|
||||
file = "framework\ambience";
|
||||
class flakInitVehicle {};
|
||||
class flakEH {};
|
||||
};
|
||||
};
|
||||
|
||||
class DOUBLES(PREFIX,client) {
|
||||
class functions {
|
||||
file = "framework\client\functions";
|
||||
class bindEmptyGroupGarbageCleanup { postInit = 1; };
|
||||
class bindEventHandlers { postInit = 1; };
|
||||
class bindVehicleActions { postInit = 1; };
|
||||
class addZenModules {postInit = 1;};
|
||||
};
|
||||
};
|
||||
|
||||
class DOUBLES(PREFIX,common) {
|
||||
class functions {
|
||||
file = "framework\common\functions";
|
||||
class addCBASettings { preInit = 1; };
|
||||
class logMissionInfo {};
|
||||
class addPlayerInfoToArray {};
|
||||
class createOrUpdateDiaryRecord {};
|
||||
class getApprovedAssetsCfg {};
|
||||
class getBattalionCfg {};
|
||||
class getNameOfBase {};
|
||||
class getNearestBase {};
|
||||
class log {};
|
||||
class checkPlayerInventory {};
|
||||
class logSettingChanged {};
|
||||
class padString {};
|
||||
class recurseSubclasses {};
|
||||
};
|
||||
};
|
||||
|
||||
class DOUBLES(PREFIX,fbcb2_assets) {
|
||||
class functions {
|
||||
file = "framework\fbcb2_assets\functions";
|
||||
class addCBASettings {preInit=1;};
|
||||
class initServer {};
|
||||
class initClient {};
|
||||
class getCallsignFromClassname {};
|
||||
class getCurrentAssetsByBase {};
|
||||
class getInventory {};
|
||||
class getMagsForWeapon {};
|
||||
class getStartingAndCurrentAssets {};
|
||||
class getStartingAssetsByBase {};
|
||||
class getVehicleData {};
|
||||
class getWeaponry {};
|
||||
class hintAllApprovedAssets {};
|
||||
class isAssetInRangeOfBase {};
|
||||
class removeAssetDiaryRecords {};
|
||||
class removeMarkersOnMap {};
|
||||
class showMarkersOnMap {};
|
||||
class updateAssetDiary {};
|
||||
class updateAssetsByBase {};
|
||||
};
|
||||
};
|
||||
|
||||
class DOUBLES(PREFIX,fbcb2_main) {
|
||||
class functions {
|
||||
file = "framework\fbcb2_main\functions";
|
||||
class initClient {};
|
||||
class addEnvironmentRecord {};
|
||||
class addFrequenciesRecord {};
|
||||
class addSignalColorsRecord {};
|
||||
};
|
||||
class util {
|
||||
file = "framework\fbcb2_main\util";
|
||||
class formatRadioElementForDiary {};
|
||||
class generateElementFrequencyRecordText {};
|
||||
};
|
||||
};
|
||||
|
||||
class DOUBLES(PREFIX,mapcopy) {
|
||||
class functions {
|
||||
file = "framework\mapcopy\functions";
|
||||
class addCBASettings {preInit=1;};
|
||||
class initClient {};
|
||||
class getMapMarkers {};
|
||||
class loadMapMarkers {};
|
||||
class mapMarkerToString {};
|
||||
class stringToMapMarker {};
|
||||
};
|
||||
};
|
||||
|
||||
class DOUBLES(PREFIX,performance) {
|
||||
class functions {
|
||||
file = "framework\performance\functions";
|
||||
class addCBASettings {preInit=1;};
|
||||
class addDNI_PlayerFPS { postInit = 1; };
|
||||
|
||||
// PFHs managed in addCBASettings onChange code
|
||||
class addClientStatsPFH {};
|
||||
class calculateClientStats {};
|
||||
class addServerStatsPFH {};
|
||||
class calculateServerStats {};
|
||||
};
|
||||
};
|
||||
|
||||
class DOUBLES(PREFIX,reinsert) {
|
||||
class functions {
|
||||
file = "framework\reinsert\functions";
|
||||
class addCBASettings {preInit=1;};
|
||||
};
|
||||
class server {
|
||||
file = "framework\reinsert\server";
|
||||
class initServer {};
|
||||
class addToQueue {};
|
||||
class globalShowQueue {};
|
||||
class removeFromQueue {};
|
||||
class returnReinsertQueueNotification {};
|
||||
class validateQueue {};
|
||||
};
|
||||
class client {
|
||||
file = "framework\reinsert\client";
|
||||
class initClient {};
|
||||
class addAceSelfActions {};
|
||||
class addCheckQueueSelfAction {};
|
||||
class requestShowQueue {};
|
||||
};
|
||||
};
|
||||
|
||||
class DOUBLES(PREFIX,resupply) {
|
||||
class functions {
|
||||
file = "framework\resupply\functions";
|
||||
class addCBASettings {preInit=1;};
|
||||
class initClient {};
|
||||
class createBox {};
|
||||
class getSupplyCratesCfg {};
|
||||
class addArsenalObjectSpawnBoxActions {};
|
||||
};
|
||||
};
|
||||
|
||||
class DOUBLES(PREFIX,triageIcons) {
|
||||
class functions {
|
||||
file = "framework\triageIcons\functions";
|
||||
class addCBASettings {preInit=1;};
|
||||
class initClient {};
|
||||
class addDrawIconsPFH {};
|
||||
class addGetEntitiesPFH {};
|
||||
class updateColors {};
|
||||
};
|
||||
};
|
||||
|
||||
class DOUBLES(PREFIX,vehicleFlags) {
|
||||
class functions {
|
||||
file = "framework\vehicleFlags\functions";
|
||||
class initClient {};
|
||||
class getActionsFlagCategories {};
|
||||
class getVehicleFlagsCfg {};
|
||||
class isClassExcluded {};
|
||||
};
|
||||
};
|
||||
|
||||
class DOUBLES(PREFIX,zeus) {
|
||||
class functions {
|
||||
file = "framework\zeus\functions";
|
||||
class initClient {};
|
||||
class addZenModules {};
|
||||
};
|
||||
};
|
||||
};
|
||||
41
framework/client/functions/fn_addZenModules.sqf
Normal file
41
framework/client/functions/fn_addZenModules.sqf
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
[
|
||||
QUOTE(MODULE_CATEGORY_NAME),
|
||||
"Grounds Cleanup",
|
||||
{
|
||||
params [["_pos", [0,0,0], [[]], 3], ["_target", objNull, [objNull]]];
|
||||
|
||||
_pos = [_pos#0, _pos#1, 0];
|
||||
|
||||
[
|
||||
"Cleanup Area",
|
||||
[
|
||||
[ "SLIDER:RADIUS", "Radius (meters)", [50, 500, 100, 0, _pos, [0.8, 0.2, 0.2, 1.0]], true ]
|
||||
],
|
||||
{
|
||||
|
||||
params ["_dialog", "_args"];
|
||||
|
||||
_dialog params ["_radius"];
|
||||
_args params ["_pos", "_target"];
|
||||
|
||||
_objects = _pos nearObjects ["GroundWeaponHolder", _radius];
|
||||
{
|
||||
deleteVehicle _x;
|
||||
} forEach _objects
|
||||
|
||||
},
|
||||
{},
|
||||
[_pos, _target]
|
||||
] call zen_dialog_fnc_create;
|
||||
|
||||
}
|
||||
] call zen_custom_modules_fnc_register;
|
||||
|
||||
|
||||
diag_log text "[MILSIM] (client) zeus modules added";
|
||||
|
||||
nil;
|
||||
@@ -0,0 +1,43 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"Initializing empty group deletion PFH",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
_emptyGroupPFH = [
|
||||
{
|
||||
{
|
||||
if (local _x) then {
|
||||
if ((count units _x) == 0) then {
|
||||
deleteGroup _x;
|
||||
};
|
||||
};
|
||||
} forEach allGroups;
|
||||
},
|
||||
300,
|
||||
[],
|
||||
{
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"Empty group deletion PFH loaded",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
},
|
||||
{ [
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"Empty group deletion PFH unloaded",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
},
|
||||
{ true },
|
||||
{ false },
|
||||
[]
|
||||
] call CBA_fnc_createPerFrameHandlerObject;
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
player addEventHandler["Respawn",
|
||||
@@ -6,10 +8,11 @@ player addEventHandler["Respawn",
|
||||
private _killer = _corpse getVariable ["ace_medical_causeOfDeath", "#scripted"];
|
||||
if (_killer == "respawn_button") then {
|
||||
[
|
||||
"client",
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"RESPAWNED WHILE UNCONSCIOUS",
|
||||
[_unit] call milsim_fnc_addPlayerInfoToArray
|
||||
] remoteExec ["milsim_fnc_log", 2];
|
||||
[_unit] call EFUNC(common,addPlayerInfoToArray)
|
||||
] remoteExec [QEFUNC(common,log), 2];
|
||||
// format["%1 was unconscious then clicked the respawn button", name _unit] remoteExec["systemChat", 0];
|
||||
};
|
||||
}
|
||||
@@ -43,11 +46,11 @@ addMissionEventHandler ["HandleChatMessage",
|
||||
|
||||
|
||||
["ace_arsenal_displayClosed", {
|
||||
[player] remoteExec ["milsim_fnc_logPlayerInventory", 2];
|
||||
[player] remoteExec [QEFUNC(common,checkPlayerInventory), 2];
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
[missionNamespace, "arsenalClosed", {
|
||||
[player] remoteExec ["milsim_fnc_logPlayerInventory", 2];
|
||||
[player] remoteExec [QEFUNC(common,checkPlayerInventory), 2];
|
||||
}] call BIS_fnc_addScriptedEventHandler;
|
||||
|
||||
diag_log text "[MILSIM] (client) event handlers bound";
|
||||
@@ -56,7 +56,7 @@ _patchTire =
|
||||
"Patching"
|
||||
] call ace_common_fnc_progressBar
|
||||
},
|
||||
{ ( alive _target ) && ( [_player, "ToolKit"] call ace_common_fnc_hasItem ) && ( getDammage _target > 0.2 ) && ( _target getVariable["milsim_ace_repair_wheel_canPatch", true] ) }
|
||||
{ ( alive _target ) && ( [_player, "ToolKit"] call ace_common_fnc_hasItem ) && ( damage _target > 0.2 ) && ( _target getVariable["milsim_ace_repair_wheel_canPatch", true] ) }
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
["ACE_Wheel", 0, ["ACE_MainActions"], _patchTire, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
3
framework/client/script_component.hpp
Normal file
3
framework/client/script_component.hpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#define COMPONENT client
|
||||
#define COMPONENT_BEAUTIFIED Client
|
||||
#include "../script_mod.hpp"
|
||||
27
framework/common/functions/fn_addCBASettings.sqf
Normal file
27
framework/common/functions/fn_addCBASettings.sqf
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
//---------------------
|
||||
// Side Chat
|
||||
//---------------------
|
||||
|
||||
[
|
||||
QGVARMAIN(sideChat),
|
||||
"CHECKBOX",
|
||||
"Side Chat Text Enabled",
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)],
|
||||
false, // default value
|
||||
true, // requires restart
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVARMAIN(sideChat),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[QGVARMAIN(sideChat), false] call CBA_settings_fnc_set;
|
||||
|
||||
diag_log text "[MILSIM] (settings) Custom CBA settings initialized";
|
||||
|
||||
nil;
|
||||
@@ -1,4 +1,6 @@
|
||||
params [["_playerObj", objNull], ["_arrayToModify", [], [[]]]];
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [["_playerObj", objNull, [nil, objNull]], ["_arrayToModify", [], [[]]]];
|
||||
|
||||
if (isNull _playerObj) exitWith {_arrayToModify};
|
||||
|
||||
@@ -8,7 +10,7 @@ if (isNull _playerObj) exitWith {_arrayToModify};
|
||||
["playerName", name _playerObj],
|
||||
["playerUID", getPlayerUID _playerObj],
|
||||
["playerGroup", groupId (group _playerObj)],
|
||||
["playerNetID", [_playerObj] call BIS_fnc_netId]
|
||||
["playerNetID", _playerObj call BIS_fnc_netId]
|
||||
];
|
||||
|
||||
_arrayToModify;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Function: milsim_fnc_logPlayerInventory
|
||||
Function: milsim_common_fnc_checkPlayerInventory
|
||||
|
||||
Description:
|
||||
Checks a player's inventory for non-compliant items and logs results to all machines.
|
||||
@@ -13,16 +13,19 @@
|
||||
<ARRAY> - Array of strings to be logged.
|
||||
|
||||
*/
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [
|
||||
["_player", objNull, [objNull]]
|
||||
];
|
||||
|
||||
if (!isPlayer _player) exitWith {
|
||||
[
|
||||
"logPlayerInventory",
|
||||
LEVEL_ERROR,
|
||||
QUOTE(COMPONENT),
|
||||
"PARAM PLAYER IS NOT A PLAYER",
|
||||
[["player", _player]]
|
||||
] call milsim_fnc_log;
|
||||
] call EFUNC(common,log);
|
||||
};
|
||||
|
||||
// testing
|
||||
@@ -53,10 +56,11 @@ _playerItems pushBack (uniform _player);
|
||||
|
||||
|
||||
[
|
||||
"logPlayerInventory",
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
"CHECKING PLAYER INVENTORY",
|
||||
[_player] call milsim_fnc_addPlayerInfoToArray
|
||||
] call milsim_fnc_log;
|
||||
[_player] call EFUNC(common,addPlayerInfoToArray)
|
||||
] call EFUNC(common,log);
|
||||
|
||||
////////////////////////////////////////
|
||||
// HARDCODED DISALLOWED ITEMS - see functions/definitions/DisallowedEquipment.hpp
|
||||
@@ -115,10 +119,11 @@ private _thermalItems = _playerItems select {
|
||||
// Only log compliance message if no non-compliant items were found
|
||||
if (count _allFoundItemsSoFar isEqualTo 0) exitWith {
|
||||
[
|
||||
"logPlayerInventory",
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"PLAYER INVENTORY IS COMPLIANT",
|
||||
[_player] call milsim_fnc_addPlayerInfoToArray
|
||||
] call milsim_fnc_log;
|
||||
[_player] call EFUNC(common,addPlayerInfoToArray)
|
||||
] call EFUNC(common,log);
|
||||
};
|
||||
|
||||
// Log all non-compliant items
|
||||
@@ -132,13 +137,14 @@ if (count _allFoundItemsSoFar isEqualTo 0) exitWith {
|
||||
private _itemConfig = _itemClassName call CBA_fnc_getItemConfig;
|
||||
// Log to RPT
|
||||
[
|
||||
"logPlayerInventory",
|
||||
LEVEL_WARNING,
|
||||
QUOTE(COMPONENT),
|
||||
"NON-COMPLIANT ITEM",
|
||||
[_player, [
|
||||
["category", _categoryLabel],
|
||||
["className", _itemClassName],
|
||||
["displayName", [_itemConfig] call BIS_fnc_displayName]
|
||||
]] call milsim_fnc_addPlayerInfoToArray
|
||||
] call milsim_fnc_log;
|
||||
]] call EFUNC(common,addPlayerInfoToArray)
|
||||
] call EFUNC(common,log);
|
||||
} forEach _items;
|
||||
} forEach _foundItemsKeyValue;
|
||||
58
framework/common/functions/fn_createOrUpdateDiaryRecord.sqf
Normal file
58
framework/common/functions/fn_createOrUpdateDiaryRecord.sqf
Normal file
@@ -0,0 +1,58 @@
|
||||
#include "../script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
params [
|
||||
["_subjectID", "", [""]],
|
||||
["_recordTitle", "", [""]],
|
||||
["_recordText", "", [""]],
|
||||
["_recordIcon", "", [""]]
|
||||
];
|
||||
|
||||
// Check if all parameters are provided
|
||||
if (
|
||||
count _subjectID isEqualTo 0 ||
|
||||
count _recordTitle isEqualTo 0 ||
|
||||
count _recordText isEqualTo 0
|
||||
) exitWith {
|
||||
[LEVEL_ERROR, QUOTE(COMPONENT), "Not all parameters provided"] call EFUNC(common,log);
|
||||
};
|
||||
|
||||
// Check if already created
|
||||
private _subjectRecords = GVAR(diaryRecords) getOrDefault [_subjectID, createHashMap, true];
|
||||
private _existingRecord = _subjectRecords getOrDefault [_recordTitle, diaryRecordNull, true];
|
||||
|
||||
if (!isNull _existingRecord) then {
|
||||
player setDiaryRecordText [[_subjectID, _existingRecord], [_recordTitle, _recordText, _recordIcon]];
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
format ["Updated diary record: %1", _recordTitle],
|
||||
[
|
||||
["subjectID", _subjectID],
|
||||
["recordTitle", _recordTitle]
|
||||
]
|
||||
] call EFUNC(common,log);
|
||||
} else {
|
||||
private _new = player createDiaryRecord [
|
||||
_subjectID,
|
||||
[
|
||||
_recordTitle,
|
||||
_recordText,
|
||||
_recordIcon
|
||||
]
|
||||
];
|
||||
_subjectRecords set [_recordTitle, _new];
|
||||
GVAR(diaryRecords) set [_subjectID, _subjectRecords];
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
format ["Created diary record: %1", _recordTitle],
|
||||
[
|
||||
["subjectID", _subjectID],
|
||||
["recordTitle", _recordTitle]
|
||||
]
|
||||
] call EFUNC(common,log);
|
||||
};
|
||||
15
framework/common/functions/fn_getApprovedAssetsCfg.sqf
Normal file
15
framework/common/functions/fn_getApprovedAssetsCfg.sqf
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "../script_component.hpp"
|
||||
|
||||
private _approvedAssetsCfg = (missionConfigFile >> "ApprovedAssets");
|
||||
|
||||
if (!IS_CONFIG(_approvedAssetsCfg) || {!isClass _approvedAssetsCfg}) exitWith {
|
||||
[
|
||||
LEVEL_ERROR,
|
||||
QUOTE(COMPONENT),
|
||||
"ERROR: Approved assets config not found. Check that the config is present and correctly named in the mission config file. See defines/ApprovedAssets.hpp and framework/util/functions/getApprovedAssetsCfg.sqf.",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
configNull;
|
||||
};
|
||||
|
||||
_approvedAssetsCfg;
|
||||
15
framework/common/functions/fn_getBattalionCfg.sqf
Normal file
15
framework/common/functions/fn_getBattalionCfg.sqf
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "../script_component.hpp"
|
||||
|
||||
private _battalionInfoCfg = (missionConfigFile >> "BattalionInfo");
|
||||
|
||||
if (!IS_CONFIG(_battalionInfoCfg) || {!isClass _battalionInfoCfg}) exitWith {
|
||||
[
|
||||
LEVEL_ERROR,
|
||||
QUOTE(COMPONENT),
|
||||
"ERROR: Battalion config not found. Check that the battalion config is present and correctly named in the mission config file. See defines/BattalionInfo.hpp and framework/util/functions/getBattalionCfg.sqf.",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
configNull;
|
||||
};
|
||||
|
||||
_battalionInfoCfg;
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [["_base", objNull, [objNull]]];
|
||||
if (_base == objNull) exitWith {""};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [["_object", objNull, [objNull]]];
|
||||
if (isNull _object) exitWith {objNull};
|
||||
|
||||
33
framework/common/functions/fn_log.sqf
Normal file
33
framework/common/functions/fn_log.sqf
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
Function: milsim_common_fnc_log
|
||||
|
||||
Description:
|
||||
Used to log messages to the server RPT file.
|
||||
|
||||
Parameters:
|
||||
0: NUMBER - log level.
|
||||
1: STRING - component name.
|
||||
2: STRING - message to log.
|
||||
3: ARRAY - key value pairs of data to log.
|
||||
*/
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [
|
||||
["_logLevel", 1, [-1,0,1,2,3]], // script_mod.hpp
|
||||
["_component", "", [""]],
|
||||
["_message", "", [""]],
|
||||
["_data", [], [[]]]
|
||||
];
|
||||
|
||||
if (_logLevel < DEBUG_MODE) exitWith {};
|
||||
|
||||
private _hash = createHashMapFromArray _data;
|
||||
|
||||
// Replace square brackets with round brackets to avoid parsing issues.
|
||||
_message regexReplace ['(\[)', "("];
|
||||
_message regexReplace ['(\])', ")"];
|
||||
|
||||
private _json = [_hash] call CBA_fnc_encodeJSON;
|
||||
_log = format ["[%1] [%2] [%3] [%4] :: %5", QUOTE(PREFIX), _component, _fnc_scriptNameParent, _message, _json];
|
||||
|
||||
diag_log text _log;
|
||||
@@ -1,5 +1,8 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
[
|
||||
"init",
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"MISSION INFO",
|
||||
[
|
||||
["serverName", serverName],
|
||||
@@ -20,4 +23,4 @@
|
||||
["LOGIC", playableSlotsNumber sideLogic] // 5 is LOGIC side
|
||||
]]
|
||||
]
|
||||
] call milsim_fnc_log;
|
||||
] call FUNC(log);
|
||||
16
framework/common/functions/fn_logSettingChanged.sqf
Normal file
16
framework/common/functions/fn_logSettingChanged.sqf
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [
|
||||
["_settingName", "", [""]],
|
||||
"_newValue"
|
||||
];
|
||||
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"SETTING CHANGED",
|
||||
[
|
||||
["setting", _settingName],
|
||||
["newValue", _value]
|
||||
]
|
||||
] call EFUNC(common,log);
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [
|
||||
["_text", "", [""]],
|
||||
["_padSide", "left", ["left", "right"]],
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [
|
||||
["_cfg", configNull, [configNull]],
|
||||
["_code", {}, [{}]]
|
||||
3
framework/common/script_component.hpp
Normal file
3
framework/common/script_component.hpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#define COMPONENT common
|
||||
#define COMPONENT_BEAUTIFIED Common
|
||||
#include "../script_mod.hpp"
|
||||
27
framework/fbcb2_assets/functions/fn_addCBASettings.sqf
Normal file
27
framework/fbcb2_assets/functions/fn_addCBASettings.sqf
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
//---------------------
|
||||
// Asset Diary and Markers Settings
|
||||
|
||||
[
|
||||
QGVAR(setting_detectionRangeFromBase), // variable
|
||||
"SLIDER", // type
|
||||
["Detection Range From Base", "The range from a base that assets will be detected"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
[0, 1000, 750, 0, false], // [_min, _max, _default, _trailingDecimals, _isPercentage]
|
||||
true, // global setting
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_detectionRangeFromBase),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"CREATED SETTINGS",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
@@ -0,0 +1,15 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [
|
||||
["_className", "", [""]]
|
||||
];
|
||||
|
||||
// Get the approved assets config
|
||||
private _approvedAssetsCfg = call EFUNC(common,getApprovedAssetsCfg);
|
||||
if (isNull _approvedAssetsCfg) exitWith {""};
|
||||
|
||||
// Get the asset definition
|
||||
private _assetDef = (_approvedAssetsCfg >> _className);
|
||||
if (isClass _assetDef) exitWith {getText(_assetDef >> "callsign")};
|
||||
|
||||
"";
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "../script_component.hpp"
|
||||
|
||||
// return each base with its assets
|
||||
GVARMAIN(baseObjects) apply {
|
||||
[_x, _x getVariable [QGVAR(assetsAtThisBase), []]]
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
// get all starting assets at each base and combine to array
|
||||
private _startingAssetsByBase = call FUNC(getStartingAssetsByBase);
|
||||
private _startingAssets = [];
|
||||
{
|
||||
_startingAssets append (_x#1);
|
||||
} forEach _startingAssetsByBase;
|
||||
|
||||
// get all current assets at each base and combine to array
|
||||
private _assetsByBase = call FUNC(getCurrentAssetsByBase);
|
||||
private _assets = [];
|
||||
{
|
||||
_assets append (_x#1);
|
||||
} forEach _assetsByBase;
|
||||
|
||||
[_startingAssets, _assets];
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "../script_component.hpp"
|
||||
|
||||
// return each base with its assets
|
||||
GVARMAIN(baseObjects) apply {
|
||||
[_x, _x getVariable [QGVAR(assetsStartedAtThisBase), []]]
|
||||
};
|
||||
@@ -39,7 +39,7 @@ private _pylons = getAllPylonsInfo _vic;
|
||||
///////////////////////////////////////////////
|
||||
// WRITE TITLE
|
||||
///////////////////////////////////////////////
|
||||
_title pushBack format["<font size='24' shadow='1' color='#e1701a' face='PuristaBold'>%1</font>", _dispName];
|
||||
_title pushBack format["%1", _dispName];
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// WRITE IMAGE
|
||||
@@ -0,0 +1,94 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
// get vehicles the mission started with at base locations
|
||||
(call FUNC(getStartingAndCurrentAssets)) params [
|
||||
"_startingAssets",
|
||||
"_currentAssets"
|
||||
];
|
||||
|
||||
// get distinct classnames to group by
|
||||
private _distinctStartingAssetsClassNames = [];
|
||||
{
|
||||
_x params ["_netId", "_cfg"];
|
||||
private _className = configName _cfg;
|
||||
_distinctStartingAssetsClassNames pushBackUnique _className;
|
||||
} forEach _startingAssets;
|
||||
|
||||
// get the approved assets config to identify callsigns
|
||||
private _approvedAssetsCfg = call EFUNC(common,getApprovedAssetsCfg);
|
||||
if (isNull _approvedAssetsCfg) exitWith {
|
||||
[
|
||||
LEVEL_ERROR,
|
||||
QUOTE(COMPONENT),
|
||||
"No approved assets defined.",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
[
|
||||
"ERROR: No approved assets defined. See defines/ApprovedAssets.hpp"
|
||||
] call BIS_fnc_error;
|
||||
};
|
||||
|
||||
_text = parseText "<t size='4'>MESSAGE</t>";
|
||||
_text = composeText [_text, lineBreak ];
|
||||
|
||||
_text = composeText [_text, parseText "<t align='left' size='2'>Asset</t><t align='right' size='2'>Available</t>", lineBreak ];
|
||||
|
||||
{
|
||||
private _className = _x;
|
||||
// only approved assets
|
||||
if (!isClass (_approvedAssetsCfg >> _className)) then {continue};
|
||||
|
||||
private _callsign = [_className] call FUNC(getCallsignFromClassname);
|
||||
|
||||
private _startingAssetsOfThisType = _startingAssets select {
|
||||
// select all starting assets of this type
|
||||
_x params ["_netId", "_cfg"];
|
||||
_className isEqualTo (configName _cfg);
|
||||
};
|
||||
private _currentAssetsOfThisType = _currentAssets select {
|
||||
_x params ["_netId", "_cfg"];
|
||||
private _object = _netId call BIS_fnc_objectFromNetId;
|
||||
// objNull if deleted, then check classname and if alive
|
||||
!isNull _object && {
|
||||
_className isEqualTo (typeOf _object) &&
|
||||
alive _object
|
||||
};
|
||||
};
|
||||
|
||||
(_startingAssetsOfThisType#0) params [
|
||||
"_assetNetId",
|
||||
"_assetCfg"
|
||||
];
|
||||
|
||||
_assigned = count _startingAssetsOfThisType;
|
||||
_available = count _currentAssetsOfThisType;
|
||||
// count (getMarkerPos "respawn_west" nearEntities [ _asset, 2000] );
|
||||
|
||||
|
||||
_image = getText(_assetCfg >> "picture");
|
||||
|
||||
_name = getText(_assetCfg >> "displayName") select [0, 22];
|
||||
private _data = format[
|
||||
"<img size='1' align='left' image='%1'/><t size='1' align='left'> %2</t><t size='1' align='right'>%3 [ %4 ]</t>",
|
||||
_image,
|
||||
_name,
|
||||
_available,
|
||||
_assigned
|
||||
];
|
||||
|
||||
// private _data = format[
|
||||
// "<img size='1' align='left' image='%1'/>
|
||||
// <t size='1' align='left'> %2</t>
|
||||
// <t size='1' align='middle'>%3</t>
|
||||
// <t size='1' align='right'>%4</t>",
|
||||
// _image,
|
||||
// _name,
|
||||
// _assigned,
|
||||
// _available
|
||||
// ];
|
||||
_text = composeText[ _text, parseText _data, lineBreak ];
|
||||
|
||||
|
||||
} foreach _distinctStartingAssetsClassNames;
|
||||
|
||||
hint _text;
|
||||
28
framework/fbcb2_assets/functions/fn_initClient.sqf
Normal file
28
framework/fbcb2_assets/functions/fn_initClient.sqf
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
call FUNC(updateAssetDiary);
|
||||
|
||||
// once the server has published that assets have been gathered and distributed to bases (respawn modules),
|
||||
// we can update the asset diary on our end using that data
|
||||
[QGVAR(assetsGathered), {
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
"Received gathered base asset data from server",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
// update the asset diary with the data we've received
|
||||
FUNC(updateAssetDiary);
|
||||
}] call CBA_fnc_addEventHandlerArgs;
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
"initClient complete",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
localNamespace setVariable [QGVAR(complete), true];
|
||||
29
framework/fbcb2_assets/functions/fn_initServer.sqf
Normal file
29
framework/fbcb2_assets/functions/fn_initServer.sqf
Normal file
@@ -0,0 +1,29 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
// init asset stores at bases
|
||||
[true] call FUNC(updateAssetsByBase);
|
||||
|
||||
// starting 5 minutes after postInit, update asset stores every 5 minutes
|
||||
[{
|
||||
[
|
||||
{[false] call FUNC(updateAssetsByBase);},
|
||||
60*5
|
||||
] call CBA_fnc_addPerFrameHandler;
|
||||
}, 60*5] call CBA_fnc_waitAndExecute;
|
||||
|
||||
|
||||
// add end mission EH
|
||||
addMissionEventHandler ["MPEnded", {
|
||||
// log the "current" asset counts to RPT
|
||||
[false, true] call FUNC(updateAssetsByBase);
|
||||
}];
|
||||
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
"postInit complete",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
@@ -0,0 +1,8 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [["_asset", objNull, [objNull]]];
|
||||
|
||||
private _closestBase = [_asset] call EFUNC(common,getNearestBase);
|
||||
if (isNull _closestBase) exitWith {false};
|
||||
|
||||
(_asset distance2D _closestBase) <= GVAR(setting_detectionRangeFromBase)
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
{
|
||||
@@ -10,7 +12,7 @@ if (!hasInterface) exitWith {};
|
||||
player removeDiaryRecord [_diarySubject, _diaryRecord];
|
||||
} forEach _records;
|
||||
} forEach [
|
||||
milsim_fbcb2_subjectAssetsFixedWingID,
|
||||
milsim_fbcb2_subjectAssetsRotaryID,
|
||||
milsim_fbcb2_subjectAssetsGroundID
|
||||
EGVAR(fbcb2_main,subjectAssetsFixedWingID),
|
||||
EGVAR(fbcb2_main,subjectAssetsRotaryID),
|
||||
EGVAR(fbcb2_main,subjectAssetsGroundID)
|
||||
];
|
||||
@@ -1,12 +1,11 @@
|
||||
private _baseMarkerStoreVar = "milsim_fbcb2_assets_baseMarkerStore";
|
||||
private _assetMarkerStoreVar = "milsim_fbcb2_assets_assetMarkerStore";
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
private _baseMarkerStore = localNamespace getVariable [
|
||||
_baseMarkerStoreVar,
|
||||
QGVAR(baseMarkerStore),
|
||||
[]
|
||||
];
|
||||
private _assetMarkerStore = localNamespace getVariable [
|
||||
_assetMarkerStoreVar,
|
||||
QGVAR(assetMarkerStore),
|
||||
[]
|
||||
];
|
||||
|
||||
@@ -16,10 +15,10 @@ private _assetMarkerStore = localNamespace getVariable [
|
||||
} forEach (_baseMarkerStore + _assetMarkerStore);
|
||||
|
||||
localNamespace setVariable [
|
||||
_baseMarkerStoreVar,
|
||||
QGVAR(baseMarkerStore),
|
||||
[]
|
||||
];
|
||||
localNamespace setVariable [
|
||||
_assetMarkerStoreVar,
|
||||
QGVAR(assetMarkerStore),
|
||||
[]
|
||||
];
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [
|
||||
["_className", "", [""]],
|
||||
["_markerType", "hd_dot", [""]],
|
||||
@@ -12,11 +14,11 @@ if (count _markerColor isEqualTo 0) exitWith {
|
||||
["No marker color provided!"] call BIS_fnc_error;
|
||||
};
|
||||
if (count _assetObjects isEqualTo 0) exitWith {
|
||||
["No vehicles provided!"] call BIS_fnc_error;
|
||||
["No vehicles to draw markers for!"] call BIS_fnc_error;
|
||||
};
|
||||
|
||||
private _baseMarkerStoreVar = "milsim_fbcb2_assets_baseMarkerStore";
|
||||
private _assetMarkerStoreVar = "milsim_fbcb2_assets_assetMarkerStore";
|
||||
private _baseMarkerStoreVar = QGVAR(baseMarkerStore);
|
||||
private _assetMarkerStoreVar = QGVAR(assetMarkerStore);
|
||||
|
||||
private _baseMarkerStore = localNamespace getVariable [
|
||||
_baseMarkerStoreVar,
|
||||
@@ -35,15 +37,15 @@ if (not (count _baseMarkerStore > 0)) then {
|
||||
|
||||
// create a circle marker with range as the detection range of assets
|
||||
_newMarker = createMarkerLocal [
|
||||
format["milsim_fbcb2_assets_base_marker_%1", _forEachIndex + 1],
|
||||
format["%1_%2", QGVAR(baseCircleMarker), _forEachIndex + 1],
|
||||
getPosASL _base
|
||||
];
|
||||
_newMarker setMarkerTypeLocal "mil_dot";
|
||||
_newMarker setMarkerColorLocal "ColorGreen";
|
||||
_newMarker setMarkerShapeLocal "ELLIPSE";
|
||||
_newMarker setMarkerSizeLocal [
|
||||
milsim_fbcb2_assets_setting_detectionRangeFromBase,
|
||||
milsim_fbcb2_assets_setting_detectionRangeFromBase
|
||||
GVAR(setting_detectionRangeFromBase),
|
||||
GVAR(setting_detectionRangeFromBase)
|
||||
];
|
||||
_newMarker setMarkerAlphaLocal 0.5;
|
||||
_newMarker setMarkerTextLocal str(_forEachIndex + 1);
|
||||
@@ -55,19 +57,19 @@ if (not (count _baseMarkerStore > 0)) then {
|
||||
|
||||
// create a flag marker at base position
|
||||
_newMarker = createMarkerLocal [
|
||||
format["milsim_fbcb2_assets_base_flag_marker_%1", _forEachIndex + 1],
|
||||
format["%1_%2", QGVAR(baseFlagMarker), _forEachIndex + 1],
|
||||
getPosASL _base
|
||||
];
|
||||
_newMarker setMarkerTypeLocal "mil_flag";
|
||||
_newMarker setMarkerColorLocal "ColorGreen";
|
||||
_newMarker setMarkerSizeLocal [0.7, 0.7];
|
||||
_newMarker setMarkerTextLocal ([_base] call milsim_fnc_getNameOfBase);
|
||||
_newMarker setMarkerTextLocal ([_base] call EFUNC(common,getNameOfBase));
|
||||
|
||||
_baseMarkerStore pushBack [
|
||||
_base,
|
||||
_newMarker
|
||||
];
|
||||
} forEach milsim_baseObjects;
|
||||
} forEach GVARMAIN(baseObjects);
|
||||
|
||||
localNamespace setVariable [_baseMarkerStoreVar, _baseMarkerStore];
|
||||
};
|
||||
@@ -85,9 +87,12 @@ private _start = (count _assetMarkerStore) + 1;
|
||||
> -1
|
||||
) then {continue};
|
||||
|
||||
// check if the asset is within base detection range
|
||||
if (not ([_asset] call FUNC(isAssetInRangeOfBase))) then {continue};
|
||||
|
||||
// create a marker for the asset
|
||||
private _newMarker = createMarkerLocal [
|
||||
format["milsim_fbcb2_assets_marker_%1", _start],
|
||||
format["%1_%2", QGVAR(assetMarker), _start],
|
||||
getPosASL _asset
|
||||
];
|
||||
_newMarker setMarkerAlphaLocal 1;
|
||||
261
framework/fbcb2_assets/functions/fn_updateAssetDiary.sqf
Normal file
261
framework/fbcb2_assets/functions/fn_updateAssetDiary.sqf
Normal file
@@ -0,0 +1,261 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
// create diary records
|
||||
|
||||
// remove any existing asset map markers
|
||||
call FUNC(removeMarkersOnMap);
|
||||
|
||||
// remove existing asset records
|
||||
call FUNC(removeAssetDiaryRecords);
|
||||
|
||||
(call FUNC(getStartingAndCurrentAssets)) params [
|
||||
"_startingAssets",
|
||||
"_currentAssets"
|
||||
];
|
||||
|
||||
// get distinct vehicle class names
|
||||
private _distinctVehiclesClassNames = [];
|
||||
{
|
||||
_x params ["_netId", "_cfg"];
|
||||
private _className = configName _cfg;
|
||||
_distinctVehiclesClassNames pushBackUnique _className;
|
||||
} forEach _startingAssets;
|
||||
|
||||
|
||||
// for random color cycling
|
||||
private _colorSelectionIndex = 0;
|
||||
private _randomColors = [
|
||||
["ColorRed", "#FF0000", "Red"],
|
||||
["ColorGreen", "#00FF00", "Green"],
|
||||
["ColorBlue", "#0000FF", "Blue"],
|
||||
["ColorYellow", "#FFFF00", "Yellow"],
|
||||
["ColorWhite", "#FFFFFF", "White"]
|
||||
];
|
||||
|
||||
// ForEach unique vehicle class name, we'll find the first and gather its info
|
||||
{
|
||||
private _className = _x;
|
||||
private _vehicleCallsign = toUpper (
|
||||
[_className] call FUNC(getCallsignFromClassname)
|
||||
);
|
||||
|
||||
// Get all starting assets of this type
|
||||
private _startingAssetsOfThisType = _startingAssets select {
|
||||
_x params ["_netId", "_cfg"];
|
||||
_className isEqualTo (configName _cfg);
|
||||
};
|
||||
// Get all current assets of this type
|
||||
private _currentAssetsOfThisType = _currentAssets select {
|
||||
_x params ["_netId", "_cfg"];
|
||||
private _object = _netId call BIS_fnc_objectFromNetId;
|
||||
// objNull if deleted, then check classname and if alive
|
||||
!isNull _object && {_className isEqualTo (typeOf _object) && alive _object};
|
||||
};
|
||||
// This should never happen, but...
|
||||
if (count _startingAssetsOfThisType isEqualTo 0) then {continue};
|
||||
|
||||
// Try to find a not null vehicle that can be processed
|
||||
private _exampleVehicleToProcess = objNull;
|
||||
private _assetCfg = configNull;
|
||||
|
||||
private _exampleVehicleToProcessIndex = _startingAssetsOfThisType findIf {
|
||||
_x params ["_netId", "_cfg"];
|
||||
!isNull (_netId call BIS_fnc_objectFromNetId);
|
||||
};
|
||||
// If found, get the data
|
||||
if (_exampleVehicleToProcessIndex > -1) then {
|
||||
private _exampleData = _startingAssetsOfThisType select _exampleVehicleToProcessIndex;
|
||||
_assetNetId = _exampleData#0;
|
||||
_assetCfg = _exampleData#1;
|
||||
_exampleVehicleToProcess = _assetNetId call BIS_fnc_objectFromNetId;
|
||||
} else {
|
||||
// otherwise, we only have the config to work with
|
||||
private _exampleData = _startingAssetsOfThisType#0;
|
||||
_assetCfg = _exampleData#1;
|
||||
};
|
||||
|
||||
private _parentClassNames = [_assetCfg, true] call BIS_fnc_returnParents;
|
||||
|
||||
|
||||
|
||||
// Process the vehicle for extended info
|
||||
// Exclusion list for display names
|
||||
if (
|
||||
[_assetCfg] call BIS_fnc_displayName
|
||||
in ["Helicopter"]
|
||||
) then {continue};
|
||||
|
||||
// Get the vehicle data
|
||||
private _processed = [configNull, "", []];
|
||||
if (!isNull _exampleVehicleToProcess) then {
|
||||
_processed = [_exampleVehicleToProcess] call FUNC(getVehicleData);
|
||||
};
|
||||
_processed params ["_processedVehicleCfg", "_displayName", "_diaryTextSections"];
|
||||
_diaryTextSections params [
|
||||
["_title", "", [""]],
|
||||
["_image", "", [""]],
|
||||
["_info", "", [""]],
|
||||
["_capacity", "", [""]]
|
||||
// ["_weapons", "", [""]],
|
||||
// ["_pylonWeapons", "", [""]],
|
||||
// ["_inventory", "", [""]]
|
||||
];
|
||||
|
||||
// Get what we can from the vehicle cfg
|
||||
|
||||
// Create the diary record
|
||||
private _recordText = [];
|
||||
// Add the title and image
|
||||
if (count _title isEqualTo 0) then {
|
||||
_title = format["%1", [_assetCfg] call BIS_fnc_displayName];
|
||||
};
|
||||
_recordText pushBack format[
|
||||
"<font size='24' shadow='1' color='#e1701a' face='PuristaBold'>%1</font>",
|
||||
_title
|
||||
];
|
||||
if (count _image isEqualTo 0) then {
|
||||
_image = format["<img width='200' image='%1'/>", getText(_assetCfg >> 'editorPreview')];
|
||||
};
|
||||
_recordText pushBack _image;
|
||||
_recordText pushBack "<br/>";
|
||||
_recordText pushBack format[
|
||||
"CALLSIGN: %1",
|
||||
_vehicleCallsign
|
||||
];
|
||||
_recordText pushBack format[
|
||||
"COUNT STARTED: %1",
|
||||
count _startingAssetsOfThisType
|
||||
];
|
||||
_recordText pushBack format[
|
||||
"COUNT ACTIVE: %1",
|
||||
count _currentAssetsOfThisType
|
||||
];
|
||||
|
||||
// Here, we'll create a link to show markers on the map for all vehicles of this kind
|
||||
// get 'picture' for record
|
||||
private _icon = getText(_assetCfg >> "picture");
|
||||
// determine marker type
|
||||
private _markerType = "mil_dot";
|
||||
switch (true) do {
|
||||
case ("Helicopter" in _parentClassNames): {
|
||||
_markerType = "loc_heli";
|
||||
};
|
||||
case ("Air" in _parentClassNames): {
|
||||
_markerType = "loc_plane";
|
||||
};
|
||||
case ("Ship" in _parentClassNames): {
|
||||
_markerType = "loc_boat";
|
||||
};
|
||||
case ("Car" in _parentClassNames): {
|
||||
_markerType = "loc_car";
|
||||
};
|
||||
default {
|
||||
_markerType = "loc_truck";
|
||||
};
|
||||
};
|
||||
|
||||
private "_randomColor";
|
||||
if (_colorSelectionIndex < count _randomColors) then {
|
||||
_randomColor = _randomColors select _colorSelectionIndex;
|
||||
INC(_colorSelectionIndex);
|
||||
} else {
|
||||
_colorSelectionIndex = 0;
|
||||
_randomColor = _randomColors select _colorSelectionIndex;
|
||||
};
|
||||
|
||||
// Link to show markers
|
||||
private _showMarkersText = format[
|
||||
"<execute expression='[""%1"",""%2"",""%3"",%4] call %5'>SHOW MARKERS for vehicles at base</execute> (in %6)",
|
||||
_className,
|
||||
_markerType,
|
||||
_randomColor#0,
|
||||
(_currentAssetsOfThisType apply {
|
||||
_x params ["_netId", "_cfg"];
|
||||
_netId;
|
||||
}),
|
||||
QFUNC(showMarkersOnMap),
|
||||
format["<font color='%1'>%2</font>", _randomColor#1, _randomColor#2]
|
||||
];
|
||||
_recordText pushBack _showMarkersText;
|
||||
|
||||
// Link to hide markers
|
||||
_recordText pushBack format[
|
||||
"<execute expression=""call %1"">REMOVE ALL MARKERS showing asset positions</execute>",
|
||||
QFUNC(removeMarkersOnMap)
|
||||
];
|
||||
|
||||
// Link to update asset diary entries
|
||||
_recordText pushBack format[
|
||||
"<execute expression=""call %1"">UPDATE ENTRIES for all assets</execute>",
|
||||
QFUNC(updateAssetDiary)
|
||||
];
|
||||
|
||||
// link to display hint with all assets
|
||||
_recordText pushBack format[
|
||||
"<execute expression=""call %1"">SHOW APPROVED ASSET COUNTS via hint</execute>",
|
||||
QFUNC(hintAllApprovedAssets)
|
||||
];
|
||||
|
||||
_recordText pushBack format[
|
||||
"<font size='10' color='#777777'>%1</font>",
|
||||
"Notes:<br/>
|
||||
- Markers are only displayed on your local machine.<br/>
|
||||
- The REMOVE ALL option will remove all assets' markers from the map.<br/>
|
||||
- UPDATE ENTRIES will update the asset diary with the latest information.<br/>
|
||||
- Markers will only be displayed for assets that are within a certain distance of a base."
|
||||
];
|
||||
|
||||
|
||||
|
||||
// Add info and capacity sections - exclude if no living examples were found
|
||||
if (count _info > 0) then {
|
||||
_recordText pushBack _info;
|
||||
};
|
||||
if (count _capacity > 0) then {
|
||||
_recordText pushBack _capacity;
|
||||
};
|
||||
|
||||
|
||||
private _subjectID = "";
|
||||
switch (true) do {
|
||||
case ("Helicopter" in _parentClassNames): {
|
||||
_subjectID = EGVAR(fbcb2_main,subjectAssetsRotaryID);
|
||||
};
|
||||
case ("Air" in _parentClassNames): {
|
||||
_subjectID = EGVAR(fbcb2_main,subjectAssetsFixedWingID);
|
||||
};
|
||||
default {
|
||||
_subjectID = EGVAR(fbcb2_main,subjectAssetsGroundID);
|
||||
};
|
||||
};
|
||||
|
||||
[
|
||||
_subjectID,
|
||||
format[
|
||||
"[%1/%2] %3",
|
||||
count _currentAssetsOfThisType,
|
||||
count _startingAssetsOfThisType,
|
||||
(_assetCfg) call BIS_fnc_displayName
|
||||
],
|
||||
_recordText joinString "<br/>",
|
||||
_icon
|
||||
] call EFUNC(common,createOrUpdateDiaryRecord);
|
||||
|
||||
// "\A3\ui_f\data\igui\cfg\simpleTasks\types\car_ca.paa"
|
||||
} forEach _distinctVehiclesClassNames;
|
||||
|
||||
// log to RPT
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"UPDATED ASSET DIARY",
|
||||
[
|
||||
["startingAssetCount", count _startingAssets],
|
||||
["startingAssetCountDistinct", count _distinctVehiclesClassNames],
|
||||
["currentassetCount", count _currentAssets]
|
||||
]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
true;
|
||||
141
framework/fbcb2_assets/functions/fn_updateAssetsByBase.sqf
Normal file
141
framework/fbcb2_assets/functions/fn_updateAssetsByBase.sqf
Normal file
@@ -0,0 +1,141 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [
|
||||
["_isInit", false, [false]],
|
||||
["_logCurrentAssets", false, [false]]
|
||||
];
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
GVARMAIN(baseObjects) = allMissionObjects "ModuleRespawnPosition_F";
|
||||
|
||||
// Get all approved assets on map, find the closest base
|
||||
// Then determine if it's within range
|
||||
// If it is, add it to the base's assets list
|
||||
// This is to ensure bases with overlapping detection range don't have duplicate assets
|
||||
private _allVehicles = vehicles;
|
||||
private _allSaved = [];
|
||||
|
||||
private _assetsStartedAtThisBaseVar = QGVAR(assetsStartedAtThisBase);
|
||||
private _assetsAtThisBaseVar = QGVAR(assetsAtThisBase);
|
||||
|
||||
private _approvedAssetsCfg = call EFUNC(common,getApprovedAssetsCfg);
|
||||
if (isNull _approvedAssetsCfg) exitWith {};
|
||||
|
||||
private _currentBaseAssetsGathered = GVARMAIN(baseObjects) apply {[_x, []]};;
|
||||
|
||||
{
|
||||
private _className = configName _x;
|
||||
private _callsign = getText(_x >> "callsign");
|
||||
private _found = _allVehicles select { typeOf _x == _className };
|
||||
{
|
||||
private _asset = _x;
|
||||
|
||||
// ignore assets beyond the range of bases
|
||||
if (not ([_asset] call FUNC(isAssetInRangeOfBase))) then {continue};
|
||||
|
||||
|
||||
// add to base's assets list
|
||||
private _closestBase = [_asset] call EFUNC(common,getNearestBase);
|
||||
private _closestBaseCurrentAssets = (_currentBaseAssetsGathered select { _x select 0 isEqualTo _closestBase })#0#1;
|
||||
_closestBaseCurrentAssets pushBackUnique [
|
||||
_asset call BIS_fnc_netId,
|
||||
configOf _asset
|
||||
];
|
||||
} forEach _found;
|
||||
} forEach (_approvedAssetsCfg call BIS_fnc_returnChildren);
|
||||
|
||||
// Add all ground vehicles (LandVehicle)
|
||||
{
|
||||
private _asset = _x;
|
||||
|
||||
// ignore assets beyond the range of bases
|
||||
if (not ([_asset] call FUNC(isAssetInRangeOfBase))) then {continue};
|
||||
|
||||
// add to base's assets list
|
||||
private _closestBase = [_asset] call EFUNC(common,getNearestBase);
|
||||
private _closestBaseCurrentAssets = (_currentBaseAssetsGathered select { _x select 0 isEqualTo _closestBase })#0#1;
|
||||
_closestBaseCurrentAssets pushBackUnique [
|
||||
_asset call BIS_fnc_netId,
|
||||
configOf _asset
|
||||
];
|
||||
} forEach (_allVehicles select { _x isKindOf "LandVehicle" });
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// publish updated base variables
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
private _base = _x;
|
||||
|
||||
private _thisBaseCurrentAssets = (_currentBaseAssetsGathered select { _x select 0 isEqualTo _base })#0#1;
|
||||
_base setVariable [_assetsAtThisBaseVar, _thisBaseCurrentAssets, true];
|
||||
|
||||
if (_isInit) then {
|
||||
_base setVariable [_assetsStartedAtThisBaseVar, _thisBaseCurrentAssets, true];
|
||||
};
|
||||
} forEach GVARMAIN(baseObjects);
|
||||
|
||||
// send a CBA event to let other scripts know that assets have been gathered
|
||||
[{[QGVAR(assetsGathered)] call CBA_fnc_globalEvent;}, 2] call CBA_fnc_waitAndExecute;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// log starting assets if init
|
||||
// log current assets if requested (for end of mission counts)
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
if !(_isInit || _logCurrentAssets) exitWith {};
|
||||
|
||||
{
|
||||
private _base = _x;
|
||||
|
||||
// get current assets
|
||||
private _baseAssets = (_currentBaseAssetsGathered select { _x select 0 isEqualTo _base })#0#1;
|
||||
|
||||
// prepare key value for logging
|
||||
private _baseAssetsHashesPrep = _baseAssets apply {
|
||||
_x params ["_netId", "_cfg"];
|
||||
[
|
||||
["callsign", [configName _cfg] call FUNC(getCallsignFromClassname)],
|
||||
["className", configName _cfg],
|
||||
["displayName", [_cfg] call BIS_fnc_displayName]
|
||||
];
|
||||
};
|
||||
|
||||
_baseAssetsHashesPrep = _baseAssetsHashesPrep call BIS_fnc_consolidateArray;
|
||||
|
||||
private _baseAssetsHashes = [];
|
||||
{
|
||||
private _out = createHashMapFromArray (_x#0);
|
||||
_out set ["count", _x#1];
|
||||
_baseAssetsHashes pushBack _out;
|
||||
} forEach _baseAssetsHashesPrep;
|
||||
|
||||
// if logging current assets
|
||||
if (_logCurrentAssets) then {
|
||||
{
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"CURRENT ASSETS",
|
||||
[
|
||||
["baseName", [[_base] call EFUNC(common,getNameOfBase)]],
|
||||
["asset", _x]
|
||||
]
|
||||
] call EFUNC(common,log);
|
||||
} forEach _baseAssetsHashes;
|
||||
};
|
||||
|
||||
// if init, log starting assets
|
||||
if (_isInit) then {
|
||||
{
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"STARTING ASSETS",
|
||||
[
|
||||
["baseName", [[_base] call EFUNC(common,getNameOfBase)]],
|
||||
["asset", _x]
|
||||
]
|
||||
] call EFUNC(common,log);
|
||||
} forEach _baseAssetsHashes;
|
||||
};
|
||||
} forEach GVARMAIN(baseObjects);
|
||||
3
framework/fbcb2_assets/script_component.hpp
Normal file
3
framework/fbcb2_assets/script_component.hpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#define COMPONENT fbcb2_assets
|
||||
#define COMPONENT_BEAUTIFIED FBCB2 - Assets
|
||||
#include "../script_mod.hpp"
|
||||
112
framework/fbcb2_main/functions/fn_addEnvironmentRecord.sqf
Normal file
112
framework/fbcb2_main/functions/fn_addEnvironmentRecord.sqf
Normal file
@@ -0,0 +1,112 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
private _recordTitle = "ENVIRONMENTAL CONDITIONS";
|
||||
|
||||
private _text = [
|
||||
format[
|
||||
"<font size='%1' color='%2' face='%3'>%4</font>",
|
||||
GVAR(recordTitleSize),
|
||||
GVAR(recordTitleColor),
|
||||
GVAR(recordTitleFont),
|
||||
_recordTitle
|
||||
]
|
||||
];
|
||||
|
||||
private _sunriseColor = "#4A86E8";
|
||||
private _sunsetColor = "#6AA84F";
|
||||
private _whiteColor = "#FFFFFF";
|
||||
|
||||
private _sunTimes = date call BIS_fnc_sunriseSunsetTime;
|
||||
private _nearestBase = [player] call EFUNC(common,getNearestBase);
|
||||
|
||||
if (isNull _nearestBase) exitWith {
|
||||
[
|
||||
LEVEL_WARNING,
|
||||
QUOTE(COMPONENT),
|
||||
"WARNING: No bases found nearby to report weather!",
|
||||
[player, [
|
||||
["position", getPos player]
|
||||
]] call EFUNC(common,addPlayerInfoToArray)
|
||||
] call EFUNC(common,log);
|
||||
["WARNING: No bases found nearby to report weather!"] call BIS_fnc_error;
|
||||
};
|
||||
|
||||
_text pushBack format[
|
||||
"<font size='%1'>Current conditions at nearest weather station: %2</font><br/>",
|
||||
GVAR(recordTextBodySize),
|
||||
[_nearestBase] call EFUNC(common,getNameOfBase)
|
||||
];
|
||||
|
||||
private _weatherData = [];
|
||||
|
||||
if (isClass (configFile >> "CfgPatches" >> "ace_weather")) then {
|
||||
// get ace_weather data
|
||||
private _barometricPressure = ((getPosASL _nearestBase)#2) call ace_weather_fnc_calculateBarometricPressure;
|
||||
private _relHumidity = missionNamespace getVariable ["ace_weather_currentHumidity", 0.5];
|
||||
private _temperature = ((getPosASL _nearestBase)#2) call ace_weather_fnc_calculateTemperatureAtHeight;
|
||||
private _dewPoint = [_temperature, _relHumidity] call ace_weather_fnc_calculateDewPoint;
|
||||
private _windSpeed = [getPosASL _nearestBase, false, false, false] call ace_weather_fnc_calculateWindSpeed;
|
||||
private _windChill = [_temperature, _windSpeed] call ace_weather_fnc_calculateWindChill;
|
||||
private _heatIndex = [_temperature, _relHumidity] call ace_weather_fnc_calculateHeatIndex;
|
||||
|
||||
toFixed 2;
|
||||
private _aceData = [
|
||||
["Temperature", format["%1°C / %2°F", _temperature, _temperature * (9/5) + 32]],
|
||||
["Wind Chill", format["%1°C / %2°F", _windChill, _windChill * (9/5) + 32]],
|
||||
["Heat Index", format["%1°C / %2°F", _heatIndex, _heatIndex * (9/5) + 32]],
|
||||
["Dew Point", format["%1°C / %2°F", _dewPoint, _dewPoint * (9/5) + 32]],
|
||||
["Wind Speed", format["%1mph / %2kph / %3kts", _windSpeed * 2.237, _windSpeed * 3.6, _windSpeed * 1.944]],
|
||||
["Wind Direction", ""],
|
||||
["Barometric Pressure", format["%1 hPA", _barometricPressure]],
|
||||
["Relative Humidity", format["%1%2", _relHumidity * 100, "%"]],
|
||||
["Fog Cover", ""],
|
||||
["Rain", ""],
|
||||
["Overcast", ""]
|
||||
];
|
||||
toFixed -1;
|
||||
|
||||
{
|
||||
_x params ["_name", "_value"];
|
||||
[_weatherData, _name, _value] call BIS_fnc_setToPairs;
|
||||
} forEach _aceData;
|
||||
};
|
||||
|
||||
// always add built-in weather
|
||||
toFixed 2;
|
||||
private _vanillaData = [
|
||||
["Temperature", format["%1°C", (ambientTemperature)#0]],
|
||||
["Fog Cover", format["%1%2", fog * 100, "%"]],
|
||||
["Overcast", format["%1%2", overcast * 100, "%"]],
|
||||
["Rain", format["%1%2", rain * 100, "%"]],
|
||||
["Wind Speed", format["%1m/s", windStr]],
|
||||
["Wind Direction", format["%1°", windDir]]
|
||||
];
|
||||
toFixed -1;
|
||||
|
||||
_vanillaData pushBack ["Sunrise", ([_sunTimes select 0, "HH:MM"] call BIS_fnc_timeToString)];
|
||||
_vanillaData pushBack ["Sunset", ([_sunTimes select 1, "HH:MM"] call BIS_fnc_timeToString)];
|
||||
|
||||
// override or set keys for vanilla data into weather data
|
||||
{
|
||||
_x params ["_name", "_value"];
|
||||
[_weatherData, _name, _value] call BIS_fnc_setToPairs;
|
||||
} forEach _vanillaData;
|
||||
|
||||
// write lines
|
||||
{
|
||||
_x params ["_name", "_value"];
|
||||
_text pushBack format[
|
||||
"<font size='%1' face='EtelkaMonospacePro'>%2%3</font>",
|
||||
GVAR(recordTextBodySize)-4,
|
||||
[_name, "right", " ", 23] call EFUNC(common,padString),
|
||||
_value
|
||||
];
|
||||
} forEach _weatherData;
|
||||
|
||||
_text = _text joinString "<br/>";
|
||||
|
||||
[
|
||||
GVAR(subjectIntelID),
|
||||
_recordTitle,
|
||||
_text
|
||||
] call EFUNC(common,createOrUpdateDiaryRecord);
|
||||
@@ -1,11 +1,32 @@
|
||||
// updated 2024-02-01 by IndigoFox
|
||||
// now reads from the battalion config structure to generate the diary entries
|
||||
|
||||
#include "../script_component.hpp"
|
||||
|
||||
////////////////////////////////////////
|
||||
// Get info from missionConfigFile
|
||||
////////////////////////////////////////
|
||||
private _battalionInfoCfg = call milsim_fnc_getBattalionCfg;
|
||||
private _battalionInfoCfg = call EFUNC(common,getBattalionCfg);
|
||||
if (isNull _battalionInfoCfg) exitWith {
|
||||
[
|
||||
LEVEL_ERROR,
|
||||
QUOTE(COMPONENT),
|
||||
"Null Battalion Config",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
["Null Battalion Config"] call BIS_fnc_error;
|
||||
};
|
||||
|
||||
private _battalionElementCfgs = [_battalionInfoCfg >> "Command"] call BIS_fnc_returnChildren;
|
||||
if (count _battalionElementCfgs == 0) exitWith {
|
||||
[
|
||||
LEVEL_ERROR,
|
||||
QUOTE(COMPONENT),
|
||||
"ERROR: No battalion elements found. Check that the battalion config is correctly structured. See defines/BattalionInfo.hpp and framework/util/functions/getBattalionCfg.sqf.",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
["ERROR: No battalion elements found. Check that the battalion config is correctly structured. See defines/BattalionInfo.hpp and framework/util/functions/getBattalionCfg.sqf."] call BIS_fnc_error;
|
||||
};
|
||||
|
||||
////////////////////////////////////////
|
||||
// Define formatting constants
|
||||
@@ -29,22 +50,28 @@ private _FREQ_TEXT_COLOR = "#CCCCCC";
|
||||
reverse _battalionElementCfgs;
|
||||
|
||||
{
|
||||
// recursively generate diary text for all child elements of battalion-level elements
|
||||
private _diaryTitleText = [_x, true] call milsim_fnc_generateElementFrequencyRecordText;
|
||||
[
|
||||
milsim_fbcb2_subjectFrequenciesID,
|
||||
LEVEL_TRACE,
|
||||
QUOTE(COMPONENT),
|
||||
format["Processing battalion element %1", configName _x],
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
// recursively generate diary text for all child elements of battalion-level elements
|
||||
private _diaryTitleText = [_x, true] call FUNC(generateElementFrequencyRecordText);
|
||||
[
|
||||
GVAR(subjectFrequenciesID),
|
||||
_diaryTitleText#0,
|
||||
_diaryTitleText#1
|
||||
] call milsim_fnc_createOrUpdateDiaryRecord;
|
||||
] call EFUNC(common,createOrUpdateDiaryRecord);
|
||||
} forEach _battalionElementCfgs;
|
||||
|
||||
// add the battalion command to the top of the list
|
||||
// don't process child elements
|
||||
private _diaryTitleText = [_battalionInfoCfg >> "Command", false] call milsim_fnc_generateElementFrequencyRecordText;
|
||||
private _diaryTitleText = [_battalionInfoCfg >> "Command", false] call FUNC(generateElementFrequencyRecordText);
|
||||
[
|
||||
milsim_fbcb2_subjectFrequenciesID,
|
||||
GVAR(subjectFrequenciesID),
|
||||
_diaryTitleText#0,
|
||||
_diaryTitleText#1
|
||||
] call milsim_fnc_createOrUpdateDiaryRecord;
|
||||
] call EFUNC(common,createOrUpdateDiaryRecord);
|
||||
|
||||
true;
|
||||
59
framework/fbcb2_main/functions/fn_addSignalColorsRecord.sqf
Normal file
59
framework/fbcb2_main/functions/fn_addSignalColorsRecord.sqf
Normal file
@@ -0,0 +1,59 @@
|
||||
#include "../script_component.hpp"
|
||||
|
||||
private _recordTitle = "SIGNAL COLORS";
|
||||
|
||||
private _text = [
|
||||
// Title
|
||||
format[
|
||||
"<font size='%1' color='%2' face='%3'>%4</font>",
|
||||
GVAR(recordTitleSize),
|
||||
GVAR(recordTitleColor),
|
||||
GVAR(recordTitleFont),
|
||||
_recordTitle
|
||||
]
|
||||
];
|
||||
|
||||
private _signalColorDefs = (missionConfigFile >> "SignalColors") call BIS_fnc_returnChildren;
|
||||
|
||||
{
|
||||
private _cfg = _x;
|
||||
private _color = getText(_cfg >> "hexCode");
|
||||
private _name = getText(_cfg >> "name");
|
||||
private _usage = getText(_cfg >> "usage");
|
||||
private _itemExamples = getArray(_cfg >> "itemExamples");
|
||||
|
||||
private _thisText = [];
|
||||
|
||||
_thisText pushBack format[
|
||||
"<font size='%1'><font color='%2'>%3</font> - %4</font>",
|
||||
GVAR(recordTextHeaderSize),
|
||||
_color,
|
||||
_name,
|
||||
_usage
|
||||
];
|
||||
|
||||
private _imagesLine = [];
|
||||
|
||||
{
|
||||
private _itemClassname = _x;
|
||||
private _itemCfg = [_itemClassname] call CBA_fnc_getItemConfig;
|
||||
private _itemName = getText(_itemCfg >> "displayName");
|
||||
private _itemImage = getText(_itemCfg >> "picture");
|
||||
_imagesLine pushBack format[
|
||||
"<img height='32' src='%1' title='%2'/>",
|
||||
_itemImage,
|
||||
_itemName
|
||||
];
|
||||
} forEach _itemExamples;
|
||||
|
||||
_thisText pushBack (_imagesLine joinString " ");
|
||||
_text pushBack (_thisText joinString "<br/>");
|
||||
} forEach _signalColorDefs;
|
||||
|
||||
_text = _text joinString "<br/><br/>";
|
||||
|
||||
[
|
||||
GVAR(subjectIntelID),
|
||||
_recordTitle,
|
||||
_text
|
||||
] call EFUNC(common,createOrUpdateDiaryRecord);
|
||||
48
framework/fbcb2_main/functions/fn_initClient.sqf
Normal file
48
framework/fbcb2_main/functions/fn_initClient.sqf
Normal file
@@ -0,0 +1,48 @@
|
||||
#include "../script_component.hpp"
|
||||
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
GVAR(recordTitleColor) = "#ff6666";
|
||||
GVAR(recordTitleFont) = "PuristaMedium";
|
||||
GVAR(recordTitleSize) = 20;
|
||||
|
||||
GVAR(recordTextHeaderSize) = 16;
|
||||
GVAR(recordTextBodySize) = 14;
|
||||
|
||||
GVAR(subjectStatusID) = "FBCB2_Status";
|
||||
GVAR(subjectIntelID) = "FBCB2_Intel";
|
||||
GVAR(subjectMessagesID) = "FBCB2_Messages";
|
||||
GVAR(subjectFrequenciesID) = "FBCB2_Frequencies";
|
||||
GVAR(subjectAssetsFixedWingID) = "FBCB2_Assets_FixedWing";
|
||||
GVAR(subjectAssetsRotaryID) = "FBCB2_Assets_Rotary";
|
||||
GVAR(subjectAssetsGroundID) = "FBCB2_Assets_Ground";
|
||||
|
||||
player createDiarySubject[GVAR(subjectStatusID), "FBCB2 Status"];
|
||||
player createDiarySubject[GVAR(subjectMessagesID), "FBCB2 Messages"];
|
||||
player createDiarySubject[GVAR(subjectIntelID), "FBCB2 Intel"];
|
||||
player createDiarySubject[GVAR(subjectFrequenciesID), "FBCB2 Frequencies"];
|
||||
player createDiarySubject[GVAR(subjectAssetsFixedWingID), "FBCB2 Planes"];
|
||||
player createDiarySubject[GVAR(subjectAssetsRotaryID), "FBCB2 Helicopters"];
|
||||
player createDiarySubject[GVAR(subjectAssetsGroundID), "FBCB2 Ground"];
|
||||
|
||||
// run main inits
|
||||
[] call FUNC(addFrequenciesRecord);
|
||||
[] call FUNC(addSignalColorsRecord);
|
||||
[] call FUNC(addEnvironmentRecord);
|
||||
|
||||
// starting 5 minutes after postInit, update weather diary record every 5 minutes
|
||||
[{
|
||||
[
|
||||
{call FUNC(addEnvironmentRecord);},
|
||||
60*5
|
||||
] call CBA_fnc_addPerFrameHandler;
|
||||
}, 60*5] call CBA_fnc_waitAndExecute;
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
"initClient complete",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
localNamespace setVariable [QGVAR(complete), true];
|
||||
3
framework/fbcb2_main/script_component.hpp
Normal file
3
framework/fbcb2_main/script_component.hpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#define COMPONENT fbcb2_main
|
||||
#define COMPONENT_BEAUTIFIED FBCB2 - Main
|
||||
#include "../script_mod.hpp"
|
||||
@@ -1,4 +1,6 @@
|
||||
// called from milsim_fnc_processFBCB2RadioFrequencies
|
||||
#include "../script_component.hpp"
|
||||
|
||||
params ["_cfg", ["_indentCount", 1, [5]]];
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
@@ -62,8 +64,8 @@ _freqLeadingSpace = _freqLeadingSpace joinString "";
|
||||
_ELEMENT_FREQ_SIZE,
|
||||
_ELEMENT_FREQ_FONT,
|
||||
_FREQ_TEXT_COLOR,
|
||||
[_role, "right", " ", _FREQ_PAD_LENGTH] call milsim_fnc_padString,
|
||||
[_srStr, "right", " ", _FREQ_PAD_LENGTH] call milsim_fnc_padString,
|
||||
[_role, "right", " ", _FREQ_PAD_LENGTH] call EFUNC(common,padString),
|
||||
[_srStr, "right", " ", _FREQ_PAD_LENGTH] call EFUNC(common,padString),
|
||||
_lrStr
|
||||
];
|
||||
} forEach (getArray (_cfg >> "frequencies"));
|
||||
@@ -1,5 +1,8 @@
|
||||
// called from milsim_fnc_processFBCB2RadioFrequencies ONLY
|
||||
// this function is called recursively to process all child elements of a battalion element in missionConfigFile
|
||||
|
||||
#include "../script_component.hpp"
|
||||
|
||||
params [
|
||||
["_elementCfg", configNull, [configNull]],
|
||||
["_shouldProcessChildCfgs", true]
|
||||
@@ -40,9 +43,9 @@ _freqLeadingSpace = _freqLeadingSpace joinString "";
|
||||
private _headers = [
|
||||
format[
|
||||
"<font size='%1' color='%2' face='%3'>%4</font>",
|
||||
milsim_fbcb2_recordTitleSize,
|
||||
milsim_fbcb2_recordTitleColor,
|
||||
milsim_fbcb2_recordTitleFont,
|
||||
GVAR(recordTitleSize),
|
||||
GVAR(recordTitleColor),
|
||||
GVAR(recordTitleFont),
|
||||
_recordTitle
|
||||
],
|
||||
format[
|
||||
@@ -51,8 +54,8 @@ private _headers = [
|
||||
_ELEMENT_FREQ_SIZE,
|
||||
_ELEMENT_FREQ_FONT,
|
||||
_FREQ_TEXT_COLOR,
|
||||
["ROLE", "right", " ", _FREQ_PAD_LENGTH] call milsim_fnc_padString,
|
||||
["SR", "right", " ", _FREQ_PAD_LENGTH] call milsim_fnc_padString,
|
||||
["ROLE", "right", " ", _FREQ_PAD_LENGTH] call EFUNC(common,padString),
|
||||
["SR", "right", " ", _FREQ_PAD_LENGTH] call EFUNC(common,padString),
|
||||
"LR"
|
||||
]
|
||||
];
|
||||
@@ -65,16 +68,30 @@ private _allText = [];
|
||||
|
||||
// get all child elements recursively and format them
|
||||
if (_shouldProcessChildCfgs) then {
|
||||
[
|
||||
LEVEL_TRACE,
|
||||
QUOTE(COMPONENT),
|
||||
"Processing child elements for battalion element %1",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
[_battalionElement, {
|
||||
params ["_cfg", "_recurseCounter"];
|
||||
// add config
|
||||
private _lines = [_cfg, _recurseCounter+1] call milsim_fnc_formatRadioElementForDiary;
|
||||
private _lines = [_cfg, _recurseCounter+1] call FUNC(formatRadioElementForDiary);
|
||||
// private _lines = [_cfg, _indentCount] call t;
|
||||
_allText pushBack (_lines joinString "<br/>");
|
||||
}] call milsim_fnc_recurseSubclasses;
|
||||
}] call EFUNC(common,recurseSubclasses);
|
||||
} else {
|
||||
[
|
||||
LEVEL_TRACE,
|
||||
QUOTE(COMPONENT),
|
||||
"Skipping processing of child elements for battalion element %1",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
// or if the param was false, just add the battalion element
|
||||
private _lines = [_battalionElement, 1] call milsim_fnc_formatRadioElementForDiary;
|
||||
private _lines = [_battalionElement, 1] call FUNC(formatRadioElementForDiary);
|
||||
// private _lines = [_cfg, _indentCount] call t;
|
||||
_allText pushBack (_lines joinString "<br/>");
|
||||
};
|
||||
18
framework/init/functions/fn_addAARChatHandler.sqf
Normal file
18
framework/init/functions/fn_addAARChatHandler.sqf
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
[
|
||||
"saveaar",
|
||||
{
|
||||
[] remoteExec["ocap_fnc_exportData", 2];
|
||||
},
|
||||
"admin"
|
||||
] call CBA_fnc_registerChatCommand;
|
||||
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"OCAP chat handler registered",
|
||||
[player] call EFUNC(common,addPlayerInfoToArray)
|
||||
] call EFUNC(common,log);
|
||||
|
||||
nil;
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
[
|
||||
"respawn",
|
||||
{
|
||||
@@ -6,10 +8,11 @@
|
||||
|
||||
// log to server RPT
|
||||
[
|
||||
"init",
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"CHAT COMMAND RESPAWN",
|
||||
[player] call milsim_fnc_addPlayerInfoToArray
|
||||
] remoteExec ["milsim_fnc_log", 2];
|
||||
[player] call EFUNC(common,addPlayerInfoToArray)
|
||||
] remoteExec [QEFUNC(common,log), 2];
|
||||
|
||||
// systemChat to all remote machines
|
||||
format["%1 claims they were glitched and respawned (%2)", name player, netID player] remoteExec["systemChat", -_clientID];
|
||||
@@ -18,6 +21,11 @@
|
||||
[clientOwner]
|
||||
] call CBA_fnc_registerChatCommand;
|
||||
|
||||
diag_log text "[MILSIM] (settings) respawn chat handler registered";
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"respawn chat handler registered",
|
||||
[player] call EFUNC(common,addPlayerInfoToArray)
|
||||
] call EFUNC(common,log);
|
||||
|
||||
nil;
|
||||
45
framework/init/functions/fn_initClient.sqf
Normal file
45
framework/init/functions/fn_initClient.sqf
Normal file
@@ -0,0 +1,45 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
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)};
|
||||
|
||||
["InitializePlayer", [player, true]] call BIS_fnc_dynamicGroups;
|
||||
|
||||
// Initialize a holder for managing local diary records
|
||||
// store records in format:
|
||||
// [subject, [
|
||||
// [title, diaryRecord]
|
||||
// ]]
|
||||
EGVAR(common,diaryRecords) = createHashMap;
|
||||
|
||||
|
||||
// initialize other modules
|
||||
call EFUNC(mapcopy,initClient);
|
||||
call EFUNC(reinsert,initClient);
|
||||
call EFUNC(resupply,initClient);
|
||||
call EFUNC(triageIcons,initClient);
|
||||
call EFUNC(vehicleFlags,initClient);
|
||||
call EFUNC(zeus,initClient);
|
||||
call EFUNC(fbcb2_main,initClient);
|
||||
call EFUNC(fbcb2_assets,initClient);
|
||||
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
"initClient complete",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
localNamespace setVariable [QGVAR(complete), true];
|
||||
|
||||
nil;
|
||||
42
framework/init/functions/fn_initServer.sqf
Normal file
42
framework/init/functions/fn_initServer.sqf
Normal file
@@ -0,0 +1,42 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
// array of all respawn modules in the mission representing "bases"
|
||||
GVARMAIN(baseObjects) = allMissionObjects "ModuleRespawnPosition_F";
|
||||
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);
|
||||
call EFUNC(reinsert,initServer);
|
||||
|
||||
// declare init complete to other modules
|
||||
missionNamespace setVariable [QGVARMAIN(complete), true, true];
|
||||
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
format["%1: version %2", QGVARMAIN(complete), QUOTE(VERSION_STR)],
|
||||
[["version", QUOTE(VERSION_STR)]]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
"postInit complete",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
34
framework/init/functions/fn_setDefaults.sqf
Normal file
34
framework/init/functions/fn_setDefaults.sqf
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
enableSaving[false, false];
|
||||
|
||||
enableRadio false;
|
||||
enableSentences false;
|
||||
|
||||
missionNamespace setVariable ["ACE_maxWeightDrag", 2400];
|
||||
missionNamespace setVariable ["ACE_maxWeightCarry", 1800];
|
||||
|
||||
if(isClass(configfile >> "CfgPatches" >> "rhs_main")) then {
|
||||
rhs_vehicleRadioChatter = 0;
|
||||
};
|
||||
|
||||
waitUntil {time > 0};
|
||||
|
||||
enableEnvironment[false, true];
|
||||
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"Defaults set",
|
||||
[
|
||||
["enableSaving", [false, false]],
|
||||
["enableRadio", false],
|
||||
["enableSentences", false],
|
||||
["ACE_maxWeightDrag", 2400],
|
||||
["ACE_maxWeightCarry", 1800],
|
||||
["rhs_vehicleRadioChatter", 0],
|
||||
["enableEnvironment", [false, true]]
|
||||
]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
nil;
|
||||
3
framework/init/script_component.hpp
Normal file
3
framework/init/script_component.hpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#define COMPONENT init
|
||||
#define COMPONENT_BEAUTIFIED Init
|
||||
#include "../script_mod.hpp"
|
||||
24
framework/mapcopy/functions/fn_addCBASettings.sqf
Normal file
24
framework/mapcopy/functions/fn_addCBASettings.sqf
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
[
|
||||
QGVAR(setting_enable),
|
||||
"CHECKBOX",
|
||||
"Allow Map Copying",
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)],
|
||||
true, // default value
|
||||
true, // is global
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_enable),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"CREATED SETTINGS",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
15
framework/mapcopy/functions/fn_getMapMarkers.sqf
Normal file
15
framework/mapcopy/functions/fn_getMapMarkers.sqf
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "..\script_component.hpp"
|
||||
// serializes markers on local machine and returns them as array
|
||||
|
||||
_markerData = [];
|
||||
|
||||
{
|
||||
_marker = toArray _x;
|
||||
_marker resize 15;
|
||||
if ( toString _marker == "_USER_DEFINED #" ) then {
|
||||
_marker = _x call FUNC(mapMarkerToString);
|
||||
_markerData pushBack _marker;
|
||||
};
|
||||
} forEach allMapMarkers;
|
||||
|
||||
_markerData;
|
||||
57
framework/mapcopy/functions/fn_initClient.sqf
Normal file
57
framework/mapcopy/functions/fn_initClient.sqf
Normal file
@@ -0,0 +1,57 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Create action to copy map markers on all inheritors of CAManBase
|
||||
////////////////////////////////////////////////////////////////////
|
||||
private _mapCopyAction =
|
||||
[
|
||||
QGVAR(actionID),
|
||||
"Copy Map",
|
||||
"\a3\ui_f\data\igui\cfg\actions\talk_ca.paa",
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
format["Copying map markers from %1", name _target] call CBA_fnc_notify;
|
||||
[QGVAR(mapCopyRequest), _this, _target] call CBA_fnc_targetEvent;
|
||||
},
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
[QGVAR(setting_enable)] call CBA_settings_fnc_get && {
|
||||
('ItemMap' in (assignedItems _player)) &&
|
||||
('ItemMap' in (assignedItems _target)) &&
|
||||
([_player, _target, []] call ace_common_fnc_canInteractWith)
|
||||
};
|
||||
}
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
["CAManBase", 0, ["ACE_MainActions"], _mapCopyAction, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Create CBA event to receive requests
|
||||
////////////////////////////////////////////////////////////////////
|
||||
[QGVAR(mapCopyRequest), {
|
||||
params ["_me", "_requester", "_params"];
|
||||
format["Your map is being copied by %1", name _requester] call CBA_fnc_notify;
|
||||
private _myMarkers = _this call FUNC(getMapMarkers);
|
||||
[QGVAR(mapCopyResponse), [_me, _myMarkers], _requester] call CBA_fnc_targetEvent;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Create CBA event to receive responses
|
||||
////////////////////////////////////////////////////////////////////
|
||||
[QGVAR(mapCopyResponse), {
|
||||
params [["_responder", objNull, [objNull]], ["_markerList", [], [[]]]];
|
||||
if ('ItemMap' in (assignedItems player)) then {
|
||||
[_markerList] call FUNC(loadMapMarkers);
|
||||
format["Copied %1 markers from %2", count _markerList, name _responder] call CBA_fnc_notify;
|
||||
} else {
|
||||
format["You need a map to copy onto!"] call CBA_fnc_notify;
|
||||
};
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
"initClient complete",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
localNamespace setVariable [QGVAR(complete), true];
|
||||
8
framework/mapcopy/functions/fn_loadMapMarkers.sqf
Normal file
8
framework/mapcopy/functions/fn_loadMapMarkers.sqf
Normal file
@@ -0,0 +1,8 @@
|
||||
#include "..\script_component.hpp"
|
||||
// accepts an array of serialized markers and adds them to local map
|
||||
|
||||
params [["_markerList", [], [[]]]];
|
||||
|
||||
{
|
||||
_x call FUNC(stringToMapMarker);
|
||||
} foreach _markerList;
|
||||
3
framework/mapcopy/script_component.hpp
Normal file
3
framework/mapcopy/script_component.hpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#define COMPONENT mapcopy
|
||||
#define COMPONENT_BEAUTIFIED Map Copy
|
||||
#include "../script_mod.hpp"
|
||||
105
framework/performance/functions/fn_addCBASettings.sqf
Normal file
105
framework/performance/functions/fn_addCBASettings.sqf
Normal file
@@ -0,0 +1,105 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
//---------------------
|
||||
// Server CPS
|
||||
//---------------------
|
||||
|
||||
[
|
||||
QGVAR(server_cps_enable),
|
||||
"CHECKBOX",
|
||||
"Server CPS Metrics Enabled",
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)],
|
||||
true,
|
||||
true,
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(cps_enable),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[QGVAR(cps_enable), true] call CBA_settings_fnc_set;
|
||||
|
||||
[
|
||||
QGVAR(server_cps_interval),
|
||||
"TIME",
|
||||
"Server CPS Metrics Interval",
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)],
|
||||
[60,300,120],
|
||||
true,
|
||||
{
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
params ["_value"];
|
||||
|
||||
[
|
||||
QGVAR(cps_interval),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
|
||||
_cpsPFH = missionNamespace getVariable [QGVAR(server_cps_handler), ObjNull];
|
||||
if (!isNull _cpsPFH) then {
|
||||
_cpsPFH call CBA_fnc_deletePerFrameHandlerObject;
|
||||
};
|
||||
|
||||
[] call FUNC(addServerStatsPFH);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
|
||||
//---------------------
|
||||
// Client CPS
|
||||
//---------------------
|
||||
|
||||
[
|
||||
QGVAR(client_cps_enable),
|
||||
"CHECKBOX",
|
||||
"Client CPS Metrics Enabled",
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)],
|
||||
true,
|
||||
true,
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(client_cps_enable),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[QGVAR(client_cps_enable), true] call CBA_settings_fnc_set;
|
||||
|
||||
[
|
||||
QGVAR(client_cps_interval),
|
||||
"TIME",
|
||||
"Client CPS Metrics Interval",
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)],
|
||||
[60,300,120],
|
||||
true,
|
||||
{
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
params ["_value"];
|
||||
|
||||
[
|
||||
QGVAR(client_cps_interval),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
|
||||
_cpsPFH = player getVariable [QGVAR(client_cps_handler), ObjNull];
|
||||
if (!isNull _cpsPFH) then {
|
||||
_cpsPFH call CBA_fnc_deletePerFrameHandlerObject;
|
||||
};
|
||||
|
||||
[] call FUNC(addClientStatsPFH);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"CREATED SETTINGS",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
38
framework/performance/functions/fn_addClientStatsPFH.sqf
Normal file
38
framework/performance/functions/fn_addClientStatsPFH.sqf
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"Initializing client stats PFH",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
_cpsPFH = [
|
||||
{
|
||||
[] call FUNC(calculateClientStats);
|
||||
},
|
||||
QGVAR(client_cps_interval) call CBA_settings_fnc_get,
|
||||
[],
|
||||
{
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"Client PFH loaded",
|
||||
[["pfhInterval", QGVAR(client_cps_interval) call CBA_settings_fnc_get]]
|
||||
] call EFUNC(common,log);
|
||||
},
|
||||
{ [
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"Client PFH unloaded",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
},
|
||||
{ QGVAR(client_cps_enable) call CBA_settings_fnc_get },
|
||||
{ false },
|
||||
[]
|
||||
] call CBA_fnc_createPerFrameHandlerObject;
|
||||
|
||||
player setVariable [QGVAR(client_cps_handler), _cpsPFH];
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
diag_log text "[MILSIM] (DNI) writing variable loop";
|
||||
@@ -1,28 +1,48 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
missionNamespace setVariable["milsim_raw_cps", 0];
|
||||
missionNamespace setVariable["milsim_cps", 0];
|
||||
missionNamespace setVariable[QGVAR(raw_cps), 0];
|
||||
missionNamespace setVariable[QGVAR(cps), 0];
|
||||
|
||||
publicVariable "milsim_raw_cps";
|
||||
publicVariable "milsim_cps";
|
||||
publicVariable QGVAR(raw_cps);
|
||||
publicVariable QGVAR(cps);
|
||||
|
||||
diag_log text format ["[MILSIM] (server) initializing Server Stats PFH"];
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"Initializing server stats PFH",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
_serverCpsPFH = [
|
||||
{
|
||||
[] call milsim_fnc_calculateServerStats;
|
||||
[] call FUNC(calculateServerStats);
|
||||
},
|
||||
"milsim_server_cps_interval" call CBA_settings_fnc_get,
|
||||
QGVAR(server_cps_interval) call CBA_settings_fnc_get,
|
||||
[],
|
||||
{ diag_log text format ["[MILSIM] (server) Server PFH loaded with interval %1 seconds", "milsim_server_cps_interval" call CBA_settings_fnc_get ] },
|
||||
{ diag_log text format ["[MILSIM] (server) Server PFH unloaded"] },
|
||||
{ "milsim_server_cps_enable" call CBA_settings_fnc_get },
|
||||
{
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"Server PFH loaded",
|
||||
[["pfhInterval", QGVAR(server_cps_interval) call CBA_settings_fnc_get]]
|
||||
] call EFUNC(common,log);
|
||||
},
|
||||
{ [
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"Server PFH unloaded",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
},
|
||||
{ QGVAR(server_cps_enable) call CBA_settings_fnc_get },
|
||||
{ false },
|
||||
[]
|
||||
] call CBA_fnc_createPerFrameHandlerObject;
|
||||
|
||||
|
||||
missionNamespace setVariable ["milsim_server_cps_handler", _serverCpsPFH];
|
||||
missionNamespace setVariable [QGVAR(server_cps_handler), _serverCpsPFH];
|
||||
|
||||
_playerCpsPFH = [
|
||||
{
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
[] spawn {
|
||||
// warning: while loop without suspension executes multiple times per frame
|
||||
private _counter = 0;
|
||||
@@ -8,8 +10,8 @@
|
||||
_counter = _counter + 1;
|
||||
};
|
||||
// in an empty mission, the _counter may go well over 2000 times per frame!
|
||||
diag_log text format ["[MILSIM] (client) Average Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)];
|
||||
player setVariable ["milsim_player_raw_cps", _counter / (diag_frameNo - _frameNo), true];
|
||||
private _rawCPS = _counter / (diag_frameNo - _frameNo);
|
||||
player setVariable [QGVAR(player_raw_cps), _rawCPS, true];
|
||||
|
||||
// with suspension
|
||||
private _counter = 0;
|
||||
@@ -21,9 +23,23 @@
|
||||
uiSleep 0.001; // waits at least 1 frame
|
||||
};
|
||||
// _counter says one per frame, as expected
|
||||
diag_log text format ["[MILSIM] (client) Average Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)];
|
||||
player setVariable ["milsim_player_cps", _counter / (diag_frameNo - _frameNo), true];
|
||||
private _playerCPS = _counter / (diag_frameNo - _frameNo);
|
||||
player setVariable [QGVAR(player_cps), _playerCPS, true];
|
||||
|
||||
// log to RPT
|
||||
[
|
||||
|
||||
{_this call EFUNC(common,log);},
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
format ["Average Execution: %1 times per frame", _playerCPS],
|
||||
[
|
||||
["playerRawCPS", _rawCPS],
|
||||
["playerCPS", _playerCPS]
|
||||
]
|
||||
]
|
||||
] call CBA_fnc_directCall;
|
||||
};
|
||||
|
||||
nil;
|
||||
54
framework/performance/functions/fn_calculateServerStats.sqf
Normal file
54
framework/performance/functions/fn_calculateServerStats.sqf
Normal file
@@ -0,0 +1,54 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
[] spawn {
|
||||
// warning: while loop without suspension executes multiple times per frame
|
||||
private _counter = 0;
|
||||
private _endTime = diag_tickTime + 5;
|
||||
private _frameNo = diag_frameNo;
|
||||
while { diag_tickTime < _endTime } do
|
||||
{
|
||||
_counter = _counter + 1;
|
||||
};
|
||||
|
||||
private _rawCPS = _counter / (diag_frameNo - _frameNo);
|
||||
missionNamespace setVariable [QGVAR(server_raw_cps), _rawCPS];
|
||||
publicVariable QGVAR(server_raw_cps);
|
||||
|
||||
// with suspension
|
||||
private _counter = 0;
|
||||
private _endTime = diag_tickTime + 5;
|
||||
private _frameNo = diag_frameNo;
|
||||
while { diag_tickTime < _endTime } do
|
||||
{
|
||||
_counter = _counter + 1;
|
||||
uiSleep 0.001; // waits at least 1 frame
|
||||
};
|
||||
|
||||
private _serverCPS = _counter / (diag_frameNo - _frameNo);
|
||||
missionNamespace setVariable [QGVAR(server_cps), _counter / (diag_frameNo - _frameNo)];
|
||||
publicVariable QGVAR(server_cps);
|
||||
|
||||
// log to RPT
|
||||
[
|
||||
|
||||
{_this call EFUNC(common,log);},
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
format ["Average Server Execution: %1 times per frame", _serverCPS],
|
||||
[
|
||||
["serverRawCPS", _rawCPS],
|
||||
["serverCPS", _serverCPS]
|
||||
]
|
||||
]
|
||||
] call CBA_fnc_directCall;
|
||||
|
||||
[QGVARMAIN(serverEfficiency), [
|
||||
[
|
||||
["float", QGVARMAIN(raw_cps), missionNamespace getVariable [QGVAR(server_raw_cps), -1]],
|
||||
["float", QGVARMAIN(cps), missionNamespace getVariable [QGVAR(server_cps), -1]]
|
||||
]
|
||||
]] call CBA_fnc_localEvent;
|
||||
};
|
||||
|
||||
nil;
|
||||
3
framework/performance/script_component.hpp
Normal file
3
framework/performance/script_component.hpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#define COMPONENT performance
|
||||
#define COMPONENT_BEAUTIFIED Performance Monitoring
|
||||
#include "../script_mod.hpp"
|
||||
65
framework/reinsert/client/fn_addAceSelfActions.sqf
Normal file
65
framework/reinsert/client/fn_addAceSelfActions.sqf
Normal file
@@ -0,0 +1,65 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [
|
||||
["_types", [], [[]]], // classnames to assign these action to
|
||||
["_useInheritance", false, [false]]
|
||||
];
|
||||
|
||||
{ // forEach _types
|
||||
private _classToAddActionsTo = _x;
|
||||
|
||||
private _fileForReinsertAction = [
|
||||
QGVAR(fileReinsertRequestAction),
|
||||
"File Re-insert Request",
|
||||
"\A3\ui_f\data\igui\cfg\simpleTasks\types\takeoff_ca.paa",
|
||||
{ // statement
|
||||
params ["_target", "_player", "_params"];
|
||||
// find nearest base or location
|
||||
private _base = [_player] call EFUNC(common,getNearestBase);
|
||||
private _baseName = [_base] call EFUNC(common,getNameOfBase);
|
||||
// send event to server
|
||||
[QGVAR(fileReinsertRequest), [_player, _base]] call CBA_fnc_serverEvent;
|
||||
// notify player their request was filed
|
||||
[["Re-insert Request Filed"], [format["Location: %1", _baseName]]] call CBA_fnc_notify;
|
||||
},
|
||||
{ // condition
|
||||
params ["_target", "_player", "_params"];
|
||||
// find nearest base or location
|
||||
private _base = [_player] call EFUNC(common,getNearestBase);
|
||||
private _baseDistance = _player distance _base;
|
||||
|
||||
private _maxRangeToReady = [QGVAR(setting_maxRangeToReady)] call CBA_settings_fnc_get;
|
||||
private _existingQueue = missionNamespace getVariable [QGVAR(reinsertionQueue), []];
|
||||
|
||||
// check if module is enabled, player is near a base, and player is not already in the queue
|
||||
// (serverTime - GVAR(missionStartServerTime)) > 60*5 && // only allow after 15 minutes
|
||||
[QGVAR(setting_enabled)] call CBA_settings_fnc_get &&
|
||||
(_baseDistance < _maxRangeToReady) &&
|
||||
not (_player in (_existingQueue apply {_x#0}))
|
||||
}
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
[_classToAddActionsTo, 1, ["ACE_SelfActions"], _fileForReinsertAction, _useInheritance] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
private _removeFileForReinsertAction = [
|
||||
QGVAR(removeReinsertRequestAction),
|
||||
"Remove Re-insert Request",
|
||||
"\A3\ui_f\data\igui\cfg\simpleTasks\types\land_ca.paa",
|
||||
{ // statement
|
||||
params ["_target", "_player", "_params"];
|
||||
// send event to server
|
||||
[QGVAR(removeReinsertRequest), [_player]] call CBA_fnc_serverEvent;
|
||||
// notify player their request was rescinded
|
||||
"Re-insert Request Rescinded" call CBA_fnc_notify;
|
||||
},
|
||||
{ // condition
|
||||
params ["_target", "_player", "_params"];
|
||||
private _existingQueue = missionNamespace getVariable [QGVAR(reinsertionQueue), []];
|
||||
|
||||
// check if module is enabled, player is in the queue
|
||||
// (serverTime - GVAR(missionStartServerTime)) > 60*5 && // only allow after 15 minutes
|
||||
[QGVAR(setting_enabled)] call CBA_settings_fnc_get &&
|
||||
(_player in (_existingQueue apply {_x#0}))
|
||||
}
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
[_classToAddActionsTo, 1, ["ACE_SelfActions"], _removeFileForReinsertAction, _useInheritance] call ace_interact_menu_fnc_addActionToClass;
|
||||
} forEach _types;
|
||||
28
framework/reinsert/client/fn_addCheckQueueSelfAction.sqf
Normal file
28
framework/reinsert/client/fn_addCheckQueueSelfAction.sqf
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [
|
||||
["_types", [], [[]]], // classnames to assign these action to
|
||||
["_useInheritance", false, [false]]
|
||||
];
|
||||
|
||||
{ // forEach _types
|
||||
private _classToAddActionsTo = _x;
|
||||
|
||||
private _checkReinsertQueueAction = [
|
||||
QGVAR(checkReinsertQueue),
|
||||
"[PILOT] Check Re-insert Queue",
|
||||
"\A3\ui_f\data\igui\cfg\simpleTasks\types\land_ca.paa",
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
// request notification from the server
|
||||
call FUNC(requestShowQueue);
|
||||
// reset last check time
|
||||
localNamespace setVariable [QGVAR(lastReinsertQueueCheck), diag_tickTime];
|
||||
},
|
||||
{
|
||||
GVAR(setting_enabled);
|
||||
} // condition
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
[_classToAddActionsTo, 1, ["ACE_SelfActions"], _checkReinsertQueueAction, _useInheritance] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
} forEach _types;
|
||||
54
framework/reinsert/client/fn_initClient.sqf
Normal file
54
framework/reinsert/client/fn_initClient.sqf
Normal file
@@ -0,0 +1,54 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
// ACE SELF-INTERACTIONS FOR FILING AND RESCINDING REINSERT REQUESTS NEAR BASE - ALL PLAYERS
|
||||
localNamespace setVariable [QGVAR(fileForReinsertClassesAdded), []];
|
||||
// add actions to current class
|
||||
[["CAManBase"], true] call FUNC(addAceSelfActions);
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
// PILOTS ONLY
|
||||
// ACE SELF-INTERACTIONS FOR CHECKING REINSERT QUEUE - ONLY FOR PILOTS
|
||||
localNamespace setVariable [QGVAR(checkReinsertQueueClassesAdded), []];
|
||||
localNamespace setVariable [QGVAR(lastReinsertQueueCheck), diag_tickTime];
|
||||
|
||||
// add actions to pilot classes, and don't apply to child classes
|
||||
[["B_Helipilot_F", "B_helicrew_F"], false] call FUNC(addCheckQueueSelfAction);
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// 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 module not enabled and pilot forced check not enabled, exit
|
||||
if (not (
|
||||
[QGVAR(setting_enabled)] call CBA_settings_fnc_get and
|
||||
[QGVAR(setting_pilotForcedCheckEnabled)] call CBA_settings_fnc_get
|
||||
)) exitWith {};
|
||||
|
||||
// if last check was less than X minutes ago, skip
|
||||
private _lastCheck = localNamespace getVariable [QGVAR(lastReinsertQueueCheck), diag_tickTime];
|
||||
private _requiredCheckInterval = [QGVAR(setting_pilotForcedCheckInterval)] call CBA_settings_fnc_get;
|
||||
if (
|
||||
diag_tickTime - _lastCheck <
|
||||
_requiredCheckInterval
|
||||
) exitWith {}; // if last check was less than X minutes ago, skip
|
||||
|
||||
// last check was greater than X minutes ago
|
||||
// reset last check time
|
||||
localNamespace setVariable [QGVAR(lastReinsertQueueCheck), diag_tickTime];
|
||||
// request notification from the server
|
||||
call FUNC(requestShowQueue);
|
||||
}, 30] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
"initClient complete",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
localNamespace setVariable [QGVAR(complete), true];
|
||||
5
framework/reinsert/client/fn_requestShowQueue.sqf
Normal file
5
framework/reinsert/client/fn_requestShowQueue.sqf
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
[] remoteExec [QFUNC(returnReinsertQueueNotification), 2];
|
||||
83
framework/reinsert/functions/fn_addCBASettings.sqf
Normal file
83
framework/reinsert/functions/fn_addCBASettings.sqf
Normal file
@@ -0,0 +1,83 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
//---------------------
|
||||
// Respawn Settings
|
||||
[
|
||||
QGVAR(setting_enabled), // variable
|
||||
"CHECKBOX", // type
|
||||
["Enabled", "Whether or not players can file for reinsert and pilots can check the reinsert queue"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
true, // default value
|
||||
true, // global setting
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_enabled),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_maxRangeToReady), // variable
|
||||
"SLIDER", // type
|
||||
["Max Request Filing Range", "Maximum distance from a respawn point a player can be to ready up"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
[0, 1000, 400, 0, false], // [_min, _max, _default, _trailingDecimals, _isPercentage]
|
||||
true, // global setting
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_maxRangeToReady),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_maxWait), // variable
|
||||
"TIME", // type
|
||||
["Max Wait Before Global Notify", "How long should at least one person be waiting before prompting a global notification."], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
[60*5, 60*30, 60*20], // [_min, _max, _default]
|
||||
true,
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_maxWait),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_pilotForcedCheckEnabled), // variable
|
||||
"CHECKBOX", // type
|
||||
["Force Queue Checks for Pilots", "Whether or not pilots are forced to view the contents of the reinsertion queue per interval"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
false, // default value
|
||||
true, // global setting
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_pilotForcedCheckEnabled),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_pilotForcedCheckInterval), // variable
|
||||
"TIME", // type
|
||||
["Pilot Forced Check Interval", "Pilots will be force shown the queue if they haven't checked it in X seconds"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
[60*5, 60*30, 60*10], // [_min, _max, _default]
|
||||
true,
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_pilotForcedCheckInterval),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
3
framework/reinsert/script_component.hpp
Normal file
3
framework/reinsert/script_component.hpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#define COMPONENT reinsert
|
||||
#define COMPONENT_BEAUTIFIED Reinsertion
|
||||
#include "../script_mod.hpp"
|
||||
61
framework/reinsert/server/fn_addToQueue.sqf
Normal file
61
framework/reinsert/server/fn_addToQueue.sqf
Normal file
@@ -0,0 +1,61 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [
|
||||
["_player", objNull, [objNull]],
|
||||
["_base", objNull, [objNull]],
|
||||
["_timeFiled", diag_tickTime, [25]]
|
||||
];
|
||||
|
||||
if (!isServer) exitWith {
|
||||
[
|
||||
LEVEL_ERROR,
|
||||
QUOTE(COMPONENT),
|
||||
"ATTEMPTED RUN ON CLIENT",
|
||||
[
|
||||
["player", _player],
|
||||
["base", _base]
|
||||
]
|
||||
] call EFUNC(common,log);
|
||||
["ATTEMPTED RUN ON CLIENT"] call BIS_fnc_error;
|
||||
};
|
||||
if (
|
||||
isNull _player ||
|
||||
isNull _base
|
||||
) exitWith {
|
||||
[
|
||||
LEVEL_ERROR,
|
||||
QUOTE(COMPONENT),
|
||||
"NULL PARAMETERS",
|
||||
[
|
||||
["player", _player],
|
||||
["base", _base]
|
||||
]
|
||||
] call EFUNC(common,log);
|
||||
["NULL PARAMETERS"] call BIS_fnc_error;
|
||||
};
|
||||
|
||||
|
||||
private _maxRangeToReady = missionNamespace getVariable [QGVAR(setting_maxRangeToReady), 400];
|
||||
// nearest base here is the same as the base sent
|
||||
private _nearestBase = _base;
|
||||
|
||||
GVAR(reinsertionQueue) pushBackUnique [
|
||||
_player, _base, _timeFiled
|
||||
];
|
||||
// broadcast new list to all machines
|
||||
publicVariable QGVAR(reinsertionQueue);
|
||||
|
||||
// log to rpt
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"PLAYER FILED REQUEST",
|
||||
[_player, [
|
||||
["filedAtBase", [_base] call EFUNC(common,getNameOfBase)],
|
||||
["filedAtBaseDistance", _player distance _base],
|
||||
["closestBase", [_nearestBase] call EFUNC(common,getNameOfBase)],
|
||||
["closestBaseDistance", _player distance _nearestBase],
|
||||
["maxDistanceSetting", _maxRangeToReady],
|
||||
["inQueueDuration", diag_tickTime - _timeFiled]
|
||||
]] call EFUNC(common,addPlayerInfoToArray)
|
||||
] call EFUNC(common,log);
|
||||
@@ -1,8 +1,10 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
// if at least 1 player in the queue has been waiting longer than the configured timeout, notify all players
|
||||
private _timeout = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_max_wait", 60*20]; // default 20 minutes
|
||||
private _timeoutPlayers = milsim_reinsert_reinsertionQueue select {
|
||||
private _timeout = missionNamespace getVariable [QGVAR(setting_maxWait), 60*20]; // default 20 minutes
|
||||
private _timeoutPlayers = GVAR(reinsertionQueue) select {
|
||||
_x params ["_player", "_base", "_timeFiled"];
|
||||
alive (_player) &&
|
||||
(diag_tickTime - (_timeFiled)) > _timeout
|
||||
@@ -10,10 +12,10 @@ private _timeoutPlayers = milsim_reinsert_reinsertionQueue select {
|
||||
if (count _timeoutPlayers > 0) then {
|
||||
// GLOBAL CBA NOTIFY
|
||||
private _playerLines = [["Players are still waiting for Re-insert!", 1.2, [1, 0.64, 0, 1]]];
|
||||
private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_maxRangeToReady", 400];
|
||||
private _maxRangeToReady = missionNamespace getVariable [QGVAR(setting_maxRangeToReady), 400];
|
||||
|
||||
// get base objects from queue
|
||||
private _basesWithPeople = (missionNamespace getVariable ["milsim_reinsert_reinsertionQueue", []]) apply {_x#1};
|
||||
private _basesWithPeople = (missionNamespace getVariable [QGVAR(reinsertionQueue), []]) apply {_x#1};
|
||||
// get unique base objects
|
||||
private _basesWithPeople = _basesWithPeople arrayIntersect _basesWithPeople;
|
||||
|
||||
@@ -21,7 +23,7 @@ if (count _timeoutPlayers > 0) then {
|
||||
private _thisBase = _x;
|
||||
|
||||
// Add line for base name
|
||||
_playerLines pushBack ([[_thisBase] call milsim_fnc_getNameOfBase, 1, [0,1,0,1]]);
|
||||
_playerLines pushBack ([[_thisBase] call EFUNC(common,getNameOfBase), 1, [0,1,0,1]]);
|
||||
|
||||
// Get players under this base
|
||||
private _thisBasePlayers = _timeoutPlayers select {_x#1 isEqualTo _thisBase};
|
||||
@@ -35,36 +37,35 @@ if (count _timeoutPlayers > 0) then {
|
||||
{ // for each player under this base, add a line
|
||||
_x params ["_player", "_base", "_timeFiled"];
|
||||
// get the closest base to the player
|
||||
private _nearestBase = [_player] call milsim_fnc_getNearestBase;
|
||||
private _nearestBase = [_player] call EFUNC(common,getNearestBase);
|
||||
|
||||
// add player to array of players under bases
|
||||
_playerLines pushBack ([format [
|
||||
"%1: %2 [%3]",
|
||||
groupID (group (_player)),
|
||||
name (_player),
|
||||
name _player,
|
||||
[diag_tickTime - (_timeFiled), "MM:SS"] call BIS_fnc_secondsToString
|
||||
], 0.8, [0.8, 0.8, 0.8, 1]]);
|
||||
|
||||
// log to rpt
|
||||
private _logParams = [
|
||||
["filedAtBase", [_base] call milsim_fnc_getNameOfBase],
|
||||
["filedAtBaseDistance", _player distance _base],
|
||||
["closestBase", [_nearestBase] call milsim_fnc_getNameOfBase],
|
||||
["closestBaseDistance", _player distance _nearestBase],
|
||||
["maxDistanceSetting", _maxRangeToReady],
|
||||
["inQueueDuration", diag_tickTime - _timeFiled]
|
||||
];
|
||||
_logParams = [_player, _logParams] call milsim_fnc_addPlayerInfoToArray;
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
LEVEL_WARNING,
|
||||
QUOTE(COMPONENT),
|
||||
"PLAYER WAITING OVER TIMEOUT",
|
||||
_logParams
|
||||
] call milsim_fnc_log;
|
||||
[_player, [
|
||||
["filedAtBase", [_base] call EFUNC(common,getNameOfBase)],
|
||||
["filedAtBaseDistance", _player distance _base],
|
||||
["closestBase", [_nearestBase] call EFUNC(common,getNameOfBase)],
|
||||
["closestBaseDistance", _player distance _nearestBase],
|
||||
["maxDistanceSetting", _maxRangeToReady],
|
||||
["inQueueDuration", diag_tickTime - _timeFiled]
|
||||
]] call EFUNC(common,addPlayerInfoToArray)
|
||||
] call EFUNC(common,log);
|
||||
} forEach _thisBasePlayers;
|
||||
} forEach _basesWithPeople;
|
||||
|
||||
// SEND NOTIFY
|
||||
_playerLines remoteExec ["CBA_fnc_notify", [0, -2] select isDedicated];
|
||||
// RESET NOTIFICATION TIMER
|
||||
milsim_reinsert_reinsertionOverTimeoutLastNotificationTime = diag_tickTime;
|
||||
GVAR(overTimeoutLastNotificationTime) = diag_tickTime;
|
||||
};
|
||||
@@ -3,48 +3,51 @@
|
||||
// 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
|
||||
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
// array of all respawn modules in the mission, used as 'base' locations for reinsertion
|
||||
milsim_baseObjects = allMissionObjects "ModuleRespawnPosition_F";
|
||||
publicVariable "milsim_baseObjects";
|
||||
|
||||
// register queue
|
||||
milsim_reinsert_reinsertionQueue = [];
|
||||
publicVariable "milsim_reinsert_reinsertionQueue";
|
||||
|
||||
GVAR(reinsertionQueue) = [];
|
||||
publicVariable QGVAR(reinsertionQueue);
|
||||
|
||||
// server mission start time
|
||||
milsim_reinsert_missionStartServerTime = serverTime;
|
||||
GVAR(missionStartServerTime) = serverTime;
|
||||
|
||||
// FILE REQUEST CBA HANDLER
|
||||
["milsim_reinsert_fileReinsertRequest", {
|
||||
[QGVAR(fileReinsertRequest), {
|
||||
params ["_player", "_base"];
|
||||
[_player, _base] call milsim_reinsert_fnc_addToQueue;
|
||||
[_player, _base] call FUNC(addToQueue);
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
// REMOVE REQUEST CBA HANDLER
|
||||
["milsim_reinsert_removeReinsertRequest", {
|
||||
[QGVAR(removeReinsertRequest), {
|
||||
params ["_player"];
|
||||
[_player] call milsim_reinsert_fnc_removeFromQueue;
|
||||
[_player] call FUNC(removeFromQueue);
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
|
||||
// automated wait threshold timer
|
||||
milsim_reinsert_reinsertionOverTimeoutLastNotificationTime = 0;
|
||||
GVAR(overTimeoutLastNotificationTime) = 0;
|
||||
|
||||
[{ // every 60 seconds
|
||||
|
||||
// validate queue
|
||||
call milsim_reinsert_fnc_validateQueue;
|
||||
call FUNC(validateQueue);
|
||||
|
||||
// check if last overTimeout notification was sent more than X minutes ago
|
||||
if (
|
||||
diag_tickTime - milsim_reinsert_reinsertionOverTimeoutLastNotificationTime > 60*5
|
||||
diag_tickTime - GVAR(overTimeoutLastNotificationTime) > 60*5
|
||||
) then {
|
||||
// show global queue notification with any players that are over timeout
|
||||
call milsim_reinsert_fnc_globalShowQueue;
|
||||
call FUNC(globalShowQueue);
|
||||
};
|
||||
|
||||
}, 60] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
"postInit complete",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
60
framework/reinsert/server/fn_removeFromQueue.sqf
Normal file
60
framework/reinsert/server/fn_removeFromQueue.sqf
Normal file
@@ -0,0 +1,60 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [["_player", objNull, [objNull]]];
|
||||
|
||||
if (!isServer) exitWith {
|
||||
[
|
||||
LEVEL_ERROR,
|
||||
QUOTE(COMPONENT),
|
||||
"ATTEMPTED RUN ON CLIENT",
|
||||
[
|
||||
["player", _player]
|
||||
]
|
||||
] call EFUNC(common,log);
|
||||
};
|
||||
if (isNull _player) exitWith {
|
||||
[
|
||||
LEVEL_ERROR,
|
||||
QUOTE(COMPONENT),
|
||||
"NULL PARAMETERS",
|
||||
[
|
||||
["player", _player]
|
||||
]
|
||||
] call EFUNC(common,log);
|
||||
};
|
||||
|
||||
// get entries for this player from queue
|
||||
private _unitArrs = GVAR(reinsertionQueue) select {_x#0 isEqualTo _player};
|
||||
// if player not in queue, skip
|
||||
if (count _unitArrs isEqualTo 0) exitWith {};
|
||||
|
||||
private _maxRangeToReady = missionNamespace getVariable [QGVAR(setting_maxRangeToReady), 400];
|
||||
|
||||
// remove player from queue
|
||||
GVAR(reinsertionQueue) = GVAR(reinsertionQueue) - _unitArrs;
|
||||
// broadcast new list to all machines
|
||||
publicVariable QGVAR(reinsertionQueue);
|
||||
|
||||
// sort _unitArrs by time in queue, descending, to get longest wait (if for some reason there's a duplicate)
|
||||
[_unitArrs, [], {
|
||||
_x#2
|
||||
}, "DESCEND"] call BIS_fnc_sortBy;
|
||||
|
||||
// get first entry (longest wait)
|
||||
(_unitArrs#0) params ["_player", "_base", "_timeFiled"]; // _unitArr = [unit, base, timeInQueue]
|
||||
// get the closest base to the player
|
||||
private _nearestBase = [_player] call EFUNC(common,getNearestBase);
|
||||
// log to rpt
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"PLAYER RESCINDED REQUEST",
|
||||
[_player, [
|
||||
["filedAtBase", [_base] call EFUNC(common,getNameOfBase)],
|
||||
["filedAtBaseDistance", _player distance _base],
|
||||
["closestBase", [_nearestBase] call EFUNC(common,getNameOfBase)],
|
||||
["closestBaseDistance", _player distance _nearestBase],
|
||||
["maxDistanceSetting", _maxRangeToReady],
|
||||
["inQueueDuration", diag_tickTime - _timeFiled]
|
||||
]] call EFUNC(common,addPlayerInfoToArray)
|
||||
] call EFUNC(common,log);
|
||||
@@ -7,6 +7,8 @@
|
||||
Author: IndigoFox
|
||||
*/
|
||||
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if (not isRemoteExecuted) exitWith {
|
||||
diag_log text format ["[milsim] (respawn_reinsertion) SHOW QUEUE NOT REMOTE EXECUTED"];
|
||||
};
|
||||
@@ -25,16 +27,16 @@ if (isNull _userObject) exitWith {
|
||||
};
|
||||
|
||||
// log to rpt
|
||||
private _logParams = [_userObject, []] call milsim_fnc_addPlayerInfoToArray;
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"SHOW QUEUE REQUESTED",
|
||||
_logParams
|
||||
] call milsim_fnc_log;
|
||||
[_userObject] call EFUNC(common,addPlayerInfoToArray)
|
||||
] call EFUNC(common,log);
|
||||
|
||||
private _queue = missionNamespace getVariable ["milsim_reinsert_reinsertionQueue", []];
|
||||
private _queue = missionNamespace getVariable [QGVAR(reinsertionQueue), []];
|
||||
// get base objects from queue
|
||||
private _basesWithPeople = (missionNamespace getVariable ["milsim_reinsert_reinsertionQueue", []]) apply {_x#1};
|
||||
private _basesWithPeople = (missionNamespace getVariable [QGVAR(reinsertionQueue), []]) apply {_x#1};
|
||||
// get unique base objects
|
||||
private _basesWithPeople = _basesWithPeople arrayIntersect _basesWithPeople;
|
||||
|
||||
@@ -48,7 +50,7 @@ if (count _basesWithPeople isEqualTo 0) then {
|
||||
// forEach _basesWithPeople
|
||||
{
|
||||
private _thisBase = _x;
|
||||
private _baseName = [_thisBase] call milsim_fnc_getNameOfBase;
|
||||
private _baseName = [_thisBase] call EFUNC(common,getNameOfBase);
|
||||
|
||||
// generate player lines for this base
|
||||
private _playerLines = _queue select {
|
||||
57
framework/reinsert/server/fn_validateQueue.sqf
Normal file
57
framework/reinsert/server/fn_validateQueue.sqf
Normal file
@@ -0,0 +1,57 @@
|
||||
// revalidate any players in the queue
|
||||
// compare their distance to the nearest base, and remove them if they're too far away (or dead)
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
private _stillValid = [];
|
||||
private _maxRangeToReady = missionNamespace getVariable [QGVAR(setting_maxRangeToReady), 400];
|
||||
{
|
||||
_x params ["_player", "_base", "_timeFiled"]; // _unitArr = [unit, baseName, timeInQueue]
|
||||
|
||||
private _distanceToOriginalBase = _player distance _base;
|
||||
// get the closest base to the player
|
||||
private _nearestBase = [_player] call EFUNC(common,getNearestBase);
|
||||
private _isCloseEnoughToAnyBase = (_player distance _nearestBase) < _maxRangeToReady;
|
||||
|
||||
if (not _isCloseEnoughToAnyBase || not (alive _player)) then {
|
||||
// don't include player in updated queue
|
||||
// log to rpt
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"PLAYER DEQUEUED AUTOMATICALLY",
|
||||
[_player, [
|
||||
["filedAtBase", [_base] call EFUNC(common,getNameOfBase)],
|
||||
["filedAtBaseDistance", _player distance _base],
|
||||
["closestBase", [_nearestBase] call EFUNC(common,getNameOfBase)],
|
||||
["closestBaseDistance", _player distance _nearestBase],
|
||||
["maxDistanceSetting", _maxRangeToReady],
|
||||
["inQueueDuration", diag_tickTime - _timeFiled]
|
||||
]] call EFUNC(common,addPlayerInfoToArray)
|
||||
] call EFUNC(common,log);
|
||||
// continue loop
|
||||
continue
|
||||
};
|
||||
|
||||
// include player in updated queue, and update their location to nearest base
|
||||
_stillValid pushBackUnique [_player, _nearestBase, _timeFiled];
|
||||
// if player's base has changed, log to rpt
|
||||
if (_base != _nearestBase) then {
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"PLAYER BASE WAS UPDATED",
|
||||
[_player, [
|
||||
["filedAtBase", [_base] call EFUNC(common,getNameOfBase)],
|
||||
["filedAtBaseDistance", _player distance _base],
|
||||
["closestBase", [_nearestBase] call EFUNC(common,getNameOfBase)],
|
||||
["closestBaseDistance", _player distance _nearestBase],
|
||||
["maxDistanceSetting", _maxRangeToReady],
|
||||
["inQueueDuration", diag_tickTime - _timeFiled]
|
||||
]] call EFUNC(common,addPlayerInfoToArray)
|
||||
] call EFUNC(common,log);
|
||||
};
|
||||
} forEach GVAR(reinsertionQueue);
|
||||
|
||||
// broadcast new list to all machines
|
||||
GVAR(reinsertionQueue) = _stillValid;
|
||||
publicVariable QGVAR(reinsertionQueue);
|
||||
@@ -0,0 +1,63 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
// adds a scroll wheel action to all arsenal boxes to spawn different supply crate types
|
||||
|
||||
private _arsenalBoxClassName = "Land_PaperBox_open_full_F";
|
||||
|
||||
// get all instances of the arsenal item
|
||||
private _arsenalBoxes = (allMissionObjects _arsenalBoxClassName) select {
|
||||
// only select the ones that already have user actions attached
|
||||
count (actionIDs _x) > 0;
|
||||
};
|
||||
|
||||
private _supplyCratesCfg = call FUNC(getSupplyCratesCfg);
|
||||
private _supplyCrateTypesCfgs = _supplyCratesCfg call BIS_fnc_returnChildren;
|
||||
|
||||
{
|
||||
// add scroll wheel action to spawn different supply box types
|
||||
private _arsenalBox = _x;
|
||||
|
||||
// always remove old actions if they exist
|
||||
private _actionIDs = _arsenalBox getVariable [QGVAR(supplyCrateActionIDs), []];
|
||||
{
|
||||
_arsenalBox removeAction _x;
|
||||
} forEach _actionIDs;
|
||||
_arsenalBox setVariable [QGVAR(supplyCrateActionIDs), []];
|
||||
|
||||
|
||||
// if setting disabled, skip adding actions
|
||||
if (not (
|
||||
[QGVAR(setting_allowSupplyBoxScrollWheelSpawning)] call CBA_settings_fnc_get
|
||||
)) then {continue};
|
||||
|
||||
|
||||
{ // add an action for each supply crate type
|
||||
private _cfg = _x;
|
||||
private _supplyCrateDisplayName = (_cfg >> "displayName") call BIS_fnc_getCfgData;
|
||||
|
||||
// add action to spawn supply crate
|
||||
private _actionID = _arsenalBox addAction [format ["<t color='#ffffff'>Spawn %1</t>", _supplyCrateDisplayName], {
|
||||
params ["_target", "_caller", "_actionId", "_arguments"];
|
||||
_arguments params ["_supplyCrateCfg"];
|
||||
[
|
||||
objNull,
|
||||
configName _supplyCrateCfg,
|
||||
getPos _target
|
||||
] call FUNC(createBox);
|
||||
|
||||
// log action use in server RPT
|
||||
private _supplyCrateDisplayName = (_supplyCrateCfg >> "displayName") call BIS_fnc_getCfgData;
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"Supply crate spawned",
|
||||
[player, [
|
||||
["supplyCrateDisplayName", _supplyCrateDisplayName],
|
||||
["supplyCrateCfgName", configName _supplyCrateCfg],
|
||||
["position", getPos _target]
|
||||
]] call EFUNC(common,addPlayerInfoToArray)
|
||||
] remoteExec [QEFUNC(common,log), 2];
|
||||
}, [_cfg], 0, false, true, "", ""];
|
||||
(_arsenalBox getVariable [QGVAR(supplyCrateActionIDs), []]) pushBack _actionID;
|
||||
} forEach _supplyCrateTypesCfgs;
|
||||
} forEach _arsenalBoxes;
|
||||
29
framework/resupply/functions/fn_addCBASettings.sqf
Normal file
29
framework/resupply/functions/fn_addCBASettings.sqf
Normal file
@@ -0,0 +1,29 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
[
|
||||
QGVAR(setting_allowSupplyBoxScrollWheelSpawning), // variable
|
||||
"CHECKBOX", // type
|
||||
["Allow Spawning Boxes from Arsenal Box", "If true, adds scroll wheel options to arsenal boxes to spawn supply boxes"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
false, // default value
|
||||
true, // global setting
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_allowSupplyBoxScrollWheelSpawning),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
|
||||
if (_value && hasInterface && time > 0) then {
|
||||
[] call FUNC(addArsenalObjectSpawnBoxActions);
|
||||
};
|
||||
},
|
||||
true // requires mission restart
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"CREATED SETTINGS",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
@@ -27,7 +27,8 @@
|
||||
["weapon", (weaponCargo cursorObject) call BIS_fnc_consolidateArray]
|
||||
]];
|
||||
*/
|
||||
|
||||
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [
|
||||
["_box", objNull, [objNull]],
|
||||
@@ -36,7 +37,7 @@ params [
|
||||
];
|
||||
|
||||
// get defs class
|
||||
private _supplyCratesCfg = call milsim_resupply_fnc_getSupplyCratesCfg;
|
||||
private _supplyCratesCfg = call FUNC(getSupplyCratesCfg);
|
||||
if (!isClass _supplyCratesCfg) exitWith {
|
||||
["Resupply Boxes: Failed to load crate definitions, possibly a bad edit?"] call BIS_fnc_error;
|
||||
objNull;
|
||||
2
framework/resupply/functions/fn_getSupplyCratesCfg.sqf
Normal file
2
framework/resupply/functions/fn_getSupplyCratesCfg.sqf
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "..\script_component.hpp"
|
||||
(missionConfigFile >> "SupplyCrates");
|
||||
14
framework/resupply/functions/fn_initClient.sqf
Normal file
14
framework/resupply/functions/fn_initClient.sqf
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
call FUNC(addArsenalObjectSpawnBoxActions);
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
"initClient complete",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
localNamespace setVariable [QGVAR(complete), true];
|
||||
3
framework/resupply/script_component.hpp
Normal file
3
framework/resupply/script_component.hpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#define COMPONENT resupply
|
||||
#define COMPONENT_BEAUTIFIED Resupply
|
||||
#include "../script_mod.hpp"
|
||||
11
framework/script_macros.hpp
Normal file
11
framework/script_macros.hpp
Normal file
@@ -0,0 +1,11 @@
|
||||
// all text before cba include
|
||||
#define SETTINGS_GROUP_NAME 17th Battalion
|
||||
#define MODULE_CATEGORY_NAME 17th Battalion
|
||||
|
||||
#define LEVEL_TRACE -1
|
||||
#define LEVEL_DEBUG 0
|
||||
#define LEVEL_INFO 1
|
||||
#define LEVEL_WARNING 2
|
||||
#define LEVEL_ERROR 3
|
||||
|
||||
#include "\x\cba\addons\main\script_macros_mission.hpp"
|
||||
17
framework/script_mod.hpp
Normal file
17
framework/script_mod.hpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#define PREFIX milsim
|
||||
|
||||
#include "script_version.hpp"
|
||||
|
||||
#define VERSION MAJOR.MINOR.PATCHLVL
|
||||
#define VERSION_STR MAJOR.MINOR.PATCHLVL
|
||||
#define VERSION_AR MAJOR,MINOR,PATCHLVL
|
||||
|
||||
// #define DEBUG_MODE -1 // TRACE
|
||||
// #define DEBUG_MODE 0 // DEBUG
|
||||
#define DEBUG_MODE 1 // INFO
|
||||
// #define DEBUG_MODE 2 // WARNING
|
||||
// #define DEBUG_MODE 3 // ERROR
|
||||
|
||||
|
||||
// should always be last
|
||||
#include "script_macros.hpp"
|
||||
4
framework/script_version.hpp
Normal file
4
framework/script_version.hpp
Normal file
@@ -0,0 +1,4 @@
|
||||
#define MAJOR 4
|
||||
#define MINOR 0
|
||||
#define PATCHLVL 0
|
||||
#define BUILD 0
|
||||
138
framework/triageIcons/functions/fn_addCBASettings.sqf
Normal file
138
framework/triageIcons/functions/fn_addCBASettings.sqf
Normal file
@@ -0,0 +1,138 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
//---------------------
|
||||
// Medical Overlay
|
||||
//---------------------
|
||||
|
||||
[
|
||||
QGVAR(setting_enabled), // variable
|
||||
"CHECKBOX", // type
|
||||
["Enable 3D Triage Card State", "For players with medic perms, a colored dot will be shown over unconscious units within Xm indicating current ACE Triage State"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
true, // default value
|
||||
false, // isGlobal
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_enabled),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
|
||||
call FUNC(addGetEntitiesPFH);
|
||||
call FUNC(addDrawIconsPFH);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_drawRange), // variable
|
||||
"LIST", // type
|
||||
["Range To Draw Icons", "Determines range at which dots are visible"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
[[2, 4, 6, 8, 10], ["2", "4", "6", "8", "10"], 4], // option values, option labels, default index
|
||||
false, // isGlobal
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_drawRange),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_colorMinimal), // variable
|
||||
"COLOR", // type
|
||||
["Minimal State Color", "Color of the dot for MINIMAL state"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
[0, 0.5, 0], // default value
|
||||
false, // isGlobal
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_colorMinimal),
|
||||
str _value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
|
||||
call FUNC(updateColors);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_colorDelayed), // variable
|
||||
"COLOR", // type
|
||||
["Delayed State Color", "Color of the dot for DELAYED state"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
[1, 0.84, 0], // default value
|
||||
false, // isGlobal
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_colorDelayed),
|
||||
str _value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
|
||||
call FUNC(updateColors);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_colorImmediate), // variable
|
||||
"COLOR", // type
|
||||
["Immediate State Color", "Color of the dot for IMMEDIATE state"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
[1, 0, 0], // default value
|
||||
false, // isGlobal
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_colorImmediate),
|
||||
str _value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
|
||||
call FUNC(updateColors);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_colorDeceased), // variable
|
||||
"COLOR", // type
|
||||
["Deceased State Color", "Color of the dot for DECEASED state"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
[0.15, 0.15, 0.15], // default value
|
||||
false, // isGlobal
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_colorDeceased),
|
||||
str _value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
|
||||
call FUNC(updateColors);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_colorNone), // variable
|
||||
"COLOR", // type
|
||||
["None State Color", "Color of the dot for NONE state, when a card is not set"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
[0.5, 0.5, 0.5], // default value
|
||||
false, // isGlobal
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_colorNone),
|
||||
str _value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
|
||||
call FUNC(updateColors);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"CREATED SETTINGS",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
62
framework/triageIcons/functions/fn_addDrawIconsPFH.sqf
Normal file
62
framework/triageIcons/functions/fn_addDrawIconsPFH.sqf
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
|
||||
// Per-frame handler to draw icons
|
||||
// cleanup
|
||||
if (!isNil QGVAR(drawIconsPfh)) then {
|
||||
[GVAR(drawIconsPfh)] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
// add pfh
|
||||
GVAR(drawIconsPfh) = [{
|
||||
// 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};
|
||||
private _color = GVAR(colors) select (_triageLevel - 1);
|
||||
_color set [3, 0.9]; // set alpha
|
||||
// draw position, slightly above the prone unit
|
||||
private _drawPos = (visiblePosition _unit) 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
|
||||
"", // text
|
||||
true // outline
|
||||
// further params optional, omitted
|
||||
];
|
||||
} forEach GVAR(drawTargets);
|
||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
18
framework/triageIcons/functions/fn_addGetEntitiesPFH.sqf
Normal file
18
framework/triageIcons/functions/fn_addGetEntitiesPFH.sqf
Normal file
@@ -0,0 +1,18 @@
|
||||
#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;
|
||||
13
framework/triageIcons/functions/fn_initClient.sqf
Normal file
13
framework/triageIcons/functions/fn_initClient.sqf
Normal file
@@ -0,0 +1,13 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
// List of units to draw icons for
|
||||
GVAR(drawTargets) = [];
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
"initClient complete",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
localNamespace setVariable [QGVAR(complete), true];
|
||||
18
framework/triageIcons/functions/fn_updateColors.sqf
Normal file
18
framework/triageIcons/functions/fn_updateColors.sqf
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
// ACE Triage colors, for consistency across UIs and functions
|
||||
// GVAR(colors) = [
|
||||
// (([QGVAR(setting_colorMinimal)] call CBA_settings_fnc_get) + 0.9), // TRIAGE_COLOR_MINIMAL
|
||||
// (([QGVAR(setting_colorDelayed)] call CBA_settings_fnc_get) + 0.9), // TRIAGE_COLOR_DELAYED
|
||||
// (([QGVAR(setting_colorImmediate)] call CBA_settings_fnc_get) + 0.9), // TRIAGE_COLOR_IMMEDIATE
|
||||
// (([QGVAR(setting_colorDeceased)] call CBA_settings_fnc_get) + 0.9), // TRIAGE_COLOR_DECEASED
|
||||
// (([QGVAR(setting_colorNone)] call CBA_settings_fnc_get) + 0) // TRIAGE_COLOR_NONE
|
||||
// ];
|
||||
|
||||
GVAR(colors) = [
|
||||
([QGVAR(setting_colorMinimal)] call CBA_settings_fnc_get), // TRIAGE_COLOR_MINIMAL
|
||||
([QGVAR(setting_colorDelayed)] call CBA_settings_fnc_get), // TRIAGE_COLOR_DELAYED
|
||||
([QGVAR(setting_colorImmediate)] call CBA_settings_fnc_get), // TRIAGE_COLOR_IMMEDIATE
|
||||
([QGVAR(setting_colorDeceased)] call CBA_settings_fnc_get), // TRIAGE_COLOR_DECEASED
|
||||
([QGVAR(setting_colorNone)] call CBA_settings_fnc_get) // TRIAGE_COLOR_NONE
|
||||
];
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user