15 : _luaEngine(luaEngine), _world(world) {
17 LOG_ERROR(
"LuaSystemAdapter: LuaEngine is null");
20 LOG_ERROR(
"LuaSystemAdapter: ECSWorld is null");
26 LOG_ERROR(
"LuaSystemAdapter not properly initialized");
32 static int logCounter = 0;
33 if (++logCounter % 60 == 0) {
38 for (
const auto &entityAddr : entities) {
55 if (scriptPath.empty()) {
63 LOG_WARNING(
"Invalid entity " + std::to_string(entityAddr) +
64 " for script: " + scriptPath);
73 }
catch (
const std::exception &e) {
74 LOG_ERROR(
"Error executing Lua script for entity " + std::to_string(entityAddr) +
": " +
75 std::string(e.what()));
81 return (1ULL << ecs::getComponentType<ecs::LuaScript>());
Component that holds the path to a Lua script for entity behavior.
const std::string & getScriptPath() const
Get the path to the Lua script.
Manages entities, their signatures and component type registrations.
std::vector< Address > getEntitiesWithMask(Signature requiredMask)
Get all entities matching a specific component mask.
T & getComponent(Address address)
Get a component from an entity.
bool hasComponent(Address address)
Check if an entity has a specific component.
High-level ECS manager providing clean server-side API.
Entity getEntity(Address address)
Get an entity wrapper from an address.
High-level entity wrapper providing fluent interface.
bool isValid() const
Check if this entity is valid.
Manages Lua state and script execution for the server.
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.
ecs::ComponentMask getComponentMask() const override
Get component mask for this system.
ecs::wrapper::ECSWorld * _world
LuaSystemAdapter(LuaEngine *luaEngine, ecs::wrapper::ECSWorld *world)
Constructor with LuaEngine and ECSWorld.
void update(ecs::Registry ®istry, float deltaTime) override
Updates all Lua scripts for entities.
std::uint64_t ComponentMask
Type alias for component bitmask.