7#include "platform/library/dynamic_library.h"
25 ScriptModule() =
default;
28 ScriptModule(
const ScriptModule& other) =
delete;
29 ScriptModule& operator=(
const ScriptModule& other) =
delete;
31 ScriptModule(ScriptModule && other) =
delete;
32 ScriptModule& operator=(ScriptModule && other) =
delete;
101 bool isLoaded()
const {
return m_lib->isLoaded(); }
109 const std::filesystem::path&
modulePath()
const {
return m_modulePath; }
115 struct OpenedModule {
116 std::unique_ptr<DynamicLibrary> lib;
117 std::filesystem::path copy;
129 OpenedModule openBuilt();
138 void adopt(OpenedModule opened);
148 void releaseRegistrations(EventBus* events);
151 std::unique_ptr<DynamicLibrary> m_lib = std::make_unique<DynamicLibrary>();
152 NetSession* m_net =
nullptr;
153 std::filesystem::path m_modulePath;
154 std::filesystem::path m_loadedCopyPath;
155 int m_reloadCounter = 0;
Drives the lifecycle of every entity's ScriptComponent behaviors.
Definition behavior_system.h:27
Typed pub/sub event dispatcher.
Definition event_bus.h:22
One end of a game, whether it is the authority or a guest.
Definition net_session.h:116
Open type-erased resource registry with typed handles and generational lifetimes.
Definition resource_manager.h:46
Central registry managing entities and an open set of component types.
Definition scene.h:29
void unload(EventBus &events)
Drop the loaded module and the behavior types it registered.
void expect(const std::filesystem::path &modulePath, EventBus &events)
Unload whatever is loaded and remember modulePath for a project not yet built.
bool buildScene(Scene &scene, ResourceManager &resources)
Let the module seed scene through the optional vkmBuildScene, if it has one.
const std::filesystem::path & modulePath() const
The built module this loaded from, not the mapped copy: the file to watch for a build.
Definition script_module.h:109
bool setupNetwork(NetSession &session)
Let the module say what a player is, through the optional vkmSetupNetwork.
bool reload(Scene &scene, BehaviorSystem &behaviors, EventBus &events)
Hot-reload from the same path: serialize, swap module, recreate.
bool load(const std::filesystem::path &modulePath, EventBus *events)
Load the gameplay module and register its behaviors.