This wiki is archived from 2021-09-05
New game user interface scene
Jump to navigation
Jump to search
File:Titans-icon.png Planetary Annihilation New Game User Interface Scene
Path: /ui/main/game/new_game/
Scene name: New Game
Server script state: /server-script/states/lobby.js
The new_game user interface is loaded when:
- host creates a new game
- player or spectator joins a game in the lobby state
File:Gold-rank-icon.png Preventing the need for a host refresh
When a host creates a new game the user interface is displayed before any server mods are loaded requiring a host refresh to load any updated user interface provided by a server mod.
A refresh can be triggered by the host using any of the following:
- manual refresh (default binding of F5)
- navigating to another user interface scene eg load_planet when selecting a system
The current approach to avoid the need for a host refresh is:
- include the new game modifications in both the server mod and a dependent client mod
- check if the client mod has already been loaded
{ "identifier": "com.pa.my-unique-mod-name", "context": "server", ... "scenes": { "new_game": "coui://ui/mods/com.pa.my-unique-mod-name/new_game.js" ...
{ "identifier": "com.pa.my-unique-mod-name-client", "context": "client", ... "scenes": { "new_game": "coui://ui/mods/com.pa.my-unique-mod-name/new_game.js" ...
var myUniqueModNameLoaded; function myUniqueModName() { if myUniqueModNameLoaded ) { return; } loadCss( ' myUniqueModNameLoaded = true; // do stuff } try { myUniqueModName(); } catch (e) { console.error(e); }