Much more stable and simplified subsystem architecture
This commit is contained in:
@@ -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 {};
|
||||
|
||||
37
Nuake/src/Scripting/NetModules/EngineSubsystemNetAPI.cpp
Normal file
37
Nuake/src/Scripting/NetModules/EngineSubsystemNetAPI.cpp
Normal 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);
|
||||
}
|
||||
}
|
||||
14
Nuake/src/Scripting/NetModules/EngineSubsystemNetAPI.h
Normal file
14
Nuake/src/Scripting/NetModules/EngineSubsystemNetAPI.h
Normal 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;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user