From 14fa450e3e9001102fc078a6efeaf5e0098f9007 Mon Sep 17 00:00:00 2001
From: Quaternions <krakow20@gmail.com>
Date: Tue, 22 Apr 2025 21:04:29 -0700
Subject: [PATCH] roblox_emulator: implement Players service stub

---
 lib/roblox_emulator/src/runner/instance/instance.rs | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib/roblox_emulator/src/runner/instance/instance.rs b/lib/roblox_emulator/src/runner/instance/instance.rs
index b93c788..bc831b9 100644
--- a/lib/roblox_emulator/src/runner/instance/instance.rs
+++ b/lib/roblox_emulator/src/runner/instance/instance.rs
@@ -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{