GMS_RC/@GMS/addons/GMS/Compiles/Missions/fn_addMIssionToQue.sqf

67 lines
2.2 KiB
Plaintext
Raw Normal View History

2023-09-23 14:05:31 +00:00
/*
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];
2023-10-15 18:53:11 +00:00
//{
// diag_log format["_addMissionToQue: _this %1 = %2",_forEachIndex, _this select _forEachIndex];
2023-10-15 18:53:11 +00:00
//} forEach _this;
private "_waitTime";
if (_isStatic) then {
_waitTime = 60;
} else {
_waitTime = diag_tickTime + (_tMin) + random((_tMax) - (_tMin));
2023-09-23 14:05:31 +00:00
};
//diag_log format["_addMissionToQue: _waitTime = %1",_waitTime];
2023-10-25 23:53:01 +00:00
private "_missionFile";
2023-09-23 14:05:31 +00:00
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];
2023-10-25 23:53:01 +00:00
if (GMS_debugLevel > 0) then {[format["_addMissionToQue: adding %1 mission with fileName %2",_difficulty,_missionFile]] call GMS_fnc_log};
2023-09-23 14:05:31 +00:00
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];
2023-09-23 14:05:31 +00:00
};
} else {
//diag_log format["bad path\mission combination %1",_missionFile];
2023-09-23 14:05:31 +00:00
};
} forEach _missionList;
2023-09-23 14:05:31 +00:00
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
2023-10-25 23:53:01 +00:00
_isStatic,
_missionFile
2023-09-23 14:05:31 +00:00
];
//diag_log format["_addMissionToQue (55): _missions = %1",_missions];
2023-09-23 14:05:31 +00:00
GMS_missionData pushBack _missions;