Initial commit

This commit is contained in:
2023-06-19 00:57:30 -05:00
commit 2caf7cb720
36 changed files with 1696 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
// 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";

View File

@@ -0,0 +1,85 @@
diag_log text "[MILSIM] (DNI) writing variable loop";
[] spawn {
while {true} do {
player setVariable ["DNI_PlayerFPS", floor diag_fps, true];
sleep 1
};
};
diag_log text "[MILSIM] (DNI) variable loop complete";
/////////////////////////////////////////////////////////
//Waits until curators are initalized in order to check//
//if player is zeus to run the fps scripts //
/////////////////////////////////////////////////////////
diag_log text "[MILSIM] (DNI) waiting for curators";
waitUntil {
private _hasCurators = (count allcurators) > 0;
private _hasInitializedCurators = (count (call BIS_fnc_listCuratorPlayers)) > 0;
private _curatorsInitialized = !_hasCurators || _hasInitializedCurators;
((time > 2) || _curatorsInitialized)
};
diag_log text "[MILSIM] (DNI) curator init complete";
/////////////////////////////////////////////////////////
//If player is a curator it will run the script and each/
//player will have their FPS appear beneath them //
/////////////////////////////////////////////////////////
if (player in (call bis_fnc_listcuratorplayers)) then {
diag_log text "[MILSIM] (DNI) player is in curator list, adding Draw3D handler";
addMissionEventHandler ["Draw3D", {
{
_distance = position curatorCamera distance _x;
//if zeus camera is farther than 1200 meters away from the targets the text will not display
if (_distance < 1200) then {
_playerFPS = _x getVariable ["DNI_PlayerFPS",50];
//if the FPS is below 20 it turns red and becomes more visible for zeus to see so they are aware
if (_playerFPS <20) then
{
drawIcon3D
[
"",//Path to image displayed near text
[1,0,0,0.7],//color of the text using RGBA
position _x,//position of the text _x referring to the player in 'allPlayers'
1,//Width
2,//height from position, below
0,//angle
format["%1 FPS: %2", name _x, str _playerFPS],//text to be displayed
0,//shadow on text, 0=none,1=shadow,2=outline
0.05,//text size
"PuristaMedium",//text font
"center"//align text left, right, or center
];
}
//if the FPS is above 20 text is smaller and less visible as to not conern zeus as much
else
{
drawIcon3D
[
"",//Path to image displayed near text
[1,1,1,0.3],//color of the text using RGBA
position _x,//position of the text _x referring to the player in 'allPlayers'
1,//Width
2,//height from position, below
0,//angle
format["%1 FPS: %2", name _x, str _playerFPS],//text to be displayed
0,//shadow on text, 0=none,1=shadow,2=outline
0.03,//text size
"PuristaMedium",//text font
"center"//align text left, right, or center
];
};
};
} forEach allPlayers;
//Here is the array of units you wish to display the FPS text for, it can be
//changed to be an array of specific units or players if you wish
}];
};
/////////////////////////////////////////////////////////
/////////////////////End FPS Script//////////////////////
/////////////////////////////////////////////////////////

View File

@@ -0,0 +1,11 @@
[] spawn milsim_fnc_init;
if (isServer) then {
[] spawn milsim_fnc_initServer;
};
if (hasInterface) then {
[] spawn milsim_fnc_initPlayerLocal;
};
nil

View File

@@ -0,0 +1,45 @@
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];

View File

@@ -0,0 +1,133 @@
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;

View File

@@ -0,0 +1,140 @@
if (isServer) then {
_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]
];
_homes = allMissionObjects "ModuleRespawnPosition_F";
{
_home = _x;
{
_a = _home nearEntities [ _x select 1, 750];
_x set [2, (_x select 2) + count _a];
} forEach _fixedAssets;
} forEach _homes;
missionNamespace setVariable ["milsim_var_fixedAssets", _fixedAssets];
{
_home = _x;
{
_a = _home nearEntities [ _x select 1, 750];
_x set [2, (_x select 2) + count _a];
} forEach _rotaryAssets;
} forEach _homes;
missionNamespace setVariable ["milsim_var_rotaryAssets", _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;
missionNamespace setVariable ["milsim_cps_handler", _cpsPFH];
_playerCpsPFH = [
{
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";
};