Ah Engine.EndGame(); got me somewhere. What it looks like happens is g_GameAttributes don't actually populate correctly (since the new game leaves me on Observer mode) + it seems that the seed is the same, so it looks like a few things do need to be handled manually. I'd rather this be done proper though (not a hack) should I put this together as a mod or submit a patch? (not 100% sure if a mod would work in this case).
EDIT: OK this is exactly what worked for me, will attach patch shortly ...
function restartGame()
{
let playerId = Engine.GetPlayerID();
let gameAttributes = g_GameAttributes;
gameAttributes.settings.Seed = Math.floor(Math.random() * Math.pow(2, 32));
Engine.EndGame();
Engine.StartGame(gameAttributes, playerId);
Engine.SwitchGuiPage("page_loading.xml", {
"attribs": gameAttributes,
"isNetworked" : g_IsNetworked,
"playerAssignments": g_PlayerAssignments
});
}
EDIT: Patch attached (YMMV)
restart-menu.diff