Much more stable and simplified subsystem architecture

This commit is contained in:
WiggleWizard
2024-09-18 21:20:14 +01:00
parent 510b577f49
commit 066b2998ac
15 changed files with 183 additions and 66 deletions

View File

@@ -9,7 +9,7 @@
#include <Coral/ManagedObject.hpp>
#include <Coral/Array.hpp>
#include "Coral/Type.hpp"
#include "src/Subsystems/EngineSubsystemScript.h"
#include "..\..\Subsystems\EngineSubsystemScriptable.h"
namespace Nuake {
@@ -119,7 +119,7 @@ namespace Nuake {
Coral::ManagedObject GetEngineSubsystemByName(Coral::String subsystemName)
{
const Ref<EngineSubsystemScript> scriptedSubsystem = Engine::GetScriptedSubsystem(subsystemName);
const Ref<EngineSubsystemScriptable> scriptedSubsystem = Engine::GetScriptedSubsystem(subsystemName);
if (scriptedSubsystem == nullptr)
{
return {};

View File

@@ -0,0 +1,37 @@
#include "EngineSubsystemNetAPI.h"
#include "Engine.h"
#include "src/Subsystems/EngineSubsystemScriptable.h"
namespace Nuake
{
void SetCanTick(int subsystemId, bool tick)
{
auto subsystem = Engine::GetScriptedSubsystem(subsystemId);
if (subsystem == nullptr)
{
Logger::Log("Subsystem isn't a valid scripted subsystem", "EngineSubsystemNetAPI", WARNING);
return;
}
subsystem->SetCanTick(tick);
}
bool GetCanTick(int subsystemId)
{
auto subsystem = Engine::GetScriptedSubsystem(subsystemId);
if (subsystem == nullptr)
{
Logger::Log("Subsystem isn't a valid scripted subsystem", "EngineSubsystemNetAPI", WARNING);
return false;
}
return subsystem->CanEverTick();
}
void EngineSubsystemNetAPI::RegisterMethods()
{
RegisterMethod("EngineSubsystem.SetCanTickIcall", &SetCanTick);
RegisterMethod("EngineSubsystem.GetCanTickIcall", &GetCanTick);
}
}

View File

@@ -0,0 +1,14 @@
#pragma once
#include "NetAPIModule.h"
namespace Nuake
{
class EngineSubsystemNetAPI : public Nuake::NetAPIModule
{
public:
virtual const std::string GetModuleName() const override { return "EngineSubsystem"; }
virtual void RegisterMethods() override;
};
}