using System; using RobocraftX.GUI.CommandLine; using RobocraftX.Multiplayer; using RobocraftX.StateSync; using RobocraftX.Character; using Svelto.ECS; using Unity.Entities; using UnityEngine; using uREPL; using Svelto.Context; using RobocraftX; // checklist of things to rename to make this command your own: // [ ] namespace ExtraCommands.Example -> namespace ExtraCommands.[your command's namespace] // [ ] class ExampleCommandEngine : CustomCommandEngine -> class [your command name]CommandEngine : CustomCommandEngine // [ ] public ExampleCommandEngine(UnityContext<... -> public [your command name]CommandEngine(UnityContext<... // [ ] CustomCommandUtility.Register("[your command name]", [your command name]Command, "[your command description]") // [ ] private void ExampleCommand() -> private void [your command name]Command() // [ ] CustomCommandUtility.Unregister("[your command name]") // // For aesthetics, I'd recommend using PascalCase (first letter in every word is uppercase; spaces are illegal*) // * You can use spaces in your command description, but nowhere else. The description should be written like a normal English sentence. namespace ExtraCommands.Example { // !!! Uncomment the line below this !!! // [CustomCommand("Example")] class ExampleCommandEngine : CustomCommandEngine { // This class is a custom implementation of CustomCommandEngine specific to this command // You can use Svelto.ECS.IEntityDB entitiesDB to query game entities or one of the protected variables for other things // More documentation on Svelto.ECS: https://github.com/sebas77/Svelto.ECS // Unfortunately the documentation is severely lacking and out of date; you may have better luck decompiling Svelto.ECS.dll // See CustomCommandEngine.cs for more information on the super class public ExampleCommandEngine(UnityContext ctxHolder, EnginesRoot enginesRoot, World physW, Action reloadGame, MultiplayerInitParameters mpParams) : base(ctxHolder, enginesRoot, physW, reloadGame, mpParams) { } // Ready() is called when the command is registered in-game (this happens whenever you load a game) public override void Ready() { // CustomCommandUtility.Register has multiple overloads depending on how many parameters you want to pass to your command // See CustomCommandUtility.cs for more information CustomCommandUtility.Register("Example", ExampleCommand, "This is an example command which does nothing!"); } // ExampleCommand() is called whenever the command is executed. This can accept up to three parameters // Please rename this, but don't forget to change the name in CustomCommandUtility.Register as well private void ExampleCommand() { // command operations go here } // Dispose() is called when the command is unregistered in-game (this happens whenever you leave a game) public override void Dispose() { // You must unregister the command so it doesn't waste memory and so // it can be re-registered next time CustomCommandUtility.Unregister("Example"); } } }