aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/ClientView.ProcessPackets.cs
diff options
context:
space:
mode:
authorMW2007-05-24 12:16:50 +0000
committerMW2007-05-24 12:16:50 +0000
commit3376b82501000692d6dac24b051af738cdaf2737 (patch)
tree90ed0a5d4955236f011fa63fce9d555186b0d179 /OpenSim.RegionServer/ClientView.ProcessPackets.cs
parentAdded "terrain save grdmap <filename> <gradientmap>" function to console. Gra... (diff)
downloadopensim-SC_OLD-3376b82501000692d6dac24b051af738cdaf2737.zip
opensim-SC_OLD-3376b82501000692d6dac24b051af738cdaf2737.tar.gz
opensim-SC_OLD-3376b82501000692d6dac24b051af738cdaf2737.tar.bz2
opensim-SC_OLD-3376b82501000692d6dac24b051af738cdaf2737.tar.xz
Some more code refactoring, plus a restructuring of the directories so that the Grid servers can be a separate solution to the region server.
Diffstat (limited to '')
-rw-r--r--OpenSim-Source/OpenSim.RegionServer/ClientView.ProcessPackets.cs (renamed from OpenSim.RegionServer/ClientView.ProcessPackets.cs)218
1 files changed, 100 insertions, 118 deletions
diff --git a/OpenSim.RegionServer/ClientView.ProcessPackets.cs b/OpenSim-Source/OpenSim.RegionServer/ClientView.ProcessPackets.cs
index a78f27a..a6ad8d2 100644
--- a/OpenSim.RegionServer/ClientView.ProcessPackets.cs
+++ b/OpenSim-Source/OpenSim.RegionServer/ClientView.ProcessPackets.cs
@@ -20,17 +20,20 @@ namespace OpenSim
20{ 20{
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 GenericCall(ClientView remoteClient);
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(); 24 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 public delegate void GenericCall3(Packet packet); // really don't want to be passing packets in these events, so this is very temporary.
26 public delegate void GenericCall4(Packet packet, ClientView remoteClient);
27 public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock);
28 public delegate void ObjectSelect(uint localID, ClientView remoteClient);
29 public delegate void UpdatePrimFlags(uint localID, Packet packet, ClientView remoteClient);
30 public delegate void UpdatePrimTexture(uint localID, byte[] texture, ClientView remoteClient);
31 public delegate void UpdatePrimVector(uint localID, LLVector3 pos, ClientView remoteClient);
32 public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, ClientView remoteClient);
31 33
32 public event ChatFromViewer OnChatFromViewer; 34 public event ChatFromViewer OnChatFromViewer;
33 public event RezObject OnRezObject; 35 public event RezObject OnRezObject;
36 public event GenericCall4 OnDeRezObject;
34 public event ModifyTerrain OnModifyTerrain; 37 public event ModifyTerrain OnModifyTerrain;
35 public event GenericCall OnRegionHandShakeReply; 38 public event GenericCall OnRegionHandShakeReply;
36 public event GenericCall OnRequestWearables; 39 public event GenericCall OnRequestWearables;
@@ -39,6 +42,15 @@ namespace OpenSim
39 public event GenericCall3 OnAgentUpdate; 42 public event GenericCall3 OnAgentUpdate;
40 public event StartAnim OnStartAnim; 43 public event StartAnim OnStartAnim;
41 public event GenericCall OnRequestAvatarsData; 44 public event GenericCall OnRequestAvatarsData;
45 public event LinkObjects OnLinkObjects;
46 public event GenericCall4 OnAddPrim;
47 public event UpdateShape OnUpdatePrimShape;
48 public event ObjectSelect OnObjectSelect;
49 public event UpdatePrimFlags OnUpdatePrimFlags;
50 public event UpdatePrimTexture OnUpdatePrimTexture;
51 public event UpdatePrimVector OnUpdatePrimPosition;
52 public event UpdatePrimRotation OnUpdatePrimRotation;
53 public event UpdatePrimVector OnUpdatePrimScale;
42 54
43 protected override void ProcessInPacket(Packet Pack) 55 protected override void ProcessInPacket(Packet Pack)
44 { 56 {
@@ -62,7 +74,20 @@ namespace OpenSim
62 74
63 switch (Pack.Type) 75 switch (Pack.Type)
64 { 76 {
65 #region New Event system 77 case PacketType.ViewerEffect:
78 ViewerEffectPacket viewer = (ViewerEffectPacket)Pack;
79 foreach (ClientView client in m_clientThreads.Values)
80 {
81 if (client.AgentID != this.AgentID)
82 {
83 viewer.AgentData.AgentID = client.AgentID;
84 viewer.AgentData.SessionID = client.SessionID;
85 client.OutPacket(viewer);
86 }
87 }
88 break;
89
90 #region New Event System - World/Avatar
66 case PacketType.ChatFromViewer: 91 case PacketType.ChatFromViewer:
67 ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; 92 ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack;
68 if (Util.FieldToString(inchatpack.ChatData.Message) == "") 93 if (Util.FieldToString(inchatpack.ChatData.Message) == "")
@@ -93,153 +118,100 @@ namespace OpenSim
93 } 118 }
94 } 119 }
95 break; 120 break;
121 case PacketType.DeRezObject:
122 OnDeRezObject(Pack, this);
123 break;
96 case PacketType.ModifyLand: 124 case PacketType.ModifyLand:
97 ModifyLandPacket modify = (ModifyLandPacket)Pack; 125 ModifyLandPacket modify = (ModifyLandPacket)Pack;
98 if (modify.ParcelData.Length > 0) 126 if (modify.ParcelData.Length > 0)
99 { 127 {
100 OnModifyTerrain(modify.ModifyBlock.Action, modify.ParcelData[0].North, modify.ParcelData[0].West); 128 OnModifyTerrain(modify.ModifyBlock.Action, modify.ParcelData[0].North, modify.ParcelData[0].West);
101 } 129 }
102 break; 130 break;
131 case PacketType.RegionHandshakeReply:
132 OnRegionHandShakeReply(this);
133 break;
134 case PacketType.AgentWearablesRequest:
135 OnRequestWearables(this);
136 OnRequestAvatarsData(this);
137 break;
138 case PacketType.AgentSetAppearance:
139 AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack;
140 OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam);
141 break;
142 case PacketType.CompleteAgentMovement:
143 if (this.m_child) this.UpgradeClient();
144 OnCompleteMovementToRegion();
145 this.EnableNeighbours();
146 break;
147 case PacketType.AgentUpdate:
148 OnAgentUpdate(Pack);
149 break;
150 case PacketType.AgentAnimation:
151 if (!m_child)
152 {
153 AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
154 for (int i = 0; i < AgentAni.AnimationList.Length; i++)
155 {
156 if (AgentAni.AnimationList[i].StartAnim)
157 {
158 OnStartAnim(AgentAni.AnimationList[i].AnimID, 1);
159 }
160 }
161 }
162 break;
103 163
104 case PacketType.RegionHandshakeReply:
105 OnRegionHandShakeReply(this);
106 break;
107 case PacketType.AgentWearablesRequest:
108 OnRequestWearables(this);
109 OnRequestAvatarsData(this);
110 break;
111 case PacketType.AgentSetAppearance:
112 AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack;
113 OnSetAppearance(appear.ObjectData.TextureEntry, appear.VisualParam);
114 break;
115 case PacketType.CompleteAgentMovement:
116 if (this.m_child) this.UpgradeClient();
117 OnCompleteMovementToRegion();
118 this.EnableNeighbours();
119 break;
120 case PacketType.AgentUpdate:
121 OnAgentUpdate(Pack);
122 break;
123 case PacketType.AgentAnimation:
124 if (!m_child)
125 {
126 AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
127 for (int i = 0; i < AgentAni.AnimationList.Length; i++)
128 {
129 if (AgentAni.AnimationList[i].StartAnim)
130 {
131 OnStartAnim(AgentAni.AnimationList[i].AnimID, 1);
132 }
133 }
134 }
135 break;
136 case PacketType.AgentIsNowWearing:
137 // AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack;
138 //Console.WriteLine(Pack.ToString());
139 break;
140 #endregion 164 #endregion
141 165
142 //old handling, should move most to a event based system. 166 #region New Event System - Objects/Prims
143 #region World/Avatar/Primitive related packets
144 case PacketType.ObjectAdd:
145 m_world.AddNewPrim((ObjectAddPacket)Pack, this);
146 break;
147 case PacketType.ObjectLink: 167 case PacketType.ObjectLink:
148 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, Pack.ToString()); 168 // OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, Pack.ToString());
149 ObjectLinkPacket link = (ObjectLinkPacket)Pack; 169 ObjectLinkPacket link = (ObjectLinkPacket)Pack;
150 uint parentprimid = 0; 170 uint parentprimid = 0;
151 OpenSim.world.Primitive parentprim = null; 171 List<uint> childrenprims = new List<uint>();
152 if (link.ObjectData.Length > 1) 172 if (link.ObjectData.Length > 1)
153 { 173 {
154 parentprimid = link.ObjectData[0].ObjectLocalID; 174 parentprimid = link.ObjectData[0].ObjectLocalID;
155 foreach (Entity ent in m_world.Entities.Values)
156 {
157 if (ent.localid == parentprimid)
158 {
159 parentprim = (OpenSim.world.Primitive)ent;
160 175
161 }
162 }
163 for (int i = 1; i < link.ObjectData.Length; i++) 176 for (int i = 1; i < link.ObjectData.Length; i++)
164 { 177 {
165 foreach (Entity ent in m_world.Entities.Values) 178 childrenprims.Add(link.ObjectData[i].ObjectLocalID);
166 {
167 if (ent.localid == link.ObjectData[i].ObjectLocalID)
168 {
169 ((OpenSim.world.Primitive)ent).MakeParent(parentprim);
170 }
171 }
172 } 179 }
173 } 180 }
181 OnLinkObjects(parentprimid, childrenprims);
174 break; 182 break;
175 case PacketType.ObjectScale: 183 case PacketType.ObjectAdd:
176 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, Pack.ToString()); 184 m_world.AddNewPrim((ObjectAddPacket)Pack, this);
185 OnAddPrim(Pack, this);
177 break; 186 break;
178 case PacketType.ObjectShape: 187 case PacketType.ObjectShape:
179 ObjectShapePacket shape = (ObjectShapePacket)Pack; 188 ObjectShapePacket shape = (ObjectShapePacket)Pack;
180 for (int i = 0; i < shape.ObjectData.Length; i++) 189 for (int i = 0; i < shape.ObjectData.Length; i++)
181 { 190 {
182 foreach (Entity ent in m_world.Entities.Values) 191 OnUpdatePrimShape(shape.ObjectData[i].ObjectLocalID, shape.ObjectData[i]);
183 {
184 if (ent.localid == shape.ObjectData[i].ObjectLocalID)
185 {
186 ((OpenSim.world.Primitive)ent).UpdateShape(shape.ObjectData[i]);
187 }
188 }
189 } 192 }
190 break; 193 break;
191 case PacketType.ObjectSelect: 194 case PacketType.ObjectSelect:
192 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; 195 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack;
193 for (int i = 0; i < incomingselect.ObjectData.Length; i++) 196 for (int i = 0; i < incomingselect.ObjectData.Length; i++)
194 { 197 {
195 foreach (Entity ent in m_world.Entities.Values) 198 OnObjectSelect(incomingselect.ObjectData[i].ObjectLocalID, this);
196 {
197 if (ent.localid == incomingselect.ObjectData[i].ObjectLocalID)
198 {
199 ((OpenSim.world.Primitive)ent).GetProperites(this);
200 break;
201 }
202 }
203 } 199 }
204 break; 200 break;
201 case PacketType.ObjectFlagUpdate:
202 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack;
203 OnUpdatePrimFlags(flags.AgentData.ObjectLocalID, Pack, this);
204 break;
205 case PacketType.ObjectImage: 205 case PacketType.ObjectImage:
206 ObjectImagePacket imagePack = (ObjectImagePacket)Pack; 206 ObjectImagePacket imagePack = (ObjectImagePacket)Pack;
207 for (int i = 0; i < imagePack.ObjectData.Length; i++) 207 for (int i = 0; i < imagePack.ObjectData.Length; i++)
208 { 208 {
209 foreach (Entity ent in m_world.Entities.Values) 209 OnUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID, imagePack.ObjectData[i].TextureEntry, this);
210 { 210
211 if (ent.localid == imagePack.ObjectData[i].ObjectLocalID)
212 {
213 ((OpenSim.world.Primitive)ent).UpdateTexture(imagePack.ObjectData[i].TextureEntry);
214 }
215 }
216 }
217 break;
218 case PacketType.ObjectFlagUpdate:
219 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack;
220 foreach (Entity ent in m_world.Entities.Values)
221 {
222 if (ent.localid == flags.AgentData.ObjectLocalID)
223 {
224 ((OpenSim.world.Primitive)ent).UpdateObjectFlags(flags);
225 }
226 } 211 }
227 break; 212 break;
213 #endregion
228 214
229 case PacketType.ViewerEffect:
230 ViewerEffectPacket viewer = (ViewerEffectPacket)Pack;
231 foreach (ClientView client in m_clientThreads.Values)
232 {
233 if (client.AgentID != this.AgentID)
234 {
235 viewer.AgentData.AgentID = client.AgentID;
236 viewer.AgentData.SessionID = client.SessionID;
237 client.OutPacket(viewer);
238 }
239 }
240 break;
241 #endregion
242
243 #region Inventory/Asset/Other related packets 215 #region Inventory/Asset/Other related packets
244 case PacketType.RequestImage: 216 case PacketType.RequestImage:
245 RequestImagePacket imageRequest = (RequestImagePacket)Pack; 217 RequestImagePacket imageRequest = (RequestImagePacket)Pack;
@@ -464,6 +436,16 @@ namespace OpenSim
464 } 436 }
465 break; 437 break;
466 #endregion 438 #endregion
439
440 #region unimplemented handlers
441 case PacketType.AgentIsNowWearing:
442 // AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack;
443 //Console.WriteLine(Pack.ToString());
444 break;
445 case PacketType.ObjectScale:
446 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, Pack.ToString());
447 break;
448 #endregion
467 } 449 }
468 } 450 }
469 } 451 }