roblox_emulator: Tween Create & Play stub

This commit is contained in:
Quaternions 2025-04-23 13:56:41 -07:00
parent b507624d91
commit 08f9163605
Signed by: Quaternions
GPG Key ID: D0DF5964F79AC131
3 changed files with 42 additions and 1 deletions
lib/roblox_emulator/src/runner

@ -471,7 +471,13 @@ static CLASS_FUNCTION_DATABASE:CFD=phf::phf_map!{
"Play"=>NO_OP,
},
"TweenService"=>phf::phf_map!{
"Create"=>NO_OP,
"Create"=>cf!(|_lua,_,(instance,tween_info,goal):(Instance,crate::runner::tween_info::TweenInfo,mlua::Table)|->mlua::Result<_>{
Ok(crate::runner::tween::Tween::create(
instance,
tween_info,
goal,
))
}),
},
};

@ -5,6 +5,7 @@ mod runner;
mod r#enum;
mod task;
mod udim;
mod tween;
mod udim2;
mod color3;
mod cframe;

@ -0,0 +1,34 @@
use super::instance::Instance;
use super::tween_info::TweenInfo;
#[derive(Clone)]
pub struct Tween{
instance:Instance,
tween_info:TweenInfo,
goal:mlua::Table,
playback_state:rbx_types::Enum,
}
impl Tween{
pub fn create(
instance:Instance,
tween_info:TweenInfo,
goal:mlua::Table,
)->Self{
Self{
instance,
tween_info,
goal,
// Enum.PlaybackState.Begin
playback_state:rbx_types::Enum::from_u32(0),
}
}
pub fn play(&mut self){
}
}
impl mlua::UserData for Tween{
fn add_methods<M:mlua::UserDataMethods<Self>>(methods:&mut M){
methods.add_method_mut("Play",|_,this,()|Ok(this.play()))
}
}
type_from_lua_userdata_clone!(Tween);