version 3.0
This commit is contained in:
17
CHANGELOG.md
17
CHANGELOG.md
@@ -4,6 +4,23 @@ 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.0] - 2023-05-03
|
||||
|
||||
### Added
|
||||
|
||||
- CBA settings for dynamic enable/disable of player/server metrics gathering
|
||||
- CBA settings for dynamic timing for player/server metrics gathering
|
||||
|
||||
### Changed
|
||||
|
||||
- Reformat CBA settings
|
||||
- Separate player and server metrics into proper functions/initializers/handlers
|
||||
- Refactor most functions and change initialization routines in `CfgFunctions`
|
||||
|
||||
### Removed
|
||||
|
||||
- Remove `CfgRemoteExec` from `description.ext` as it has been deprecated as of Arma v1.54
|
||||
|
||||
## [2.2] - 2023-04-23
|
||||
|
||||
### Added
|
||||
|
||||
@@ -93,28 +93,6 @@ class cfgFunctions
|
||||
};
|
||||
|
||||
|
||||
class cfgRemoteExec
|
||||
{
|
||||
// List of script commands allowed to be sent from client via remoteExec
|
||||
class Commands
|
||||
{
|
||||
// State of remoteExec: 0-turned off, 1-turned on, taking whitelist into account, 2-turned on, however, ignoring whitelists (default because of backward compatibility)
|
||||
mode = 2;
|
||||
};
|
||||
// List of script functions allowed to be sent from client via remoteExec
|
||||
class Functions
|
||||
{
|
||||
// State of remoteExec: 0-turned off, 1-turned on, taking whitelist into account, 2-turned on, however, ignoring whitelists (default because of backward compatibility)
|
||||
mode = 2;
|
||||
// Ability to send jip messages: 0-disabled, 1-enabled (default)
|
||||
jip = 1;
|
||||
class BIS_fnc_effectKilledAirDestruction {};
|
||||
class BIS_fnc_effectKilledSecondaries {};
|
||||
class BIS_fnc_objectVar {};
|
||||
class BIS_fnc_execVM {};
|
||||
};
|
||||
};
|
||||
|
||||
class CfgDebriefingSections {
|
||||
class acex_killTracker {
|
||||
title = "Acex Killed Events";
|
||||
|
||||
@@ -1,46 +1,63 @@
|
||||
class milsim
|
||||
{
|
||||
tag = "milsim";
|
||||
class settings
|
||||
{
|
||||
class setDefaults { postInit = 1; };
|
||||
class addCBASettings { postInit = 1; };
|
||||
class addAARChatHandler { postInit = 1; };
|
||||
class addRespawnChatHandler { postInit = 1; };
|
||||
};
|
||||
|
||||
class init
|
||||
{
|
||||
class initManager { postInit = 1; };
|
||||
class init {};
|
||||
class initPlayerLocal {};
|
||||
class initPlayerCPS {};
|
||||
class initDNI_PlayerFPS {};
|
||||
class initServer {};
|
||||
class initServer { postInit = 1;}; //needs refactor
|
||||
class initPlayerLocal { postInit = 1;};
|
||||
};
|
||||
class userSettings
|
||||
{
|
||||
};
|
||||
class intel {
|
||||
class initFBCB2 {};
|
||||
class MDS_callsigns {};
|
||||
class MDS_fixedAssets {};
|
||||
class MDS_rotaryAssets {};
|
||||
class MDS_smokeColors {};
|
||||
class MDS_radioFrequencies {};
|
||||
class MDS_environment {};
|
||||
class messageAssetStatus {};
|
||||
|
||||
class fbcb2 {
|
||||
class addFBCB2DiaryEntries { postInit = 1; };
|
||||
class initFBCB2 { postInit = 1; };
|
||||
class processFBCB2Callsigns {};
|
||||
class processFBCB2FixedWingAssets {};
|
||||
class processFBCB2RotaryAssets {};
|
||||
class processFBCB2RadioFrequencies {};
|
||||
class processFBCB2SmokeColors {};
|
||||
class processFBCB2Environment {};
|
||||
class messageFBCB2AssetStatus {};
|
||||
};
|
||||
|
||||
class client {
|
||||
class zenModules { postInit = 1; };
|
||||
class addZenModules { postInit = 1; };
|
||||
class addDNI_PlayerFPS { postInit = 1; }; // needs refactor
|
||||
class bindEventHandlers { postInit = 1; };
|
||||
class bindVehicleActions { postInit = 1; };
|
||||
class addClientStatsPFH {};
|
||||
class calculateClientStats {};
|
||||
};
|
||||
|
||||
class server {
|
||||
class addServerStatsPFH {};
|
||||
class calculateServerStats {};
|
||||
};
|
||||
|
||||
class resupply {
|
||||
class createAmmoBox {};
|
||||
class createWeaponsBox {};
|
||||
class createMedicalBox {};
|
||||
}
|
||||
|
||||
class ambience {
|
||||
class flakInitVehicle {};
|
||||
class flakEH {};
|
||||
};
|
||||
|
||||
class map
|
||||
{
|
||||
class copyMapFromPlayer {};
|
||||
class getPlayerMapMarkers {};
|
||||
class loadMapMarkers {};
|
||||
class mapMarkerToString {};
|
||||
class stringToMapMarker {};
|
||||
class initMapCopy { postInit = 1; };
|
||||
class copyMapFromPlayer {}; //needs refactor
|
||||
class getPlayerMapMarkers {}; //needs refactor
|
||||
class loadMapMarkers {}; //needs refactor
|
||||
class mapMarkerToString {}; //needs refactor
|
||||
class stringToMapMarker {}; //needs refactor
|
||||
};
|
||||
};
|
||||
@@ -9,30 +9,30 @@ params [
|
||||
["_distanceDispersion", 30, [0]]
|
||||
];
|
||||
|
||||
// diag_log("flakEH running");
|
||||
// diag_log(_event);
|
||||
// diag_log "[MILSIM] (ambience) flakEH running";
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH event: %1", _event];
|
||||
|
||||
_unit = _event select 0;
|
||||
// diag_log(format["i have a unit: %1", _unit]);
|
||||
// diag_log text format["[MILSIM] (ambience) flahEH vehicle: %1", _unit];
|
||||
|
||||
_projectile = _event select 6;
|
||||
// diag_log(format["i have a projectile in flight: %1", _projectile]);
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH projectile in flight: %1", _projectile];
|
||||
|
||||
deleteVehicle _projectile;
|
||||
// diag_log("i have deleted the projectile");
|
||||
// diag_log text "[MILSIM] (ambience) flakEH projectile deleted");
|
||||
|
||||
// diag_log(_unit weaponsTurret [0] select _primaryTurret);
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH primary turret: %1", _unit weaponsTurret [0] select _primaryTurret];
|
||||
|
||||
_weapon = _unit weaponsTurret [0] select _primaryTurret;
|
||||
|
||||
_munitionConversionRate = _fullAmmoCount - _flakRoundsEvery;
|
||||
|
||||
// diag_log(format["munition count: %1", _unit ammo _weapon]);
|
||||
// diag_log(format["munition replacement at: %1", _munitionConversionRate]);
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH munition count: %1", _unit ammo _weapon];
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH munition replacement at: %1", _munitionConversionRate];
|
||||
|
||||
if (_unit ammo _weapon < _munitionConversionRate) then {
|
||||
_unit setAmmo [_weapon, _fullAmmoCount];
|
||||
// diag_log(format["replacing ammo count to: %1", _fullAmmoCount]);
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH replacing ammo count to: %1", _fullAmmoCount];
|
||||
|
||||
_targetPosition = [];
|
||||
|
||||
@@ -48,7 +48,7 @@ if (_unit ammo _weapon < _munitionConversionRate) then {
|
||||
|
||||
} else {
|
||||
_possibleTargets = _unit nearTargets _maximumDistance;
|
||||
diag_log(format["ai has %1 possible targetting solutions", count _possibleTargets]);
|
||||
diag_log text format["ai has %1 possible targetting solutions", count _possibleTargets];
|
||||
|
||||
if ((count _possibleTargets) > 0) then {
|
||||
|
||||
@@ -59,7 +59,7 @@ if (_unit ammo _weapon < _munitionConversionRate) then {
|
||||
_i = _unit aimedAtTarget [_x select 4, _weapon];
|
||||
if (_i > _hold && (_x select 3) > 0) then {
|
||||
_target = _x select 4;
|
||||
diag_log(format["setting target to %1", _target]);
|
||||
diag_log text format["setting target to %1", _target];
|
||||
_targetPosition = _x select 0;
|
||||
_hold = _i;
|
||||
};
|
||||
@@ -69,30 +69,30 @@ if (_unit ammo _weapon < _munitionConversionRate) then {
|
||||
|
||||
};
|
||||
|
||||
// diag_log(format["i have found target coordinates: %1", _targetPosition]);
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH target coordinates: %1", _targetPosition];
|
||||
|
||||
if ((count _targetPosition) > 0) then {
|
||||
// diag_log("calculating new projectile placement");
|
||||
// diag_log text "[MILSIM] (ambience) flakEH calculating new projectile placement";
|
||||
|
||||
_targetX = _targetPosition select 0;
|
||||
_targetY = _targetPosition select 1;
|
||||
_targetZ = _targetPosition select 2;
|
||||
|
||||
// diag_log(format["checking target altitude: %1", _targetZ]);
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH checking target altitude: %1", _targetZ];
|
||||
|
||||
if (_targetZ > _minimumAltitude) then {
|
||||
// diag_log("target is above minimum height, proceeding");
|
||||
// diag_log text "[MILSIM] (ambience) flakEH target is above minimum height, proceeding";
|
||||
|
||||
if !(lineIntersects [getPos _unit, _targetPosition, _unit, _target]) then {
|
||||
|
||||
// diag_log("intersection calculated");
|
||||
// diag_log text "[MILSIM] (ambience) flakEH intersection calculated";
|
||||
|
||||
_flakDistance = ((speed _target * 0.8) * (_speedDispersion / 100)) + ((_unit distance _target) * (_distanceDispersion / 500));
|
||||
|
||||
_distanceX = ((random (_flakDistance * 2)) - _flakDistance) + _targetX;
|
||||
_distanceY = ((random (_flakDistance * 2)) - _flakDistance) + _targetY;
|
||||
_distanceZ = ((random (_flakDistance * 2)) - _flakDistance) + _targetZ;
|
||||
// diag_log( format["target is distance: %1 / distance2D %2 from me, creating munition distance %3, distance2D %4 from me", _unit distance _targetPosition, _unit distance2D _targetPosition, _unit distance [_distanceX, _distanceY, _distanceZ], _unit distance2D [_distanceX, _distanceY, _distanceZ]]);
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH target is distance: %1 / distance2D %2 from me, creating munition distance %3, distance2D %4 from me", _unit distance _targetPosition, _unit distance2D _targetPosition, _unit distance [_distanceX, _distanceY, _distanceZ], _unit distance2D [_distanceX, _distanceY, _distanceZ]];
|
||||
_flak = createVehicle ["SmallSecondary", [_distanceX, _distanceY, _distanceZ], [], 0, "CAN_COLLIDE"];
|
||||
|
||||
};
|
||||
|
||||
@@ -8,34 +8,34 @@ params [
|
||||
["_removeMissiles", true, [true]]
|
||||
];
|
||||
|
||||
diag_log("initializing flak v16");
|
||||
diag_log text "[MILSIM] (ambience) initializing flak v18";
|
||||
|
||||
_primaryTurret = objNull;
|
||||
|
||||
if (_removeMissiles) then {
|
||||
|
||||
diag_log("removing missiles");
|
||||
diag_log text "[MILSIM] (ambience) removing missiles";
|
||||
|
||||
_magazines = magazinesAllTurrets _unit;
|
||||
|
||||
{
|
||||
_magazine = _x select 0;
|
||||
diag_log( format["Checking: %1", _magazine]);
|
||||
diag_log text format["[MILSIM] (ambience) checking: %1", _magazine];
|
||||
|
||||
_ammo = gettext( configfile >> "CfgMagazines" >> _magazine >> "ammo");
|
||||
diag_log( format["ammo: %1", _ammo]);
|
||||
diag_log text format["[MILSIM] (ambience) ammo: %1", _ammo];
|
||||
|
||||
_type = gettext(configFile >> "CfgAmmo" >> _ammo >> "simulation");
|
||||
diag_log( format["ammo type: %1", _type]);
|
||||
diag_log text format["[MILSIM] (ambience) ammo type: %1", _type];
|
||||
|
||||
if (_type == "shotMissile") then {
|
||||
_unit removeMagazinesTurret [_magazine, [0]];
|
||||
diag_log(format["removing ammo: %1", _ammo]);
|
||||
diag_log text format["[MILSIM] (ambience) removing ammo: %1", _ammo];
|
||||
};
|
||||
|
||||
if ((_type == "shotBullet") && (_primaryTurret isEqualTo objNull)) then {
|
||||
_primaryTurret = _forEachIndex;
|
||||
diag_log(format["found primary turret: %1", _unit weaponsTurret [0] select _primaryTurret]);
|
||||
diag_log text format["[MILSIM] (ambience) found primary turret: %1", _unit weaponsTurret [0] select _primaryTurret];
|
||||
};
|
||||
|
||||
} foreach _magazines;
|
||||
@@ -55,29 +55,27 @@ _unit setVariable["feh_flakRoundsEvery", _flakRoundsEvery];
|
||||
_unit setVariable["feh_speedDispersion", _speedDispersion];
|
||||
_unit setVariable["feh_distanceDispersion", _distanceDispersion];
|
||||
|
||||
diag_log( format[
|
||||
"{[_this, maximumDistance: %1, minimumAltitude: %2, primaryTurret: %3, fullAmmoCount: %4, flakRoundsEvery: %5, speedDispersion: %6, distanceDispersion: %7] call milsim_fnc_flakEH;}",
|
||||
_maximumDistance,
|
||||
_minimumAltitude,
|
||||
_primaryTurret,
|
||||
_fullAmmoCount,
|
||||
_flakRoundsEvery,
|
||||
_speedDispersion,
|
||||
_distanceDispersion
|
||||
]
|
||||
);
|
||||
diag_log text format [
|
||||
"[MILSIM] (ambience) {[_this, maximumDistance: %1, minimumAltitude: %2, primaryTurret: %3, fullAmmoCount: %4, flakRoundsEvery: %5, speedDispersion: %6, distanceDispersion: %7] call milsim_fnc_flakEH;}",
|
||||
_maximumDistance,
|
||||
_minimumAltitude,
|
||||
_primaryTurret,
|
||||
_fullAmmoCount,
|
||||
_flakRoundsEvery,
|
||||
_speedDispersion,
|
||||
_distanceDispersion
|
||||
];
|
||||
|
||||
|
||||
_unit addEventHandler [
|
||||
"Fired",
|
||||
format[
|
||||
"diag_log('firing'); [_this, %1, %2, %3, %4, %5, %6, %7] call milsim_fnc_flakEH",
|
||||
_maximumDistance,
|
||||
_minimumAltitude,
|
||||
_primaryTurret,
|
||||
_fullAmmoCount,
|
||||
_flakRoundsEvery,
|
||||
_speedDispersion,
|
||||
_distanceDispersion
|
||||
]
|
||||
];
|
||||
_unit addEventHandler ["Fired",
|
||||
format[
|
||||
"[_this, %1, %2, %3, %4, %5, %6, %7] call milsim_fnc_flakEH",
|
||||
_maximumDistance,
|
||||
_minimumAltitude,
|
||||
_primaryTurret,
|
||||
_fullAmmoCount,
|
||||
_flakRoundsEvery,
|
||||
_speedDispersion,
|
||||
_distanceDispersion
|
||||
]
|
||||
];
|
||||
18
functions/client/fn_addClientStatsPFH.sqf
Normal file
18
functions/client/fn_addClientStatsPFH.sqf
Normal file
@@ -0,0 +1,18 @@
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
diag_log text "[MILSIM] (client) initializing Stats PFH";
|
||||
|
||||
_cpsPFH = [
|
||||
{
|
||||
[] call milsim_fnc_calculateClientStats;
|
||||
},
|
||||
"milsim_client_cps_interval" call CBA_settings_fnc_get,
|
||||
[],
|
||||
{ diag_log text format ["[MILSIM] (client) PFH loaded with interval %1 seconds", "milsim_client_cps_interval" call CBA_settings_fnc_get ], },
|
||||
{ diag_log text format ["[MILSIM] (client) PFH unloaded"] },
|
||||
{ "milsim_client_cps_enable" call CBA_settings_fnc_get },
|
||||
{ false },
|
||||
[]
|
||||
] call CBA_fnc_createPerFrameHandlerObject;
|
||||
|
||||
player setVariable ["milsim_client_cps_handler", _cpsPFH];
|
||||
@@ -1,3 +1,5 @@
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
diag_log text "[MILSIM] (DNI) writing variable loop";
|
||||
|
||||
[] spawn {
|
||||
@@ -1,3 +1,5 @@
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
[
|
||||
"17th Battalion",
|
||||
"Create Resupply Box",
|
||||
@@ -38,7 +40,7 @@
|
||||
|
||||
[
|
||||
"17th Battalion",
|
||||
"Grounds Cleanup2",
|
||||
"Grounds Cleanup",
|
||||
{
|
||||
params [["_pos", [0,0,0], [[]], 3], ["_target", objNull, [objNull]]];
|
||||
|
||||
@@ -68,3 +70,8 @@
|
||||
|
||||
}
|
||||
] call zen_custom_modules_fnc_register;
|
||||
|
||||
|
||||
diag_log text "[MILSIM] (client) zeus modules added";
|
||||
|
||||
nil;
|
||||
43
functions/client/fn_bindEventHandlers.sqf
Normal file
43
functions/client/fn_bindEventHandlers.sqf
Normal file
@@ -0,0 +1,43 @@
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
player addEventHandler["Respawn",
|
||||
{
|
||||
params ["_unit", "_corpse"];
|
||||
_killer = _corpse getVariable ["ace_medical_causeOfDeath", "#scripted"];
|
||||
if (_killer == "respawn_button") then {
|
||||
format["[MILSIM] (client) %1 was unconscious then clicked the respawn button", name _unit] remoteExec["diag_log", 0];
|
||||
// format["%1 was unconscious then clicked the respawn button", name _unit] remoteExec["systemChat", 0];
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
[
|
||||
{
|
||||
params ["_unit", "_object", "_cost"];
|
||||
private _return = (count nearestObjects [_unit, ["B_APC_Tracked_01_CRV_F", "rhsusf_M1239_M2_Deploy_socom_d", "rhsusf_stryker_m1132_m2_wd", "rhsusf_m113_usarmy_supply", "rhsusf_M1078A1P2_B_WD_CP_fmtv_usarmy", "B_Slingload_01_Cargo_F"], 120]) > 0;
|
||||
_return
|
||||
}
|
||||
] call ace_fortify_fnc_addDeployHandler;
|
||||
|
||||
|
||||
addMissionEventHandler ["HandleChatMessage",
|
||||
{
|
||||
params ["_channel", "_owner", "_from", "_text", "_person", "_name", "_strID", "_forcedDisplay", "_isPlayerMessage", "_sentenceType", "_chatMessageType"];
|
||||
|
||||
if ( missionNamespace getVariable ["milsim_sideChat", false] ) exitWith{ false };
|
||||
|
||||
if (_channel != 1) exitWith { false };
|
||||
|
||||
if ( ( admin _owner ) != 0 ) exitWith { false };
|
||||
|
||||
if ( !isNull ( getAssignedCuratorLogic _person ) ) exitWith { false };
|
||||
|
||||
true;
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
diag_log text "[MILSIM] (client) event handlers bound";
|
||||
|
||||
nil;
|
||||
67
functions/client/fn_bindVehicleActions.sqf
Normal file
67
functions/client/fn_bindVehicleActions.sqf
Normal file
@@ -0,0 +1,67 @@
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
_checkFuel =
|
||||
[
|
||||
"CheckFuel",
|
||||
"Check Fuel",
|
||||
"",
|
||||
{
|
||||
hint format ["Fuel: %1%2", floor (fuel _target *100), "%"];
|
||||
},
|
||||
{true}
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
["LandVehicle", 0, ["ACE_MainActions"], _checkFuel, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
|
||||
_unflip =
|
||||
[
|
||||
"Unfuck",
|
||||
"Flip Vehicle",
|
||||
"",
|
||||
{
|
||||
_target setpos [(getpos _target) select 0,(getpos _target) select 1, 0.5];
|
||||
_target setVectorUp surfaceNormal position _target;
|
||||
},
|
||||
{true}
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
["LandVehicle", 0, ["ACE_MainActions"], _unflip, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
|
||||
_patchTire =
|
||||
[
|
||||
"patchTire",
|
||||
"Patch Tire",
|
||||
"\a3\ui_f\data\IGUI\Cfg\Actions\repair_ca.paa",
|
||||
{
|
||||
[_player, "AinvPknlMstpSnonWnonDr_medic5", 0] call ace_common_fnc_doAnimation;
|
||||
|
||||
[
|
||||
30,
|
||||
[_player, _target],
|
||||
{
|
||||
params ["_args"];
|
||||
_args params ["_player", "_target"];
|
||||
hint "Tire Patched";
|
||||
_target setDamage 0.2;
|
||||
_target setVariable["milsim_ace_repair_wheel_canPatch", false];
|
||||
},
|
||||
{
|
||||
params ["_args"];
|
||||
_args params ["_player", "_target"];
|
||||
hint "Stopped repair";
|
||||
[_player, "", 0] call ace_common_fnc_doAnimation;
|
||||
},
|
||||
"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] ) }
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
["ACE_Wheel", 0, ["ACE_MainActions"], _patchTire, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
|
||||
diag_log text "[MILSIM] (client) vehicle actions bound";
|
||||
|
||||
nil;
|
||||
29
functions/client/fn_calculateClientStats.sqf
Normal file
29
functions/client/fn_calculateClientStats.sqf
Normal file
@@ -0,0 +1,29 @@
|
||||
[] 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;
|
||||
};
|
||||
// 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];
|
||||
|
||||
// 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
|
||||
};
|
||||
// _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];
|
||||
|
||||
};
|
||||
|
||||
nil;
|
||||
10
functions/fbcb2/fn_addFBCB2DiaryEntries.sqf
Normal file
10
functions/fbcb2/fn_addFBCB2DiaryEntries.sqf
Normal file
@@ -0,0 +1,10 @@
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
player createDiarySubject["Status","FBCB2 - Status"];
|
||||
player createDiarySubject["Intel","FBCB2 - Combat Msgs"];
|
||||
player createDiarySubject["Messages","FBCB2 - Messages"];
|
||||
|
||||
|
||||
diag_log text "[MILSIM] (fbcb2) diary entries added";
|
||||
|
||||
nil;
|
||||
10
functions/fbcb2/fn_initFBCB2.sqf
Normal file
10
functions/fbcb2/fn_initFBCB2.sqf
Normal file
@@ -0,0 +1,10 @@
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
waitUntil { !isNil "milsim_complete" };
|
||||
|
||||
[] call milsim_fnc_processFBCB2Callsigns;
|
||||
[] call milsim_fnc_processFBCB2FixedWingAssets;
|
||||
[] call milsim_fnc_processFBCB2RotaryAssets;
|
||||
[] call milsim_fnc_processFBCB2RadioFrequencies;
|
||||
[] call milsim_fnc_processFBCB2SmokeColors;
|
||||
[] call milsim_fnc_processFBCB2Environment;
|
||||
@@ -14,6 +14,6 @@ _text = "<font size='24' color='#ff0000'>=======------ Mission Data Set ----
|
||||
|
||||
} foreach _assetList;
|
||||
|
||||
_text = _text + "<br/><br/><execute expression='[missionNamespace getVariable ""milsim_var_fixedAssets""] call milsim_fnc_messageAssetStatus'>Run Report on local node?</execute>";
|
||||
_text = _text + "<br/><br/><execute expression='[missionNamespace getVariable ""milsim_var_fixedAssets""] call milsim_fnc_messageFBCB2AssetStatus'>Run Report on local node?</execute>";
|
||||
|
||||
player createDiaryRecord ["Status", ["MDS - ASSETS - FIXED", _text]];
|
||||
@@ -14,6 +14,6 @@ _text = "<font size='24' color='#ff0000'>=======------ Mission Data Set ----
|
||||
|
||||
} foreach _assetList;
|
||||
|
||||
_text = _text + "<br/><br/><execute expression='[missionNamespace getVariable ""milsim_var_rotaryAssets""] call milsim_fnc_messageAssetStatus'>Run Report on local node?</execute>";
|
||||
_text = _text + "<br/><br/><execute expression='[missionNamespace getVariable ""milsim_var_rotaryAssets""] call milsim_fnc_messageFBCB2AssetStatus'>Run Report on local node?</execute>";
|
||||
|
||||
player createDiaryRecord ["Status", ["MDS - ASSETS - ROTARY", _text]];
|
||||
@@ -1,60 +0,0 @@
|
||||
// Disable saving
|
||||
enableSaving[false, false];
|
||||
|
||||
// Disable radio chatter and sentences
|
||||
enableRadio false;
|
||||
enableSentences false;
|
||||
|
||||
// update ace weight settings since arma quadruples the value when an object is loaded into another object
|
||||
missionNamespace setVariable ["ACE_maxWeightDrag", 2400];
|
||||
missionNamespace setVariable ["ACE_maxWeightCarry", 1800];
|
||||
|
||||
// Disable RHS radio chatter (if RHS is present)
|
||||
if(isClass(configfile >> "CfgPatches" >> "rhs_main")) then {
|
||||
rhs_vehicleRadioChatter = 0;
|
||||
};
|
||||
|
||||
// Disable ambient life (rabbits & snakes) once the mission starts
|
||||
waitUntil {time > 0};
|
||||
enableEnvironment[false, true];
|
||||
diag_log text "[MILSIM] (init) ambient life disabled";
|
||||
|
||||
[
|
||||
"saveaar",
|
||||
{
|
||||
[] remoteExec["ocap_fnc_exportData", 2];
|
||||
},
|
||||
"admin"
|
||||
] call CBA_fnc_registerChatCommand;
|
||||
|
||||
[
|
||||
"respawn",
|
||||
{
|
||||
_clientID = _thisArgs select 0;
|
||||
player setDamage 1;
|
||||
format["[MILSIM] (init) %1 claims they were glitched and respawned - %2", name player, netID player] remoteExec["diag_log", 2];
|
||||
format["%1 claims they were glitched and respawned (%2)", name player, netID player] remoteExec["systemChat", -_clientID];
|
||||
},
|
||||
"all",
|
||||
[clientOwner]
|
||||
] call CBA_fnc_registerChatCommand;
|
||||
|
||||
diag_log text "[MILSIM] (init) OCAP chat handler registered";
|
||||
|
||||
|
||||
[
|
||||
"milsim_sideChat",
|
||||
"CHECKBOX",
|
||||
"Enable Side Chat Text",
|
||||
"17th Batallion",
|
||||
false,
|
||||
true,
|
||||
{
|
||||
params ["_value"];
|
||||
missionNamespace setVariable["milsim_sideChat", _value];
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
["milsim_sideChat", false] call CBA_settings_fnc_set;
|
||||
|
||||
diag_log text "[MILSIM] (init) Custom CBA settings initialized";
|
||||
@@ -1,11 +0,0 @@
|
||||
[] spawn milsim_fnc_init;
|
||||
|
||||
|
||||
if (isServer) then {
|
||||
[] spawn milsim_fnc_initServer;
|
||||
};
|
||||
if (hasInterface) then {
|
||||
[] spawn milsim_fnc_initPlayerLocal;
|
||||
};
|
||||
|
||||
nil
|
||||
@@ -1,45 +0,0 @@
|
||||
diag_log text "[MILSIM] (initPlayerCPS) writing variable loop";
|
||||
|
||||
_cpsPFH = [
|
||||
{
|
||||
|
||||
[] 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;
|
||||
};
|
||||
// in an empty mission, the _counter may go well over 2000 times per frame!
|
||||
diag_log text format ["[MILSIM] (initPlayerCPS) Average Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)];
|
||||
player setVariable["milsim_player_raw_cps", _counter / (diag_frameNo - _frameNo), true];
|
||||
|
||||
// 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
|
||||
};
|
||||
// _counter says one per frame, as expected
|
||||
diag_log text format ["[MILSIM] (initPlayerCPS) Average Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)];
|
||||
player setVariable["milsim_player_cps", _counter / (diag_frameNo - _frameNo), true];
|
||||
|
||||
|
||||
};
|
||||
|
||||
},
|
||||
300,
|
||||
[],
|
||||
{ diag_log text "[MILSIM] (initPlayerCPS) CPS PFH loaded" },
|
||||
{ diag_log text "IF YOU SEE THIS CPS PFH FUCKED UP" },
|
||||
{ true },
|
||||
{ false },
|
||||
[]
|
||||
] call CBA_fnc_createPerFrameHandlerObject;
|
||||
|
||||
player setVariable ["milsim_player_cps_handler", _cpsPFH];
|
||||
@@ -1,133 +1,5 @@
|
||||
if (!hasInterface) exitWith {};
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
waitUntil {player == player};
|
||||
|
||||
|
||||
player createDiarySubject["Status","FBCB2 - Status"];
|
||||
player createDiarySubject["Intel","FBCB2 - Combat Msgs"];
|
||||
player createDiarySubject["Messages","FBCB2 - Messages"];
|
||||
diag_log text "[MILSIM] (initPlayerLocal) diaries created";
|
||||
|
||||
|
||||
waitUntil {time > 0};
|
||||
[] spawn milsim_fnc_initDNI_PlayerFPS;
|
||||
[] spawn milsim_fnc_initPlayerCPS;
|
||||
|
||||
|
||||
_action = [
|
||||
"CheckFuel",
|
||||
"Check Fuel",
|
||||
"",
|
||||
{
|
||||
hint format ["Fuel: %1", (fuel _target *100)]
|
||||
},
|
||||
{true}
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
["LandVehicle", 0, ["ACE_MainActions"], _action, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
|
||||
_action = [
|
||||
"Unfuck",
|
||||
"Flip Vehicle",
|
||||
"",
|
||||
{
|
||||
_target setpos [(getpos _target) select 0,(getpos _target) select 1, 0.5];
|
||||
_target setVectorUp surfaceNormal position _target;
|
||||
},
|
||||
{true}
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
["LandVehicle", 0, ["ACE_MainActions"], _action, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
|
||||
_action = ["CheckExtTank","Check External Tank","",{hint format ["Ext Tank: %1", 5]},{true}] call ace_interact_menu_fnc_createAction;
|
||||
["Tank_F", 0, ["ACE_MainActions", "CheckFuel"], _action, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
|
||||
_map_copy_condition = {
|
||||
('ItemMap' in (assignedItems _player)) && ('ItemMap' in (assignedItems _target)) && ([_player, _target, []] call ace_common_fnc_canInteractWith)
|
||||
};
|
||||
|
||||
_map_copy_action = [
|
||||
"MilSimCopyMap",
|
||||
"Copy Map",
|
||||
// "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
|
||||
"\a3\ui_f\data\igui\cfg\actions\talk_ca.paa",
|
||||
{[_target,_player] call milsim_fnc_copyMapFromPlayer},
|
||||
_map_copy_condition
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
["Man", 0, ["ACE_MainActions"], _map_copy_action, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
|
||||
_patchTire =
|
||||
[
|
||||
"patchTire",
|
||||
"Patch Tire",
|
||||
"\a3\ui_f\data\IGUI\Cfg\Actions\repair_ca.paa",
|
||||
{
|
||||
[_player, "AinvPknlMstpSnonWnonDr_medic5", 0] call ace_common_fnc_doAnimation;
|
||||
|
||||
[
|
||||
30,
|
||||
[_player, _target],
|
||||
{
|
||||
params ["_args"];
|
||||
_args params ["_player", "_target"];
|
||||
hint "Tire Patched";
|
||||
_target setDamage 0.2;
|
||||
_target setVariable["milsim_ace_repair_wheel_canPatch", false];
|
||||
},
|
||||
{
|
||||
params ["_args"];
|
||||
_args params ["_player", "_target"];
|
||||
hint "Stopped repair";
|
||||
[_player, "", 0] call ace_common_fnc_doAnimation;
|
||||
},
|
||||
"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] ) }
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
|
||||
["ACE_Wheel", 0, ["ACE_MainActions"], _patchTire, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
|
||||
player addEventHandler["Respawn",
|
||||
{
|
||||
params ["_unit", "_corpse"];
|
||||
_killer = _corpse getVariable ["ace_medical_causeOfDeath", "#scripted"];
|
||||
if (_killer == "respawn_button") then {
|
||||
format["[MILSIM] (initPlayerLocal) %1 was unconscious then clicked the respawn button", name _unit] remoteExec["diag_log", 0];
|
||||
// format["%1 was unconscious then clicked the respawn button", name _unit] remoteExec["systemChat", 0];
|
||||
};
|
||||
}];
|
||||
|
||||
|
||||
[{
|
||||
params ["_unit", "_object", "_cost"];
|
||||
private _return = (count nearestObjects [_unit, ["B_APC_Tracked_01_CRV_F", "rhsusf_M1239_M2_Deploy_socom_d", "rhsusf_stryker_m1132_m2_wd", "rhsusf_m113_usarmy_supply", "rhsusf_M1078A1P2_B_WD_CP_fmtv_usarmy", "B_Slingload_01_Cargo_F"], 120]) > 0;
|
||||
_return
|
||||
}] call ace_fortify_fnc_addDeployHandler;
|
||||
|
||||
addMissionEventHandler ["HandleChatMessage", {
|
||||
params ["_channel", "_owner", "_from", "_text", "_person", "_name", "_strID", "_forcedDisplay", "_isPlayerMessage", "_sentenceType", "_chatMessageType"];
|
||||
|
||||
if ( missionNamespace getVariable ["milsim_sideChat", false] ) exitWith{ false };
|
||||
|
||||
if (_channel != 1) exitWith { false };
|
||||
|
||||
if ( ( admin _owner ) != 0 ) exitWith { false };
|
||||
|
||||
if ( !isNull ( getAssignedCuratorLogic _person ) ) exitWith { false };
|
||||
|
||||
true;
|
||||
}];
|
||||
|
||||
|
||||
waitUntil {!isNil "milsim_complete"};
|
||||
[] spawn milsim_fnc_initFBCB2;
|
||||
|
||||
|
||||
// Initializes the player/client side Dynamic Groups framework and registers the player group
|
||||
["InitializePlayer", [player, true]] call BIS_fnc_dynamicGroups;
|
||||
|
||||
nil;
|
||||
@@ -1,140 +1,61 @@
|
||||
if (isServer) then {
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
_fixedAssets = [
|
||||
["Ares", "USAF_A10", 0],
|
||||
["Odyssey", "RHSGREF_A29B_HIDF", 0],
|
||||
["Hercules", "USAF_C130J", 0]
|
||||
_fixedAssets = [
|
||||
["Ares", "USAF_A10", 0],
|
||||
["Odyssey", "RHSGREF_A29B_HIDF", 0],
|
||||
["Hercules", "USAF_C130J", 0]
|
||||
|
||||
];
|
||||
];
|
||||
|
||||
_rotaryAssets = [
|
||||
["Apollo", "RHS_MELB_MH6M", 0],
|
||||
["Artemis", "RHS_MELB_AH6M", 0],
|
||||
["Icarus", "RHS_MELB_H6M", 0],
|
||||
["Achilles", "RHS_CH_47F", 0],
|
||||
["Hades", "ej_MH60MDAP4", 0],
|
||||
["Griffin", "RHS_UH60M", 0],
|
||||
["Dustoff", "RHS_UH60M_MEV2", 0],
|
||||
["Pegasus", "B_T_VTOL_01_INFANTRY_F", 0],
|
||||
["Spartan", "B_T_VTOL_01_ARMED_F", 0],
|
||||
["Orion", "RHS_AH64D", 0],
|
||||
["Athena", "RHS_AH1Z", 0],
|
||||
["Homer", "RHS_UH1Y", 0],
|
||||
["Atlas", "rhsusf_CH53E_USMC", 0]
|
||||
_rotaryAssets = [
|
||||
["Apollo", "RHS_MELB_MH6M", 0],
|
||||
["Artemis", "RHS_MELB_AH6M", 0],
|
||||
["Icarus", "RHS_MELB_H6M", 0],
|
||||
["Achilles", "RHS_CH_47F", 0],
|
||||
["Hades", "ej_MH60MDAP4", 0],
|
||||
["Griffin", "RHS_UH60M", 0],
|
||||
["Dustoff", "RHS_UH60M_MEV2", 0],
|
||||
["Pegasus", "B_T_VTOL_01_INFANTRY_F", 0],
|
||||
["Spartan", "B_T_VTOL_01_ARMED_F", 0],
|
||||
["Orion", "RHS_AH64D", 0],
|
||||
["Athena", "RHS_AH1Z", 0],
|
||||
["Homer", "RHS_UH1Y", 0],
|
||||
["Atlas", "rhsusf_CH53E_USMC", 0]
|
||||
];
|
||||
|
||||
];
|
||||
|
||||
_homes = allMissionObjects "ModuleRespawnPosition_F";
|
||||
_homes = allMissionObjects "ModuleRespawnPosition_F";
|
||||
|
||||
{
|
||||
_home = _x;
|
||||
{
|
||||
_home = _x;
|
||||
{
|
||||
_a = _home nearEntities [ _x select 1, 750];
|
||||
_x set [2, (_x select 2) + count _a];
|
||||
_a = _home nearEntities [ _x select 1, 750];
|
||||
_x set [2, (_x select 2) + count _a];
|
||||
|
||||
} forEach _fixedAssets;
|
||||
} forEach _homes;
|
||||
} forEach _fixedAssets;
|
||||
} forEach _homes;
|
||||
|
||||
missionNamespace setVariable ["milsim_var_fixedAssets", _fixedAssets];
|
||||
missionNamespace setVariable ["milsim_var_fixedAssets", _fixedAssets];
|
||||
|
||||
{
|
||||
_home = _x;
|
||||
{
|
||||
_home = _x;
|
||||
{
|
||||
_a = _home nearEntities [ _x select 1, 750];
|
||||
_x set [2, (_x select 2) + count _a];
|
||||
_a = _home nearEntities [ _x select 1, 750];
|
||||
_x set [2, (_x select 2) + count _a];
|
||||
|
||||
} forEach _rotaryAssets;
|
||||
} forEach _homes;
|
||||
} forEach _rotaryAssets;
|
||||
} forEach _homes;
|
||||
|
||||
missionNamespace setVariable ["milsim_var_rotaryAssets", _rotaryAssets];
|
||||
missionNamespace setVariable ["milsim_var_rotaryAssets", _rotaryAssets];
|
||||
|
||||
publicVariable "milsim_var_fixedAssets";
|
||||
publicVariable "milsim_var_rotaryAssets";
|
||||
publicVariable "milsim_var_fixedAssets";
|
||||
publicVariable "milsim_var_rotaryAssets";
|
||||
|
||||
// Initializes the Dynamic Groups framework and groups
|
||||
["Initialize", [true]] call BIS_fnc_dynamicGroups;
|
||||
|
||||
missionNamespace setVariable["milsim_raw_cps", 0];
|
||||
missionNamespace setVariable["milsim_cps", 0];
|
||||
|
||||
publicVariable "milsim_raw_cps";
|
||||
publicVariable "milsim_cps";
|
||||
|
||||
_cpsPFH = [
|
||||
{
|
||||
|
||||
[] 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;
|
||||
};
|
||||
// in an empty mission, the _counter may go well over 2000 times per frame!
|
||||
diag_log text format ["[MILSIM] (initServer) Average Server Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)];
|
||||
missionNamespace setVariable["milsim_raw_cps", _counter / (diag_frameNo - _frameNo)];
|
||||
publicVariable "milsim_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
|
||||
};
|
||||
// _counter says one per frame, as expected
|
||||
diag_log text format ["[MILSIM] (initServer) Average Server Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)];
|
||||
missionNamespace setVariable["milsim_cps", _counter / (diag_frameNo - _frameNo)];
|
||||
publicVariable "milsim_cps";
|
||||
|
||||
["milsim_serverEfficiency", [ [ ["float", "milsim_raw_cps", missionNamespace getVariable ["milsim_raw_cps", -1]], ["float", "milsim_cps", missionNamespace getVariable ["milsim_cps", -1]] ] ] ] call CBA_fnc_localEvent;
|
||||
|
||||
};
|
||||
|
||||
},
|
||||
300,
|
||||
[],
|
||||
{ diag_log text "[MILSIM] (initServer) CPS PFH loaded" },
|
||||
{ diag_log text "IF YOU SEE THIS CPS PFH FUCKED UP" },
|
||||
{ true },
|
||||
{ false },
|
||||
[]
|
||||
] call CBA_fnc_createPerFrameHandlerObject;
|
||||
// Initializes the Dynamic Groups framework and groups
|
||||
["Initialize", [true]] call BIS_fnc_dynamicGroups;
|
||||
|
||||
|
||||
missionNamespace setVariable ["milsim_cps_handler", _cpsPFH];
|
||||
|
||||
_playerCpsPFH = [
|
||||
{
|
||||
missionNamespace setVariable ["milsim_complete", true];
|
||||
diag_log text "[MILSIM] (initServer) milsim_complete: version 2.3";
|
||||
|
||||
diag_log text "[MILSIM] (initServer) ** Player Executions **";
|
||||
|
||||
{
|
||||
diag_log ( format ["%1: ( %2, %3 )", name _x, _x getVariable ["milsim_player_raw_cps",-1], _x getVariable ["milsim_player_cps",-1] ] )
|
||||
} forEach allPlayers;
|
||||
|
||||
diag_log text "[MILSIM] (initServer) ***********************";
|
||||
|
||||
},
|
||||
300,
|
||||
[],
|
||||
{ diag_log text "[MILSIM] (initServer) Player CPS PFH loaded" },
|
||||
{ diag_log text "IF YOU SEE THIS CPS PFH FUCKED UP" },
|
||||
{ true },
|
||||
{ false },
|
||||
[]
|
||||
] call CBA_fnc_createPerFrameHandlerObject;
|
||||
|
||||
missionNamespace setVariable ["milsim_player_cps_handler", _playerCpsPFH];
|
||||
|
||||
|
||||
missionNamespace setVariable ["milsim_complete", true];
|
||||
diag_log text "[MILSIM] (initServer) milsim_complete";
|
||||
|
||||
publicVariable "milsim_complete";
|
||||
|
||||
};
|
||||
publicVariable "milsim_complete";
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
waitUntil {player == player && !isNil "milsim_complete"};
|
||||
|
||||
[] spawn milsim_fnc_MDS_callsigns;
|
||||
[] spawn milsim_fnc_MDS_fixedAssets;
|
||||
[] spawn milsim_fnc_MDS_rotaryAssets;
|
||||
[] spawn milsim_fnc_MDS_radioFrequencies;
|
||||
[] spawn milsim_fnc_MDS_smokeColors;
|
||||
[] spawn milsim_fnc_MDS_environment;
|
||||
17
functions/map/fn_initMapCopy.sqf
Normal file
17
functions/map/fn_initMapCopy.sqf
Normal file
@@ -0,0 +1,17 @@
|
||||
_map_copy_condition =
|
||||
{
|
||||
('ItemMap' in (assignedItems _player)) && ('ItemMap' in (assignedItems _target)) && ([_player, _target, []] call ace_common_fnc_canInteractWith)
|
||||
};
|
||||
|
||||
_map_copy_action =
|
||||
[
|
||||
"MilSimCopyMap",
|
||||
"Copy Map",
|
||||
"\a3\ui_f\data\igui\cfg\actions\talk_ca.paa",
|
||||
{
|
||||
[_target,_player] call milsim_fnc_copyMapFromPlayer
|
||||
},
|
||||
_map_copy_condition
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
["Man", 0, ["ACE_MainActions"], _map_copy_action, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
50
functions/server/fn_addServerStatsPFH.sqf
Normal file
50
functions/server/fn_addServerStatsPFH.sqf
Normal file
@@ -0,0 +1,50 @@
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
missionNamespace setVariable["milsim_raw_cps", 0];
|
||||
missionNamespace setVariable["milsim_cps", 0];
|
||||
|
||||
publicVariable "milsim_raw_cps";
|
||||
publicVariable "milsim_cps";
|
||||
|
||||
diag_log text format ["[MILSIM] (server) initializing Server Stats PFH"];
|
||||
|
||||
_serverCpsPFH = [
|
||||
{
|
||||
[] call milsim_fnc_calculateServerStats;
|
||||
},
|
||||
"milsim_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 },
|
||||
{ false },
|
||||
[]
|
||||
] call CBA_fnc_createPerFrameHandlerObject;
|
||||
|
||||
|
||||
missionNamespace setVariable ["milsim_server_cps_handler", _serverCpsPFH];
|
||||
|
||||
_playerCpsPFH = [
|
||||
{
|
||||
|
||||
diag_log text "[MILSIM] (server) ** Player Executions **";
|
||||
|
||||
{
|
||||
diag_log ( format ["%1: ( %2, %3 )", name _x, _x getVariable ["milsim_player_raw_cps",-1], _x getVariable ["milsim_player_cps",-1] ] )
|
||||
} forEach allPlayers;
|
||||
|
||||
diag_log text "[MILSIM] (server) ***********************";
|
||||
|
||||
},
|
||||
"milsim_server_cps_interval" call CBA_settings_fnc_get,
|
||||
[],
|
||||
{ diag_log text format ["[MILSIM] (server) Player PFH loaded"] },
|
||||
{ diag_log text format ["[MILSIM] (server) Player PFH unloaded"] },
|
||||
{ "milsim_server_cps_enable" call CBA_settings_fnc_get },
|
||||
{ false },
|
||||
[]
|
||||
] call CBA_fnc_createPerFrameHandlerObject;
|
||||
|
||||
missionNamespace setVariable ["milsim_player_cps_handler", _playerCpsPFH];
|
||||
|
||||
nil;
|
||||
34
functions/server/fn_calculateServerStats.sqf
Normal file
34
functions/server/fn_calculateServerStats.sqf
Normal file
@@ -0,0 +1,34 @@
|
||||
[] 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;
|
||||
};
|
||||
|
||||
diag_log text format ["[MILSIM] (server) Average Server Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)];
|
||||
|
||||
missionNamespace setVariable ["milsim_raw_cps", _counter / (diag_frameNo - _frameNo)];
|
||||
publicVariable "milsim_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
|
||||
};
|
||||
|
||||
diag_log text format ["[MILSIM] (server) Average Server Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)];
|
||||
|
||||
missionNamespace setVariable ["milsim_cps", _counter / (diag_frameNo - _frameNo)];
|
||||
publicVariable "milsim_cps";
|
||||
|
||||
["milsim_serverEfficiency", [ [ ["float", "milsim_raw_cps", missionNamespace getVariable ["milsim_raw_cps", -1]], ["float", "milsim_cps", missionNamespace getVariable ["milsim_cps", -1]] ] ] ] call CBA_fnc_localEvent;
|
||||
};
|
||||
|
||||
nil;
|
||||
11
functions/settings/fn_addAARChatHandler.sqf
Normal file
11
functions/settings/fn_addAARChatHandler.sqf
Normal file
@@ -0,0 +1,11 @@
|
||||
[
|
||||
"saveaar",
|
||||
{
|
||||
[] remoteExec["ocap_fnc_exportData", 2];
|
||||
},
|
||||
"admin"
|
||||
] call CBA_fnc_registerChatCommand;
|
||||
|
||||
diag_log text "[MILSIM] (settings) OCAP chat handler registered";
|
||||
|
||||
nil;
|
||||
110
functions/settings/fn_addCBASettings.sqf
Normal file
110
functions/settings/fn_addCBASettings.sqf
Normal file
@@ -0,0 +1,110 @@
|
||||
//---------------------
|
||||
// Side Chat
|
||||
//---------------------
|
||||
|
||||
[
|
||||
"milsim_sideChat",
|
||||
"CHECKBOX",
|
||||
"Side Chat Text Enabled",
|
||||
["17th Batallion", "Side Chat"],
|
||||
false,
|
||||
true,
|
||||
{
|
||||
params ["_value"];
|
||||
diag_log format["side chat activation set to %1", _value];
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
["milsim_sideChat", false] call CBA_settings_fnc_set;
|
||||
|
||||
//---------------------
|
||||
// Server CPS
|
||||
//---------------------
|
||||
|
||||
[
|
||||
"milsim_server_cps_enable",
|
||||
"CHECKBOX",
|
||||
"CPS Metrics Enabled",
|
||||
["17th Batallion", "Server Metrics"],
|
||||
true,
|
||||
true,
|
||||
{
|
||||
params ["_value"];
|
||||
diag_log format["server cps activation set to %1", _value];
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
["milsim_server_cps_enable", true] call CBA_settings_fnc_set;
|
||||
|
||||
[
|
||||
"milsim_server_cps_interval",
|
||||
"TIME",
|
||||
"Metrics Interval",
|
||||
["17th Batallion", "Server Metrics"],
|
||||
[60,300,120],
|
||||
true,
|
||||
{
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
params ["_value"];
|
||||
diag_log format["server cps interval set to %1", _value];
|
||||
_cpsPFH = missionNamespace getVariable ["milsim_server_cps_handler", ObjNull];
|
||||
if (!isNull _cpsPFH) then {
|
||||
_cpsPFH call CBA_fnc_deletePerFrameHandlerObject;
|
||||
};
|
||||
|
||||
_playerCpsPFH = missionNamespace getVariable ["milsim_player_cps_handler", ObjNull];
|
||||
if (!isNull _playerCpsPFH) then {
|
||||
_playerCpsPFH call CBA_fnc_deletePerFrameHandlerObject;
|
||||
};
|
||||
|
||||
[] call milsim_fnc_addServerStatsPFH;
|
||||
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
//---------------------
|
||||
// Client CPS
|
||||
//---------------------
|
||||
|
||||
[
|
||||
"milsim_client_cps_enable",
|
||||
"CHECKBOX",
|
||||
"CPS Metrics Enabled",
|
||||
["17th Batallion", "Client Metrics"],
|
||||
true,
|
||||
true,
|
||||
{
|
||||
params ["_value"];
|
||||
diag_log format["client cps activation set to %1", _value];
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
["milsim_client_cps_enable", true] call CBA_settings_fnc_set;
|
||||
|
||||
[
|
||||
"milsim_client_cps_interval",
|
||||
"TIME",
|
||||
"CPS Metrics Interval",
|
||||
["17th Batallion", "Client Metrics"],
|
||||
[60,300,120],
|
||||
true,
|
||||
{
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
params ["_value"];
|
||||
diag_log format["client cps interval set to %1", _value];
|
||||
_cpsPFH = player getVariable ["milsim_client_cps_handler", ObjNull];
|
||||
if (!isNull _cpsPFH) then {
|
||||
_cpsPFH call CBA_fnc_deletePerFrameHandlerObject;
|
||||
};
|
||||
|
||||
[] call milsim_fnc_addClientStatsPFH;
|
||||
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
|
||||
diag_log text "[MILSIM] (settings) Custom CBA settings initialized";
|
||||
|
||||
nil;
|
||||
15
functions/settings/fn_addRespawnChatHandler.sqf
Normal file
15
functions/settings/fn_addRespawnChatHandler.sqf
Normal file
@@ -0,0 +1,15 @@
|
||||
[
|
||||
"respawn",
|
||||
{
|
||||
_clientID = _thisArgs select 0;
|
||||
player setDamage 1;
|
||||
format["[MILSIM] (init) %1 claims they were glitched and respawned - %2", name player, netID player] remoteExec["diag_log", 2];
|
||||
format["%1 claims they were glitched and respawned (%2)", name player, netID player] remoteExec["systemChat", -_clientID];
|
||||
},
|
||||
"all",
|
||||
[clientOwner]
|
||||
] call CBA_fnc_registerChatCommand;
|
||||
|
||||
diag_log text "[MILSIM] (settings) respawn chat handler registered";
|
||||
|
||||
nil;
|
||||
19
functions/settings/fn_setDefaults.sqf
Normal file
19
functions/settings/fn_setDefaults.sqf
Normal file
@@ -0,0 +1,19 @@
|
||||
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];
|
||||
|
||||
diag_log text "[MILSIM] (settings) defaults set";
|
||||
|
||||
nil;
|
||||
Reference in New Issue
Block a user