From a84456c2391e9fa7c5ade8244bf979118a3d0e29 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Thu, 29 May 2008 13:55:02 +0000 Subject: Mantis#1411. Thank you kindly for Dataserver.cs and a patch that adds function stub to request region info by name and adds llRequestSimulatorData() and the dataserver event --- .../ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 48 +++++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs') diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 4e25ff8..9a2d240 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -5618,10 +5618,54 @@ namespace OpenSim.Region.ScriptEngine.Common wComm.DeliverMessage(ChatTypeEnum.Owner, 0, m_host.Name, m_host.UUID, msg); } - public void llRequestSimulatorData(string simulator, int data) + public string llRequestSimulatorData(string simulator, int data) { m_host.AddScriptLPS(1); - NotImplemented("llRequestSimulatorData"); + + string reply = String.Empty; + + RegionInfo info = m_ScriptEngine.World.RequestClosestRegion(simulator); + + switch(data) + { + case 5: // DATA_SIM_POS + if(info == null) + return LLUUID.Zero.ToString(); + reply = new LSL_Types.Vector3( + info.RegionLocX * Constants.RegionSize, + info.RegionLocY * Constants.RegionSize, + 0).ToString(); + break; + case 6: // DATA_SIM_STATUS + if(info != null) + reply = "up"; // Duh! + else + reply = "unknown"; + break; + case 7: // DATA_SIM_RATING + if(info == null) + return LLUUID.Zero.ToString(); + int access = (int)info.EstateSettings.simAccess; + if(access == 21) + reply = "MATURE"; + else if(access == 13) + reply = "MATURE"; + else + reply = "UNKNOWN"; + break; + default: + return LLUUID.Zero.ToString(); // Raise no event + } + LLUUID rq = LLUUID.Random(); + + LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. + m_Dataserver.RegisterRequest(m_localID, + m_itemID, rq.ToString()); + + m_ScriptEngine.m_ASYNCLSLCommandManager. + m_Dataserver.DataserverReply(rq.ToString(), reply); + + return tid.ToString(); } public void llForceMouselook(int mouselook) -- cgit v1.1