continuous-integration/drone/push Build is passing
Discover installed mod vehicles and save independent garage, traffic, patrol and convoy assignments. Retire the superseded RHS 1.9 overrides. Include native menu, crew/driving and publication evidence.
147 lines
6.7 KiB
Plaintext
147 lines
6.7 KiB
Plaintext
#ifdef WORKBENCH
|
|
modded class SCR_RespawnSystemComponent
|
|
{
|
|
override void UpdateLoadingPlaceholder(float dt)
|
|
{
|
|
super.UpdateLoadingPlaceholder(dt);
|
|
if (ERR_AdminMenu.GetOpenMenu() && m_wLoadingPlaceholder) m_wLoadingPlaceholder.SetVisible(false);
|
|
}
|
|
}
|
|
|
|
modded class ERR_GameMode
|
|
{
|
|
protected override void StartScenario() {}
|
|
protected override void EOnInit(IEntity owner)
|
|
{
|
|
super.EOnInit(owner);
|
|
if (SCR_Global.IsEditMode() || !Replication.IsServer()) return;
|
|
GetGame().GetCallqueue().CallLater(ERR_ContentReviewBegin, 5000, false);
|
|
}
|
|
protected void ERR_ContentReviewBegin()
|
|
{
|
|
PrintFormat("ERR CONTENT: controller=%1",GetGame().GetPlayerController()!=null);
|
|
ERR_AdminMenu.Open();
|
|
}
|
|
}
|
|
modded class ERR_AdminMenu
|
|
{
|
|
protected int m_ContentReviewStage;
|
|
protected float m_ContentReviewAt;
|
|
protected string m_ContentReviewItem;
|
|
protected string m_ContentReviewVehicle;
|
|
protected string m_ContentReviewAddon="58d0fb3206b6f859";
|
|
override void OnMenuOpen()
|
|
{
|
|
super.OnMenuOpen();
|
|
GetGame().GetCallqueue().CallLater(ERR_ContentReviewTick,1000,true);
|
|
}
|
|
override void OnMenuClose()
|
|
{
|
|
GetGame().GetCallqueue().Remove(ERR_ContentReviewTick);
|
|
super.OnMenuClose();
|
|
}
|
|
void ERR_ContentReviewFail(string reason)
|
|
{
|
|
Print("ERR SMOKE FAIL: content menu "+reason,LogLevel.ERROR);
|
|
GetGame().GetCallqueue().Remove(ERR_ContentReviewTick);
|
|
}
|
|
void ERR_ContentReviewTick()
|
|
{
|
|
float now=GetGame().GetWorld().GetWorldTime();
|
|
if(!m_Ready || now<m_ContentReviewAt)return;
|
|
m_ContentReviewAt=now+3000;
|
|
PrintFormat("ERR CONTENT STAGE: %1 page=%2 vehicles=%3 addon=%4",m_ContentReviewStage,m_Page,m_VehicleRows.Count(),m_ShownVehicleAddon);
|
|
ERR_ItemPreferences prefs=GetGame().ERR_ItemSelections();
|
|
if(m_ContentReviewStage==0)
|
|
{
|
|
if(m_ServerAddonKeys.IsEmpty() || m_VehicleMods.IsEmpty())return;
|
|
ShowPage(ERR_AdminPage.MODS);GetRootWidget().Update();
|
|
if(!ERR_ProbeNavigation(ERR_AdminPage.MODS)){ERR_ContentReviewFail("navigation");return;}
|
|
PrintFormat("ERR CONTENT MODS: rows=%1 vehicleMods=%2",m_ServerAddonRows.Count(),m_VehicleMods.Count());
|
|
System.MakeScreenshot("$logs:content-mods");
|
|
m_ContentReviewStage=1;return;
|
|
}
|
|
if(m_ContentReviewStage==1)
|
|
{
|
|
SCR_ComboBoxComponent.GetComboBoxComponent("ItemsMod",GetRootWidget()).SetCurrentItem(m_ServerAddonKeys.Find(m_ContentReviewAddon),false,false,false);
|
|
ShowPage(ERR_AdminPage.ALLOWED_ITEMS);BrowseItems(0);m_ContentReviewStage=2;return;
|
|
}
|
|
if(m_ContentReviewStage==2)
|
|
{
|
|
if(m_ItemRows.IsEmpty())return;
|
|
foreach(string key,Widget row:m_ItemRows){m_ContentReviewItem=key;OnItemRowButton(SCR_ButtonTextComponent.GetButtonText("Disable",row));break;}
|
|
System.MakeScreenshot("$logs:content-items");m_ContentReviewStage=3;return;
|
|
}
|
|
if(m_ContentReviewStage==3)
|
|
{
|
|
if(prefs.Enabled(m_ContentReviewAddon,m_ContentReviewItem)){ERR_ContentReviewFail("item disable through menu");return;}
|
|
SubmitItems("items mod "+m_ContentReviewAddon+" 0");m_ContentReviewStage=4;return;
|
|
}
|
|
if(m_ContentReviewStage==4)
|
|
{
|
|
if(prefs.ModEnabled(m_ContentReviewAddon)){ERR_ContentReviewFail("mod disable");return;}
|
|
array<ResourceName> disabledPool={ERR_CivilianTraffic.CarPrefab(0)};
|
|
if(!ERR_VehicleSelection.Choose(disabledPool).IsEmpty()){ERR_ContentReviewFail("disabled mod still permits traffic candidate");return;}
|
|
SubmitItems("items mod "+m_ContentReviewAddon+" 1");m_ContentReviewStage=5;return;
|
|
}
|
|
if(m_ContentReviewStage==5)
|
|
{
|
|
if(!prefs.ModEnabled(m_ContentReviewAddon)||prefs.Enabled(m_ContentReviewAddon,m_ContentReviewItem)){ERR_ContentReviewFail("master restore lost item choice");return;}
|
|
SCR_EditBoxComponent.GetEditBoxComponent("ItemsSearch",GetRootWidget()).SetValue("err_no_such_item_9387");BrowseItems(0);m_ContentReviewStage=6;return;
|
|
}
|
|
if(m_ContentReviewStage==6)
|
|
{
|
|
if(!m_ItemRows.IsEmpty()){ERR_ContentReviewFail("search stale rows");return;}
|
|
Print("ERR SMOKE PASS: real menu item disable, master mod restoration and empty search");
|
|
PrintFormat("ERR CONTENT VEHICLE INDEX: %1",m_VehicleMods.Find(m_ContentReviewAddon));
|
|
ShowPage(ERR_AdminPage.WEIGHTS); SubmitItems("items list "+m_ContentReviewAddon+" 0");m_ContentReviewStage=10;return;
|
|
}
|
|
if(m_ContentReviewStage==10)
|
|
{
|
|
ShowPage(ERR_AdminPage.ALLOWED_ITEMS);m_ContentReviewStage=11;return;
|
|
}
|
|
if(m_ContentReviewStage==11)
|
|
{
|
|
if(!m_ItemRows.IsEmpty()){ERR_ContentReviewFail("search lost after advanced page");return;}
|
|
Print("ERR SMOKE PASS: item search restored after visiting advanced weights");
|
|
OpenVehicleAddon(m_ContentReviewAddon);m_ContentReviewStage=7;return;
|
|
}
|
|
if(m_ContentReviewStage==7)
|
|
{
|
|
if(m_VehicleRows.IsEmpty())return;
|
|
if(!ERR_ProbeNavigation(ERR_AdminPage.VEHICLE_POOL)){ERR_ContentReviewFail("vehicle navigation");return;}
|
|
foreach(string key,Widget row:m_VehicleRows){m_ContentReviewVehicle=key;OnVehicleRowButton(SCR_ButtonTextComponent.GetButtonText("Disable",row));break;}
|
|
System.MakeScreenshot("$logs:content-vehicles");m_ContentReviewStage=8;return;
|
|
}
|
|
if(m_ContentReviewStage==8)
|
|
{
|
|
if(prefs.VehicleEnabled(m_ContentReviewAddon,m_ContentReviewVehicle)){ERR_ContentReviewFail("vehicle disable");return;}
|
|
ERR_ServerAddonItems vehicles=GetGame().ERR_ServerVehicles().Find(m_ContentReviewAddon);
|
|
foreach(ERR_ServerItem vehicle:vehicles.Items)
|
|
if(ERR_TerrainCatalog.Key(vehicle.Prefab)==m_ContentReviewVehicle)
|
|
{
|
|
array<ResourceName> pool={vehicle.Prefab};
|
|
if(!ERR_VehicleSelection.Choose(pool).IsEmpty()){ERR_ContentReviewFail("disabled vehicle still selected");return;}
|
|
}
|
|
ERR_ItemPreferences reloaded=new ERR_ItemPreferences();
|
|
if(reloaded.VehicleEnabled(m_ContentReviewAddon,m_ContentReviewVehicle)||reloaded.Enabled(m_ContentReviewAddon,m_ContentReviewItem)||!reloaded.ModEnabled(m_ContentReviewAddon)){ERR_ContentReviewFail("saved configuration reload");return;}
|
|
SCR_ComboBoxComponent.GetComboBoxComponent("VehiclesFilter",GetRootWidget()).SetCurrentItem(2,false,false,false);BrowseVehicles(0);m_ContentReviewStage=9;return;
|
|
}
|
|
if(m_ContentReviewStage==9)
|
|
{
|
|
if(m_VehicleRows.Count()!=1 || !m_VehicleRows.Contains(m_ContentReviewVehicle)){ERR_ContentReviewFail("disabled vehicle filter");return;}
|
|
Print("ERR SMOKE PASS: vehicle disable, filtered list and persisted preferences reload");
|
|
for(int page=0;page<Pages().Count();page++)
|
|
{
|
|
ShowPage(page);
|
|
if(!ERR_ProbeNavigation(page)){ERR_ContentReviewFail("page bounds "+page.ToString());return;}
|
|
}
|
|
Print("ERR SMOKE PASS: all navigation pages fit and disabled vehicles are excluded from selection");
|
|
ShowPage(ERR_AdminPage.MODS);System.MakeScreenshot("$logs:content-final");
|
|
Print("ERR SMOKE COMPLETE: content menu native admin actions and saved selections");
|
|
GetGame().GetCallqueue().Remove(ERR_ContentReviewTick);
|
|
}
|
|
}
|
|
}
|
|
#endif
|