From a93a74d4d3b3b2764cbec5494a9881c31828e0aa Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Mon, 10 Oct 2022 04:14:21 +0700 Subject: [PATCH] Fix command aliases not being properly added There were numerous errors in new files, as well as conflicts with the ones added awhile ago. --- config/AcediaAliases.ini | 1 + sources/Aliases/Aliases.uc | 14 +++++++--- sources/Aliases/Aliases_Feature.uc | 1 + .../BuiltInSources/CommandAliasSource.uc | 2 +- .../Commands/Aliases/CommandAliasSource.uc | 26 ------------------ sources/Commands/Aliases/CommandAliases.uc | 27 ------------------- 6 files changed, 13 insertions(+), 58 deletions(-) delete mode 100644 sources/Commands/Aliases/CommandAliasSource.uc delete mode 100644 sources/Commands/Aliases/CommandAliases.uc diff --git a/config/AcediaAliases.ini b/config/AcediaAliases.ini index 8f77a09..6f12e10 100644 --- a/config/AcediaAliases.ini +++ b/config/AcediaAliases.ini @@ -10,6 +10,7 @@ weaponAliasSource=Class'AcediaCore.WeaponAliasSource' colorAliasSource=Class'AcediaCore.ColorAliasSource' featureAliasSource=Class'AcediaCore.FeatureAliasSource' entityAliasSource=Class'AcediaCore.EntityAliasSource' +commandAliasSource=Class'AcediaCore.CommandAliasSource' ; `customSource` records allow you to add custom alias sources into Acedia, ; that is sources that do not fit either of the standard groups. These sources ; can then be used by mods to resolve custom aliases using specified `name`. diff --git a/sources/Aliases/Aliases.uc b/sources/Aliases/Aliases.uc index f1bd8f2..2bbfb30 100644 --- a/sources/Aliases/Aliases.uc +++ b/sources/Aliases/Aliases.uc @@ -31,6 +31,7 @@ var public config class weaponAliasSource; var public config class colorAliasSource; var public config class featureAliasSource; var public config class entityAliasSource; +var public config class commandAliasSource; var public config array customSource; protected function HashTable ToData() @@ -41,10 +42,11 @@ protected function HashTable ToData() data = __().collections.EmptyHashTable(); // Add named aliases - data.SetString(P("weapon"), string(weaponAliasSource)); - data.SetString(P("color"), string(colorAliasSource)); - data.SetString(P("feature"), string(featureAliasSource)); - data.SetString(P("entity"), string(entityAliasSource)); + data.SetString(P("weapon"), string(weaponAliasSource)); + data.SetString(P("color"), string(colorAliasSource)); + data.SetString(P("feature"), string(featureAliasSource)); + data.SetString(P("entity"), string(entityAliasSource)); + data.SetString(P("command"), string(commandAliasSource)); // Add the rest otherSourcesData = __().collections.EmptyHashTable(); for (i = 0; i < customSource.length; i += 1) @@ -77,6 +79,8 @@ protected function FromData(HashTable source) source.GetString(P("feature"), string(class'FeatureAliasSource')))); entityAliasSource = class(_.memory.LoadClass_S( source.GetString(P("entity"), string(class'EntityAliasSource')))); + commandAliasSource = class(_.memory.LoadClass_S( + source.GetString(P("command"), string(class'CommandAliasSource')))); otherSourcesData = source.GetHashTable(P("other")); if (otherSourcesData != none) { @@ -122,6 +126,7 @@ protected function DefaultIt() colorAliasSource = class'ColorAliasSource'; featureAliasSource = class'FeatureAliasSource'; entityAliasSource = class'EntityAliasSource'; + commandAliasSource = class'CommandAliasSource'; } defaultproperties @@ -131,4 +136,5 @@ defaultproperties colorAliasSource = class'ColorAliasSource' featureAliasSource = class'FeatureAliasSource' entityAliasSource = class'EntityAliasSource' + commandAliasSource = class'CommandAliasSource' } \ No newline at end of file diff --git a/sources/Aliases/Aliases_Feature.uc b/sources/Aliases/Aliases_Feature.uc index 8402ff6..002f628 100644 --- a/sources/Aliases/Aliases_Feature.uc +++ b/sources/Aliases/Aliases_Feature.uc @@ -118,6 +118,7 @@ protected function SwapConfig(FeatureConfig config) colorAliasSource = GetSource(newConfig.colorAliasSource); featureAliasSource = GetSource(newConfig.featureAliasSource); entityAliasSource = GetSource(newConfig.entityAliasSource); + commandAliasSource = GetSource(newConfig.commandAliasSource); LoadCustomSources(newConfig.customSource); _.alias._reloadSources(); } diff --git a/sources/Aliases/BuiltInSources/CommandAliasSource.uc b/sources/Aliases/BuiltInSources/CommandAliasSource.uc index 6102bf8..56ef465 100644 --- a/sources/Aliases/BuiltInSources/CommandAliasSource.uc +++ b/sources/Aliases/BuiltInSources/CommandAliasSource.uc @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with Acedia. If not, see . */ -class ColorAliasSource extends AliasSource +class CommandAliasSource extends AliasSource config(AcediaAliases_Commands); defaultproperties diff --git a/sources/Commands/Aliases/CommandAliasSource.uc b/sources/Commands/Aliases/CommandAliasSource.uc deleted file mode 100644 index c37c57f..0000000 --- a/sources/Commands/Aliases/CommandAliasSource.uc +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Source intended for AcediaCore's command aliases. - * Copyright 2021 Anton Tarasenko - *------------------------------------------------------------------------------ - * This file is part of Acedia. - * - * Acedia is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 3 of the License, or - * (at your option) any later version. - * - * Acedia is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Acedia. If not, see . - */ -class CommandAliasSource extends AliasSource - config(AcediaAliases_Commands); - -defaultproperties -{ - aliasesClass = class'CommandAliases' -} \ No newline at end of file diff --git a/sources/Commands/Aliases/CommandAliases.uc b/sources/Commands/Aliases/CommandAliases.uc deleted file mode 100644 index 4ef02ba..0000000 --- a/sources/Commands/Aliases/CommandAliases.uc +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Per-object-configuration intended for AcediaCore's command aliases. - * Copyright 2021 Anton Tarasenko - *------------------------------------------------------------------------------ - * This file is part of Acedia. - * - * Acedia is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 3 of the License, or - * (at your option) any later version. - * - * Acedia is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Acedia. If not, see . - */ -class CommandAliases extends AliasesStorage - perObjectConfig - config(AcediaAliases_Commands); - -defaultproperties -{ - sourceClass = class'CommandAliasSource' -} \ No newline at end of file