mifriis / edge-of-kuiper

Textbased space rpg somewhat based on real science
Other
7 stars 3 forks source link

Fully featured ConsoleCommands #32

Closed VisualBean closed 2 years ago

VisualBean commented 3 years ago

Note: Commandlineparser did not meet up to expectation.

A Command in this installment is considered as a {CommandGroup} --{CommandName} {Args} A Command without a CommandGroup will simply be known by its CommandName {CommandName} {Args}

Commands now support arguments in the form of string[], anything that comes AFTER the CommandName is considered arguments split by space.

Any inheritance from IConsoleCommand will get auto-registered as a singleton, through DI.

The original implementation was doing similar, but through reflection and attributes. This version is built in a heavier OOP fashion.

mifriis commented 3 years ago

Thank you for contributing! Let me know if you have more questions. As for your current one, lets try it out. Maybe the CLI approach would make it easier to make a simple UI on top later on

Nicoolai commented 3 years ago

This could actually also be a pretty cool gameplay mechanics. That you're actually interacting through programs, using CLI's, with parameters.

I keep thinking about what Notch tried to do, after minecraft. His space game where he wanted you to program ship computers, within the game. This could maybe give a light-weight feeling of that.

VisualBean commented 3 years ago

Ill implement it as a "real" CLI then.

VisualBean commented 3 years ago

CommandLineParser did not work entirely as expected, So I ended up making a slightly naive implementation for supporting commands.

Updated description to reflect this new change