pub struct ScriptEngine {
pub log_queue: Arc<Mutex<Vec<(String, String)>>>,
/* private fields */
}Expand description
Lua Scripting Motoru — Genişletilmiş API ile oyun mantığını yönetir
Fields§
§log_queue: Arc<Mutex<Vec<(String, String)>>>Implementations§
Source§impl ScriptEngine
impl ScriptEngine
pub fn new() -> Result<Self, LuaError>
pub fn load_script(&mut self, path: &str) -> Result<(), String>
Sourcepub fn update(
&mut self,
world: &World,
input: &Input,
dt: f32,
) -> Result<(), String>
pub fn update( &mut self, world: &World, input: &Input, dt: f32, ) -> Result<(), String>
Her frame çağrılan güncelleme — World verilerini Lua’ya aktarır, scriptleri çalıştırır
Sourcepub fn update_entity(
&mut self,
entity_id: u32,
script_path: &str,
dt: f32,
) -> Result<(), String>
pub fn update_entity( &mut self, entity_id: u32, script_path: &str, dt: f32, ) -> Result<(), String>
Per-entity script güncelleme — Script component’i olan entity’ler için izole ortamda çalıştırır
Sourcepub fn flush_commands(&self, world: &mut World, dt: f32) -> Vec<ScriptCommand>
pub fn flush_commands(&self, world: &mut World, dt: f32) -> Vec<ScriptCommand>
Komut kuyruğundaki tüm komutları World’e uygular ve oyun mantığı için kalan komutları döndürür
Sourcepub fn get_pending_audio_scene_commands(&self) -> Vec<ScriptCommand>
pub fn get_pending_audio_scene_commands(&self) -> Vec<ScriptCommand>
Runtime’da bekleyen ses/sahne komutlarını döndürür (demo tarafında ele alınır)
Sourcepub fn reload_if_changed(&mut self, path: &str) -> Result<bool, String>
pub fn reload_if_changed(&mut self, path: &str) -> Result<bool, String>
Script’in hot-reload edilip edilmeyeceğini kontrol eder
Sourcepub fn has_function(&self, path: &str, name: &str) -> bool
pub fn has_function(&self, path: &str, name: &str) -> bool
Belirli bir isimdeki Lua fonksiyonunun var olup olmadığını kontrol eder
Sourcepub fn run_entity_update(
&self,
path: &str,
func_name: &str,
ctx: &ScriptContext,
) -> Result<ScriptResult, String>
pub fn run_entity_update( &self, path: &str, func_name: &str, ctx: &ScriptContext, ) -> Result<ScriptResult, String>
Belirli bir isimdeki Lua fonksiyonunu çağırır (per-entity scriptler için)
Sourcepub fn command_queue(&self) -> &Arc<CommandQueue>
pub fn command_queue(&self) -> &Arc<CommandQueue>
Komut kuyruğuna doğrudan erişim (internals)
Trait Implementations§
impl Send for ScriptEngine
impl Sync for ScriptEngine
Auto Trait Implementations§
impl Freeze for ScriptEngine
impl !RefUnwindSafe for ScriptEngine
impl Unpin for ScriptEngine
impl UnsafeUnpin for ScriptEngine
impl !UnwindSafe for ScriptEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more