Skip to main content

Crate gizmo_scripting

Crate gizmo_scripting 

Source
Expand description

Gizmo Scripting — a Lua-based game-logic scripting layer for the Gizmo engine.

Scripts run inside a sandboxed mlua Lua 5.4 VM. Because Lua callbacks cannot borrow and mutate the ECS World directly, they enqueue changes as ScriptCommands into a CommandQueue; the ScriptEngine later drains and applies those commands at a controlled point in the frame.

§Usage

ⓘ
let mut script_engine = ScriptEngine::new().unwrap();
script_engine.load_script("scripts/player.lua").unwrap();

// Each frame:
script_engine.update(&world, &input, dt).unwrap();
script_engine.flush_commands(&mut world);

§Lua API surface

  • entity — read/write position, rotation, scale, velocity; spawn/destroy
  • input — query key and mouse state
  • physics — apply forces and impulses
  • scene — save/load scenes, look up entities
  • audio — play 2D/3D sounds
  • time — delta time, elapsed time, FPS

Re-exports§

pub use commands::CommandQueue;
pub use commands::ScriptCommand;
pub use engine::Script;
pub use engine::ScriptContext;
pub use engine::ScriptEngine;
pub use engine::ScriptResult;

Modules§

api_ai
AI API — Lua’ya sunulan Yapay Zeka navigasyon fonksiyonları
api_audio
Audio API — Lua’ya sunulan ses yönetim fonksiyonları
api_entity
Entity API — Lua’ya sunulan entity yönetim fonksiyonları
api_fighter
Fighter API — Lua’ya sunulan dövüş sistemi fonksiyonları
api_input
Input API — Lua’ya sunulan girdi sorgulama fonksiyonları
api_physics
Physics API — Lua’ya sunulan fizik sistemi fonksiyonları
api_scene
Scene API — Lua’ya sunulan sahne ve oyun yönetim fonksiyonları
api_time
Time API — Lua’ya sunulan zaman fonksiyonları
api_vehicle
Vehicle API — Lua’ya sunulan araç kontrol fonksiyonları
commands
Script Command Queue — Lua scriptlerden gelen değişiklik isteklerinin biriktirildiği kuyruk
engine

Functions§

register_script_components
Registers the scripting layer’s serializable scene components (currently Script) into a scene ComponentRegistry.