@@ -188,6 +188,7 @@ declare namespace Gimloader {
188188 needsLib : string [ ] ;
189189 optionalLib : string [ ] ;
190190 syncEval : string ;
191+ gamemode : string [ ] ;
191192 hasSettings : string ;
192193 } ;
193194 /** Gets the exported values of a plugin, if it has been enabled */
@@ -219,6 +220,7 @@ declare namespace Gimloader {
219220 needsLib : string [ ] ;
220221 optionalLib : string [ ] ;
221222 syncEval : string ;
223+ gamemode : string [ ] ;
222224 hasSettings : string ;
223225 } ;
224226 /** Gets the exported values of a library */
@@ -403,12 +405,14 @@ declare namespace Gimloader {
403405
404406 class ScopedNetApi extends BaseNetApi {
405407 private readonly id ;
406- constructor ( id : string ) ;
408+ private readonly defaultGamemode ;
409+ constructor ( id : string , defaultGamemode : string [ ] ) ;
407410 /**
408- * Runs a callback when the game is loaded, or runs it immediately if the game has already loaded
411+ * Runs a callback when the game is loaded, or runs it immediately if the game has already loaded.
412+ * If the \@gamemode header is set the callback will only fire if the gamemode matches one of the provided gamemodes.
409413 * @returns A function to cancel waiting for load
410414 */
411- onLoad ( callback : ( type : ConnectionType ) => void ) : ( ) => void ;
415+ onLoad ( callback : ( type : ConnectionType , gamemode : string ) => void , gamemode ?: string | string [ ] ) : ( ) => void ;
412416 }
413417
414418 type ConnectionType = "None" | "Colyseus" | "Blueboat" ;
@@ -417,6 +421,8 @@ declare namespace Gimloader {
417421 constructor ( ) ;
418422 /** Which type of server the client is currently connected to */
419423 get type ( ) : ConnectionType ;
424+ /** The id of the gamemode the player is currently playing */
425+ get gamemode ( ) : string ;
420426 /** The room that the client is connected to, or null if there is no connection */
421427 get room ( ) : any ;
422428 /** Whether the user is the one hosting the current game */
@@ -431,7 +437,11 @@ declare namespace Gimloader {
431437 * Runs a callback when the game is loaded, or runs it immediately if the game has already loaded
432438 * @returns A function to cancel waiting for load
433439 */
434- onLoad ( id : string , callback : ( type : ConnectionType ) => void ) : ( ) => void ;
440+ onLoad (
441+ id : string ,
442+ callback : ( type : ConnectionType , gamemode : string ) => void ,
443+ gamemode ?: string | string [ ] ,
444+ ) : ( ) => void ;
435445 /** Cancels any calls to {@link onLoad} with the same id */
436446 offLoad ( id : string ) : void ;
437447 /**
0 commit comments