R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
scripting::LuaSystemAdapter Class Reference

ECS system that executes Lua scripts for entities. More...

#include <LuaSystemAdapter.hpp>

Inheritance diagram for scripting::LuaSystemAdapter:
Inheritance graph
Collaboration diagram for scripting::LuaSystemAdapter:
Collaboration graph

Public Member Functions

 LuaSystemAdapter (LuaEngine *luaEngine, ecs::wrapper::ECSWorld *world)
 Constructor with LuaEngine and ECSWorld.
 
void update (ecs::Registry &registry, float deltaTime) override
 Updates all Lua scripts for entities.
 
ecs::ComponentMask getComponentMask () const override
 Get component mask for this system.
 
- Public Member Functions inherited from ecs::ISystem
virtual ~ISystem ()=default
 Virtual destructor.
 

Private Attributes

LuaEngine_luaEngine
 
ecs::wrapper::ECSWorld_world
 

Detailed Description

ECS system that executes Lua scripts for entities.

Integrates the Lua scripting engine with the ECS system, executing scripts attached to entities via LuaScript components. Requires LuaScript component.

Definition at line 24 of file LuaSystemAdapter.hpp.

Constructor & Destructor Documentation

◆ LuaSystemAdapter()

scripting::LuaSystemAdapter::LuaSystemAdapter ( LuaEngine luaEngine,
ecs::wrapper::ECSWorld world 
)

Constructor with LuaEngine and ECSWorld.

Parameters
luaEnginePointer to the Lua engine
worldPointer to the ECS world wrapper

Definition at line 14 of file LuaSystemAdapter.cpp.

References LOG_ERROR.

Member Function Documentation

◆ getComponentMask()

ecs::ComponentMask scripting::LuaSystemAdapter::getComponentMask ( ) const
overridevirtual

Get component mask for this system.

Returns
ComponentMask requiring LuaScript component

Implements ecs::ISystem.

Definition at line 80 of file LuaSystemAdapter.cpp.

Referenced by update().

◆ update()

void scripting::LuaSystemAdapter::update ( ecs::Registry registry,
float  deltaTime 
)
overridevirtual

Updates all Lua scripts for entities.

Overrides the base ISystem to properly integrate with LuaEngine.

Parameters
registryReference to the ECS registry
deltaTimeTime elapsed since last frame

Implements ecs::ISystem.

Definition at line 24 of file LuaSystemAdapter.cpp.

References _luaEngine, _world, scripting::LuaEngine::cleanupEntity(), scripting::LuaEngine::executeUpdate(), ecs::Registry::getComponent(), getComponentMask(), ecs::Registry::getEntitiesWithMask(), ecs::wrapper::ECSWorld::getEntity(), ecs::LuaScript::getScriptPath(), ecs::Registry::hasComponent(), ecs::wrapper::Entity::isValid(), LOG_ERROR, and LOG_WARNING.

Here is the call graph for this function:

Member Data Documentation

◆ _luaEngine

LuaEngine* scripting::LuaSystemAdapter::_luaEngine
private

Definition at line 52 of file LuaSystemAdapter.hpp.

Referenced by update().

◆ _world

ecs::wrapper::ECSWorld* scripting::LuaSystemAdapter::_world
private

Definition at line 53 of file LuaSystemAdapter.hpp.

Referenced by update().


The documentation for this class was generated from the following files: