2016-10-22 21:15:11 +00:00
/*
2018-01-07 07:02:29 +00:00
By Ghostrider-GRG-
2017-03-15 04:36:06 +00:00
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
2016-10-22 21:15:11 +00:00
*/
2019-09-02 12:45:20 +00:00
2019-05-25 17:04:06 +00:00
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
2020-01-29 13:37:13 +00:00
diag_log format["[blckeagls] blck_init_server started"];
// Only run this on a dedicated server
2017-10-19 02:31:53 +00:00
if ( !(isServer) || hasInterface) exitWith{};
2020-01-29 13:37:13 +00:00
// Only run this once
2018-11-19 20:33:20 +00:00
if !(isNil "blck_Initialized") exitWith{};
2020-01-29 13:37:13 +00:00
// This is just a flag so we know if blckeagls has been started or not.
blck_Initialized = true;
2018-11-19 20:33:20 +00:00
// find and set Mod
2020-05-05 22:11:24 +00:00
blck_modType = "";
if (!isNull (configFile >> "CfgPatches" >> "exile_server")) then {blck_modType = "Exile"};
if (!isnull (configFile >> "CfgPatches" >> "a3_epoch_server")) then {blck_modType = "Epoch"};
if (!(blck_modType in ["Exile","Epoch"] )) then {blck_modType = "default"};
diag_log format["[blckeagls] blck_modType = %1",blck_modtype];
2018-11-19 20:33:20 +00:00
publicVariable "blck_modType";
2018-11-21 04:35:30 +00:00
2020-01-29 13:37:13 +00:00
// This block waits for the mod to start but is disabled for now
2018-11-19 20:33:20 +00:00
if ((tolower blck_modType) isEqualto "epoch") then {
diag_log "[blckeagls] Waiting until EpochMod is ready...";
2020-01-29 23:32:43 +00:00
//waituntil {!isnil "EPOCH_SERVER_READY"};
diag_log "[blckeagls] EpochMod is ready...loading blckeagls";
2018-11-19 20:33:20 +00:00
};
2018-11-21 04:35:30 +00:00
if ((toLower blck_modType) isEqualTo "exile") then
{
diag_log "[blckeagls] Waiting until ExileMod is ready ...";
2020-01-29 23:32:43 +00:00
//waitUntil {!PublicServerIsLoaded};
diag_log "[blckeagls] Exilemod is ready...loading blckeagls";
2018-11-21 04:35:30 +00:00
};
2020-05-05 22:11:24 +00:00
if ((toLower blck_modType) isEqualTo "default") then
{
diag_log "[blckeagls] Configuring Mission System for Default Settings...";
};
2020-01-29 13:37:13 +00:00
// Just some housekeeping for ghost.
2018-07-21 21:04:50 +00:00
private _blck_loadingStartTime = diag_tickTime;
2016-11-12 12:05:45 +00:00
#include "\q\addons\custom_server\init\build.sqf";
2020-01-29 23:32:43 +00:00
diag_log format["[blckeagls] build information loaded at %1",diag_tickTime];
2016-10-22 21:15:11 +00:00
2020-01-29 13:37:13 +00:00
2016-10-22 21:15:11 +00:00
// compile functions
2020-01-29 23:32:43 +00:00
[] call compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\blck_functions.sqf";
diag_log format["[blckeagls] functions compiled at %1",diag_tickTime];
2018-06-13 23:55:59 +00:00
2020-01-29 23:32:43 +00:00
[] call compile preprocessfilelinenumbers "\q\addons\custom_server\Configs\blck_configs.sqf";
diag_log format["[blckeagls] blck_configs.sqf run at %1",diag_tickTime];
2020-05-05 22:11:24 +00:00
waitUntil{(!isNil "blck_useHC") && (!isNil "blck_simulationManager") && (!isNil "blck_debugOn") && (!isNil "blck_AI_Side")};
2020-03-01 10:52:33 +00:00
uiSleep 10;
2020-01-29 13:37:13 +00:00
2018-07-06 23:38:03 +00:00
// Load any user-defined specifications or overrides
2020-05-05 22:11:24 +00:00
[] execVM "\q\addons\custom_server\Configs\blck_custom_config.sqf";
2020-01-29 13:37:13 +00:00
diag_log format["[blckeagls] Custom Configurations Loaded at %1",diag_tickTime];
diag_log format["[blckeagls] debug mode settings:blck_debugON = %1 | blck_debugLevel = %3",blck_debugON,blck_debugLevel];
// Load vaariables used to store information for the mission system.
[] call compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\blck_variables.sqf";
diag_log format["[blckeagls] Variables loaded at %1",diag_tickTime];
// configure dynamic simulation management is this is being used.
2018-11-21 04:35:30 +00:00
if (blck_simulationManager == 2) then
{
"Group" setDynamicSimulationDistance 1800;
enableDynamicSimulationSystem true;
};
2018-07-06 23:38:03 +00:00
2017-01-03 14:24:27 +00:00
// spawn map addons to give the server time to position them before spawning in crates etc.
if (blck_spawnMapAddons) then
{
call compileFinal preprocessFileLineNumbers "\q\addons\custom_server\MapAddons\MapAddons_init.sqf";
}else{
2018-10-21 11:56:34 +00:00
diag_log "[blckeagls] Map Addons disabled";
2017-01-03 14:24:27 +00:00
};
2018-11-19 20:33:20 +00:00
// find and set Mapcenter and size
call compileFinal preprocessFileLineNumbers "\q\addons\custom_server\init\GMS_fnc_findWorld.sqf";
2020-01-29 23:32:43 +00:00
diag_log "[blckeagls] Map-specific information defined";
2018-11-18 19:29:07 +00:00
2016-10-22 21:15:11 +00:00
// set up the lists of available missions for each mission category
#include "\q\addons\custom_server\Missions\GMS_missionLists.sqf";
2018-07-06 23:38:03 +00:00
diag_log "[blckeagls] Mission Lists Loaded Successfully";
2016-11-12 12:05:45 +00:00
2018-11-19 20:33:20 +00:00
call compile preprocessfilelinenumbers "\q\addons\custom_server\Missions\Static\GMS_StaticMissions_init.sqf";
call compile preprocessfilelinenumbers "q\addons\custom_server\Missions\UMS\GMS_UMS_init.sqf"; // loads functions and spawns any static missions.
2018-10-21 11:56:34 +00:00
diag_log "[blckeagls] blck_init_server: ->> Static and UMS systems initialized.";
2018-07-06 23:38:03 +00:00
2018-10-21 11:56:34 +00:00
switch (blck_simulationManager) do
{
case 2: {diag_log "[blckeagls] dynamic simulation manager enabled"};
case 1: {diag_log "[blckeagls] blckeagls simulation manager enabled"};
case 0: {diag_log "[blckeagls] simulation management disabled"};
};
2018-12-01 17:59:38 +00:00
diag_log format["[blckeagls] version %1 Build %2 Loaded in %3 seconds",blck_versionNumber,blck_buildNumber,diag_tickTime - _blck_loadingStartTime]; //,blck_modType];
2019-09-13 01:33:07 +00:00
diag_log format["[blckeagls] waiting for players to join ---- >>>>"];
2017-05-01 01:58:38 +00:00
2018-11-22 09:31:36 +00:00
if ( !(blck_debugON) && (blck_debugLevel isEqualTo 0)) then
2017-01-12 09:27:58 +00:00
{
2018-06-13 23:55:59 +00:00
waitUntil{{isPlayer _x}count allPlayers > 0};
2017-05-01 01:58:38 +00:00
diag_log "[blckeagls] Player Connected, spawning missions";
} else {
2018-11-22 09:31:36 +00:00
diag_log "[blckeagls] Debug mode ON, proceding without players";
2017-01-12 09:27:58 +00:00
};
2016-10-22 21:15:11 +00:00
2016-12-20 05:08:37 +00:00
if (blck_spawnStaticLootCrates) then
{
2020-01-29 13:37:13 +00:00
[] spawn compile preprocessfilelinenumbers "\q\addons\custom_server\SLS\SLS_init.sqf";
2017-05-01 01:58:38 +00:00
diag_log "[blckeagls] SLS:: -- >> Static Loot Spawner Done";
2016-12-20 05:08:37 +00:00
}else{
diag_log "[blckeagls] SLS:: -- >> Static Loot Spawner disabled";
};
2018-11-22 09:31:36 +00:00
if (blck_blacklistTraderCities) then
2018-07-21 21:04:50 +00:00
{
2020-01-29 13:37:13 +00:00
[] spawn compile preprocessfilelinenumbers "\q\addons\custom_server\init\GMS_fnc_getTraderCites.sqf";
2018-07-21 21:04:50 +00:00
};
2018-11-19 20:33:20 +00:00
2019-09-08 20:13:08 +00:00
if (blck_ai_offload_to_client) then
{
2020-01-29 23:32:43 +00:00
if (blck_useHC) then
{
blck_useHC = false;
diag_log "[blckeagls] <WARNING> blck_useHC has been diabled to allow offloading to clients";
};
// Broadcast some code to clients
2019-09-08 20:13:08 +00:00
publicVariable "blck_fnc_setNextWaypoint";
2019-09-12 00:19:51 +00:00
publicVariable "blck_EH_unitWeaponReloaded";
2020-01-29 13:37:13 +00:00
publicVariable "blck_EH_AIfiredNear";
publicVariable "blck_fnc_processAIfiredNear";
publicVariable "blck_EH_vehicleGetOut";
publicVariable "blck_fnc_handleVehicleGetOut";
publicVariable "blck_EH_vehicleManGetOut";
publicVariable "blck_fnc_checkForEmptyVehicle";
publicVariable "blck_fnc_handleEmptyVehicle";
publicVariable "blck_fnc_unlockVehicle";
publicVariable "blck_EH_AIKilled";
publicVariable "blck_fnc_processAIKill";
};
_fn_setupLocationType = {
params[ "_locationType"];
private _locations = nearestLocations [getArray (configFile >> "CfgWorlds" >> worldName >> "centerPosition"), [_locationType], worldSize];
_locations
};
private _villages = ["NameVillage"] call _fn_setupLocationType;
private _cites = ["NameCity"] call _fn_setupLocationType;
private _capitals = ["NameCityCapital"] call _fn_setupLocationType;
private _marine = ["NameMarine"] call _fn_setupLocationType;
private _other = ["NameLocal"] call _fn_setupLocationType;
private _airport = ["Airport"] call _fn_setupLocationType;
blck_townLocations = _villages + _cites + _capitals + _marine + _other + _airport;
diag_log format["_init_server: count blck_townLocations = %1 || blck_townLocations = %2",count blck_townLocations, blck_townLocations];
2019-09-08 20:13:08 +00:00
2016-10-22 21:15:11 +00:00
//Start the mission timers
2016-12-23 01:02:19 +00:00
if (blck_enableOrangeMissions > 0) then
2016-10-22 21:15:11 +00:00
{
2017-01-22 11:48:41 +00:00
//[_missionListOrange,_pathOrange,"OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange] spawn blck_fnc_missionTimer;//Starts major mission system (Orange Map Markers)
[_missionListOrange,_pathOrange,"OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange,blck_enableOrangeMissions] call blck_fnc_addMissionToQue;
2016-10-22 21:15:11 +00:00
};
2016-12-23 01:02:19 +00:00
if (blck_enableGreenMissions > 0) then
2016-10-22 21:15:11 +00:00
{
2017-01-22 11:48:41 +00:00
//[_missionListGreen,_pathGreen,"GreenMarker","green",blck_TMin_Green,blck_TMax_Green] spawn blck_fnc_missionTimer;//Starts major mission system 2 (Green Map Markers)
[_missionListGreen,_pathGreen,"GreenMarker","green",blck_TMin_Green,blck_TMax_Green,blck_enableGreenMissions] call blck_fnc_addMissionToQue;
2016-10-22 21:15:11 +00:00
};
2016-12-23 01:02:19 +00:00
if (blck_enableRedMissions > 0) then
2016-10-22 21:15:11 +00:00
{
2017-01-22 11:48:41 +00:00
//[_missionListRed,_pathRed,"RedMarker","red",blck_TMin_Red,blck_TMax_Red] spawn blck_fnc_missionTimer;//Starts minor mission system (Red Map Markers)//Starts minor mission system 2 (Red Map Markers)
[_missionListRed,_pathRed,"RedMarker","red",blck_TMin_Red,blck_TMax_Red,blck_enableRedMissions] call blck_fnc_addMissionToQue;
2016-10-22 21:15:11 +00:00
};
2016-12-23 01:02:19 +00:00
if (blck_enableBlueMissions > 0) then
2016-10-22 21:15:11 +00:00
{
2017-01-22 11:48:41 +00:00
//[_missionListBlue,_pathBlue,"BlueMarker","blue",blck_TMin_Blue,blck_TMax_Blue] spawn blck_fnc_missionTimer;//Starts minor mission system (Blue Map Markers)
[_missionListBlue,_pathBlue,"BlueMarker","blue",blck_TMin_Blue,blck_TMax_Blue,blck_enableBlueMissions] call blck_fnc_addMissionToQue;
2016-10-22 21:15:11 +00:00
};
2017-12-17 22:51:44 +00:00
2020-03-23 22:12:59 +00:00
#ifdef GRGserver
diag_log "[blckeagls] Running GhostriderGaming Version";
//diag_log format["[blckeagls] _init_server: blck_enableScoutsMissions = %1",blck_enableScoutsMissions];
if (blck_enableScoutsMissions > 0) then
{
//[_missionListScouts,_pathScouts,"ScoutsMarker","red",blck_TMin_Scouts,blck_TMax_Scouts] spawn blck_fnc_missionTimer;
[_missionListScouts,_pathScouts,"ScoutsMarker","red",blck_TMin_Scouts,blck_TMax_Scouts,blck_enableScoutsMissions,false] call blck_fnc_addMissionToQue;
};
//diag_log format["[blckeagls] _init_server: blck_enableHunterMissions = %1",blck_enableHunterMissions];
if (blck_enableHunterMissions > 0) then
{
//[_missionListHunters,_pathHunters,"HunterMarker","green",blck_TMin_Hunter,blck_TMax_Hunter] spawn blck_fnc_missionTimer;
// params["_missionList","_path","_marker","_difficulty","_tMin","_tMax","_noMissions"];
[_missionListHunters,_pathHunters,"HunterMarker","green",blck_TMin_Hunter,blck_TMax_Hunter,blck_enableHunterMissions,false] call blck_fnc_addMissionToQue;
};
// Running new version of Crash sites.
//diag_log format["[blckeagls] _init_server: blck_maxCrashSites = %1",blck_maxCrashSites];
if (blck_maxCrashSites > 0) then
{
[] execVM "\q\addons\custom_server\Missions\HeliCrashs\Crashes2.sqf";
};
//diag_log "loading DLS System";
call compile preprocessfilelinenumbers "\q\addons\custom_server\DLS\DLS_init.sqf";
#endif
2020-01-29 13:37:13 +00:00
// Setup a group for AI corpses
blck_graveyardGroup = createGroup [blck_AI_Side,false];
blck_graveyardGroup setGroupId ["blck_graveyard"];
blck_graveyardGroup setVariable ["blck_group",1];
2017-01-25 06:01:16 +00:00
// start the main thread for the mission system which monitors missions running and stuff to be cleaned up
[] spawn blck_fnc_mainThread;
2019-05-07 02:39:26 +00:00
blck_pvs_version = blck_versionNumber;
publicVariable "blck_pvs_version";
2020-05-05 22:11:24 +00:00
diag_log format["[blckeagls] version %1 Build %2 Date %4 Loaded in %3 seconds",blck_versionNumber,blck_buildNumber,diag_tickTime - _blck_loadingStartTime,blck_buildDate]; //,blck_modType];
2020-03-23 22:12:59 +00:00
2020-05-09 15:59:39 +00:00