GMS_RC/@GMS/addons/GMS/Compiles/Missions/fn_addMIssionToQue.sqf
Ghostrider [GRG] 7273521854 Build 275/Ver 7.21
Moved over to $prefix$ and labeled unused files
2023-10-31 21:57:49 -04:00

67 lines
2.2 KiB
Plaintext

/*
GMS_fnc_addMissionToQue
Adds the basic list of parameters that define a mission such as the marker name, mission list, mission path, AI difficulty, and timer settings, to the arrays that the main thread inspects.
By Ghostrider-GRG-
Copyright 2016
*/
#include "\x\addons\GMS\Compiles\Init\GMS_defines.hpp"
params[["_missionList",[]],["_path",""],["_marker",""],["_difficulty","Red"],["_tMin",60],["_tMax",120],["_noMissions",1],["_isStatic",false]];
//diag_log format["_addMissionToQue: _this = %1",_this];
//{
// diag_log format["_addMissionToQue: _this %1 = %2",_forEachIndex, _this select _forEachIndex];
//} forEach _this;
private "_waitTime";
if (_isStatic) then {
_waitTime = 60;
} else {
_waitTime = diag_tickTime + (_tMin) + random((_tMax) - (_tMin));
};
//diag_log format["_addMissionToQue: _waitTime = %1",_waitTime];
private "_missionFile";
private _missionsData = []; // Parameters definine each of the missions for this difficulty are stored as arrays here.
{
_missionFile = format["\x\addons\GMS\Missions\%1\%2.sqf",_path,_x];
if (GMS_debugLevel > 0) then {[format["_addMissionToQue: adding %1 mission with fileName %2",_difficulty,_missionFile]] call GMS_fnc_log};
private _missionCode = compileFinal preprocessFileLinenumbers _missionFile;//return all of the values that define how the mission is spawned as an array of values
if !(isNil "_missionCode") then
{
private _data = [_marker,_difficulty] call _missionCode;
if !(isNil "_data") then
{
_missionsData pushBack _data;
//diag_log format["_addMissionToQue: _data = %1",_data];
};
} else {
//diag_log format["bad path\mission combination %1",_missionFile];
};
} forEach _missionList;
private _key = round(random(10000));
private _missions = [
_key,
_difficulty,
_noMissions, // Max no missions of this category
0, // Number active
_tMin, // Used to calculate waittime in the future
_tMax, // as above
_waitTime, // time at which a mission should be spawned
_missionsData, // Array of data about individual missions that could be spawned. The data table for each mission is defined in _missionSpawner
_isStatic,
_missionFile
];
//diag_log format["_addMissionToQue (55): _missions = %1",_missions];
GMS_missionData pushBack _missions;