Browse Source

Fix command aliases not being properly added

There were numerous errors in new files, as well as conflicts with the
ones added awhile ago.
pull/8/head
Anton Tarasenko 2 years ago
parent
commit
a93a74d4d3
  1. 1
      config/AcediaAliases.ini
  2. 14
      sources/Aliases/Aliases.uc
  3. 1
      sources/Aliases/Aliases_Feature.uc
  4. 2
      sources/Aliases/BuiltInSources/CommandAliasSource.uc
  5. 26
      sources/Commands/Aliases/CommandAliasSource.uc
  6. 27
      sources/Commands/Aliases/CommandAliases.uc

1
config/AcediaAliases.ini

@ -10,6 +10,7 @@ weaponAliasSource=Class'AcediaCore.WeaponAliasSource'
colorAliasSource=Class'AcediaCore.ColorAliasSource' colorAliasSource=Class'AcediaCore.ColorAliasSource'
featureAliasSource=Class'AcediaCore.FeatureAliasSource' featureAliasSource=Class'AcediaCore.FeatureAliasSource'
entityAliasSource=Class'AcediaCore.EntityAliasSource' entityAliasSource=Class'AcediaCore.EntityAliasSource'
commandAliasSource=Class'AcediaCore.CommandAliasSource'
; `customSource` records allow you to add custom alias sources into Acedia, ; `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 ; 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`. ; can then be used by mods to resolve custom aliases using specified `name`.

14
sources/Aliases/Aliases.uc

@ -31,6 +31,7 @@ var public config class<AliasSource> weaponAliasSource;
var public config class<AliasSource> colorAliasSource; var public config class<AliasSource> colorAliasSource;
var public config class<AliasSource> featureAliasSource; var public config class<AliasSource> featureAliasSource;
var public config class<AliasSource> entityAliasSource; var public config class<AliasSource> entityAliasSource;
var public config class<AliasSource> commandAliasSource;
var public config array<CustomSourceRecord> customSource; var public config array<CustomSourceRecord> customSource;
protected function HashTable ToData() protected function HashTable ToData()
@ -41,10 +42,11 @@ protected function HashTable ToData()
data = __().collections.EmptyHashTable(); data = __().collections.EmptyHashTable();
// Add named aliases // Add named aliases
data.SetString(P("weapon"), string(weaponAliasSource)); data.SetString(P("weapon"), string(weaponAliasSource));
data.SetString(P("color"), string(colorAliasSource)); data.SetString(P("color"), string(colorAliasSource));
data.SetString(P("feature"), string(featureAliasSource)); data.SetString(P("feature"), string(featureAliasSource));
data.SetString(P("entity"), string(entityAliasSource)); data.SetString(P("entity"), string(entityAliasSource));
data.SetString(P("command"), string(commandAliasSource));
// Add the rest // Add the rest
otherSourcesData = __().collections.EmptyHashTable(); otherSourcesData = __().collections.EmptyHashTable();
for (i = 0; i < customSource.length; i += 1) for (i = 0; i < customSource.length; i += 1)
@ -77,6 +79,8 @@ protected function FromData(HashTable source)
source.GetString(P("feature"), string(class'FeatureAliasSource')))); source.GetString(P("feature"), string(class'FeatureAliasSource'))));
entityAliasSource = class<AliasSource>(_.memory.LoadClass_S( entityAliasSource = class<AliasSource>(_.memory.LoadClass_S(
source.GetString(P("entity"), string(class'EntityAliasSource')))); source.GetString(P("entity"), string(class'EntityAliasSource'))));
commandAliasSource = class<AliasSource>(_.memory.LoadClass_S(
source.GetString(P("command"), string(class'CommandAliasSource'))));
otherSourcesData = source.GetHashTable(P("other")); otherSourcesData = source.GetHashTable(P("other"));
if (otherSourcesData != none) if (otherSourcesData != none)
{ {
@ -122,6 +126,7 @@ protected function DefaultIt()
colorAliasSource = class'ColorAliasSource'; colorAliasSource = class'ColorAliasSource';
featureAliasSource = class'FeatureAliasSource'; featureAliasSource = class'FeatureAliasSource';
entityAliasSource = class'EntityAliasSource'; entityAliasSource = class'EntityAliasSource';
commandAliasSource = class'CommandAliasSource';
} }
defaultproperties defaultproperties
@ -131,4 +136,5 @@ defaultproperties
colorAliasSource = class'ColorAliasSource' colorAliasSource = class'ColorAliasSource'
featureAliasSource = class'FeatureAliasSource' featureAliasSource = class'FeatureAliasSource'
entityAliasSource = class'EntityAliasSource' entityAliasSource = class'EntityAliasSource'
commandAliasSource = class'CommandAliasSource'
} }

1
sources/Aliases/Aliases_Feature.uc

@ -118,6 +118,7 @@ protected function SwapConfig(FeatureConfig config)
colorAliasSource = GetSource(newConfig.colorAliasSource); colorAliasSource = GetSource(newConfig.colorAliasSource);
featureAliasSource = GetSource(newConfig.featureAliasSource); featureAliasSource = GetSource(newConfig.featureAliasSource);
entityAliasSource = GetSource(newConfig.entityAliasSource); entityAliasSource = GetSource(newConfig.entityAliasSource);
commandAliasSource = GetSource(newConfig.commandAliasSource);
LoadCustomSources(newConfig.customSource); LoadCustomSources(newConfig.customSource);
_.alias._reloadSources(); _.alias._reloadSources();
} }

2
sources/Aliases/BuiltInSources/CommandAliasSource.uc

@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with Acedia. If not, see <https://www.gnu.org/licenses/>. * along with Acedia. If not, see <https://www.gnu.org/licenses/>.
*/ */
class ColorAliasSource extends AliasSource class CommandAliasSource extends AliasSource
config(AcediaAliases_Commands); config(AcediaAliases_Commands);
defaultproperties defaultproperties

26
sources/Commands/Aliases/CommandAliasSource.uc

@ -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 <https://www.gnu.org/licenses/>.
*/
class CommandAliasSource extends AliasSource
config(AcediaAliases_Commands);
defaultproperties
{
aliasesClass = class'CommandAliases'
}

27
sources/Commands/Aliases/CommandAliases.uc

@ -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 <https://www.gnu.org/licenses/>.
*/
class CommandAliases extends AliasesStorage
perObjectConfig
config(AcediaAliases_Commands);
defaultproperties
{
sourceClass = class'CommandAliasSource'
}
Loading…
Cancel
Save