Browse Source

Start adding client support to AcediaCore

pull/8/head
Anton Tarasenko 2 years ago
parent
commit
1b58bcd3b3
  1. 31
      sources/ClientLevelCore.uc
  2. 9
      sources/Memory/MemoryAPI.uc

31
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 <https://www.gnu.org/licenses/>.
*/
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
{
}

9
sources/Memory/MemoryAPI.uc

@ -76,6 +76,7 @@ public final function Object Allocate(
class<Object> classToAllocate, class<Object> classToAllocate,
optional bool forceNewInstance) optional bool forceNewInstance)
{ {
local LevelCore core;
local Object allocatedObject; local Object allocatedObject;
local AcediaObjectPool relevantPool; local AcediaObjectPool relevantPool;
local class<AcediaObject> acediaObjectClassToAllocate; local class<AcediaObject> acediaObjectClassToAllocate;
@ -104,9 +105,11 @@ public final function Object Allocate(
actorClassToAllocate = class<Actor>(classToAllocate); actorClassToAllocate = class<Actor>(classToAllocate);
if (actorClassToAllocate != none) if (actorClassToAllocate != none)
{ {
allocatedObject = class'ServerLevelCore'.static core = class'ServerLevelCore'.static.GetInstance();
.GetInstance() if (core == none) {
.Spawn(actorClassToAllocate); core = class'ClientLevelCore'.static.GetInstance();
}
allocatedObject = core.Spawn(actorClassToAllocate);
} }
else { else {
allocatedObject = (new classToAllocate); allocatedObject = (new classToAllocate);

Loading…
Cancel
Save