Browse Source

Move `CommandAPI` into base API

pull/12/head
Anton Tarasenko 2 years ago
parent
commit
9265e97c59
  1. 0
      sources/BaseAPI/API/Commands/BuiltInCommands/ACommandHelp.uc
  2. 0
      sources/BaseAPI/API/Commands/Command.uc
  3. 0
      sources/BaseAPI/API/Commands/CommandAPI.uc
  4. 0
      sources/BaseAPI/API/Commands/CommandDataBuilder.uc
  5. 0
      sources/BaseAPI/API/Commands/CommandParser.uc
  6. 0
      sources/BaseAPI/API/Commands/Commands.uc
  7. 22
      sources/BaseAPI/API/Commands/Commands_Feature.uc
  8. 0
      sources/BaseAPI/API/Commands/PlayersParser.uc
  9. 0
      sources/BaseAPI/API/Commands/Tests/MockCommandA.uc
  10. 0
      sources/BaseAPI/API/Commands/Tests/MockCommandB.uc
  11. 0
      sources/BaseAPI/API/Commands/Tests/TEST_Command.uc
  12. 0
      sources/BaseAPI/API/Commands/Tests/TEST_CommandDataBuilder.uc

0
sources/LevelAPI/Features/Commands/BuiltInCommands/ACommandHelp.uc → sources/BaseAPI/API/Commands/BuiltInCommands/ACommandHelp.uc

0
sources/LevelAPI/Features/Commands/Command.uc → sources/BaseAPI/API/Commands/Command.uc

0
sources/LevelAPI/Features/Commands/CommandAPI.uc → sources/BaseAPI/API/Commands/CommandAPI.uc

0
sources/LevelAPI/Features/Commands/CommandDataBuilder.uc → sources/BaseAPI/API/Commands/CommandDataBuilder.uc

0
sources/LevelAPI/Features/Commands/CommandParser.uc → sources/BaseAPI/API/Commands/CommandParser.uc

0
sources/LevelAPI/Features/Commands/Commands.uc → sources/BaseAPI/API/Commands/Commands.uc

22
sources/LevelAPI/Features/Commands/Commands_Feature.uc → sources/BaseAPI/API/Commands/Commands_Feature.uc

@ -73,7 +73,7 @@ var private /*config*/ bool useMutateInput;
// Default is "!". Empty values are also treated as "!". // Default is "!". Empty values are also treated as "!".
var private /*config*/ Text chatCommandPrefix; var private /*config*/ Text chatCommandPrefix;
var LoggerAPI.Definition errCommandDuplicate; var LoggerAPI.Definition errCommandDuplicate, errServerAPIUnavailable;
protected function OnEnabled() { protected function OnEnabled() {
registeredCommands = _.collections.EmptyHashTable(); registeredCommands = _.collections.EmptyHashTable();
@ -95,10 +95,11 @@ protected function OnEnabled() {
_.chat.OnMessage(self).Disconnect(); _.chat.OnMessage(self).Disconnect();
} }
if (useMutateInput || emergencyEnabledMutate) { if (useMutateInput || emergencyEnabledMutate) {
_server.unreal.mutator.OnMutate(self).connect = HandleMutate; if (__server() != none) {
} __server().unreal.mutator.OnMutate(self).connect = HandleMutate;
else { } else {
_server.unreal.mutator.OnMutate(self).Disconnect(); _.logger.Auto(errServerAPIUnavailable);
}
} }
} }
@ -106,8 +107,8 @@ protected function OnDisabled() {
if (useChatInput) { if (useChatInput) {
_.chat.OnMessage(self).Disconnect(); _.chat.OnMessage(self).Disconnect();
} }
if (useMutateInput) { if (useMutateInput && __server() != none) {
_server.unreal.mutator.OnMutate(self).Disconnect(); __server().unreal.mutator.OnMutate(self).Disconnect();
} }
useChatInput = false; useChatInput = false;
useMutateInput = false; useMutateInput = false;
@ -244,7 +245,11 @@ public final static function EmergencyEnable() {
if (noWayToInputCommands) { if (noWayToInputCommands) {
default.emergencyEnabledMutate = true; default.emergencyEnabledMutate = true;
feature.emergencyEnabledMutate = true; feature.emergencyEnabledMutate = true;
__server().unreal.mutator.OnMutate(feature).connect = HandleMutate; if (__server() != none) {
__server().unreal.mutator.OnMutate(feature).connect = HandleMutate;
} else {
__().logger.Auto(default.errServerAPIUnavailable);
}
} }
} }
@ -503,4 +508,5 @@ public final function bool HandleInputWith(Parser parser, EPlayer callerPlayer)
defaultproperties { defaultproperties {
configClass = class'Commands' configClass = class'Commands'
errCommandDuplicate = (l=LOG_Error,m="Command `%1` is already registered with name '%2'. Command `%3` with the same name will be ignored.") errCommandDuplicate = (l=LOG_Error,m="Command `%1` is already registered with name '%2'. Command `%3` with the same name will be ignored.")
errServerAPIUnavailable = (l=LOG_Error,m="Server API is currently unavailable. Input methods through chat and mutate command will not be available.")
} }

0
sources/LevelAPI/Features/Commands/PlayersParser.uc → sources/BaseAPI/API/Commands/PlayersParser.uc

0
sources/LevelAPI/Features/Commands/Tests/MockCommandA.uc → sources/BaseAPI/API/Commands/Tests/MockCommandA.uc

0
sources/LevelAPI/Features/Commands/Tests/MockCommandB.uc → sources/BaseAPI/API/Commands/Tests/MockCommandB.uc

0
sources/LevelAPI/Features/Commands/Tests/TEST_Command.uc → sources/BaseAPI/API/Commands/Tests/TEST_Command.uc

0
sources/LevelAPI/Features/Commands/Tests/TEST_CommandDataBuilder.uc → sources/BaseAPI/API/Commands/Tests/TEST_CommandDataBuilder.uc

Loading…
Cancel
Save