aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs65
-rw-r--r--OpenSim/Region/Communications/Local/LocalBackEndServices.cs15
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs101
-rw-r--r--OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs120
-rw-r--r--OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs12
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs18
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs16
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs11
8 files changed, 356 insertions, 2 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 69c1dac..b616acb 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -229,6 +229,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
229 // private RequestAsset handlerRequestAsset = null; // OnRequestAsset; 229 // private RequestAsset handlerRequestAsset = null; // OnRequestAsset;
230 private UUIDNameRequest handlerTeleportHomeRequest = null; 230 private UUIDNameRequest handlerTeleportHomeRequest = null;
231 231
232 private RegionHandleRequest handlerRegionHandleRequest = null; // OnRegionHandleRequest
233 private ParcelInfoRequest handlerParcelInfoRequest = null; // OnParcelInfoRequest
234
232 private ScriptAnswer handlerScriptAnswer = null; 235 private ScriptAnswer handlerScriptAnswer = null;
233 private RequestPayPrice handlerRequestPayPrice = null; 236 private RequestPayPrice handlerRequestPayPrice = null;
234 private ObjectDeselect handlerObjectDetach = null; 237 private ObjectDeselect handlerObjectDetach = null;
@@ -916,6 +919,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
916 public event EstateBlueBoxMessageRequest OnEstateBlueBoxMessageRequest; 919 public event EstateBlueBoxMessageRequest OnEstateBlueBoxMessageRequest;
917 public event EstateDebugRegionRequest OnEstateDebugRegionRequest; 920 public event EstateDebugRegionRequest OnEstateDebugRegionRequest;
918 public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest; 921 public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
922 public event RegionHandleRequest OnRegionHandleRequest;
923 public event ParcelInfoRequest OnParcelInfoRequest;
919 public event ScriptReset OnScriptReset; 924 public event ScriptReset OnScriptReset;
920 public event GetScriptRunning OnGetScriptRunning; 925 public event GetScriptRunning OnGetScriptRunning;
921 public event SetScriptRunning OnSetScriptRunning; 926 public event SetScriptRunning OnSetScriptRunning;
@@ -5296,6 +5301,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5296 5301
5297 #region Parcel related packets 5302 #region Parcel related packets
5298 5303
5304 case PacketType.RegionHandleRequest:
5305 RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack;
5306
5307 handlerRegionHandleRequest = OnRegionHandleRequest;
5308 if (handlerRegionHandleRequest != null)
5309 {
5310 handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID);
5311 }
5312 break;
5313
5314 case PacketType.ParcelInfoRequest:
5315 ParcelInfoRequestPacket pirPack = (ParcelInfoRequestPacket)Pack;
5316
5317 handlerParcelInfoRequest = OnParcelInfoRequest;
5318 if (handlerParcelInfoRequest != null)
5319 {
5320 handlerParcelInfoRequest(this, pirPack.Data.ParcelID);
5321 }
5322 break;
5323
5299 case PacketType.ParcelAccessListRequest: 5324 case PacketType.ParcelAccessListRequest:
5300 ParcelAccessListRequestPacket requestPacket = (ParcelAccessListRequestPacket)Pack; 5325 ParcelAccessListRequestPacket requestPacket = (ParcelAccessListRequestPacket)Pack;
5301 5326
@@ -6294,5 +6319,45 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6294 } 6319 }
6295 6320
6296 #endregion 6321 #endregion
6322
6323 public void SendRegionHandle(LLUUID regionID, ulong handle) {
6324 RegionIDAndHandleReplyPacket reply = (RegionIDAndHandleReplyPacket)PacketPool.Instance.GetPacket(PacketType.RegionIDAndHandleReply);
6325 reply.ReplyBlock.RegionID = regionID;
6326 reply.ReplyBlock.RegionHandle = handle;
6327 OutPacket(reply, ThrottleOutPacketType.Land);
6328 }
6329
6330 public void SendParcelInfo(RegionInfo info, LandData land, LLUUID parcelID, uint x, uint y)
6331 {
6332 ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply);
6333 reply.AgentData.AgentID = m_agentId;
6334 reply.Data.ParcelID = parcelID;
6335 reply.Data.OwnerID = land.OwnerID;
6336 reply.Data.Name = Helpers.StringToField(land.Name);
6337 reply.Data.Desc = Helpers.StringToField(land.Description);
6338 reply.Data.ActualArea = land.Area;
6339 reply.Data.BillableArea = land.Area; // TODO: what is this?
6340
6341 // Bit 0: Mature, bit 7: on sale, other bits: no idea
6342 reply.Data.Flags = (byte)(
6343 ((land.Flags & (uint)Parcel.ParcelFlags.MaturePublish) != 0 ? (1 << 0) : 0) +
6344 ((land.Flags & (uint)Parcel.ParcelFlags.ForSale) != 0 ? (1 << 7) : 0));
6345
6346 LLVector3 pos = land.UserLocation;
6347 if (pos.Equals(LLVector3.Zero))
6348 {
6349 pos = (land.AABBMax + land.AABBMin) * 0.5f;
6350 }
6351 reply.Data.GlobalX = info.RegionLocX * Constants.RegionSize + x;
6352 reply.Data.GlobalY = info.RegionLocY * Constants.RegionSize + y;
6353 reply.Data.GlobalZ = pos.Z;
6354 reply.Data.SimName = Helpers.StringToField(info.RegionName);
6355 reply.Data.SnapshotID = land.SnapshotID;
6356 reply.Data.Dwell = 0; // TODO: not implemented yet
6357 reply.Data.SalePrice = land.SalePrice;
6358 reply.Data.AuctionID = (int)land.AuctionID;
6359
6360 OutPacket(reply, ThrottleOutPacketType.Land);
6361 }
6297 } 6362 }
6298} 6363}
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index 5cf62f3..8149bcc 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -491,5 +491,20 @@ namespace OpenSim.Region.Communications.Local
491 491
492 return false; 492 return false;
493 } 493 }
494
495 public LandData RequestLandData (ulong regionHandle, uint x, uint y)
496 {
497 m_log.DebugFormat("[INTERREGION STANDALONE] requests land data in {0}, at {1}, {2}",
498 regionHandle, x, y);
499
500 if (m_regionListeners.ContainsKey(regionHandle))
501 {
502 LandData land = m_regionListeners[regionHandle].TriggerGetLandData(x, y);
503 return land;
504 }
505
506 m_log.Debug("[INTERREGION STANDALONE] didn't find land data locally.");
507 return null;
508 }
494 } 509 }
495} 510}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 65b8763..9a4c166 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.IO;
31using System.Net; 32using System.Net;
32using System.Net.Sockets; 33using System.Net.Sockets;
33using System.Reflection; 34using System.Reflection;
@@ -92,6 +93,7 @@ namespace OpenSim.Region.Communications.OGS1
92 httpServer.AddXmlRPCHandler("expect_user", ExpectUser); 93 httpServer.AddXmlRPCHandler("expect_user", ExpectUser);
93 httpServer.AddXmlRPCHandler("logoff_user", LogOffUser); 94 httpServer.AddXmlRPCHandler("logoff_user", LogOffUser);
94 httpServer.AddXmlRPCHandler("check", PingCheckReply); 95 httpServer.AddXmlRPCHandler("check", PingCheckReply);
96 httpServer.AddXmlRPCHandler("land_data", LandData);
95 97
96 StartRemoting(); 98 StartRemoting();
97 } 99 }
@@ -1624,5 +1626,104 @@ namespace OpenSim.Region.Communications.OGS1
1624 } 1626 }
1625 } 1627 }
1626 } 1628 }
1629
1630 public LandData RequestLandData (ulong regionHandle, uint x, uint y)
1631 {
1632 m_log.DebugFormat("[OGS1 GRID SERVICES] requests land data in {0}, at {1}, {2}",
1633 regionHandle, x, y);
1634 LandData landData = m_localBackend.RequestLandData(regionHandle, x, y);
1635 if (landData == null)
1636 {
1637 Hashtable hash = new Hashtable();
1638 hash["region_handle"] = regionHandle.ToString();
1639 hash["x"] = x.ToString();
1640 hash["y"] = y.ToString();
1641
1642 IList paramList = new ArrayList();
1643 paramList.Add(hash);
1644
1645 // this might be cached, as we probably requested it just a moment ago...
1646 RegionInfo info = RequestNeighbourInfo(regionHandle);
1647
1648 try
1649 {
1650 XmlRpcRequest request = new XmlRpcRequest("land_data", paramList);
1651 string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
1652 XmlRpcResponse response = request.Send(uri, 10000);
1653 if (response.IsFault)
1654 {
1655 m_log.ErrorFormat("[OGS1 GRID SERVICES] remote call returned an error: {0}", response.FaultString);
1656 }
1657 else
1658 {
1659 hash = (Hashtable)response.Value;
1660 try {
1661 landData = new LandData();
1662 landData.AABBMax = LLVector3.Parse((string)hash["AABBMax"]);
1663 landData.AABBMin = LLVector3.Parse((string)hash["AABBMin"]);
1664 landData.Area = Convert.ToInt32(hash["Area"]);
1665 landData.AuctionID = Convert.ToUInt32(hash["AuctionID"]);
1666 landData.Description = (string)hash["Description"];
1667 landData.Flags = Convert.ToUInt32(hash["Flags"]);
1668 landData.GlobalID = new LLUUID((string)hash["GlobalID"]);
1669 landData.Name = (string)hash["Name"];
1670 landData.OwnerID = new LLUUID((string)hash["OwnerID"]);
1671 landData.SalePrice = Convert.ToInt32(hash["SalePrice"]);
1672 landData.SnapshotID = new LLUUID((string)hash["SnapshotID"]);
1673 landData.UserLocation = LLVector3.Parse((string)hash["UserLocation"]);
1674 m_log.DebugFormat("[OGS1 GRID SERVICES] Got land data for parcel {0}", landData.Name);
1675 }
1676 catch (Exception e)
1677 {
1678 m_log.Error("[OGS1 GRID SERVICES] Got exception while parsing land-data:", e);
1679 }
1680 }
1681 }
1682 catch (Exception e)
1683 {
1684 m_log.ErrorFormat("[OGS1 GRID SERVICES] Couldn't contact region {0}: {1}", regionHandle, e);
1685 }
1686 }
1687 return landData;
1688 }
1689
1690 // Grid Request Processing
1691 /// <summary>
1692 /// Someone asked us about parcel-information
1693 /// </summary>
1694 /// <param name="request"></param>
1695 /// <returns></returns>
1696 public XmlRpcResponse LandData(XmlRpcRequest request)
1697 {
1698 Hashtable requestData = (Hashtable)request.Params[0];
1699 ulong regionHandle = Convert.ToUInt64(requestData["region_handle"]);
1700 uint x = Convert.ToUInt32(requestData["x"]);
1701 uint y = Convert.ToUInt32(requestData["y"]);
1702 m_log.DebugFormat("[OGS1 GRID SERVICES]: Got XML reqeuest for land data at {0}, {1} in region {2}", x, y, regionHandle);
1703
1704 LandData landData = m_localBackend.RequestLandData(regionHandle, x, y);
1705 Hashtable hash = new Hashtable();
1706 if (landData != null)
1707 {
1708 // for now, only push out the data we need for answering a ParcelInfoReqeust
1709 // FIXME: these Replace calls are necessary as LLVector3.Parse can't parse vectors with spaces in them. Can be removed as soon as we switch to a newer version
1710 hash["AABBMax"] = landData.AABBMax.ToString().Replace(" ", "");
1711 hash["AABBMin"] = landData.AABBMin.ToString().Replace(" ", "");
1712 hash["Area"] = landData.Area.ToString();
1713 hash["AuctionID"] = landData.AuctionID.ToString();
1714 hash["Description"] = landData.Description;
1715 hash["Flags"] = landData.Flags.ToString();
1716 hash["GlobalID"] = landData.GlobalID.ToString();
1717 hash["Name"] = landData.Name;
1718 hash["OwnerID"] = landData.OwnerID.ToString();
1719 hash["SalePrice"] = landData.SalePrice.ToString();
1720 hash["SnapshotID"] = landData.SnapshotID.ToString();
1721 hash["UserLocation"] = landData.UserLocation.ToString().Replace(" ", "");
1722 }
1723
1724 XmlRpcResponse response = new XmlRpcResponse();
1725 response.Value = hash;
1726 return response;
1727 }
1627 } 1728 }
1628} 1729}
diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs
index 92eda80..46f108e 100644
--- a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs
@@ -26,19 +26,30 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections;
29using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection;
30using libsecondlife; 32using libsecondlife;
33using log4net;
31using Nini.Config; 34using Nini.Config;
32using OpenSim.Region.Environment.Interfaces; 35using OpenSim.Region.Environment.Interfaces;
33using OpenSim.Region.Environment.Scenes; 36using OpenSim.Region.Environment.Scenes;
34using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Servers;
39using OpenSim.Framework.Communications.Capabilities;
35using OpenSim.Region.Physics.Manager; 40using OpenSim.Region.Physics.Manager;
36using Axiom.Math; 41using Axiom.Math;
42using Caps = OpenSim.Framework.Communications.Capabilities.Caps;
37 43
38namespace OpenSim.Region.Environment.Modules.World.Land 44namespace OpenSim.Region.Environment.Modules.World.Land
39{ 45{
40 public class LandManagementModule : IRegionModule 46 public class LandManagementModule : IRegionModule
41 { 47 {
48 private static readonly ILog m_log =
49 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50
51 private static readonly string remoteParcelRequestPath = "0009/";
52
42 private LandChannel landChannel; 53 private LandChannel landChannel;
43 private Scene m_scene; 54 private Scene m_scene;
44 55
@@ -75,6 +86,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
75 m_scene.EventManager.OnSetAllowForcefulBan += this.SetAllowedForcefulBans; 86 m_scene.EventManager.OnSetAllowForcefulBan += this.SetAllowedForcefulBans;
76 m_scene.EventManager.OnRequestParcelPrimCountUpdate += this.PerformParcelPrimCountUpdate; 87 m_scene.EventManager.OnRequestParcelPrimCountUpdate += this.PerformParcelPrimCountUpdate;
77 m_scene.EventManager.OnParcelPrimCountTainted += this.SetPrimsTainted; 88 m_scene.EventManager.OnParcelPrimCountTainted += this.SetPrimsTainted;
89 m_scene.EventManager.OnRegisterCaps += this.OnRegisterCaps;
78 90
79 lock (m_scene) 91 lock (m_scene)
80 { 92 {
@@ -95,7 +107,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
95 client.OnParcelAccessListUpdateRequest += new ParcelAccessListUpdateRequest(handleParcelAccessUpdateRequest); 107 client.OnParcelAccessListUpdateRequest += new ParcelAccessListUpdateRequest(handleParcelAccessUpdateRequest);
96 client.OnParcelAbandonRequest += new ParcelAbandonRequest(handleParcelAbandonRequest); 108 client.OnParcelAbandonRequest += new ParcelAbandonRequest(handleParcelAbandonRequest);
97 client.OnParcelReclaim += new ParcelReclaim(handleParcelReclaim); 109 client.OnParcelReclaim += new ParcelReclaim(handleParcelReclaim);
98 110 client.OnParcelInfoRequest += new ParcelInfoRequest(handleParcelInfo);
99 if (m_scene.Entities.ContainsKey(client.AgentId)) 111 if (m_scene.Entities.ContainsKey(client.AgentId))
100 { 112 {
101 SendLandUpdate((ScenePresence)m_scene.Entities[client.AgentId], true); 113 SendLandUpdate((ScenePresence)m_scene.Entities[client.AgentId], true);
@@ -1084,6 +1096,112 @@ namespace OpenSim.Region.Environment.Modules.World.Land
1084 public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel) 1096 public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel)
1085 { 1097 {
1086 } 1098 }
1099
1100 #region CAPS handler
1101 private void OnRegisterCaps(LLUUID agentID, Caps caps)
1102 {
1103 string capsBase = "/CAPS/" + caps.CapsObjectPath;
1104 caps.RegisterHandler("RemoteParcelRequest",
1105 new RestStreamHandler("POST", capsBase + remoteParcelRequestPath,
1106 delegate(string request, string path, string param,
1107 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
1108 {
1109 return RemoteParcelRequest(request, path, param, agentID, caps);
1110 }));
1111 }
1112
1113 // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the
1114 // "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to.
1115 // So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x
1116 // and y coordinate (each 8 bit), encoded in a LLUUID (128 bit).
1117 //
1118 // Request format:
1119 // <llsd>
1120 // <map>
1121 // <key>location</key>
1122 // <array>
1123 // <real>1.23</real>
1124 // <real>45..6</real>
1125 // <real>78.9</real>
1126 // </array>
1127 // <key>region_id</key>
1128 // <uuid>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</uuid>
1129 // </map>
1130 // </llsd>
1131 private string RemoteParcelRequest(string request, string path, string param, LLUUID agentID, Caps caps)
1132 {
1133 LLUUID parcelID = LLUUID.Zero;
1134 try
1135 {
1136 Hashtable hash = new Hashtable();
1137 hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request));
1138 if(hash.ContainsKey("region_id") && hash.ContainsKey("location"))
1139 {
1140 LLUUID regionID = (LLUUID)hash["region_id"];
1141 ArrayList list = (ArrayList)hash["location"];
1142 uint x = (uint)(double)list[0];
1143 uint y = (uint)(double)list[1];
1144 if(hash.ContainsKey("region_handle"))
1145 {
1146 // if you do a "About Landmark" on a landmark a second time, the viewer sends the
1147 // region_handle it got earlier via RegionHandleRequest
1148 ulong regionHandle = Helpers.BytesToUInt64((byte[])hash["region_handle"]);
1149 parcelID = Util.BuildFakeParcelID(regionHandle, x, y);
1150 }
1151 else if(regionID == m_scene.RegionInfo.RegionID)
1152 {
1153 // a parcel request for a local parcel => no need to query the grid
1154 parcelID = Util.BuildFakeParcelID(m_scene.RegionInfo.RegionHandle, x, y);
1155 }
1156 else
1157 {
1158 // a parcel request for a parcel in another region. Ask the grid about the region
1159 RegionInfo info = m_scene.CommsManager.GridService.RequestNeighbourInfo(regionID);
1160 if(info != null) parcelID = Util.BuildFakeParcelID(info.RegionHandle, x, y);
1161 }
1162 }
1163 }
1164 catch (LLSD.LLSDParseException e)
1165 {
1166 m_log.ErrorFormat("[LAND] Fetch error: {0}", e.Message);
1167 m_log.ErrorFormat("[LAND] ... in request {0}", request);
1168 }
1169 catch(InvalidCastException)
1170 {
1171 m_log.ErrorFormat("[LAND] Wrong type in request {0}", request);
1172 }
1173
1174 LLSDRemoteParcelResponse response = new LLSDRemoteParcelResponse();
1175 response.parcel_id = parcelID;
1176 m_log.DebugFormat("[LAND] got parcelID {0}", parcelID);
1177
1178 return LLSDHelpers.SerialiseLLSDReply(response);
1179 }
1180
1181 #endregion
1182
1183 private void handleParcelInfo(IClientAPI remoteClient, LLUUID parcelID)
1184 {
1185 if(parcelID == LLUUID.Zero) return;
1186
1187 // assume we've got the parcelID we just computed in RemoteParcelRequest
1188 ulong regionHandle;
1189 uint x, y;
1190 Util.ParseFakeParcelID(parcelID, out regionHandle, out x, out y);
1191 m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}", regionHandle, x, y);
1192
1193 LandData landData;
1194 if(regionHandle == m_scene.RegionInfo.RegionHandle) landData = this.GetLandObject(x, y).landData;
1195 else landData = m_scene.CommsManager.GridService.RequestLandData(regionHandle, x, y);
1196
1197 if(landData != null)
1198 {
1199 // we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark.
1200 m_log.Debug("[LAND] got parcelinfo; sending");
1201 remoteClient.SendParcelInfo(m_scene.RegionInfo, landData, parcelID, x, y);
1202 }
1203 else m_log.Debug("[LAND] got no parcelinfo; not sending");
1204 }
1087 } 1205 }
1088 1206
1089} 1207}
diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
index 5853b87..7b05027 100644
--- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
@@ -302,6 +302,10 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
302 public event UpdateVector OnAutoPilotGo; 302 public event UpdateVector OnAutoPilotGo;
303 303
304 public event TerrainUnacked OnUnackedTerrain; 304 public event TerrainUnacked OnUnackedTerrain;
305
306 public event RegionHandleRequest OnRegionHandleRequest;
307 public event ParcelInfoRequest OnParcelInfoRequest;
308
305#pragma warning restore 67 309#pragma warning restore 67
306 310
307 #endregion 311 #endregion
@@ -832,5 +836,13 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
832 public void SendClearFollowCamProperties (LLUUID objectID) 836 public void SendClearFollowCamProperties (LLUUID objectID)
833 { 837 {
834 } 838 }
839
840 public void SendRegionHandle (LLUUID regoinID, ulong handle)
841 {
842 }
843
844 public void SendParcelInfo (RegionInfo info, LandData land, LLUUID parcelID, uint x, uint y)
845 {
846 }
835 } 847 }
836} 848}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 2e89e4b..9b0b53a 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -2170,6 +2170,8 @@ namespace OpenSim.Region.Environment.Scenes
2170 client.OnScriptReset += ProcessScriptReset; 2170 client.OnScriptReset += ProcessScriptReset;
2171 client.OnGetScriptRunning += GetScriptRunning; 2171 client.OnGetScriptRunning += GetScriptRunning;
2172 client.OnSetScriptRunning += SetScriptRunning; 2172 client.OnSetScriptRunning += SetScriptRunning;
2173
2174 client.OnRegionHandleRequest += RegionHandleRequest;
2173 2175
2174 client.OnUnackedTerrain += TerrainUnAcked; 2176 client.OnUnackedTerrain += TerrainUnAcked;
2175 2177
@@ -2502,6 +2504,7 @@ namespace OpenSim.Region.Environment.Scenes
2502 m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; 2504 m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar;
2503 m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid; 2505 m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid;
2504 m_sceneGridService.KillObject += SendKillObject; 2506 m_sceneGridService.KillObject += SendKillObject;
2507 m_sceneGridService.OnGetLandData += GetLandData;
2505 } 2508 }
2506 2509
2507 /// <summary> 2510 /// <summary>
@@ -2518,6 +2521,7 @@ namespace OpenSim.Region.Environment.Scenes
2518 m_sceneGridService.OnExpectUser -= NewUserConnection; 2521 m_sceneGridService.OnExpectUser -= NewUserConnection;
2519 m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing; 2522 m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing;
2520 m_sceneGridService.OnCloseAgentConnection -= CloseConnection; 2523 m_sceneGridService.OnCloseAgentConnection -= CloseConnection;
2524 m_sceneGridService.OnGetLandData -= GetLandData;
2521 2525
2522 m_sceneGridService.Close(); 2526 m_sceneGridService.Close();
2523 } 2527 }
@@ -3436,6 +3440,12 @@ namespace OpenSim.Region.Environment.Scenes
3436 return LandChannel.GetLandObject(x, y).landData; 3440 return LandChannel.GetLandObject(x, y).landData;
3437 } 3441 }
3438 3442
3443 public LandData GetLandData(uint x, uint y)
3444 {
3445 m_log.DebugFormat("[SCENE] returning land for {0},{1}", x, y);
3446 return LandChannel.GetLandObject((int)x, (int)y).landData;
3447 }
3448
3439 public void SetLandMusicURL(float x, float y, string url) 3449 public void SetLandMusicURL(float x, float y, string url)
3440 { 3450 {
3441 ILandObject land = LandChannel.GetLandObject(x, y); 3451 ILandObject land = LandChannel.GetLandObject(x, y);
@@ -3833,6 +3843,14 @@ namespace OpenSim.Region.Environment.Scenes
3833// client.SendParcelMediaCommand((uint)(4), ParcelMediaCommandEnum.Play, 0); 3843// client.SendParcelMediaCommand((uint)(4), ParcelMediaCommandEnum.Play, 0);
3834// }); 3844// });
3835 } 3845 }
3846
3847 public void RegionHandleRequest(IClientAPI client, LLUUID regionID)
3848 {
3849 RegionInfo info;
3850 if(regionID == RegionInfo.RegionID) info = RegionInfo;
3851 else info = CommsManager.GridService.RequestNeighbourInfo(regionID);
3852 if(info != null) client.SendRegionHandle(regionID, info.RegionHandle);
3853 }
3836 3854
3837 3855
3838 public void TerrainUnAcked(IClientAPI client, int patchX, int patchY) 3856 public void TerrainUnAcked(IClientAPI client, int patchX, int patchY)
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index 008d67a..35a7434 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -59,7 +59,8 @@ namespace OpenSim.Region.Environment.Scenes
59 public event ChildAgentUpdate OnChildAgentUpdate; 59 public event ChildAgentUpdate OnChildAgentUpdate;
60 public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar; 60 public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar;
61 public event LogOffUser OnLogOffUser; 61 public event LogOffUser OnLogOffUser;
62 62 public event GetLandData OnGetLandData;
63
63 private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion; 64 private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion;
64 private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser; 65 private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser;
65 private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim; 66 private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim;
@@ -69,6 +70,7 @@ namespace OpenSim.Region.Environment.Scenes
69 private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate; 70 private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate;
70 private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar = null; // OnRemoveKnownRegionFromAvatar; 71 private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar = null; // OnRemoveKnownRegionFromAvatar;
71 private LogOffUser handlerLogOffUser = null; 72 private LogOffUser handlerLogOffUser = null;
73 private GetLandData handlerGetLandData = null; // OnGetLandData
72 74
73 public KillObjectDelegate KillObject; 75 public KillObjectDelegate KillObject;
74 public string _debugRegionName = String.Empty; 76 public string _debugRegionName = String.Empty;
@@ -108,6 +110,7 @@ namespace OpenSim.Region.Environment.Scenes
108 regionCommsHost.OnRegionUp += newRegionUp; 110 regionCommsHost.OnRegionUp += newRegionUp;
109 regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate; 111 regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate;
110 regionCommsHost.OnLogOffUser += GridLogOffUser; 112 regionCommsHost.OnLogOffUser += GridLogOffUser;
113 regionCommsHost.OnGetLandData += FetchLandData;
111 } 114 }
112 else 115 else
113 { 116 {
@@ -131,6 +134,7 @@ namespace OpenSim.Region.Environment.Scenes
131 regionCommsHost.OnExpectPrim -= IncomingPrimCrossing; 134 regionCommsHost.OnExpectPrim -= IncomingPrimCrossing;
132 regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing; 135 regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing;
133 regionCommsHost.OnCloseAgentConnection -= CloseConnection; 136 regionCommsHost.OnCloseAgentConnection -= CloseConnection;
137 regionCommsHost.OnGetLandData -= FetchLandData;
134 m_commsProvider.GridService.DeregisterRegion(m_regionInfo); 138 m_commsProvider.GridService.DeregisterRegion(m_regionInfo);
135 regionCommsHost = null; 139 regionCommsHost = null;
136 } 140 }
@@ -227,6 +231,16 @@ namespace OpenSim.Region.Environment.Scenes
227 return false; 231 return false;
228 } 232 }
229 233
234 protected LandData FetchLandData(uint x, uint y)
235 {
236 handlerGetLandData = OnGetLandData;
237 if (handlerGetLandData != null)
238 {
239 return handlerGetLandData(x, y);
240 }
241 return null;
242 }
243
230 #endregion 244 #endregion
231 245
232 #region Inform Client of Neighbours 246 #region Inform Client of Neighbours
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index a7d2ef3..61ea966 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -204,6 +204,9 @@ namespace OpenSim.Region.Examples.SimpleModule
204 204
205 public event TerrainUnacked OnUnackedTerrain; 205 public event TerrainUnacked OnUnackedTerrain;
206 206
207 public event RegionHandleRequest OnRegionHandleRequest;
208 public event ParcelInfoRequest OnParcelInfoRequest;
209
207#pragma warning restore 67 210#pragma warning restore 67
208 211
209 private LLUUID myID = LLUUID.Random(); 212 private LLUUID myID = LLUUID.Random();
@@ -832,5 +835,13 @@ namespace OpenSim.Region.Examples.SimpleModule
832 public void SendClearFollowCamProperties (LLUUID objectID) 835 public void SendClearFollowCamProperties (LLUUID objectID)
833 { 836 {
834 } 837 }
838
839 public void SendRegionHandle (LLUUID regoinID, ulong handle)
840 {
841 }
842
843 public void SendParcelInfo (RegionInfo info, LandData land, LLUUID parcelID, uint x, uint y)
844 {
845 }
835 } 846 }
836} 847}