Skip to content

Commit

Permalink
Mission testing in 3Den & Time Keeper changes (#364)
Browse files Browse the repository at this point in the history
* Adds open checklist in 3DEN to POTATO drop down. SS fixes.

* Timer Fixes and Mission testing GUI changes

* fix bwc with old attributes

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
  • Loading branch information
Dan Thomas [BadWolf] and PabstMirror authored May 27, 2022
1 parent 866a7d4 commit 2e7784a
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 36 deletions.
2 changes: 1 addition & 1 deletion addons/adminComs/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ if (isServer) then {
[{
private _authorName = getMissionConfigValue ["author", "???"];
private _authorPresent = (allUnits findIf {(name _x) == _authorName}) > -1;
["potato_adminMsg", [format ["-Mision Maker [Present: %1]", _authorPresent], _authorName]] call CBA_fnc_globalEvent;
["potato_adminMsg", [format ["-Mission Maker [Present: %1]", _authorPresent], _authorName]] call CBA_fnc_globalEvent;
}, [], 1] call CBA_fnc_waitAndExecute;
};
3 changes: 2 additions & 1 deletion addons/missionTest/functions/fnc_onMissionSave.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ if (_missionType == 0) then {
_problems pushBackUnique ["Need to select mission type", ["POTATO -> Mission Testing Attributes -> Mission Type"]];
};
private _missionLength = getMissionConfigValue QEGVAR(missionTesting,missionTimeLength);
if (_missionLength == "") then {
if (_missionLength isEqualType "") then { _missionLength = parseNumber _missionLength; }; // BWC with old attribute that was string
if (_missionLength == 0) then {
_problems pushBackUnique ["Need to set mission length value", ["POTATO -> Mission Testing Attributes -> Mission Length"]];
};

Expand Down
14 changes: 9 additions & 5 deletions addons/missionTesting/CfgEden.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ class display3DEN {
class MenuStrip: ctrlMenuStrip {
class Items {
class PREFIX {
items[] += {QGVAR(missionTesting)};
items[] += {QGVAR(missionTesting),QGVAR(editorOpenMenu)};
};
class GVAR(missionTesting) {
text = "Mission Testing Attributes";
action = QUOTE(edit3DENMissionAttributes QUOTE(QGVAR(missionTestingInfo)););
};
class GVAR(editorOpenMenu) {
text = "Open Testing Menu";
action = QUOTE([] call FUNC(displayMenu));
};
};
};
};
Expand Down Expand Up @@ -112,15 +116,15 @@ class Cfg3DEN {
displayName = "Safe Start Time Length (mins):";
property = QGVAR(SSTimeGiven);
control = QUOTE(EditShort);
defaultValue = "";
typeName = "STRING";
defaultValue = 0;
typeName = "NUMBER";
};
class GVAR(missionTimeLength) {
displayName = "Mission Length (mins):";
property = QGVAR(missionTimeLength);
control = QUOTE(EditShort);
defaultValue = "";
typeName = "STRING";
defaultValue = 0;
typeName = "NUMBER";
};
};
};
Expand Down
3 changes: 2 additions & 1 deletion addons/missionTesting/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ if (hasInterface) then { // Change briefing map's "Continue" button to red "BRIE
{
private _missionTagVar = getMissionConfigValue _x;
private _missionTag = if(isNil QUOTE(_missionTagVar)) then {"NONE"} else {A_MISSION_TAGS select _missionTagVar};
if (_missionTag == "BRIEF ON MAP") exitWith {
if (_missionTag == "BRIEF ON MAP") exitWith {
INFO("brief on map");
[{
(!isNull findDisplay 37) || {!isNull findDisplay 52} || {!isNull findDisplay 53} || {!isNull findDisplay 12}
Expand All @@ -83,3 +83,4 @@ if (hasInterface) then { // Change briefing map's "Continue" button to red "BRIE
};
} forEach [QGVAR(missionTag1), QGVAR(missionTag2), QGVAR(missionTag3)];
};

42 changes: 27 additions & 15 deletions addons/missionTesting/functions/fnc_displayMenu.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -148,23 +148,25 @@ _menuCancel ctrlSetPosition [0.73,1,0.12,0.1];
_menuCancel buttonSetAction "closeDialog 2;";
_menuCancel ctrlCommit 0;
private _menuBreifingPage = DISPLAY_TESTMENU ctrlCreate [QUOTE(RscButtonMenu),-1];
_menuBreifingPage ctrlSetText "Brieifing";
_menuBreifingPage ctrlSetText "Briefing";
_menuBreifingPage ctrlSetPosition [0.60,1,0.12,0.1];
_menuBreifingPage buttonSetAction QUOTE([] call FUNC(openBriefings));
_menuBreifingPage ctrlCommit 0;

if (!EGVAR(spectate,running)) then {
private _killGoToSpec = DISPLAY_TESTMENU ctrlCreate [QUOTE(RscButtonMenu),-1];
_killGoToSpec ctrlSetText "Goto Spec";
_killGoToSpec ctrlSetTooltip "Kill player and go to POTATO spectator if enabled (which it should be enabled else MM messed up)";
_killGoToSpec buttonSetAction QUOTE(ACE_player setDamage 1);
_killGoToSpec ctrlSetPosition [0.47,1,0.12,0.1];
_killGoToSpec ctrlCommit 0;
} else {
private _keyBindInst = DISPLAY_TESTMENU ctrlCreate [QUOTE(RscText),-1];
_keyBindInst ctrlSetText "To reopen this menu in spectator press CTRL + SHIFT + F5";
_keyBindInst ctrlSetPosition [0,1,1,0.05];
_keyBindInst ctrlCommit 0;
if (!is3DEN) then {
if (!EGVAR(spectate,running)) then {
private _killGoToSpec = DISPLAY_TESTMENU ctrlCreate [QUOTE(RscButtonMenu),-1];
_killGoToSpec ctrlSetText "Goto Spec";
_killGoToSpec ctrlSetTooltip "Kill player and go to POTATO spectator if enabled (which it should be enabled else MM messed up)";
_killGoToSpec buttonSetAction QUOTE(ACE_player setDamage 1);
_killGoToSpec ctrlSetPosition [0.47,1,0.12,0.1];
_killGoToSpec ctrlCommit 0;
} else {
private _keyBindInst = DISPLAY_TESTMENU ctrlCreate [QUOTE(RscText),-1];
_keyBindInst ctrlSetText "To reopen this menu in spectator press CTRL + SHIFT + F5";
_keyBindInst ctrlSetPosition [0,1,1,0.05];
_keyBindInst ctrlCommit 0;
};
};

private _openForumFinishedMissions = DISPLAY_TESTMENU ctrlCreate [QUOTE(RscButtonMenu),-1];
Expand All @@ -181,6 +183,9 @@ private _missionPlayerCountMax = getMissionConfigValue QGVAR(playerCountMaximum)
private _missionPlayerCountMin = getMissionConfigValue QGVAR(playerCountMinimum);
private _missionPlayerCountRec = getMissionConfigValue QGVAR(playerCountRecommended);

private _missionSSTime = str getMissionConfigValue QGVAR(SSTimeGiven);
private _missionTimeLength = str getMissionConfigValue QGVAR(missionTimeLength);

private _missionTag1Var = getMissionConfigValue QGVAR(missionTag1);
private _missionTag1 = if(isNil QUOTE(_missionTag1Var)) then {"NONE"} else {A_MISSION_TAGS select _missionTag1Var};
private _missionTag2Var = getMissionConfigValue QGVAR(missionTag2);
Expand All @@ -202,7 +207,9 @@ private _missionSummary = "You are not the mission maker so this is currently un
if (isServer && name ACE_PLAYER == _missionMaker) then {_missionSummary = "Intel" get3DENMissionAttribute "IntelOverviewText"};
private _masterChecklistArray = nil;

if(_missionMaker == name player) then {
if (is3DEN) then {call compileScript ['\z\potato\addons\missiontesting\XEH_postInit.sqf']};

if(_missionMaker == name player || is3DEN) then {
_masterChecklistArray = GVAR(MissionMakerChecklistMaster);
} else {
_masterChecklistArray = GVAR(MissionTestingChecklistMaster);
Expand All @@ -220,7 +227,7 @@ _createCtrlLine4 ctrlCommit 0;
INCREMENT_YCOORD;

private _ctrlGeneralMMNotesTitle = DISPLAY_TESTMENU ctrlCreate [QUOTE(RscText),-1,CONTROL_GROUP_L];
if(_missionMaker == name ACE_PLAYER) then {
if(_missionMaker == name ACE_PLAYER || is3DEN) then {
_ctrlGeneralMMNotesTitle ctrlSetText "Any other Notes for Mission Testers/Version";
} else {
_ctrlGeneralMMNotesTitle ctrlSetText "General Notes for Mission Maker:";
Expand Down Expand Up @@ -270,6 +277,11 @@ _ctrlCreateInfoBlockText = composeText [
,_separator
,parseText "<t color='#0080FF'>Min:</t> ",_missionPlayerCountMin,parseText "<t color='#0080FF'> Rec:</t> ",_missionPlayerCountRec,parseText "<t color='#0080FF'> Max:</t> ",_missionPlayerCountMax, lineBreak
,lineBreak
,parseText "<t color='#FF8000'>MISSION TIMERS</t>"
,_separator
,parseText "<t color='#0080FF'>Mission SS Time (mins):</t> ",_missionSSTime, linebreak
,parseText "<t color='#0080FF'>Mission Run Time (mins):</t> ",_missionTimeLength, linebreak
,lineBreak
,parseText "<t color='#FF8000'>MISSION TAGS</t>"
,_separator
,_missionTag1,", ",_missionTag2,", ",_missionTag3, lineBreak
Expand Down
6 changes: 4 additions & 2 deletions addons/missionTesting/functions/fnc_generateReport.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ private _missionSummary = "Intel" get3DENMissionAttribute "IntelOverviewText";
private _missionPlayerCountMax = getMissionConfigValue QGVAR(playerCountMaximum);
private _missionPlayerCountMin = getMissionConfigValue QGVAR(playerCountMinimum);
private _missionPlayerCountRec = getMissionConfigValue QGVAR(playerCountRecommended);
private _missionSSTime = getMissionConfigValue QGVAR(SSTimeGiven);
private _missionTimeLength = getMissionConfigValue QGVAR(missionTimeLength);
private _missionTag1Var = getMissionConfigValue QGVAR(missionTag1);
private _missionTag1 = if(isNil QUOTE(_missionTag1Var)) then {"NONE"} else {A_MISSION_TAGS select _missionTag1Var};
private _missionTag2Var = getMissionConfigValue QGVAR(missionTag2);
Expand All @@ -89,11 +91,11 @@ private _masterChecklistArray = nil;
private _textArray = [];
private _textArrayShort = [];

if(_missionMaker == name ACE_PLAYER) then {
if(_missionMaker == name ACE_PLAYER || is3DEN) then {
_masterChecklistArray = GVAR(MissionMakerChecklistMaster);
S_NEWTEXTLINE ["[size=200][u][b]Mission : [color=#FF4000]%1[/color][/b][/u] [b][u]Type : [color=#FF4000]%2[/color][/u][/b][/size]", _missionName, _missionType];
S_NEWTEXTLINE ["[size=200][u][b]Version : [color=#FF4000]%1[/color][/b][/u][/size] [size=150][u][b]BWMF Version : [color=#FF4000]%2[/color][/b][/u][/size]",_missionVersion,_missionFrameworkDate];
S_NEWTEXTLINE ["[size=150]Mission Tags : [color=#FF4000]%1, %2, %3[/color] [/size] ",_missionTag1,_missionTag2,_missionTag3];
S_NEWTEXTLINE ["[size=150]Mission Tags : [color=#FF4000]%1, %2, %3[/color] SS Length : [color=#FF4000]%4[/color] Mission Length : [color=#FF4000]%5[/color][/size] ",_missionTag1,_missionTag2,_missionTag3,_missionSSTime,_missionTimeLength];
if (isServer && name ACE_PLAYER == _missionMaker) then {
S_NEWTEXTLINE ["[size=150][u]Mission Summary (As shown in Slotting screen, Inc of Ratio if TvT) :[/u][/size]"];
S_NEWTEXTLINE ["[color=#FF4000]%1[/color]",_missionSummary];
Expand Down
16 changes: 15 additions & 1 deletion addons/safeStart/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "script_component.hpp"

if (isServer) then {
// Setting to sync to ace_fortify
// Setting to sync to ace_fortify
["potato_safeStartOn", {
if (!GVAR(syncFortify)) exitWith {};
missionNamespace setVariable [QACEGVAR(fortify,fortifyAllowed), true, true];
Expand Down Expand Up @@ -29,3 +29,17 @@ if (didJip) then {
}
] call CBA_fnc_waitUntilAndExecute;
};

if(hasInterface) then {
[QGVAR(addMissionEndMarkerLocal),{
params["_markerStr"];
TRACE_1("Params",_this);

private _markerName = "_USER_DEFINED missionEndMarker_0";
private _markerExists = allMapMarkers find _markerName;

if !(_markerExists isEqualTo -1) then {deleteMarkerLocal _markerName;};

_markerStr call BIS_fnc_stringToMarkerLocal;
}] call CBA_fnc_addEventHandler;
};
25 changes: 18 additions & 7 deletions addons/safeStart/functions/fnc_missionTimeWarning.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,27 @@ if !(isServer) exitWith {};

params [];

private _missionLength = getMissionConfigValue [QEGVAR(missionTesting,missionTimeLength),0];
if (_missionLength isEqualType "") then { _missionLength = parseNumber _missionLength; }; // BWC with old attribute that was string
private _missionLengthSec = _missionLength * 60;

if (_missionLength == 0) then {
private _missionType = getMissionConfigValue QEGVAR(missionTesting,missionType);
switch (_missionType) do {
case 1: {_missionLength = 65};
case 2: {_missionLength = 35};
default {if(true) exitWith {TRACE_1("Something is seriously wrong, exiting timer")}};
};
};

missionNamespace setVariable [QGVAR(missionstartTime), CBA_missionTime, true];
TRACE_1("Mission start time",QGVAR(missionstartTime));

// 15 min Warning
[
{
private _missionStartTime = missionNamespace getVariable QGVAR(missionstartTime);
private _missionLength = parseNumber getMissionConfigValue QEGVAR(missionTesting,missionTimeLength) * 60;
(CBA_missionTime >= (_missionStartTime + _missionLength - 900)) || !(isNil QGVAR(timerID))
(CBA_missionTime >= (_missionStartTime + _missionLengthSec - 900)) || !(isNil QGVAR(timerID))
},
{
if (isNil QGVAR(timerID)) then {
Expand Down Expand Up @@ -60,17 +72,16 @@ TRACE_1("Mission start time",QGVAR(missionstartTime));
] call CBA_fnc_waitAndExecute;
};
},
[]
[_missionLengthSec]
] call CBA_fnc_waitUntilAndExecute;

// Add Map Marker at 0,0 position with mission end time.

// Check if mission end map marker already exists.

private _startTime = daytime;
private _missionLengthDec = parseNumber getMissionConfigValue QEGVAR(missionTesting,missionTimeLength) / 60;
private _endTimeDec = _startTime + _missionLengthDec;
private _endTimeDec = _startTime + (_missionLength / 60);
private _endTime = [_endTimeDec] call BIS_fnc_timeToString;

private _string = format ["|missionEndMarker_0|[0,0,0.0000]|mil_warning|ICON|[1,1]|0|Solid|colorCivilian|1|Mission End Time - %1",_endTime];
[_string] call BIS_fnc_stringToMarker;
private _string = format ["|_USER_DEFINED missionEndMarker_0|[0,0,0.0000]|mil_warning|ICON|[1,1]|0|Solid|colorCivilian|1|Mission End Time - %1",_endTime];
[QGVAR(addMissionEndMarkerLocal),[_string]] call CBA_fnc_globalEventJIP;
6 changes: 3 additions & 3 deletions addons/safeStart/script_component.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#define COMPONENT safestart
#include "\z\potato\addons\core\script_mod.hpp"

//#define DEBUG_MODE_FULL
//#define DISABLE_COMPILE_CACHE
//#define ENABLE_PERFORMANCE_COUNTERS
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define ENABLE_PERFORMANCE_COUNTERS

#ifdef DEBUG_ENABLED_SAFESTART
#define DEBUG_MODE_FULL
Expand Down

0 comments on commit 2e7784a

Please sign in to comment.