From 1b58bcd3b3e1d57800c78f195f208c556d0f3f8b Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Mon, 11 Jul 2022 03:17:16 +0700 Subject: [PATCH] Start adding client support to AcediaCore --- sources/ClientLevelCore.uc | 31 +++++++++++++++++++++++++++++++ sources/Memory/MemoryAPI.uc | 9 ++++++--- 2 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 sources/ClientLevelCore.uc diff --git a/sources/ClientLevelCore.uc b/sources/ClientLevelCore.uc new file mode 100644 index 0000000..79d1fc4 --- /dev/null +++ b/sources/ClientLevelCore.uc @@ -0,0 +1,31 @@ +/** + * Copyright 2022 Anton Tarasenko + *------------------------------------------------------------------------------ + * This file is part of Acedia. + * + * Acedia is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3 of the License, or + * (at your option) any later version. + * + * Acedia is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Acedia. If not, see . + */ +class ClientLevelCore extends LevelCore; + +public static function LevelCore CreateLevelCore(Actor source) +{ + if (source == none) return none; + if (source.level.netMode == NM_DedicatedServer) return none; + + return super.CreateLevelCore(source); +} + +defaultproperties +{ +} \ No newline at end of file diff --git a/sources/Memory/MemoryAPI.uc b/sources/Memory/MemoryAPI.uc index dceda8a..96c04df 100644 --- a/sources/Memory/MemoryAPI.uc +++ b/sources/Memory/MemoryAPI.uc @@ -76,6 +76,7 @@ public final function Object Allocate( class classToAllocate, optional bool forceNewInstance) { + local LevelCore core; local Object allocatedObject; local AcediaObjectPool relevantPool; local class acediaObjectClassToAllocate; @@ -104,9 +105,11 @@ public final function Object Allocate( actorClassToAllocate = class(classToAllocate); if (actorClassToAllocate != none) { - allocatedObject = class'ServerLevelCore'.static - .GetInstance() - .Spawn(actorClassToAllocate); + core = class'ServerLevelCore'.static.GetInstance(); + if (core == none) { + core = class'ClientLevelCore'.static.GetInstance(); + } + allocatedObject = core.Spawn(actorClassToAllocate); } else { allocatedObject = (new classToAllocate);