From bdaccd458675ee509a28de7d085a5fc5ba7984ab Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Mon, 6 Mar 2023 03:17:42 +0700 Subject: [PATCH] Add accessors to generic Core API to Acedia's objects and actors --- sources/Types/AcediaActor.uc | 23 ++++++++++++++++++++++- sources/Types/AcediaObject.uc | 23 ++++++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/sources/Types/AcediaActor.uc b/sources/Types/AcediaActor.uc index 06578e4..c7d2cb1 100644 --- a/sources/Types/AcediaActor.uc +++ b/sources/Types/AcediaActor.uc @@ -3,7 +3,7 @@ * `AcediaActor` provides access to Acedia's APIs through an accessor to * a `Global` object, built-in mechanism for storing unneeded references in * an object pool and constructor/finalizer. - * Copyright 2021 Anton Tarasenko + * Copyright 2021-2023 Anton Tarasenko *------------------------------------------------------------------------------ * This file is part of Acedia. * @@ -416,6 +416,27 @@ public simulated static final function Global __() return class'Global'.static.GetInstance(); } +/** + * Static method accessor to the generic core API namespace (either server or + * client one, depending on which is available), necessary for Acedia's + * implementation. + */ +public static final function CoreGlobal __core() +{ + 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; +} + /** * Static method accessor to server API namespace, necessary for Acedia's * implementation. diff --git a/sources/Types/AcediaObject.uc b/sources/Types/AcediaObject.uc index ab1473a..3e0a4df 100644 --- a/sources/Types/AcediaObject.uc +++ b/sources/Types/AcediaObject.uc @@ -3,7 +3,7 @@ * `AcediaObject` provides access to Acedia's APIs through an accessor to * a `Global` object, built-in mechanism for storing unneeded references in * an object pool and constructor/finalizer. - * Copyright 2021 Anton Tarasenko + * Copyright 2021-2023 Anton Tarasenko *------------------------------------------------------------------------------ * This file is part of Acedia. * @@ -489,6 +489,27 @@ public static final function Global __() return class'Global'.static.GetInstance(); } +/** + * Static method accessor to the generic core API namespace (either server or + * client one, depending on which is available), necessary for Acedia's + * implementation. + */ +public static final function CoreGlobal __core() +{ + 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; +} + /** * Static method accessor to server API namespace, necessary for Acedia's * implementation.