Files
EscapistsReintroduced/docs/evidence/terrain-selection-2026-10-02/native-8/fixture.c
T
jakub 6a667d8deb Capture current mission, AI, map and administration development
Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
2026-10-13 22:52:53 +02:00

40 lines
1.9 KiB
C

modded class ArmaReforgerScripted
{
protected bool m_ERRSelectionProbeListed;
protected bool m_ERRSelectionProbeRequested;
override void OnUpdate(BaseWorld world, float timeslice)
{
super.OnUpdate(world, timeslice);
if (!Replication.IsServer() || !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();
}
}