You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some commands aren't usable when a game is initially launched, because they rely on members of classes which aren't instantiated yet (especially for debug stuff). I dislike that these commands are not added to the commands output, so in one game project, I wrote a helper function to add unavailable commands to the console.
InitialConsoleCommands.Add("Scene",newList<string[]>(){newstring[2]{"list_scene_entities","Lists all entities currently in a scene."}});InitialConsoleCommands.Add("DrawSystem",newList<string[]>(){newstring[2]{"draw_hitboxes","Draws all hit / hurt boxes on screen."},newstring[2]{"draw_wireframe","Enables wireframe mode."}});foreach(KeyValuePair<string,List<string[]>>kvpinInitialConsoleCommands){foreach(string[]sainkvp.Value){devConsole.AddCommand(sa[0],delegate{devConsole.Log($"Unavailable command. {kvp.Key} object is required before usage.");},sa[1]);}}
This is a problem that might be better solved in the game console library. A simple "AddUnavailableCommand" would do.
Unavailable commands should be indicated as "Not yet usable" or something in the output of commands
When a new command is added to the main commands map, it should iterate over all the unavailable commands, and remove the appropriate "unavailable" element.
While doing this, consider loading commands from a data file to make the whole skeleton command process simple across different projects (and to keep command documentation out of code).
The text was updated successfully, but these errors were encountered:
Some commands aren't usable when a game is initially launched, because they rely on members of classes which aren't instantiated yet (especially for debug stuff). I dislike that these commands are not added to the
commands
output, so in one game project, I wrote a helper function to add unavailable commands to the console.This is a problem that might be better solved in the game console library. A simple "AddUnavailableCommand" would do.
commands
While doing this, consider loading commands from a data file to make the whole skeleton command process simple across different projects (and to keep command documentation out of code).
The text was updated successfully, but these errors were encountered: