Skip to content

Class Engine::ScriptSystem

ClassList > Engine > ScriptSystem

Updates all entities with a ScriptComponent by calling their Lua onUpdate(dt) function.More...

  • #include <ScriptSystem.hpp>

Inherits the following classes: Engine::System

Public Attributes inherited from Engine::System

See Engine::System

Type Name
std::set< Entity > m_Entities

Public Functions

Type Name
sol::state_view GetLua ()
Shared Lua state used by gameplay scripts and later binders.
bool IsApiReady () const
True once the engine API and LuaBinder modules have been registered.
virtual void OnSceneUnloaded (Registry & registry) override
Calls onDestroy on every loaded script before the scene's entities go away.
virtual void Render (Registry & registry) override
World pass: drawn inside the active camera.
ScriptSystem ()
virtual void Update (Registry & registry, float dt) override
void loadScript (Registry & registry, Entity entity)
void unloadScript (Registry & registry, Entity entity)
~ScriptSystem ()

Public Functions inherited from Engine::System

See Engine::System

Type Name
virtual void OnSceneUnloaded (Registry & registry)
Called right before the current scene's entities are destroyed.
virtual void Render (Registry & registry)
World pass: drawn inside the active camera.
virtual void RenderScreen (Registry & registry)
Screen pass: drawn after the world, in window pixels.
virtual void Update (Registry & registry, float dt)
virtual ~System () = default

Detailed Description

Also handles script loading (onCreate) and unloading (onDestroy).

Public Functions Documentation

function GetLua

Shared Lua state used by gameplay scripts and later binders.

sol::state_view Engine::ScriptSystem::GetLua () 

Returns:

A view of the state. Valid after the first Update outside the editor.


function IsApiReady

True once the engine API and LuaBinder modules have been registered.

bool Engine::ScriptSystem::IsApiReady () const


function OnSceneUnloaded

Calls onDestroy on every loaded script before the scene's entities go away.

virtual void Engine::ScriptSystem::OnSceneUnloaded (
    Registry & registry
) override

The Lua state itself is kept: globals set by scripts survive a scene switch, while each script's own table is dropped with its entity.

Implements Engine::System::OnSceneUnloaded


function Render

World pass: drawn inside the active camera.

inline virtual void Engine::ScriptSystem::Render (
    Registry & registry
) override

Implements Engine::System::Render


function ScriptSystem

Engine::ScriptSystem::ScriptSystem () 

function Update

virtual void Engine::ScriptSystem::Update (
    Registry & registry,
    float dt
) override

Implements Engine::System::Update


function loadScript

void Engine::ScriptSystem::loadScript (
    Registry & registry,
    Entity entity
) 

function unloadScript

void Engine::ScriptSystem::unloadScript (
    Registry & registry,
    Entity entity
) 

function ~ScriptSystem

Engine::ScriptSystem::~ScriptSystem () 


The documentation for this class was generated from the following file /home/runner/work/r-type/r-type/Engine/include/Scripting/ScriptSystem.hpp