Last active
December 11, 2018 13:23
-
-
Save dedmen/b95fae17ce927da1a91fcb82f6d3901e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
params ["_unit"]; | |
//calc sun pos and set night/day time in map view | |
VKN_fnc_sunEval = { //TO-DO may wanna move this to CfgFunctions | |
private _lat = -1 * getNumber(configFile >> "CfgWorlds" >> worldName >> "latitude"); | |
private _day = 360 * (dateToNumber date); | |
private _hour = acos ((24 * sin(_lat) * cos(_day)) / ((12 * cos(_day) - 78) * cos(_lat))); | |
_daytime = _hour / 360 * 24; | |
_daytime | |
}; | |
private _sunEval = call VKN_fnc_sunEval; | |
private _time = [0, 1] select ((_sunEval <= 6) or (_sunEval >=21)); | |
//Collect loading screen image - if none, use terrain default | |
private _loadingPicture = getText (missionconfigfile >> "loadScreen"); | |
if (_loadingPicture == "") then { | |
_loadingPicture = getText (configFile >> "cfgworlds" >> worldName >> "pictureShot"); | |
}; | |
sleep 0.1; | |
private _missionData = (_unit call BIS_fnc_tasksUnit) apply { | |
private _taskInfo = _x call BIS_fnc_taskDescription; //return ["description", "title", "marker"] | |
private _taskPos = _x call BIS_fnc_taskDestination; //return [x,y,z], or [object,precision] | |
private _taskState = _x call BIS_fnc_taskState; | |
private _taskDescription = _taskInfo select 0; //Isolate Description | |
private _taskTitle = _taskInfo select 1; //Isolate Title | |
//If taskPos is a object, resolve it to a position. | |
if ((_taskPos select 0) isEqualType objNull) then { | |
//getPos and convert to [x,y,z] | |
_taskPos = getPos (_taskPos select 0); | |
}; | |
//setup custom mission using final data | |
[ | |
_taskPos, | |
{systemChat format ["%1, you can't use this feature!",name ((_this # 9) # 0)]}, | |
_taskTitle, | |
_taskDescription, | |
"Task State: " + _taskState, | |
"", | |
0, | |
[player] | |
] | |
}; | |
sleep 0.1; | |
//Collect ORBAT data | |
_orbatData = [ | |
[ | |
getPos _unit, //TO-DO: Grab respawn and apply full ORBAT, grab player and apply their sections ORBAT. | |
configFile >> "CfgORBAT" >> "VKN", | |
configFile >> "CfgORBAT" >> "VKN" >> "HQ", | |
["Viking PMC ORBAT"], | |
10 | |
] | |
]; | |
sleep 0.1; | |
//Ignore client/server side exec - function VKN_fnc_initStrategicMap does this already | |
[ | |
findDisplay 46, //display type | |
[worldSize / 2, worldsize / 2, 0], //Position - currently map center | |
_missionData, //large array of every task type | |
_orbatData, //Apply orbat onto the map at the position of the player | |
[], //Markers - TO-DO: Grab all pre-placed markers and place them | |
overcast, //Mission overcast | |
_time, //Evaluated time | |
1, //scaler (zoom) max 1 | |
true, //Simulation of effect | |
"Viking PMC Strategic Map Viewer", //Default lable at bottom | |
true, // Show map name | |
_loadingPicture //grab evaluated picture | |
] call BIS_fnc_StrategicMapOpen; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment