roblox_emulator: implement Players service stub
This commit is contained in:
parent
448f40a5d8
commit
14fa450e3e
@ -396,7 +396,7 @@ const GET_SERVICE:ClassFunctionPointer=cf!(|lua,_this,service:mlua::String|{
|
||||
//dom.root_ref()==this.referent ?
|
||||
let service=&*service.to_str()?;
|
||||
match service{
|
||||
"Lighting"|"RunService"=>{
|
||||
"Lighting"|"RunService"|"Players"=>{
|
||||
let referent=find_first_child_of_class(dom,dom.root(),service)
|
||||
.map(|instance|instance.referent())
|
||||
.unwrap_or_else(||
|
||||
@ -408,6 +408,9 @@ const GET_SERVICE:ClassFunctionPointer=cf!(|lua,_this,service:mlua::String|{
|
||||
}
|
||||
})
|
||||
});
|
||||
const GET_PLAYERS:ClassFunctionPointer=cf!(|_lua,_this,()|{
|
||||
Ok::<_,mlua::Error>(Vec::<Instance>::new())
|
||||
});
|
||||
static CLASS_FUNCTION_DATABASE:CFD=phf::phf_map!{
|
||||
"DataModel"=>phf::phf_map!{
|
||||
"service"=>GET_SERVICE,
|
||||
@ -417,6 +420,10 @@ static CLASS_FUNCTION_DATABASE:CFD=phf::phf_map!{
|
||||
"FillBlock"=>cf!(|_lua,_,_:(crate::runner::cframe::CFrame,Vector3,crate::runner::r#enum::Enum)|mlua::Result::Ok(())),
|
||||
"SetMaterialColor"=>cf!(|_lua,_,_:(crate::runner::r#enum::Enum,crate::runner::color3::Color3)|mlua::Result::Ok(())),
|
||||
},
|
||||
"Players"=>phf::phf_map!{
|
||||
"players"=>GET_PLAYERS,
|
||||
"GetPlayers"=>GET_PLAYERS,
|
||||
}
|
||||
};
|
||||
|
||||
/// A store of created functions for each Roblox class.
|
||||
@ -532,6 +539,9 @@ static LAZY_USER_DATA:LUD=phf::phf_map!{
|
||||
"Heartbeat"=>|lua|lua.create_any_userdata(crate::runner::script_signal::ScriptSignal::new()),
|
||||
"RenderStepped"=>|lua|lua.create_any_userdata(crate::runner::script_signal::ScriptSignal::new()),
|
||||
},
|
||||
"Players"=>phf::phf_map!{
|
||||
"PlayerAdded"=>|lua|lua.create_any_userdata(crate::runner::script_signal::ScriptSignal::new()),
|
||||
},
|
||||
};
|
||||
#[derive(Default)]
|
||||
pub struct InstanceValueStore{
|
||||
|
Loading…
x
Reference in New Issue
Block a user