Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
91 lines
4.1 KiB
C
91 lines
4.1 KiB
C
modded class ArmaReforgerScripted
|
|
{
|
|
protected bool m_ERRSelectionUIOpened;
|
|
protected string m_ERRSelectionClientState;
|
|
protected bool m_ERRSelectionProbeListed;
|
|
protected bool m_ERRSelectionProbeRequested;
|
|
override void OnUpdate(BaseWorld world, float timeslice)
|
|
{
|
|
super.OnUpdate(world, timeslice);
|
|
if (!Replication.IsServer())
|
|
{
|
|
SCR_MissionHeader clientHeader = SCR_MissionHeader.Cast(GetMissionHeader());
|
|
if (clientHeader)
|
|
{
|
|
string state = "scenario=" + ERR_TerrainCatalog.Key(clientHeader.GetHeaderResourceName()) + " mode=" + (ERR_GameMode.Get() != null).ToString();
|
|
if (state != m_ERRSelectionClientState) { Print("ERR SELECTOR CLIENT: " + state); m_ERRSelectionClientState = state; }
|
|
}
|
|
if (clientHeader && ERR_TerrainCatalog.Key(clientHeader.GetHeaderResourceName()) == "c1e20667dce324ed" && ERR_GameMode.Get() && GetPlayerController() && !m_ERRSelectionUIOpened)
|
|
{ m_ERRSelectionUIOpened = true; ERR_AdminMenu.Open(); }
|
|
return;
|
|
}
|
|
if (!GetGameMode()) return;
|
|
ERR_GameMode mode = ERR_GameMode.Get();
|
|
SCR_MissionHeader header = SCR_MissionHeader.Cast(GetMissionHeader());
|
|
if (!header) return;
|
|
string key = ERR_TerrainCatalog.Key(header.GetHeaderResourceName());
|
|
if (!m_ERRSelectionProbeListed)
|
|
{
|
|
m_ERRSelectionProbeListed = true;
|
|
foreach (ERR_TerrainChoice choice : GetGame().ERR_Terrains().Catalog().Choices()) PrintFormat("ERR SELECTOR OPTION: key=%1 title=%2 scenario=%3 world=%4", choice.Key, choice.Title, choice.Scenario, choice.WorldResource);
|
|
PrintFormat("ERR SELECTOR LOADED: scenario=%1 saved=%2", key, GetGame().ERR_Terrains().SavedKey());
|
|
}
|
|
if (!mode || !mode.Active() || m_ERRSelectionProbeRequested) return;
|
|
m_ERRSelectionProbeRequested = true;
|
|
if (key == "469880dfe1b48f95" && GetGame().ERR_Terrains().SavedKey() == "default")
|
|
{
|
|
array<string> replies = {};
|
|
mode.Admin().Execute(mode, false, "terrain set c1e20667dce324ed", replies);
|
|
PrintFormat("ERR SELECTOR UNAUTHORIZED: saved=%1 reply=%2", GetGame().ERR_Terrains().SavedKey(), replies[0]);
|
|
mode.Admin().Execute(mode, true, "terrain set c1e20667dce324ed", replies);
|
|
PrintFormat("ERR SELECTOR SAVE: saved=%1 sameWorld=%2 restart=%3", GetGame().ERR_Terrains().SavedKey(), key == ERR_TerrainCatalog.Key(header.GetHeaderResourceName()), GameStateTransitions.RequestScenarioRestart());
|
|
}
|
|
if (key == "c1e20667dce324ed")
|
|
{
|
|
PrintFormat("ERR SELECTOR COMPLETE: Everon active, saved=%1", GetGame().ERR_Terrains().SavedKey());
|
|
}
|
|
}
|
|
override protected void OnBeforeWorldCleanup()
|
|
{
|
|
m_ERRSelectionProbeListed = false; m_ERRSelectionProbeRequested = false;
|
|
super.OnBeforeWorldCleanup();
|
|
}
|
|
}
|
|
|
|
// Isolated visual fixture only: no account authorization or command bypass in production.
|
|
modded class ERR_AdminMenu
|
|
{
|
|
protected float m_ERRFixtureWait;
|
|
protected bool m_ERRFixtureCaptured;
|
|
override protected void RequestSnapshot()
|
|
{
|
|
array<string> values = {"terrainSaved=c1e20667dce324ed", "terrainCurrent=c1e20667dce324ed", "terrainOption=c1e20667dce324ed|Co10 Escape Reintroduced — Everon", "terrainOption=469880dfe1b48f95|Nogova — Exploration Alpha"};
|
|
array<string> status = {};
|
|
ReceiveSnapshot(true, values, status);
|
|
}
|
|
override void OnMenuUpdate(float tDelta)
|
|
{
|
|
super.OnMenuUpdate(tDelta);
|
|
if (m_ERRFixtureCaptured) return;
|
|
ShowPage(8);
|
|
m_ERRFixtureWait += tDelta;
|
|
if (m_ERRFixtureWait < 3) return;
|
|
SCR_ComboBoxComponent combo = SCR_ComboBoxComponent.GetComboBoxComponent("TerrainSelect", GetRootWidget());
|
|
bool ready = combo && combo.IsEnabled() && m_TerrainKeys.Count() == 3;
|
|
if (ready)
|
|
{
|
|
combo.SetCurrentItem(2); RequestSnapshot(); ready = combo.GetCurrentIndex() == 2;
|
|
}
|
|
GetRootWidget().Update();
|
|
foreach (string tab : Navigation())
|
|
{
|
|
Widget widget = GetRootWidget().FindAnyWidget(tab); float x, y, w, h;
|
|
widget.GetScreenPos(x, y); widget.GetScreenSize(w, h);
|
|
if (!widget.IsVisible() || w <= 1 || h <= 1) ready = false;
|
|
}
|
|
System.MakeScreenshot("$logs:terrain-selection-menu");
|
|
PrintFormat("ERR SELECTOR UI COMPLETE: ready=%1 draft-preserved=%2 page=%3", ready, combo.GetCurrentIndex() == 2, m_Page);
|
|
m_ERRFixtureCaptured = true;
|
|
}
|
|
}
|