<commit_before>package flixel.system.debug.console;

#if FLX_DEBUG
import flixel.FlxG;
import flixel.FlxObject;
import flixel.FlxCamera;
import flixel.tweens.FlxTween;
import flixel.math.FlxMath;
import flixel.util.FlxStringUtil;
import flixel.system.debug.FlxDebugger.FlxDebuggerLayout;
using StringTools;

class ConsoleCommands
{
	private var _console:Console;
	/**
	 * Helper variable for toggling the mouse coords in the watch window.
	 */
	private var _watchingMouse:Bool = false;
	
	public function new(console:Console):Void
	{
		_console = console;
		
		console.registerFunction("help", help, "Displays the help text of a registered object or function. See \"help\".");
		console.registerFunction("close", close, "Closes the debugger overlay.");
		
		console.registerFunction("clearHistory", _console.history.clear, "Closes the debugger overlay.");
		console.registerFunction("clearLog", FlxG.log.clear, "Clears the command history.");
		
		console.registerFunction("fields", fields, "Lists the fields of a class or instance");
		
		console.registerFunction("listObjects", listObjects, "Lists the aliases of all registered objects.");
		console.registerFunction("listFunctions", listFunctions, "Lists the aliases of all registered functions.");
		
		console.registerFunction("step", step, "Steps the game forward one frame if currently paused. No effect if unpaused.");
		console.registerFunction("pause", pause, "Toggles the game between paused and unpaused.");
		
		console.registerFunction("clearBitmapLog", FlxG.bitmapLog.clear, "Clears the bitmapLog window.");
		console.registerFunction("viewCache", FlxG.bitmapLog.viewCache, "Adds the cache to the bitmapLog window.");
		
		console.registerFunction("create", create, "Creates a new FlxObject and registers it - by default at the mouse position. \"create(ObjClass:Class<T>, PlaceAtMouse:Bool, ExtraParams:Array<Dynamic>)\" Ex: \"create(FlxSprite, false, [100, 100])\"");
		
		console.registerFunction("watch", FlxG.watch.add, "Adds the specified field of an object to the watch window.");
		console.registerFunction("watchExpression", FlxG.watch.addExpression, "Adds the specified expression to the watch window. Be sure any objects, functions, and classes used are registered!");
		console.registerFunction("watchMouse", watchMouse, "Adds the mouse coordinates to the watch window.");
		console.registerFunction("track", FlxG.debugger.track, "Adds a tracker window for the specified object or class.");
		
		// Default classes to include
		console.registerClass(Math);
		console.registerClass(Reflect);
		console.registerClass(Std);
		console.registerClass(StringTools);
		#if sys
		console.registerClass(Sys);
		#end
		console.registerClass(Type);

		console.registerClass(FlxG);
		console.registerClass(FlxObject);
		console.registerClass(FlxSprite);
		console.registerClass(FlxMath);
		console.registerClass(FlxTween);
		console.registerClass(FlxCamera);
		
		console.registerObject("FlxDebuggerLayout", FlxDebuggerLayout);
		console.registerObject("selection", null);
	}
	
	private function help(?Alias:String):String
	{
		if (Alias == null || Alias.length == 0) 
		{
			var output:String = "System classes and commands: ";
			for (obj in _console.registeredObjects.keys())
			{
				output += obj + ", ";<commit_msg>ConsoleCommands: register FlxPoint and FlxRect<commit_after>package flixel.system.debug.console;

#if FLX_DEBUG
import flixel.FlxG;
import flixel.FlxObject;
import flixel.FlxCamera;
import flixel.tweens.FlxTween;
import flixel.math.FlxMath;
import flixel.math.FlxPoint;
import flixel.math.FlxRect;
import flixel.util.FlxStringUtil;
import flixel.system.debug.FlxDebugger.FlxDebuggerLayout;
using StringTools;

class ConsoleCommands
{
	private var _console:Console;
	/**
	 * Helper variable for toggling the mouse coords in the watch window.
	 */
	private var _watchingMouse:Bool = false;
	
	public function new(console:Console):Void
	{
		_console = console;
		
		console.registerFunction("help", help, "Displays the help text of a registered object or function. See \"help\".");
		console.registerFunction("close", close, "Closes the debugger overlay.");
		
		console.registerFunction("clearHistory", _console.history.clear, "Closes the debugger overlay.");
		console.registerFunction("clearLog", FlxG.log.clear, "Clears the command history.");
		
		console.registerFunction("fields", fields, "Lists the fields of a class or instance");
		
		console.registerFunction("listObjects", listObjects, "Lists the aliases of all registered objects.");
		console.registerFunction("listFunctions", listFunctions, "Lists the aliases of all registered functions.");
		
		console.registerFunction("step", step, "Steps the game forward one frame if currently paused. No effect if unpaused.");
		console.registerFunction("pause", pause, "Toggles the game between paused and unpaused.");
		
		console.registerFunction("clearBitmapLog", FlxG.bitmapLog.clear, "Clears the bitmapLog window.");
		console.registerFunction("viewCache", FlxG.bitmapLog.viewCache, "Adds the cache to the bitmapLog window.");
		
		console.registerFunction("create", create, "Creates a new FlxObject and registers it - by default at the mouse position. \"create(ObjClass:Class<T>, PlaceAtMouse:Bool, ExtraParams:Array<Dynamic>)\" Ex: \"create(FlxSprite, false, [100, 100])\"");
		
		console.registerFunction("watch", FlxG.watch.add, "Adds the specified field of an object to the watch window.");
		console.registerFunction("watchExpression", FlxG.watch.addExpression, "Adds the specified expression to the watch window. Be sure any objects, functions, and classes used are registered!");
		console.registerFunction("watchMouse", watchMouse, "Adds the mouse coordinates to the watch window.");
		console.registerFunction("track", FlxG.debugger.track, "Adds a tracker window for the specified object or class.");
		
		// Default classes to include
		console.registerClass(Math);
		console.registerClass(Reflect);
		console.registerClass(Std);
		console.registerClass(StringTools);
		#if sys
		console.registerClass(Sys);
		#end
		console.registerClass(Type);

		console.registerClass(FlxG);
		console.registerClass(FlxObject);
		console.registerClass(FlxSprite);
		console.registerClass(FlxMath);
		console.registerClass(FlxTween);
		console.registerClass(FlxCamera);
		console.registerClass(FlxPoint);
		console.registerClass(FlxRect);
		
		console.registerObject("FlxDebuggerLayout", FlxDebuggerLayout);
		console.registerObject("selection", null);
	}
	
	private function help(?Alias:String):String
	{
		if (Alias == null || Alias.length == 0) 
		{
			var output:String = "System classes and commands: ";
			for (obj in _console.registeredObjects.keys())
			{
				output += obj + ", ";
{'fraction_non_alphanumeric': 0.11461275457113126, 'fraction_numerical': 0.002081165452653486, 'mean_word_length': 5.425978987583572, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7050642', 'n_tokens_mistral': 2079, 'n_tokens_neox': 1891, 'n_words': 540}