15#include <unordered_map>
34 explicit LuaEngine(
const std::string &scriptPath =
"server/Scripting/scripts/");
52 bool loadScript(
const std::string &scriptPath);
75 template <
typename... Args>
76 void callFunction(
const std::string &scriptPath,
const std::string &functionName, Args &&...args);
High-level ECS manager providing clean server-side API.
High-level entity wrapper providing fluent interface.
Manages Lua state and script execution for the server.
void executeOnGameStart(const std::string &scriptPath, ecs::wrapper::Entity entity)
Execute onGameStart function for an entity's script.
void registerGameStartCallback(sol::function callback)
Register a Lua callback to be called when the game starts.
void cleanupEntity(uint32_t entityId)
Clean up script cache for a destroyed entity.
void executeUpdate(const std::string &scriptPath, ecs::wrapper::Entity entity, float deltaTime)
Execute onUpdate function for an entity's script.
sol::state & getLuaState()
Get direct access to Lua state (advanced usage).
std::recursive_mutex _luaMutex
void setWorld(ecs::wrapper::ECSWorld *world)
Set the ECS world for entity operations.
std::unordered_map< uint32_t, std::unordered_map< std::string, sol::table > > _entityScriptCache
void callFunction(const std::string &scriptPath, const std::string &functionName, Args &&...args)
Call a specific Lua function.
bool loadScript(const std::string &scriptPath)
Load and cache a Lua script.
ecs::wrapper::ECSWorld * _world
std::unordered_map< std::string, sol::table > _scriptCache
std::vector< sol::function > _gameStartCallbacks
void initializeBindings()
void fireGameStartCallbacks(const std::string &roomId)
Fire all registered game start callbacks.
bool _bindingsInitialized