version 3.0

This commit is contained in:
2023-06-19 00:59:05 -05:00
parent 2caf7cb720
commit 0141b88c8e
36 changed files with 608 additions and 487 deletions

View 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];

View File

@@ -0,0 +1,87 @@
if ( !hasInterface ) exitWith {};
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

@@ -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]]];
@@ -67,4 +69,9 @@
] call zen_dialog_fnc_create;
}
] call zen_custom_modules_fnc_register;
] call zen_custom_modules_fnc_register;
diag_log text "[MILSIM] (client) zeus modules added";
nil;

View 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;

View 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;

View 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;