diff --git a/sources/ClientRealm/ClientGlobal.uc b/sources/ClientRealm/ClientGlobal.uc index bdc9314..9ab6fc8 100644 --- a/sources/ClientRealm/ClientGlobal.uc +++ b/sources/ClientRealm/ClientGlobal.uc @@ -29,6 +29,11 @@ var public ClientUnrealAPI unreal; var private LoggerAPI.Definition fatBadAdapterClass, errNoInteraction; +public function UnrealAPI unreal_api() +{ + return unreal; +} + public final static function ClientGlobal GetInstance() { if (default.myself == none) diff --git a/sources/CoreRealm/CoreGlobal.uc b/sources/CoreRealm/CoreGlobal.uc index 0ed413b..807917a 100644 --- a/sources/CoreRealm/CoreGlobal.uc +++ b/sources/CoreRealm/CoreGlobal.uc @@ -2,7 +2,7 @@ * Base class for objects that will provide an access to a Acedia's client- and * server-specific functionality by giving a reference to this object to all * Acedia's objects and actors, emulating a global API namespace. - * Copyright 2022 Anton Tarasenko + * Copyright 2022-2023 Anton Tarasenko *------------------------------------------------------------------------------ * This file is part of Acedia. * @@ -29,6 +29,30 @@ var public TimeAPI time; var private LoggerAPI.Definition fatNoAdapterClass; +/** + * Accessor to the generic `UnrealAPI`. + */ +public function UnrealAPI unreal_api() +{ + return none; +} + +public final static function CoreGlobal GetGenericInstance() +{ + local ServerGlobal serverAPI; + local ClientGlobal clientAPI; + + serverAPI = class'ServerGlobal'.static.GetInstance(); + if (serverAPI != none && serverAPI.IsAvailable()) { + return serverAPI; + } + clientAPI = class'ClientGlobal'.static.GetInstance(); + if (clientAPI != none && clientAPI.IsAvailable()) { + return clientAPI; + } + return none; +} + /** * This method must perform initialization of the caller `...Global` instance. * diff --git a/sources/ServerRealm/ServerGlobal.uc b/sources/ServerRealm/ServerGlobal.uc index 85c436e..67fefcd 100644 --- a/sources/ServerRealm/ServerGlobal.uc +++ b/sources/ServerRealm/ServerGlobal.uc @@ -2,7 +2,7 @@ * Class for an object that will provide an access to a Acedia's * server-specific functionality by giving a reference to this object to all * Acedia's objects and actors, emulating a global API namespace. - * Copyright 2022 Anton Tarasenko + * Copyright 2022-2023 Anton Tarasenko *------------------------------------------------------------------------------ * This file is part of Acedia. * @@ -30,6 +30,11 @@ var public ServerUnrealAPI unreal; var private LoggerAPI.Definition fatBadAdapterClass; +public function UnrealAPI unreal_api() +{ + return unreal; +} + public final static function ServerGlobal GetInstance() { if (default.myself == none)