aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/world
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim.RegionServer/world')
-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
4 files changed, 101 insertions, 61 deletions
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");