diff options
author | MW | 2007-05-13 12:25:08 +0000 |
---|---|---|
committer | MW | 2007-05-13 12:25:08 +0000 |
commit | 05d9593198f1a688e10ab5be1789b5661ad7d61e (patch) | |
tree | ec72812a389d6cccfbe9af39291e8128aa0ecf8a /OpenSim.RegionServer | |
parent | * Added first generation region DB for SQL-based grid storage engines. (diff) | |
download | opensim-SC-05d9593198f1a688e10ab5be1789b5661ad7d61e.zip opensim-SC-05d9593198f1a688e10ab5be1789b5661ad7d61e.tar.gz opensim-SC-05d9593198f1a688e10ab5be1789b5661ad7d61e.tar.bz2 opensim-SC-05d9593198f1a688e10ab5be1789b5661ad7d61e.tar.xz |
Added very basic support for maps (likely to only work in sandbox mode due to the non functioning remote asset server), also currently just uses textures that we already had added to the asset server (this is the first thing that needs fixing)
Diffstat (limited to 'OpenSim.RegionServer')
-rw-r--r-- | OpenSim.RegionServer/OpenSimMain.cs | 2 | ||||
-rw-r--r-- | OpenSim.RegionServer/SimClient.cs | 35 | ||||
-rw-r--r-- | OpenSim.RegionServer/world/Primitive2.cs | 22 | ||||
-rw-r--r-- | OpenSim.RegionServer/world/World.cs | 5 | ||||
-rw-r--r-- | OpenSim.RegionServer/world/WorldPacketHandlers.cs | 30 |
5 files changed, 82 insertions, 12 deletions
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs index d522e2b..9fb7c4e 100644 --- a/OpenSim.RegionServer/OpenSimMain.cs +++ b/OpenSim.RegionServer/OpenSimMain.cs | |||
@@ -225,7 +225,7 @@ namespace OpenSim | |||
225 | 225 | ||
226 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL,"Main.cs:Startup() - We are " + regionData.RegionName + " at " + regionData.RegionLocX.ToString() + "," + regionData.RegionLocY.ToString()); | 226 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL,"Main.cs:Startup() - We are " + regionData.RegionName + " at " + regionData.RegionLocX.ToString() + "," + regionData.RegionLocY.ToString()); |
227 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Initialising world"); | 227 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Initialising world"); |
228 | LocalWorld = new World(this._packetServer.ClientThreads, regionData.RegionHandle, regionData.RegionName); | 228 | LocalWorld = new World(this._packetServer.ClientThreads, regionData, regionData.RegionHandle, regionData.RegionName); |
229 | LocalWorld.InventoryCache = InventoryCache; | 229 | LocalWorld.InventoryCache = InventoryCache; |
230 | LocalWorld.AssetCache = AssetCache; | 230 | LocalWorld.AssetCache = AssetCache; |
231 | 231 | ||
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs index 76bf46e..ab13b02 100644 --- a/OpenSim.RegionServer/SimClient.cs +++ b/OpenSim.RegionServer/SimClient.cs | |||
@@ -144,7 +144,7 @@ namespace OpenSim | |||
144 | 144 | ||
145 | public void CrossSimBorder(LLVector3 avatarpos) | 145 | public void CrossSimBorder(LLVector3 avatarpos) |
146 | { // VERY VERY BASIC | 146 | { // VERY VERY BASIC |
147 | 147 | ||
148 | LLVector3 newpos = avatarpos; | 148 | LLVector3 newpos = avatarpos; |
149 | uint neighbourx = this.m_regionData.RegionLocX; | 149 | uint neighbourx = this.m_regionData.RegionLocX; |
150 | uint neighboury = this.m_regionData.RegionLocY; | 150 | uint neighboury = this.m_regionData.RegionLocY; |
@@ -642,6 +642,13 @@ namespace OpenSim | |||
642 | } | 642 | } |
643 | } | 643 | } |
644 | break; | 644 | break; |
645 | case PacketType.MapLayerRequest: | ||
646 | this.RequestMapLayer(); | ||
647 | break; | ||
648 | case PacketType.MapBlockRequest: | ||
649 | MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack; | ||
650 | this.RequestMapBlock( MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); | ||
651 | break; | ||
645 | 652 | ||
646 | } | 653 | } |
647 | } | 654 | } |
@@ -1101,7 +1108,7 @@ namespace OpenSim | |||
1101 | 1108 | ||
1102 | case 3: // Landmark | 1109 | case 3: // Landmark |
1103 | String content; | 1110 | String content; |
1104 | content = "Landmark version 2\n"; | 1111 | content = "Landmark version 2\n"; |
1105 | content += "region_id " + m_regionData.SimUUID + "\n"; | 1112 | content += "region_id " + m_regionData.SimUUID + "\n"; |
1106 | String strPos = String.Format("%.2f %.2f %.2f>", | 1113 | String strPos = String.Format("%.2f %.2f %.2f>", |
1107 | this.ClientAvatar.Pos.X, | 1114 | this.ClientAvatar.Pos.X, |
@@ -1116,5 +1123,29 @@ namespace OpenSim | |||
1116 | m_assetCache.AddAsset(asset); | 1123 | m_assetCache.AddAsset(asset); |
1117 | m_inventoryCache.AddNewInventoryItem(this, packet.InventoryBlock.FolderID, asset); | 1124 | m_inventoryCache.AddNewInventoryItem(this, packet.InventoryBlock.FolderID, asset); |
1118 | } | 1125 | } |
1126 | |||
1127 | public void RequestMapLayer() //should be getting the map layer from the grid server | ||
1128 | { | ||
1129 | //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area) | ||
1130 | MapLayerReplyPacket mapReply = new MapLayerReplyPacket(); | ||
1131 | mapReply.AgentData.AgentID = this.AgentID; | ||
1132 | mapReply.AgentData.Flags = 0; | ||
1133 | mapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1]; | ||
1134 | mapReply.LayerData[0] = new MapLayerReplyPacket.LayerDataBlock(); | ||
1135 | mapReply.LayerData[0].Bottom = 800; | ||
1136 | mapReply.LayerData[0].Left = 800; | ||
1137 | mapReply.LayerData[0].Top = 1200; | ||
1138 | mapReply.LayerData[0].Right = 1200; | ||
1139 | mapReply.LayerData[0].ImageID = new LLUUID("00000000-0000-0000-9999-000000000001"); | ||
1140 | this.OutPacket(mapReply); | ||
1141 | } | ||
1142 | |||
1143 | public void RequestMapBlock( int minX, int minY, int maxX, int maxY) | ||
1144 | { | ||
1145 | //check if our own map was requested | ||
1146 | this.m_world.RequestMapBlock(this, minX, minY, maxX, maxY); | ||
1147 | |||
1148 | //now should get other regions maps from gridserver | ||
1149 | } | ||
1119 | } | 1150 | } |
1120 | } | 1151 | } |
diff --git a/OpenSim.RegionServer/world/Primitive2.cs b/OpenSim.RegionServer/world/Primitive2.cs index 0df3079..5e76fd1 100644 --- a/OpenSim.RegionServer/world/Primitive2.cs +++ b/OpenSim.RegionServer/world/Primitive2.cs | |||
@@ -45,7 +45,17 @@ namespace OpenSim.world | |||
45 | this._physActor = value; | 45 | this._physActor = value; |
46 | } | 46 | } |
47 | } | 47 | } |
48 | 48 | public override LLVector3 Pos | |
49 | { | ||
50 | get | ||
51 | { | ||
52 | return base.Pos; | ||
53 | } | ||
54 | set | ||
55 | { | ||
56 | base.Pos = value; | ||
57 | } | ||
58 | } | ||
49 | #endregion | 59 | #endregion |
50 | 60 | ||
51 | public Primitive2(Dictionary<uint, SimClient> clientThreads, ulong regionHandle, World world) | 61 | public Primitive2(Dictionary<uint, SimClient> clientThreads, ulong regionHandle, World world) |
@@ -106,6 +116,11 @@ namespace OpenSim.world | |||
106 | 116 | ||
107 | #region Packet handlers | 117 | #region Packet handlers |
108 | 118 | ||
119 | public void UpdatePosition(LLVector3 pos) | ||
120 | { | ||
121 | |||
122 | } | ||
123 | |||
109 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket) | 124 | public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket) |
110 | { | 125 | { |
111 | this.primData.PathBegin = addPacket.PathBegin; | 126 | this.primData.PathBegin = addPacket.PathBegin; |
@@ -230,6 +245,7 @@ namespace OpenSim.world | |||
230 | 245 | ||
231 | #region Update viewers Methods | 246 | #region Update viewers Methods |
232 | 247 | ||
248 | //should change these mehtods, so that outgoing packets are sent through the avatar class | ||
233 | public void SendFullUpdateToClient(SimClient remoteClient) | 249 | public void SendFullUpdateToClient(SimClient remoteClient) |
234 | { | 250 | { |
235 | LLVector3 lPos; | 251 | LLVector3 lPos; |
@@ -346,7 +362,7 @@ namespace OpenSim.world | |||
346 | objdata.ObjectData[47] = 63; | 362 | objdata.ObjectData[47] = 63; |
347 | } | 363 | } |
348 | 364 | ||
349 | protected void UpdatePacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData) | 365 | protected void SetPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData) |
350 | { | 366 | { |
351 | objectData.OwnerID = this.primData.OwnerID; | 367 | objectData.OwnerID = this.primData.OwnerID; |
352 | objectData.PCode = this.primData.PCode; | 368 | objectData.PCode = this.primData.PCode; |
@@ -378,7 +394,7 @@ namespace OpenSim.world | |||
378 | ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock(); | 394 | ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock(); |
379 | this.SetDefaultPacketValues(objupdate); | 395 | this.SetDefaultPacketValues(objupdate); |
380 | objupdate.UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456; | 396 | objupdate.UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456; |
381 | this.UpdatePacketShapeData(objupdate); | 397 | this.SetPacketShapeData(objupdate); |
382 | byte[] pb = this.Pos.GetBytes(); | 398 | byte[] pb = this.Pos.GetBytes(); |
383 | Array.Copy(pb, 0, objupdate.ObjectData, 0, pb.Length); | 399 | Array.Copy(pb, 0, objupdate.ObjectData, 0, pb.Length); |
384 | return objupdate; | 400 | return objupdate; |
diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs index 225ce81..445df1d 100644 --- a/OpenSim.RegionServer/world/World.cs +++ b/OpenSim.RegionServer/world/World.cs | |||
@@ -43,7 +43,7 @@ namespace OpenSim.world | |||
43 | private InventoryCache _inventoryCache; | 43 | private InventoryCache _inventoryCache; |
44 | private AssetCache _assetCache; | 44 | private AssetCache _assetCache; |
45 | private Mutex updateLock; | 45 | private Mutex updateLock; |
46 | 46 | private RegionInfo m_regInfo; | |
47 | public string m_datastore; | 47 | public string m_datastore; |
48 | 48 | ||
49 | /// <summary> | 49 | /// <summary> |
@@ -52,7 +52,7 @@ namespace OpenSim.world | |||
52 | /// <param name="clientThreads">Dictionary to contain client threads</param> | 52 | /// <param name="clientThreads">Dictionary to contain client threads</param> |
53 | /// <param name="regionHandle">Region Handle for this region</param> | 53 | /// <param name="regionHandle">Region Handle for this region</param> |
54 | /// <param name="regionName">Region Name for this region</param> | 54 | /// <param name="regionName">Region Name for this region</param> |
55 | public World(Dictionary<uint, SimClient> clientThreads, ulong regionHandle, string regionName) | 55 | public World(Dictionary<uint, SimClient> clientThreads, RegionInfo regInfo, ulong regionHandle, string regionName) |
56 | { | 56 | { |
57 | try | 57 | try |
58 | { | 58 | { |
@@ -60,6 +60,7 @@ namespace OpenSim.world | |||
60 | m_clientThreads = clientThreads; | 60 | m_clientThreads = clientThreads; |
61 | m_regionHandle = regionHandle; | 61 | m_regionHandle = regionHandle; |
62 | m_regionName = regionName; | 62 | m_regionName = regionName; |
63 | m_regInfo = regInfo; | ||
63 | 64 | ||
64 | m_scriptHandlers = new Dictionary<LLUUID, ScriptHandler>(); | 65 | m_scriptHandlers = new Dictionary<LLUUID, ScriptHandler>(); |
65 | m_scripts = new Dictionary<string, ScriptFactory>(); | 66 | m_scripts = new Dictionary<string, ScriptFactory>(); |
diff --git a/OpenSim.RegionServer/world/WorldPacketHandlers.cs b/OpenSim.RegionServer/world/WorldPacketHandlers.cs index 9e1f9a1..d479c85 100644 --- a/OpenSim.RegionServer/world/WorldPacketHandlers.cs +++ b/OpenSim.RegionServer/world/WorldPacketHandlers.cs | |||
@@ -65,28 +65,28 @@ namespace OpenSim.world | |||
65 | switch (inchatpack.ChatData.Type) | 65 | switch (inchatpack.ChatData.Type) |
66 | { | 66 | { |
67 | case 0: | 67 | case 0: |
68 | int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X),(int)( client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); | 68 | int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); |
69 | if ((dis < 10) && (dis > -10)) | 69 | if ((dis < 10) && (dis > -10)) |
70 | { | 70 | { |
71 | client.OutPacket(reply); | 71 | client.OutPacket(reply); |
72 | } | 72 | } |
73 | break; | 73 | break; |
74 | case 1: | 74 | case 1: |
75 | dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); | 75 | dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); |
76 | if ((dis < 30) && (dis > -30)) | 76 | if ((dis < 30) && (dis > -30)) |
77 | { | 77 | { |
78 | client.OutPacket(reply); | 78 | client.OutPacket(reply); |
79 | } | 79 | } |
80 | break; | 80 | break; |
81 | case 2: | 81 | case 2: |
82 | dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X),(int)( client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); | 82 | dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); |
83 | if ((dis < 100) && (dis > -100)) | 83 | if ((dis < 100) && (dis > -100)) |
84 | { | 84 | { |
85 | client.OutPacket(reply); | 85 | client.OutPacket(reply); |
86 | } | 86 | } |
87 | break; | 87 | break; |
88 | } | 88 | } |
89 | 89 | ||
90 | } | 90 | } |
91 | return true; | 91 | return true; |
92 | } | 92 | } |
@@ -203,5 +203,27 @@ namespace OpenSim.world | |||
203 | return true; | 203 | return true; |
204 | } | 204 | } |
205 | 205 | ||
206 | public void RequestMapBlock(SimClient simClient, int minX, int minY, int maxX, int maxY) | ||
207 | { | ||
208 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | ||
209 | if (((m_regInfo.RegionLocX > minX) && (m_regInfo.RegionLocX < maxX)) && ((m_regInfo.RegionLocY > minY) && (m_regInfo.RegionLocY < maxY))) | ||
210 | { | ||
211 | MapBlockReplyPacket mapReply = new MapBlockReplyPacket(); | ||
212 | mapReply.AgentData.AgentID = simClient.AgentID; | ||
213 | mapReply.AgentData.Flags = 0; | ||
214 | mapReply.Data = new MapBlockReplyPacket.DataBlock[1]; | ||
215 | mapReply.Data[0] = new MapBlockReplyPacket.DataBlock(); | ||
216 | mapReply.Data[0].MapImageID = new LLUUID("00000000-0000-0000-9999-000000000002"); | ||
217 | mapReply.Data[0].X = (ushort)m_regInfo.RegionLocX; | ||
218 | mapReply.Data[0].Y = (ushort)m_regInfo.RegionLocY; | ||
219 | mapReply.Data[0].WaterHeight =(byte) m_regInfo.RegionWaterHeight; | ||
220 | mapReply.Data[0].Name = _enc.GetBytes(this.m_regionName); | ||
221 | mapReply.Data[0].RegionFlags = 72458694; | ||
222 | mapReply.Data[0].Access = 13; | ||
223 | mapReply.Data[0].Agents = 1; //should send number of clients connected | ||
224 | simClient.OutPacket(mapReply); | ||
225 | } | ||
226 | } | ||
227 | |||
206 | } | 228 | } |
207 | } | 229 | } |