Change Acedia's loading process
This commit is contained in:
parent
507c7ba12c
commit
ba85300315
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Main and only Acedia mutator used for initialization of necessary services
|
* Main and only Acedia mutator used for loading Acedia packages
|
||||||
* and providing access to mutator events' calls.
|
* and providing access to mutator events' calls.
|
||||||
* Copyright 2020 Anton Tarasenko
|
* Copyright 2020 Anton Tarasenko
|
||||||
*------------------------------------------------------------------------------
|
*------------------------------------------------------------------------------
|
||||||
@ -29,10 +29,10 @@ class Acedia extends Mutator
|
|||||||
var private Acedia selfReference;
|
var private Acedia selfReference;
|
||||||
|
|
||||||
// Array of predefined services that must be started along with Acedia mutator.
|
// Array of predefined services that must be started along with Acedia mutator.
|
||||||
var private array< class<Service> > systemServices;
|
var private config array< class<Manifest> > registeredManifests;
|
||||||
|
|
||||||
// All unit tests loaded from all packages.
|
// Array of predefined services that must be started along with Acedia mutator.
|
||||||
var private array< class<TestCase> > testCases;
|
var private array< class<Service> > systemServices;
|
||||||
|
|
||||||
static public final function Acedia GetInstance()
|
static public final function Acedia GetInstance()
|
||||||
{
|
{
|
||||||
@ -48,46 +48,58 @@ event PreBeginPlay()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
default.selfReference = self;
|
default.selfReference = self;
|
||||||
// Boot up Acedia
|
BootUp();
|
||||||
|
if (class'TestingService'.default.runTestsOnStartUp) {
|
||||||
|
RunStartUpTests();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private final function BootUp()
|
||||||
|
{
|
||||||
|
local int i;
|
||||||
Spawn(class'Global');
|
Spawn(class'Global');
|
||||||
LoadManifest(class'Manifest');
|
for (i = 0; i < registeredManifests.length; i += 1) {
|
||||||
LaunchServices();
|
LoadManifest(registeredManifests[i]);
|
||||||
|
}
|
||||||
InjectBroadcastHandler(); // TODO: move this to 'SideEffect' mechanic
|
InjectBroadcastHandler(); // TODO: move this to 'SideEffect' mechanic
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final function RunStartUpTests()
|
||||||
|
{
|
||||||
|
local TestingService testService;
|
||||||
|
testService = TestingService(class'TestingService'.static.Require());
|
||||||
|
testService.PrepareTests();
|
||||||
|
if (testService.filterTestsByName) {
|
||||||
|
testService.FilterByName(testService.requiredName);
|
||||||
|
}
|
||||||
|
if (testService.filterTestsByGroup) {
|
||||||
|
testService.FilterByName(testService.requiredGroup);
|
||||||
|
}
|
||||||
|
testService.Run();
|
||||||
|
}
|
||||||
|
|
||||||
private final function LoadManifest(class<Manifest> manifestClass)
|
private final function LoadManifest(class<Manifest> manifestClass)
|
||||||
{
|
{
|
||||||
local int i;
|
local int i;
|
||||||
// Activate manifest's listeners
|
// Load alias sources
|
||||||
for (i = 0; i < manifestClass.default.requiredListeners.length; i += 1)
|
for (i = 0; i < manifestClass.default.aliasSources.length; i += 1)
|
||||||
{
|
{
|
||||||
if (manifestClass.default.requiredListeners[i] == none) continue;
|
if (manifestClass.default.aliasSources[i] == none) continue;
|
||||||
manifestClass.default.requiredListeners[i].static.SetActive(true);
|
Spawn(manifestClass.default.aliasSources[i]);
|
||||||
}
|
}
|
||||||
// Enable features
|
// Enable features
|
||||||
for (i = 0; i < manifestClass.default.features.length; i += 1)
|
for (i = 0; i < manifestClass.default.features.length; i += 1)
|
||||||
{
|
{
|
||||||
if (manifestClass.default.features[i] == none) continue;
|
if (manifestClass.default.features[i] == none) continue;
|
||||||
if (manifestClass.default.features[i].static.IsAutoEnabled())
|
if (manifestClass.default.features[i].static.IsAutoEnabled()) {
|
||||||
{
|
|
||||||
manifestClass.default.features[i].static.EnableMe();
|
manifestClass.default.features[i].static.EnableMe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Load unit tests
|
// Load tests cases
|
||||||
for (i = 0; i < manifestClass.default.testCases.length; i += 1)
|
for (i = 0; i < manifestClass.default.testCases.length; i += 1)
|
||||||
{
|
{
|
||||||
if (manifestClass.default.testCases[i] == none) continue;
|
class'TestingService'.static
|
||||||
testCases[testCases.length] = manifestClass.default.testCases[i];
|
.RegisterTestCase(manifestClass.default.testCases[i]);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private final function LaunchServices()
|
|
||||||
{
|
|
||||||
local int i;
|
|
||||||
for (i = 0; i < systemServices.length; i += 1)
|
|
||||||
{
|
|
||||||
if (systemServices[i] == none) continue;
|
|
||||||
Spawn(systemServices[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,23 +131,22 @@ function bool CheckReplacement(Actor other, out byte isSuperRelevant)
|
|||||||
CallCheckReplacement(other, isSuperRelevant);
|
CallCheckReplacement(other, isSuperRelevant);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Mutate(string command, PlayerController sendingPlayer)
|
function Mutate(string command, PlayerController sendingController)
|
||||||
{
|
{
|
||||||
if (class'MutatorEvents'.static.CallMutate(command, sendingPlayer))
|
if (class'MutatorEvents'.static.CallMutate(command, sendingController)) {
|
||||||
{
|
super.Mutate(command, sendingController);
|
||||||
super.Mutate(command, sendingPlayer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
// List built-in services
|
// Add Acedia's own manifest
|
||||||
systemServices(0) = class'ConnectionService'
|
registeredManifests(0) = class'Manifest'
|
||||||
// This is a server-only mutator
|
// This is a server-only mutator
|
||||||
remoteRole = ROLE_None
|
remoteRole = ROLE_None
|
||||||
bAlwaysRelevant = true
|
bAlwaysRelevant = true
|
||||||
// Mutator description
|
// Mutator description
|
||||||
GroupName = "Core mutator"
|
GroupName = "Core mutator"
|
||||||
FriendlyName = "Acedia"
|
FriendlyName = "Acedia"
|
||||||
Description = "Mutator for all your degenerate needs"
|
Description = "Launcher for Acedia modules"
|
||||||
}
|
}
|
Reference in New Issue
Block a user