Browse Source

Fix style for `EnvironmentApi`

core_refactor
Anton Tarasenko 2 years ago
parent
commit
ea79a1bc33
  1. 429
      sources/BaseRealm/AcediaEnvironment/AcediaEnvironment.uc
  2. 13
      sources/BaseRealm/AcediaEnvironment/Events/Environment_FeatureDisabled_Signal.uc
  3. 16
      sources/BaseRealm/AcediaEnvironment/Events/Environment_FeatureDisabled_Slot.uc
  4. 14
      sources/BaseRealm/AcediaEnvironment/Events/Environment_FeatureEnabled_Signal.uc
  5. 16
      sources/BaseRealm/AcediaEnvironment/Events/Environment_FeatureEnabled_Slot.uc

429
sources/BaseRealm/AcediaEnvironment/AcediaEnvironment.uc

@ -1,5 +1,7 @@
/** /**
* Container for the information about available resources from other packages. * Author: dkanus
* Home repo: https://www.insultplayers.ru/git/AcediaFramework/AcediaCore
* License: GPL
* Copyright 2022-2023 Anton Tarasenko * Copyright 2022-2023 Anton Tarasenko
*------------------------------------------------------------------------------ *------------------------------------------------------------------------------
* This file is part of Acedia. * This file is part of Acedia.
@ -19,35 +21,17 @@
*/ */
class AcediaEnvironment extends AcediaObject; class AcediaEnvironment extends AcediaObject;
/** //! API for management of running `Feature`s and loaded packages.
* # `AcediaEnvironment` //!
* //! Instance of this class will be used by Acedia to manage resources available
* Instance of this class will be used by Acedia to manage resources available //! from different packages like `Feature`s and such other etc..
* from different packages like `Feature`s and such other etc.. //! This is mostly necessary to implement Acedia loader (and, possibly,
* This is mostly necessary to implement Acedia loader (and, possibly, //! its alternatives) that would load available packages and enable `Feature`s
* its alternatives) that would load available packages and enable `Feature`s //! admin wants to be enabled.
* admin wants to be enabled.
*
* ## Packages
*
* Any package to be used in Acedia should first be *registered* with
* `RegisterPackage()` method. Then a manifest class from it will be read and
* Acedia will become aware of all the resources that package contains.
* Once any of those resources is used, package gets marked as *loaded* and its
* *entry object* (if specified) will be created.
*
* ## `Feature`s
*
* Whether `Feature` is enabled is governed by the `AcediaEnvironment` added
* into the `Global` class. It is possible to create several `Feature`
* instances of the same class instance of each class, but only one can be
* considered enabled at the same time.
*/
var private bool acediaShutDown; var private bool acediaShutDown;
var private array< class<_manifest> > availablePackages; var private array< class<_manifest> > availablePackages;
var private array< class<_manifest> > loadedPackages;
var private array< class<Feature> > availableFeatures; var private array< class<Feature> > availableFeatures;
var private array<Feature> enabledFeatures; var private array<Feature> enabledFeatures;
@ -65,97 +49,77 @@ var private SimpleSignal onShutdownSystemSignal;
var private Environment_FeatureEnabled_Signal onFeatureEnabledSignal; var private Environment_FeatureEnabled_Signal onFeatureEnabledSignal;
var private Environment_FeatureDisabled_Signal onFeatureDisabledSignal; var private Environment_FeatureDisabled_Signal onFeatureDisabledSignal;
protected function Constructor() protected function Constructor() {
{
// Always register our core package // Always register our core package
RegisterPackage_S("AcediaCore"); RegisterPackage_S("AcediaCore");
onShutdownSignal = SimpleSignal( onShutdownSignal = SimpleSignal(_.memory.Allocate(class'SimpleSignal'));
_.memory.Allocate(class'SimpleSignal')); onShutdownSystemSignal = SimpleSignal(_.memory.Allocate(class'SimpleSignal'));
onShutdownSystemSignal = SimpleSignal(
_.memory.Allocate(class'SimpleSignal'));
onFeatureEnabledSignal = Environment_FeatureEnabled_Signal( onFeatureEnabledSignal = Environment_FeatureEnabled_Signal(
_.memory.Allocate(class'Environment_FeatureEnabled_Signal')); _.memory.Allocate(class'Environment_FeatureEnabled_Signal'));
onFeatureDisabledSignal = Environment_FeatureDisabled_Signal( onFeatureDisabledSignal = Environment_FeatureDisabled_Signal(
_.memory.Allocate(class'Environment_FeatureDisabled_Signal')); _.memory.Allocate(class'Environment_FeatureDisabled_Signal'));
} }
protected function Finalizer() protected function Finalizer() {
{
_.memory.Free(onShutdownSignal); _.memory.Free(onShutdownSignal);
_.memory.Free(onShutdownSystemSignal); _.memory.Free(onShutdownSystemSignal);
_.memory.Free(onFeatureEnabledSignal); _.memory.Free(onFeatureEnabledSignal);
_.memory.Free(onFeatureDisabledSignal); _.memory.Free(onFeatureDisabledSignal);
} }
/** /// Signal that will be emitted right before Acedia shuts down.
* Signal that will be emitted before Acedia shuts down. ///
* At this point all APIs should still exist and function. /// At the point of emission all APIs should still exist and function.
* ///
* [Signature] /// # Signature
* void <slot>() ///
*/ /// void <slot>()
/* SIGNAL */ public final /*signal*/ function SimpleSlot OnShutDown(AcediaObject receiver) {
public final function SimpleSlot OnShutDown(AcediaObject receiver)
{
return SimpleSlot(onShutdownSignal.NewSlot(receiver)); return SimpleSlot(onShutdownSignal.NewSlot(receiver));
} }
/** /// Signal that will be emitted during Acedia shut down.
* Signal that will be emitted during Acedia shut down. System API use it to ///
* clean up after themselves, so one shouldn't rely on them. /// System API will use it to clean up after themselves, so one shouldn't rely on using them.
* ///
* There is no reason to use this signal unless you're reimplementing one of /// There is no reason to use this signal unless you're reimplementing one of the APIs.
* the APIs. Otherwise you probably want to use `OnShutDown()` signal instead. /// Otherwise you probably want to use `OnShutDown()` signal instead.
* ///
* [Signature] /// # Signature
* void <slot>() ///
*/ /// void <slot>()
/* SIGNAL */ public final /*signal*/ function SimpleSlot OnShutDownSystem(AcediaObject receiver) {
public final function SimpleSlot OnShutDownSystem(AcediaObject receiver)
{
return SimpleSlot(onShutdownSystemSignal.NewSlot(receiver)); return SimpleSlot(onShutdownSystemSignal.NewSlot(receiver));
} }
/** /// Signal that will be emitted right after a new `Feature` is enabled and its `OnEnabled()` method
* Signal that will be emitted when new `Feature` is enabled. // was called.
* Emitted after `Feature`'s `OnEnabled()` method was called. ///
* /// # Signature
* [Signature] ///
* void <slot>(Feature enabledFeature) /// void <slot>(Feature enabledFeature)
* /// @param enabledFeature `Feature` instance that was just enabled.
* @param enabledFeature `Feature` instance that was just enabled. public final /*signal*/ function Environment_FeatureEnabled_Slot OnFeatureEnabled(
*/ AcediaObject receiver
/* SIGNAL */ ) {
public final function Environment_FeatureEnabled_Slot OnFeatureEnabled( return Environment_FeatureEnabled_Slot(onFeatureEnabledSignal.NewSlot(receiver));
AcediaObject receiver) }
{
return Environment_FeatureEnabled_Slot( /// Signal that will be emitted right after when a `Feature` is disabled and its `OnDisabled()`
onFeatureEnabledSignal.NewSlot(receiver)); /// method was called.
} ///
/// # Signature
/** ///
* Signal that will be emitted when new `Feature` is disabled. /// void <slot>(class<Feature> disabledFeatureClass)
* Emitted after `Feature`'s `OnDisabled()` method was called. /// @param disabledFeatureClass Class of the `Feature` instance that was just disabled.
* public final /*signal*/ function Environment_FeatureDisabled_Slot OnFeatureDisabled(
* [Signature] AcediaObject receiver
* void <slot>(class<Feature> disabledFeatureClass) ) {
* return Environment_FeatureDisabled_Slot(onFeatureEnabledSignal.NewSlot(receiver));
* @param disabledFeatureClass Class of the `Feature` instance that was }
* just disabled.
*/ /// Shuts AcediaCore down, performing all the necessary clean up.
/* SIGNAL */ public final function Shutdown() {
public final function Environment_FeatureDisabled_Slot OnFeatureDisabled(
AcediaObject receiver)
{
return Environment_FeatureDisabled_Slot(
onFeatureEnabledSignal.NewSlot(receiver));
}
/**
* Shuts AcediaCore down, performing all the necessary cleaning up.
*/
public final function Shutdown()
{
local LevelCore core; local LevelCore core;
if (acediaShutDown) { if (acediaShutDown) {
@ -176,18 +140,16 @@ public final function Shutdown()
acediaShutDown = true; acediaShutDown = true;
} }
/** /// Registers an Acedia package wit ha given name.
* Registers an Acedia package with name given by `packageName`. ///
* /// Returns `true` if package was successfully registered, `false` if it either does not exist,
* @param packageName Name of the package to register. Must not be `none`. /// was already registered or [`packageName`] is `none`.
* This package must exist and not have yet been registered in this ///
* environment. /// # Errors
* @return `true` if package was successfully registered, `false` if it ///
* either does not exist, was already registered or `packageName` is /// Will log an error if the package has failed to get registered (it is either missing or not
* `none`. /// an Acedia package).
*/ public final function bool RegisterPackage(BaseText packageName) {
public final function bool RegisterPackage(BaseText packageName)
{
local class<_manifest> manifestClass; local class<_manifest> manifestClass;
if (packageName == none) { if (packageName == none) {
@ -196,13 +158,11 @@ public final function bool RegisterPackage(BaseText packageName)
_.logger.Auto(infoRegisteringPackage).Arg(packageName.Copy()); _.logger.Auto(infoRegisteringPackage).Arg(packageName.Copy());
manifestClass = class<_manifest>(DynamicLoadObject( manifestClass = class<_manifest>(DynamicLoadObject(
packageName.ToString() $ manifestSuffix, class'Class', true)); packageName.ToString() $ manifestSuffix, class'Class', true));
if (manifestClass == none) if (manifestClass == none) {
{
_.logger.Auto(errNotRegistered).Arg(packageName.Copy()); _.logger.Auto(errNotRegistered).Arg(packageName.Copy());
return false; return false;
} }
if (IsManifestRegistered(manifestClass)) if (IsManifestRegistered(manifestClass)) {
{
_.logger.Auto(infoAlreadyRegistered).Arg(packageName.Copy()); _.logger.Auto(infoAlreadyRegistered).Arg(packageName.Copy());
return false; return false;
} }
@ -211,17 +171,16 @@ public final function bool RegisterPackage(BaseText packageName)
return true; return true;
} }
/** /// Registers an Acedia package wit ha given name.
* Registers an Acedia package with name given by `packageName`. ///
* /// Returns `true` if package was successfully registered, `false` if it either does not exist or
* @param packageName Name of the package to register. /// was already registered.
* This package must exist and not have yet been registered in this ///
* environment. /// # Errors
* @return `true` if package was successfully registered, `false` if it ///
* either does not exist or was already registered. /// Will log an error if the package has failed to get registered (it is either missing or not
*/ /// an Acedia package).
public final function RegisterPackage_S(string packageName) public final function RegisterPackage_S(string packageName) {
{
local Text wrapper; local Text wrapper;
wrapper = _.text.FromString(packageName); wrapper = _.text.FromString(packageName);
@ -229,12 +188,10 @@ public final function RegisterPackage_S(string packageName)
_.memory.Free(wrapper); _.memory.Free(wrapper);
} }
private final function bool IsManifestRegistered(class<_manifest> manifestClass) private final function bool IsManifestRegistered(class<_manifest> manifestClass) {
{
local int i; local int i;
for (i = 0; i < availablePackages.length; i += 1) for (i = 0; i < availablePackages.length; i += 1) {
{
if (manifestClass == availablePackages[i]) { if (manifestClass == availablePackages[i]) {
return true; return true;
} }
@ -242,72 +199,35 @@ private final function bool IsManifestRegistered(class<_manifest> manifestClass)
return false; return false;
} }
private final function ReadManifest(class<_manifest> manifestClass) private final function ReadManifest(class<_manifest> manifestClass) {
{
local int i; local int i;
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) { if (manifestClass.default.features[i] == none) {
continue; continue;
} }
manifestClass.default.features[i].static.LoadConfigs(); manifestClass.default.features[i].static.LoadConfigs();
availableFeatures[availableFeatures.length] = availableFeatures[availableFeatures.length] = manifestClass.default.features[i];
manifestClass.default.features[i];
} }
for (i = 0; i < manifestClass.default.testCases.length; i += 1) for (i = 0; i < manifestClass.default.testCases.length; i += 1) {
{ class'TestingService'.static.RegisterTestCase(manifestClass.default.testCases[i]);
class'TestingService'.static
.RegisterTestCase(manifestClass.default.testCases[i]);
} }
} }
/** /// Returns all packages registered in the caller [`AcediaEnvironment`].
* Returns all packages registered in the caller `AcediaEnvironment`. public final function array< class<_manifest> > GetAvailablePackages() {
*
* NOTE: package being registered doesn't mean it's actually loaded.
* Package must either be explicitly loaded or automatically when one of its
* resources is being used.
*
* @return All packages registered in caller `AcediaEnvironment`.
*/
public final function array< class<_manifest> > GetAvailablePackages()
{
return availablePackages; return availablePackages;
} }
/** /// Returns all [`Feature`]s available in the caller `AcediaEnvironment`.
* Returns all packages loaded in the caller `AcediaEnvironment`. public final function array< class<Feature> > GetAvailableFeatures() {
*
* NOTE: package being registered doesn't mean it's actually loaded.
* Package must either be explicitly loaded or automatically when one of its
* resources is being used.
*
* @return All packages loaded in caller `AcediaEnvironment`.
*/
public final function array< class<_manifest> > GetLoadedPackages()
{
return loadedPackages;
}
/**
* Returns all `Feature`s available in the caller `AcediaEnvironment`.
*
* @return All `Feature`s available in the caller `AcediaEnvironment`.
*/
public final function array< class<Feature> > GetAvailableFeatures()
{
return availableFeatures; return availableFeatures;
} }
/** /// Returns all currently enabled [`Feature`]s.
* Returns all `Feature` instances enabled in the caller `AcediaEnvironment`. public final function array<Feature> GetEnabledFeatures() {
*
* @return All `Feature`s enabled in the caller `AcediaEnvironment`.
*/
public final function array<Feature> GetEnabledFeatures()
{
local int i; local int i;
for (i = 0; i < enabledFeatures.length; i += 1) { for (i = 0; i < enabledFeatures.length; i += 1) {
enabledFeatures[i].NewRef(); enabledFeatures[i].NewRef();
} }
@ -319,42 +239,32 @@ public final function array<Feature> GetEnabledFeatures()
private final function CleanEnabledFeatures() private final function CleanEnabledFeatures()
{ {
local int i; local int i;
while (i < enabledFeatures.length)
{ while (i < enabledFeatures.length) {
if ( enabledFeatures[i].GetLifeVersion() if (enabledFeatures[i].GetLifeVersion() != enabledFeaturesLifeVersions[i]) {
!= enabledFeaturesLifeVersions[i])
{
enabledFeatures.Remove(i, 1); enabledFeatures.Remove(i, 1);
} } else {
else {
i += 1; i += 1;
} }
} }
} }
/** /// Checks if `Feature` of given class is enabled.
* Checks if `Feature` of given class `featureClass` is enabled. ///
* /// Even if If feature of class `featureClass` is enabled, it's not necessarily that the instance
* NOTE: even if If feature of class `featureClass` is enabled, it's not /// you have reference to is enabled.
* necessarily that the instance you have reference to is enabled. ///
* Although unlikely, it is possible that someone spawned another instance /// Although unlikely, it is possible that someone spawned another instance of the same class that
* of the same class that isn't considered enabled. If you want to check /// isn't considered enabled. If you want to check whether some particular instance of given class
* whether some particular instance of given class `featureClass` is enabled, /// [`featureClass`] is enabled, use [`IsFeatureEnabled()`] method instead.
* use `IsFeatureEnabled()` method instead. public final function bool IsFeatureClassEnabled(class<Feature> featureClass) {
*
* @param featureClass Feature class to check for being enabled.
* @return `true` if feature of class `featureClass` is currently enabled and
* `false` otherwise.
*/
public final function bool IsFeatureClassEnabled(class<Feature> featureClass)
{
local int i; local int i;
if (featureClass == none) { if (featureClass == none) {
return false; return false;
} }
CleanEnabledFeatures(); CleanEnabledFeatures();
for (i = 0; i < enabledFeatures.length; i += 1) for (i = 0; i < enabledFeatures.length; i += 1) {
{
if (featureClass == enabledFeatures[i].class) { if (featureClass == enabledFeatures[i].class) {
return true; return true;
} }
@ -362,26 +272,18 @@ public final function bool IsFeatureClassEnabled(class<Feature> featureClass)
return false; return false;
} }
/** /// Checks if given `Feature` instance is enabled.
* Checks if given `Feature` instance is enabled. ///
* /// If you want to check if any instance instance of given class `classToCheck` is enabled
* If you want to check if any instance instance of given class /// (and not [`feature`] specifically), use [`IsFeatureClassEnabled()`] method instead.
* `classToCheck` is enabled (and not `feature` specifically), use public final function bool IsFeatureEnabled(Feature feature) {
* `IsFeatureClassEnabled()` method instead.
*
* @param feature Feature instance to check for being enabled.
* @return `true` if feature `feature` is currently enabled and
* `false` otherwise.
*/
public final function bool IsFeatureEnabled(Feature feature)
{
local int i; local int i;
if (feature == none) return false; if (feature == none) return false;
if (!feature.IsAllocated()) return false; if (!feature.IsAllocated()) return false;
CleanEnabledFeatures(); CleanEnabledFeatures();
for (i = 0; i < enabledFeatures.length; i += 1) for (i = 0; i < enabledFeatures.length; i += 1) {
{
if (feature == enabledFeatures[i]) { if (feature == enabledFeatures[i]) {
return true; return true;
} }
@ -389,24 +291,17 @@ public final function bool IsFeatureEnabled(Feature feature)
return false; return false;
} }
/** /// Returns enabled `Feature` instance of the given class.
* Returns enabled `Feature` instance of the given class `featureClass`. ///
* /// Returns `none` only if `featureClass` is not enabled (or also `none`).
* @param featureClass Feature class to find enabled instance for. public final function Feature GetEnabledFeature(class<Feature> featureClass) {
* @return Enabled `Feature` instance of the given class `featureClass`.
* If no feature of `featureClass` is enabled, returns `none`.
*/
public final function Feature GetEnabledFeature(class<Feature> featureClass)
{
local int i; local int i;
if (featureClass == none) { if (featureClass == none) {
return none; return none;
} }
CleanEnabledFeatures(); CleanEnabledFeatures();
for (i = 0; i < enabledFeatures.length; i += 1) for (i = 0; i < enabledFeatures.length; i += 1) {
{ if (featureClass == enabledFeatures[i].class) {
if (featureClass == enabledFeatures[i].class)
{
enabledFeatures[i].NewRef(); enabledFeatures[i].NewRef();
return enabledFeatures[i]; return enabledFeatures[i];
} }
@ -414,41 +309,26 @@ public final function Feature GetEnabledFeature(class<Feature> featureClass)
return none; return none;
} }
/** /// Enables given `Feature` instance `newEnabledFeature` with a given config.
* Enables given `Feature` instance `newEnabledFeature` with a given config. /// Does not change a config for already enabled feature, failing instead.
* Does not change a config for already enabled feature, failing instead. ///
* /// Returns `true` if given `newEnabledFeature` was enabled and `false` otherwise
* @see `Feature::EnableMe()`. /// (including if feature of the same class has already been enabled).
* public final function bool EnableFeature(Feature newEnabledFeature, optional BaseText configName) {
* @param newEnabledFeature Instance to enable.
* @param configName Name of the config to enable `newEnabledFeature`
* feature with. `none` means "default" config (will be created, if
* necessary).
* @return `true` if given `newEnabledFeature` was enabled and `false`
* otherwise (including if feature of the same class has already been
* enabled).
*/
public final function bool EnableFeature(
Feature newEnabledFeature,
BaseText configName)
{
local int i; local int i;
if (newEnabledFeature == none) return false; if (newEnabledFeature == none) return false;
if (!newEnabledFeature.IsAllocated()) return false; if (!newEnabledFeature.IsAllocated()) return false;
CleanEnabledFeatures(); CleanEnabledFeatures();
for (i = 0; i < enabledFeatures.length; i += 1) for (i = 0; i < enabledFeatures.length; i += 1) {
{ if (newEnabledFeature.class == enabledFeatures[i].class) {
if (newEnabledFeature.class == enabledFeatures[i].class) if (newEnabledFeature == enabledFeatures[i]) {
{
if (newEnabledFeature == enabledFeatures[i])
{
_.logger _.logger
.Auto(warnFeatureAlreadyEnabled) .Auto(warnFeatureAlreadyEnabled)
.Arg(_.text.FromClass(newEnabledFeature.class)); .Arg(_.text.FromClass(newEnabledFeature.class));
} }
else else {
{
_.logger _.logger
.Auto(errFeatureClassAlreadyEnabled) .Auto(errFeatureClassAlreadyEnabled)
.Arg(_.text.FromClass(newEnabledFeature.class)); .Arg(_.text.FromClass(newEnabledFeature.class));
@ -465,26 +345,19 @@ public final function bool EnableFeature(
return true; return true;
} }
/** /// Disables given `Feature` instance `featureToDisable`.
* Disables given `Feature` instance `featureToDisable`. ///
* /// Returns `true` if given `newEnabledFeature` was disabled and `false` otherwise
* @see `Feature::EnableMe()`. /// (including if it already was disabled).
* public final function bool DisableFeature(Feature featureToDisable) {
* @param featureToDisable Instance to disable.
* @return `true` if given `newEnabledFeature` was disabled and `false`
* otherwise (including if it already was disabled).
*/
public final function bool DisableFeature(Feature featureToDisable)
{
local int i; local int i;
if (featureToDisable == none) return false; if (featureToDisable == none) return false;
if (!featureToDisable.IsAllocated()) return false; if (!featureToDisable.IsAllocated()) return false;
CleanEnabledFeatures(); CleanEnabledFeatures();
for (i = 0; i < enabledFeatures.length; i += 1) for (i = 0; i < enabledFeatures.length; i += 1) {
{ if (featureToDisable == enabledFeatures[i]) {
if (featureToDisable == enabledFeatures[i])
{
enabledFeatures.Remove(i, 1); enabledFeatures.Remove(i, 1);
enabledFeaturesLifeVersions.Remove(i, 1); enabledFeaturesLifeVersions.Remove(i, 1);
featureToDisable.DisableInternal(); featureToDisable.DisableInternal();
@ -496,13 +369,10 @@ public final function bool DisableFeature(Feature featureToDisable)
return false; return false;
} }
/** /// Disables all currently enabled `Feature`s.
* Disables all currently enabled `Feature`s. ///
* /// Mainly intended for the clean up when Acedia shuts down.
* Mainly intended for the clean up when Acedia shuts down. public final function DisableAllFeatures() {
*/
public final function DisableAllFeatures()
{
local int i; local int i;
local array<Feature> featuresCopy; local array<Feature> featuresCopy;
@ -510,8 +380,7 @@ public final function DisableAllFeatures()
featuresCopy = enabledFeatures; featuresCopy = enabledFeatures;
enabledFeatures.length = 0; enabledFeatures.length = 0;
enabledFeaturesLifeVersions.length = 0; enabledFeaturesLifeVersions.length = 0;
for (i = 0; i < enabledFeatures.length; i += 1) for (i = 0; i < enabledFeatures.length; i += 1) {
{
featuresCopy[i].DisableInternal(); featuresCopy[i].DisableInternal();
onFeatureDisabledSignal.Emit(featuresCopy[i].class); onFeatureDisabledSignal.Emit(featuresCopy[i].class);
} }

13
sources/BaseRealm/AcediaEnvironment/Events/Environment_FeatureDisabled_Signal.uc

@ -1,5 +1,7 @@
/** /**
* Signal class for `AcediaEnvironment`'s `FeatureDisabled()` signal. * Author: dkanus
* Home repo: https://www.insultplayers.ru/git/AcediaFramework/AcediaCore
* License: GPL
* Copyright 2022 Anton Tarasenko * Copyright 2022 Anton Tarasenko
*------------------------------------------------------------------------------ *------------------------------------------------------------------------------
* This file is part of Acedia. * This file is part of Acedia.
@ -19,20 +21,17 @@
*/ */
class Environment_FeatureDisabled_Signal extends Signal; class Environment_FeatureDisabled_Signal extends Signal;
public final function Emit(class<Feature> disabledFeatureClass) public final function Emit(class<Feature> disabledFeatureClass) {
{
local Slot nextSlot; local Slot nextSlot;
StartIterating(); StartIterating();
nextSlot = GetNextSlot(); nextSlot = GetNextSlot();
while (nextSlot != none) while (nextSlot != none) {
{
Environment_FeatureDisabled_Slot(nextSlot).connect(disabledFeatureClass); Environment_FeatureDisabled_Slot(nextSlot).connect(disabledFeatureClass);
nextSlot = GetNextSlot(); nextSlot = GetNextSlot();
} }
CleanEmptySlots(); CleanEmptySlots();
} }
defaultproperties defaultproperties {
{
relatedSlotClass = class'Environment_FeatureDisabled_Slot' relatedSlotClass = class'Environment_FeatureDisabled_Slot'
} }

16
sources/BaseRealm/AcediaEnvironment/Events/Environment_FeatureDisabled_Slot.uc

@ -1,5 +1,7 @@
/** /**
* Slot class for `AcediaEnvironment`'s `FeatureDisabled()` signal. * Author: dkanus
* Home repo: https://www.insultplayers.ru/git/AcediaFramework/AcediaCore
* License: GPL
* Copyright 2022 Anton Tarasenko * Copyright 2022 Anton Tarasenko
*------------------------------------------------------------------------------ *------------------------------------------------------------------------------
* This file is part of Acedia. * This file is part of Acedia.
@ -19,22 +21,18 @@
*/ */
class Environment_FeatureDisabled_Slot extends Slot; class Environment_FeatureDisabled_Slot extends Slot;
delegate connect(class<Feature> disabledFeatureClass) delegate connect(class<Feature> disabledFeatureClass) {
{
DummyCall(); DummyCall();
} }
protected function Constructor() protected function Constructor() {
{
connect = none; connect = none;
} }
protected function Finalizer() protected function Finalizer() {
{
super.Finalizer(); super.Finalizer();
connect = none; connect = none;
} }
defaultproperties defaultproperties {
{
} }

14
sources/BaseRealm/AcediaEnvironment/Events/Environment_FeatureEnabled_Signal.uc

@ -1,5 +1,7 @@
/** /**
* Signal class for `AcediaEnvironment`'s `FeatureEnabled()` signal. * Author: dkanus
* Home repo: https://www.insultplayers.ru/git/AcediaFramework/AcediaCore
* License: GPL
* Copyright 2022 Anton Tarasenko * Copyright 2022 Anton Tarasenko
*------------------------------------------------------------------------------ *------------------------------------------------------------------------------
* This file is part of Acedia. * This file is part of Acedia.
@ -19,20 +21,18 @@
*/ */
class Environment_FeatureEnabled_Signal extends Signal; class Environment_FeatureEnabled_Signal extends Signal;
public final function Emit(Feature enabledFeature) public final function Emit(Feature enabledFeature) {
{
local Slot nextSlot; local Slot nextSlot;
StartIterating(); StartIterating();
nextSlot = GetNextSlot(); nextSlot = GetNextSlot();
while (nextSlot != none) while (nextSlot != none) {
{
Environment_FeatureEnabled_Slot(nextSlot).connect(enabledFeature); Environment_FeatureEnabled_Slot(nextSlot).connect(enabledFeature);
nextSlot = GetNextSlot(); nextSlot = GetNextSlot();
} }
CleanEmptySlots(); CleanEmptySlots();
} }
defaultproperties defaultproperties {
{
relatedSlotClass = class'Environment_FeatureEnabled_Slot' relatedSlotClass = class'Environment_FeatureEnabled_Slot'
} }

16
sources/BaseRealm/AcediaEnvironment/Events/Environment_FeatureEnabled_Slot.uc

@ -1,5 +1,7 @@
/** /**
* Slot class for `AcediaEnvironment`'s `FeatureEnabled()` signal. * Author: dkanus
* Home repo: https://www.insultplayers.ru/git/AcediaFramework/AcediaCore
* License: GPL
* Copyright 2022 Anton Tarasenko * Copyright 2022 Anton Tarasenko
*------------------------------------------------------------------------------ *------------------------------------------------------------------------------
* This file is part of Acedia. * This file is part of Acedia.
@ -19,22 +21,18 @@
*/ */
class Environment_FeatureEnabled_Slot extends Slot; class Environment_FeatureEnabled_Slot extends Slot;
delegate connect(Feature enabledFeature) delegate connect(Feature enabledFeature) {
{
DummyCall(); DummyCall();
} }
protected function Constructor() protected function Constructor() {
{
connect = none; connect = none;
} }
protected function Finalizer() protected function Finalizer() {
{
super.Finalizer(); super.Finalizer();
connect = none; connect = none;
} }
defaultproperties defaultproperties {
{
} }
Loading…
Cancel
Save