From c74dfaa669b6960825729da1f99442be3d0b212b Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Tue, 7 Jun 2022 19:02:15 +0700 Subject: [PATCH] Add built-in `ConsoleWriter`s to Acedia's commands --- sources/Commands/Command.uc | 66 ++++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 4 deletions(-) diff --git a/sources/Commands/Command.uc b/sources/Commands/Command.uc index d45f0d3..8a127b7 100644 --- a/sources/Commands/Command.uc +++ b/sources/Commands/Command.uc @@ -177,6 +177,25 @@ var private Data commandData; // of `Command`, so we will simply store and reuse one created instance. var private Command mainInstance; +/** + * When command is being executed we create several instances of + * `ConsoleWriter` that can be used for command output. They will also be + * automatically deallocated once command is executed. + * DO NOT modify them or deallocate any of them manually. + * This should make output more convenient and standardized. + * + * 1. `publicConsole` - sends messages to all present players; + * 2. `callerConsole` - sends messages to the player that + * called the command; + * 3. `targetConsole` - sends messages to the player that is currently + * being targeted (different each call of `ExecutedFor()` and + * `none` during `Executed()` call); + * 4. `othersConsole` - sends messaged to every player that is + * neither "caller" or "target". + */ +var protected ConsoleWriter publicConsole, othersConsole; +var protected ConsoleWriter callerConsole, targetConsole; + protected function Constructor() { local CommandDataBuilder dataBuilder; @@ -193,6 +212,7 @@ protected function Finalizer() local int i; local array subCommands; local array