diff options
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/world')
-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 |
3 files changed, 48 insertions, 9 deletions
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 | } |