aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim.RegionServer')
-rw-r--r--OpenSim.RegionServer/ClientView.ProcessPackets.cs160
-rw-r--r--OpenSim.RegionServer/ClientView.cs21
-rw-r--r--OpenSim.RegionServer/PacketServer.cs2
-rw-r--r--OpenSim.RegionServer/world/Avatar.Update.cs44
-rw-r--r--OpenSim.RegionServer/world/Avatar.cs15
-rw-r--r--OpenSim.RegionServer/world/World.PacketHandlers.cs98
-rw-r--r--OpenSim.RegionServer/world/World.cs5
7 files changed, 221 insertions, 124 deletions
diff --git a/OpenSim.RegionServer/ClientView.ProcessPackets.cs b/OpenSim.RegionServer/ClientView.ProcessPackets.cs
index 0079d96..16f418d 100644
--- a/OpenSim.RegionServer/ClientView.ProcessPackets.cs
+++ b/OpenSim.RegionServer/ClientView.ProcessPackets.cs
@@ -21,9 +21,23 @@ namespace OpenSim
21 public partial class ClientView 21 public partial class ClientView
22 { 22 {
23 public delegate void ChatFromViewer(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); 23 public delegate void ChatFromViewer(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
24 24 public delegate void RezObject(AssetBase primasset, LLVector3 pos);
25 public delegate void ModifyTerrain(byte Action, float North, float West);
26 public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam);
27 public delegate void StartAnim(LLUUID animID, int seq);
28 public delegate void GenericCall(ClientView RemoteClient);
29 public delegate void GenericCall2();
30 public delegate void GenericCall3(Packet packet); // really don't want to be passing packets in these events, so this is very temporary.
25 31
26 public event ChatFromViewer OnChatFromViewer; 32 public event ChatFromViewer OnChatFromViewer;
33 public event RezObject OnRezObject;
34 public event ModifyTerrain OnModifyTerrain;
35 public event GenericCall OnRegionHandShakeReply;
36 public event GenericCall OnRequestWearables;
37 public event SetAppearance OnSetAppearance;
38 public event GenericCall2 OnCompleteMovementToRegion;
39 public event GenericCall3 OnAgentUpdate;
40 public event StartAnim OnStartAnim;
27 41
28 protected override void ProcessInPacket(Packet Pack) 42 protected override void ProcessInPacket(Packet Pack)
29 { 43 {
@@ -62,40 +76,81 @@ namespace OpenSim
62 LLUUID fromAgentID = AgentID; 76 LLUUID fromAgentID = AgentID;
63 this.OnChatFromViewer(message, type, fromPos, fromName, fromAgentID); 77 this.OnChatFromViewer(message, type, fromPos, fromName, fromAgentID);
64 break; 78 break;
65 #endregion 79 case PacketType.RezObject:
66 80 RezObjectPacket rezPacket = (RezObjectPacket)Pack;
67 #region World/Avatar/Primitive related packets 81 AgentInventory inven = this.m_inventoryCache.GetAgentsInventory(this.AgentID);
68 case PacketType.CompleteAgentMovement: 82 if (inven != null)
69 if (this.m_child) this.UpgradeClient();
70 ClientAvatar.CompleteMovement(m_world);
71 ClientAvatar.SendInitialPosition();
72 this.EnableNeighbours();
73 break;
74 case PacketType.RegionHandshakeReply:
75 m_world.SendLayerData(this);
76 break;
77 case PacketType.AgentWearablesRequest:
78 ClientAvatar.SendInitialAppearance();
79 foreach (ClientView client in m_clientThreads.Values)
80 { 83 {
81 if (client.AgentID != this.AgentID) 84 if (inven.InventoryItems.ContainsKey(rezPacket.InventoryData.ItemID))
82 { 85 {
83 ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket(); 86 AssetBase asset = this.m_assetCache.GetAsset(inven.InventoryItems[rezPacket.InventoryData.ItemID].AssetID);
84 this.OutPacket(objupdate); 87 if (asset != null)
85 client.ClientAvatar.SendAppearanceToOtherAgent(this.ClientAvatar); 88 {
89 this.OnRezObject(asset, rezPacket.RezData.RayEnd);
90 this.m_inventoryCache.DeleteInventoryItem(this, rezPacket.InventoryData.ItemID);
91 }
86 } 92 }
87 } 93 }
88 m_world.GetInitialPrims(this);
89 break;
90 case PacketType.AgentIsNowWearing:
91 AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack;
92 //Console.WriteLine(Pack.ToString());
93 break;
94 case PacketType.AgentSetAppearance:
95 AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack;
96 // Console.WriteLine(appear.ToString());
97 this.ClientAvatar.SetAppearance(appear);
98 break; 94 break;
95 case PacketType.ModifyLand:
96 ModifyLandPacket modify = (ModifyLandPacket)Pack;
97 if (modify.ParcelData.Length > 0)
98 {
99 OnModifyTerrain(modify.ModifyBlock.Action, modify.ParcelData[0].North, modify.ParcelData[0].West);
100 }
101 break;
102
103 case PacketType.RegionHandshakeReply:
104 m_world.SendLayerData(this);
105 OnRegionHandShakeReply(this);
106 break;
107 case PacketType.AgentWearablesRequest:
108 OnRequestWearables(this);
109 //need to move the follow to a event system
110 foreach (ClientView client in m_clientThreads.Values)
111 {
112 if (client.AgentID != this.AgentID)
113 {
114 ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket();
115 this.OutPacket(objupdate);
116 client.ClientAvatar.SendAppearanceToOtherAgent(this.ClientAvatar);
117 }
118 }
119 break;
120 case PacketType.AgentSetAppearance:
121 AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack;
122 // Console.WriteLine(appear.ToString());
123 OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam);
124 break;
125 case PacketType.CompleteAgentMovement:
126 if (this.m_child) this.UpgradeClient();
127 OnCompleteMovementToRegion();
128 this.EnableNeighbours();
129 break;
130 case PacketType.AgentUpdate:
131 OnAgentUpdate(Pack);
132 break;
133 case PacketType.AgentAnimation:
134 if (!m_child)
135 {
136 AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
137 for (int i = 0; i < AgentAni.AnimationList.Length; i++)
138 {
139 if (AgentAni.AnimationList[i].StartAnim)
140 {
141 OnStartAnim(AgentAni.AnimationList[i].AnimID, 1);
142 }
143 }
144 }
145 break;
146 case PacketType.AgentIsNowWearing:
147 // AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack;
148 //Console.WriteLine(Pack.ToString());
149 break;
150 #endregion
151
152 //old handling, should move most to a event based system.
153 #region World/Avatar/Primitive related packets
99 case PacketType.ObjectAdd: 154 case PacketType.ObjectAdd:
100 m_world.AddNewPrim((ObjectAddPacket)Pack, this); 155 m_world.AddNewPrim((ObjectAddPacket)Pack, this);
101 break; 156 break;
@@ -143,8 +198,19 @@ namespace OpenSim
143 } 198 }
144 } 199 }
145 break; 200 break;
146 case PacketType.AgentUpdate: 201 case PacketType.ObjectSelect:
147 ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack); 202 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack;
203 for (int i = 0; i < incomingselect.ObjectData.Length; i++)
204 {
205 foreach (Entity ent in m_world.Entities.Values)
206 {
207 if (ent.localid == incomingselect.ObjectData[i].ObjectLocalID)
208 {
209 ((OpenSim.world.Primitive)ent).GetProperites(this);
210 break;
211 }
212 }
213 }
148 break; 214 break;
149 case PacketType.ObjectImage: 215 case PacketType.ObjectImage:
150 ObjectImagePacket imagePack = (ObjectImagePacket)Pack; 216 ObjectImagePacket imagePack = (ObjectImagePacket)Pack;
@@ -169,35 +235,7 @@ namespace OpenSim
169 } 235 }
170 } 236 }
171 break; 237 break;
172 case PacketType.AgentAnimation: 238
173 if (!m_child)
174 {
175 AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
176 for (int i = 0; i < AgentAni.AnimationList.Length; i++)
177 {
178 if (AgentAni.AnimationList[i].StartAnim)
179 {
180 ClientAvatar.current_anim = AgentAni.AnimationList[i].AnimID;
181 ClientAvatar.anim_seq = 1;
182 ClientAvatar.SendAnimPack();
183 }
184 }
185 }
186 break;
187 case PacketType.ObjectSelect:
188 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack;
189 for (int i = 0; i < incomingselect.ObjectData.Length; i++)
190 {
191 foreach (Entity ent in m_world.Entities.Values)
192 {
193 if (ent.localid == incomingselect.ObjectData[i].ObjectLocalID)
194 {
195 ((OpenSim.world.Primitive)ent).GetProperites(this);
196 break;
197 }
198 }
199 }
200 break;
201 case PacketType.ViewerEffect: 239 case PacketType.ViewerEffect:
202 ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; 240 ViewerEffectPacket viewer = (ViewerEffectPacket)Pack;
203 foreach (ClientView client in m_clientThreads.Values) 241 foreach (ClientView client in m_clientThreads.Values)
diff --git a/OpenSim.RegionServer/ClientView.cs b/OpenSim.RegionServer/ClientView.cs
index a97049d..63bbfab 100644
--- a/OpenSim.RegionServer/ClientView.cs
+++ b/OpenSim.RegionServer/ClientView.cs
@@ -325,6 +325,27 @@ namespace OpenSim
325 325
326 this.OutPacket(reply); 326 this.OutPacket(reply);
327 } 327 }
328
329 public void SendAppearance(AvatarWearable[] wearables)
330 {
331 AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
332 aw.AgentData.AgentID = this.AgentID;
333 aw.AgentData.SerialNum = 0;
334 aw.AgentData.SessionID = this.SessionID;
335
336 aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13];
337 AgentWearablesUpdatePacket.WearableDataBlock awb;
338 for (int i = 0; i < wearables.Length; i++)
339 {
340 awb = new AgentWearablesUpdatePacket.WearableDataBlock();
341 awb.WearableType = (byte)i;
342 awb.AssetID = wearables[i].AssetID;
343 awb.ItemID = wearables[i].ItemID;
344 aw.WearableData[i] = awb;
345 }
346
347 this.OutPacket(aw);
348 }
328 #endregion 349 #endregion
329 350
330 #region Inventory Creation 351 #region Inventory Creation
diff --git a/OpenSim.RegionServer/PacketServer.cs b/OpenSim.RegionServer/PacketServer.cs
index cb7de11..4ebe023 100644
--- a/OpenSim.RegionServer/PacketServer.cs
+++ b/OpenSim.RegionServer/PacketServer.cs
@@ -58,8 +58,6 @@ namespace OpenSim
58 { 58 {
59 if (this._localWorld != null) 59 if (this._localWorld != null)
60 { 60 {
61 ClientView.AddPacketHandler(PacketType.ModifyLand, _localWorld.ModifyTerrain);
62 ClientView.AddPacketHandler(PacketType.RezObject, _localWorld.RezObject);
63 ClientView.AddPacketHandler(PacketType.DeRezObject, _localWorld.DeRezObject); 61 ClientView.AddPacketHandler(PacketType.DeRezObject, _localWorld.DeRezObject);
64 ClientView.AddPacketHandler(PacketType.UUIDNameRequest, this.RequestUUIDName); 62 ClientView.AddPacketHandler(PacketType.UUIDNameRequest, this.RequestUUIDName);
65 } 63 }
diff --git a/OpenSim.RegionServer/world/Avatar.Update.cs b/OpenSim.RegionServer/world/Avatar.Update.cs
index 75f0bb4..ee72ba3 100644
--- a/OpenSim.RegionServer/world/Avatar.Update.cs
+++ b/OpenSim.RegionServer/world/Avatar.Update.cs
@@ -148,25 +148,15 @@ namespace OpenSim.world
148 } 148 }
149 } 149 }
150 150
151 public void SendInitialAppearance() 151 public void SendOurAppearance()
152 { 152 {
153 AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); 153 ControllingClient.SendAppearance(this.Wearables);
154 aw.AgentData.AgentID = this.ControllingClient.AgentID; 154 }
155 aw.AgentData.SerialNum = 0;
156 aw.AgentData.SessionID = ControllingClient.SessionID;
157
158 aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13];
159 AgentWearablesUpdatePacket.WearableDataBlock awb;
160 for (int i = 0; i < 13; i++)
161 {
162 awb = new AgentWearablesUpdatePacket.WearableDataBlock();
163 awb.WearableType = (byte)i;
164 awb.AssetID = this.Wearables[i].AssetID;
165 awb.ItemID = this.Wearables[i].ItemID;
166 aw.WearableData[i] = awb;
167 }
168 155
169 ControllingClient.OutPacket(aw); 156 public void SendOurAppearance(ClientView OurClient)
157 {
158 //event handler for wearables request
159 this.SendOurAppearance();
170 } 160 }
171 161
172 public void SendAppearanceToOtherAgent(Avatar avatarInfo) 162 public void SendAppearanceToOtherAgent(Avatar avatarInfo)
@@ -188,13 +178,14 @@ namespace OpenSim.world
188 avatarInfo.SendPacketToViewer(avp); 178 avatarInfo.SendPacketToViewer(avp);
189 } 179 }
190 180
191 public void SetAppearance(AgentSetAppearancePacket appear) 181 public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam)
192 { 182 {
193 LLObject.TextureEntry tex = new LLObject.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); 183 LLObject.TextureEntry tex = new LLObject.TextureEntry(texture, 0, texture.Length);
194 this.avatarAppearanceTexture = tex; 184 this.avatarAppearanceTexture = tex;
195 for (int i = 0; i < appear.VisualParam.Length; i++) 185
186 for (int i = 0; i < visualParam.Length; i++)
196 { 187 {
197 this.visualParams[i] = appear.VisualParam[i].ParamValue; 188 this.visualParams[i] = visualParam[i].ParamValue;
198 } 189 }
199 190
200 List<Avatar> avList = this.m_world.RequestAvatarList(); 191 List<Avatar> avList = this.m_world.RequestAvatarList();
@@ -291,7 +282,7 @@ namespace OpenSim.world
291 } 282 }
292 283
293 // Sends animation update 284 // Sends animation update
294 public void SendAnimPack() 285 public void SendAnimPack(LLUUID animID, int seq)
295 { 286 {
296 AvatarAnimationPacket ani = new AvatarAnimationPacket(); 287 AvatarAnimationPacket ani = new AvatarAnimationPacket();
297 ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1]; 288 ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1];
@@ -301,8 +292,8 @@ namespace OpenSim.world
301 ani.Sender.ID = ControllingClient.AgentID; 292 ani.Sender.ID = ControllingClient.AgentID;
302 ani.AnimationList = new AvatarAnimationPacket.AnimationListBlock[1]; 293 ani.AnimationList = new AvatarAnimationPacket.AnimationListBlock[1];
303 ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock(); 294 ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock();
304 ani.AnimationList[0].AnimID = this.current_anim; 295 ani.AnimationList[0].AnimID = this.current_anim = animID;
305 ani.AnimationList[0].AnimSequenceID = this.anim_seq; 296 ani.AnimationList[0].AnimSequenceID = this.anim_seq = seq;
306 297
307 List<Avatar> avList = this.m_world.RequestAvatarList(); 298 List<Avatar> avList = this.m_world.RequestAvatarList();
308 foreach (Avatar client in avList) 299 foreach (Avatar client in avList)
@@ -312,5 +303,10 @@ namespace OpenSim.world
312 303
313 } 304 }
314 305
306 public void SendAnimPack()
307 {
308 this.SendAnimPack(this.current_anim, this.anim_seq);
309 }
310
315 } 311 }
316} 312}
diff --git a/OpenSim.RegionServer/world/Avatar.cs b/OpenSim.RegionServer/world/Avatar.cs
index 55e5ae4..4e90364 100644
--- a/OpenSim.RegionServer/world/Avatar.cs
+++ b/OpenSim.RegionServer/world/Avatar.cs
@@ -64,6 +64,14 @@ namespace OpenSim.world
64 64
65 this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); 65 this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
66 66
67 //register for events
68 ControllingClient.OnRequestWearables += new ClientView.GenericCall(this.SendOurAppearance);
69 ControllingClient.OnSetAppearance += new ClientView.SetAppearance(this.SetAppearance);
70 ControllingClient.OnCompleteMovementToRegion += new ClientView.GenericCall2(this.CompleteMovement);
71 ControllingClient.OnCompleteMovementToRegion += new ClientView.GenericCall2(this.SendInitialPosition);
72 ControllingClient.OnAgentUpdate += new ClientView.GenericCall3(this.HandleAgentUpdate);
73 ControllingClient.OnStartAnim += new ClientView.StartAnim(this.SendAnimPack);
74
67 } 75 }
68 76
69 public PhysicsActor PhysActor 77 public PhysicsActor PhysActor
@@ -170,7 +178,7 @@ namespace OpenSim.world
170 178
171 } 179 }
172 180
173 public void CompleteMovement(World RegionInfo) 181 public void CompleteMovement()
174 { 182 {
175 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE,"Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet"); 183 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE,"Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet");
176 AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); 184 AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
@@ -185,6 +193,11 @@ namespace OpenSim.world
185 ControllingClient.OutPacket(mov); 193 ControllingClient.OutPacket(mov);
186 } 194 }
187 195
196 public void HandleAgentUpdate(Packet pack)
197 {
198 this.HandleUpdate((AgentUpdatePacket)pack);
199 }
200
188 public void HandleUpdate(AgentUpdatePacket pack) 201 public void HandleUpdate(AgentUpdatePacket pack)
189 { 202 {
190 if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0) 203 if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0)
diff --git a/OpenSim.RegionServer/world/World.PacketHandlers.cs b/OpenSim.RegionServer/world/World.PacketHandlers.cs
index 27f200f..d12013a 100644
--- a/OpenSim.RegionServer/world/World.PacketHandlers.cs
+++ b/OpenSim.RegionServer/world/World.PacketHandlers.cs
@@ -15,31 +15,22 @@ namespace OpenSim.world
15{ 15{
16 public partial class World 16 public partial class World
17 { 17 {
18 18 public void ModifyTerrain(byte Action, float North, float West)
19 public bool ModifyTerrain(ClientView simClient, Packet packet)
20 { 19 {
21 ModifyLandPacket modify = (ModifyLandPacket)packet; 20 switch (Action)
22
23 switch (modify.ModifyBlock.Action)
24 { 21 {
25 case 1: 22 case 1:
26 // raise terrain 23 // raise terrain
27 if (modify.ParcelData.Length > 0) 24 Terrain.raise(North, West, 10.0, 0.1);
28 { 25 RegenerateTerrain(true, (int)North, (int)West);
29 Terrain.raise(modify.ParcelData[0].North, modify.ParcelData[0].West, 10.0, 0.1);
30 RegenerateTerrain(true, (int)modify.ParcelData[0].North, (int)modify.ParcelData[0].West);
31 }
32 break; 26 break;
33 case 2: 27 case 2:
34 //lower terrain 28 //lower terrain
35 if (modify.ParcelData.Length > 0) 29 Terrain.lower(North, West, 10.0, 0.1);
36 { 30 RegenerateTerrain(true, (int)North, (int)West);
37 Terrain.lower(modify.ParcelData[0].North, modify.ParcelData[0].West, 10.0, 0.1);
38 RegenerateTerrain(true, (int)modify.ParcelData[0].North, (int)modify.ParcelData[0].West);
39 }
40 break; 31 break;
41 } 32 }
42 return true; 33 return;
43 } 34 }
44 35
45 public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 36 public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
@@ -79,27 +70,13 @@ namespace OpenSim.world
79 } 70 }
80 } 71 }
81 72
82 public bool RezObject(ClientView simClient, Packet packet) 73 public void RezObject(AssetBase primasset, LLVector3 pos)
83 { 74 {
84 RezObjectPacket rezPacket = (RezObjectPacket)packet; 75 PrimData primd = new PrimData(primasset.Data);
85 AgentInventory inven = this._inventoryCache.GetAgentsInventory(simClient.AgentID); 76 Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this);
86 if (inven != null) 77 nPrim.CreateFromStorage(primd, pos, this._primCount, true);
87 { 78 this.Entities.Add(nPrim.uuid, nPrim);
88 if (inven.InventoryItems.ContainsKey(rezPacket.InventoryData.ItemID)) 79 this._primCount++;
89 {
90 AssetBase asset = this._assetCache.GetAsset(inven.InventoryItems[rezPacket.InventoryData.ItemID].AssetID);
91 if (asset != null)
92 {
93 PrimData primd = new PrimData(asset.Data);
94 Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this);
95 nPrim.CreateFromStorage(primd, rezPacket.RezData.RayEnd, this._primCount, true);
96 this.Entities.Add(nPrim.uuid, nPrim);
97 this._primCount++;
98 this._inventoryCache.DeleteInventoryItem(simClient, rezPacket.InventoryData.ItemID);
99 }
100 }
101 }
102 return true;
103 } 80 }
104 81
105 public bool DeRezObject(ClientView simClient, Packet packet) 82 public bool DeRezObject(ClientView simClient, Packet packet)
@@ -191,6 +168,7 @@ namespace OpenSim.world
191 return true; 168 return true;
192 } 169 }
193 170
171 /*
194 public void RequestMapBlock(ClientView simClient, int minX, int minY, int maxX, int maxY) 172 public void RequestMapBlock(ClientView simClient, int minX, int minY, int maxX, int maxY)
195 { 173 {
196 System.Text.Encoding _enc = System.Text.Encoding.ASCII; 174 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
@@ -212,6 +190,54 @@ namespace OpenSim.world
212 simClient.OutPacket(mapReply); 190 simClient.OutPacket(mapReply);
213 } 191 }
214 } 192 }
193 public bool RezObjectHandler(ClientView simClient, Packet packet)
194 {
195 RezObjectPacket rezPacket = (RezObjectPacket)packet;
196 AgentInventory inven = this._inventoryCache.GetAgentsInventory(simClient.AgentID);
197 if (inven != null)
198 {
199 if (inven.InventoryItems.ContainsKey(rezPacket.InventoryData.ItemID))
200 {
201 AssetBase asset = this._assetCache.GetAsset(inven.InventoryItems[rezPacket.InventoryData.ItemID].AssetID);
202 if (asset != null)
203 {
204 PrimData primd = new PrimData(asset.Data);
205 Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this);
206 nPrim.CreateFromStorage(primd, rezPacket.RezData.RayEnd, this._primCount, true);
207 this.Entities.Add(nPrim.uuid, nPrim);
208 this._primCount++;
209 this._inventoryCache.DeleteInventoryItem(simClient, rezPacket.InventoryData.ItemID);
210 }
211 }
212 }
213 return true;
214 }
215 public bool ModifyTerrain(ClientView simClient, Packet packet)
216 {
217 ModifyLandPacket modify = (ModifyLandPacket)packet;
218
219 switch (modify.ModifyBlock.Action)
220 {
221 case 1:
222 // raise terrain
223 if (modify.ParcelData.Length > 0)
224 {
225 Terrain.raise(modify.ParcelData[0].North, modify.ParcelData[0].West, 10.0, 0.1);
226 RegenerateTerrain(true, (int)modify.ParcelData[0].North, (int)modify.ParcelData[0].West);
227 }
228 break;
229 case 2:
230 //lower terrain
231 if (modify.ParcelData.Length > 0)
232 {
233 Terrain.lower(modify.ParcelData[0].North, modify.ParcelData[0].West, 10.0, 0.1);
234 RegenerateTerrain(true, (int)modify.ParcelData[0].North, (int)modify.ParcelData[0].West);
235 }
236 break;
237 }
238 return true;
239 }
240 */
215 241
216 } 242 }
217} 243}
diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs
index c90e3f6..70ca680 100644
--- a/OpenSim.RegionServer/world/World.cs
+++ b/OpenSim.RegionServer/world/World.cs
@@ -532,7 +532,12 @@ namespace OpenSim.world
532 532
533 public override void AddViewerAgent(ClientView agentClient) 533 public override void AddViewerAgent(ClientView agentClient)
534 { 534 {
535 //register for events
535 agentClient.OnChatFromViewer += new ClientView.ChatFromViewer(this.SimChat); 536 agentClient.OnChatFromViewer += new ClientView.ChatFromViewer(this.SimChat);
537 agentClient.OnRezObject += new ClientView.RezObject(this.RezObject);
538 agentClient.OnModifyTerrain += new ClientView.ModifyTerrain(this.ModifyTerrain);
539 agentClient.OnRegionHandShakeReply += new ClientView.GenericCall(this.SendLayerData);
540 agentClient.OnRequestWearables += new ClientView.GenericCall(this.GetInitialPrims);
536 try 541 try
537 { 542 {
538 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); 543 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");