Browse Source

Change to account for AcediaCore's refactor

feature_improvement
Anton Tarasenko 2 years ago
parent
commit
c1ba704493
  1. 4
      sources/Commands/ACommandFeature.uc
  2. 50
      sources/Futility_Feature.uc

4
sources/Commands/ACommandFeature.uc

@ -224,10 +224,8 @@ protected function class<Feature> LoadFeatureClass(BaseText featureName)
protected function ShowAllFeatures()
{
local int i;
local CoreService service;
local array< class<Feature> > availableFeatures;
service = CoreService(class'CoreService'.static.Require());
availableFeatures = service.GetAvailableFeatures();
availableFeatures = _.environment.GetAvailableFeatures();
for (i = 0; i < availableFeatures.length; i ++) {
ShowFeature(availableFeatures[i]);
}

50
sources/Futility_Feature.uc

@ -20,44 +20,62 @@
*/
class Futility_Feature extends Feature;
var LoggerAPI.Definition errNoCommandsFeature;
var private array< class<Command> > allCommandClasses;
var private LoggerAPI.Definition errNoCommandsFeature;
protected function OnEnabled()
{
local int i;
local Commands_Feature commandsFeature;
commandsFeature =
Commands_Feature(class'Commands_Feature'.static.GetInstance());
Commands_Feature(class'Commands_Feature'.static.GetEnabledInstance());
if (commandsFeature == none)
{
_.logger.Auto(errNoCommandsFeature);
return;
}
commandsFeature.RegisterCommand(class'ACommandDosh');
commandsFeature.RegisterCommand(class'ACommandNick');
commandsFeature.RegisterCommand(class'ACommandTrader');
commandsFeature.RegisterCommand(class'ACommandDB');
commandsFeature.RegisterCommand(class'ACommandInventory');
commandsFeature.RegisterCommand(class'ACommandFeature');
for (i = 0; i < allCommandClasses.length; i += 1) {
commandsFeature.RegisterCommand(allCommandClasses[i]);
}
_.environment.OnFeatureEnabled(self).connect = RegisterAllCommandClasses;
}
protected function OnDisabled()
{
local int i;
local Commands_Feature commandsFeature;
commandsFeature =
Commands_Feature(class'Commands_Feature'.static.GetInstance());
if (commandsFeature != none)
Commands_Feature(class'Commands_Feature'.static.GetEnabledInstance());
if (commandsFeature == none) {
return;
}
for (i = 0; i < allCommandClasses.length; i += 1) {
commandsFeature.RegisterCommand(allCommandClasses[i]);
}
}
private final function RegisterAllCommandClasses(Feature enabledFeature)
{
commandsFeature.RemoveCommand(class'ACommandDosh');
commandsFeature.RemoveCommand(class'ACommandNick');
commandsFeature.RemoveCommand(class'ACommandTrader');
commandsFeature.RemoveCommand(class'ACommandDB');
commandsFeature.RemoveCommand(class'ACommandInventory');
commandsFeature.RemoveCommand(class'ACommandFeature');
local int i;
local Commands_Feature commandsFeature;
commandsFeature = Commands_Feature(enabledFeature);
if (commandsFeature == none) {
return;
}
for (i = 0; i < allCommandClasses.length; i += 1) {
commandsFeature.RegisterCommand(allCommandClasses[i]);
}
}
defaultproperties
{
configClass = class'Futility'
allCommandClasses(0) = class'ACommandDosh'
allCommandClasses(1) = class'ACommandNick'
allCommandClasses(2) = class'ACommandTrader'
allCommandClasses(3) = class'ACommandDB'
allCommandClasses(4) = class'ACommandInventory'
allCommandClasses(5) = class'ACommandFeature'
errNoCommandsFeature = (l=LOG_Error,m="`Commands_Feature` is not detected, \"Futility\" will not be able to provide its functionality.")
}
Loading…
Cancel
Save