aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/ClientView.ProcessPackets.cs
diff options
context:
space:
mode:
authorMW2007-05-21 19:12:18 +0000
committerMW2007-05-21 19:12:18 +0000
commitf96083a903024550243ada885c8edccad7e0eed7 (patch)
treee789d0d973490b0d5fdca86a41bacf319fe80f31 /OpenSim.RegionServer/ClientView.ProcessPackets.cs
parentMerged the new ODE stuff (diff)
downloadopensim-SC_OLD-f96083a903024550243ada885c8edccad7e0eed7.zip
opensim-SC_OLD-f96083a903024550243ada885c8edccad7e0eed7.tar.gz
opensim-SC_OLD-f96083a903024550243ada885c8edccad7e0eed7.tar.bz2
opensim-SC_OLD-f96083a903024550243ada885c8edccad7e0eed7.tar.xz
More work on adding Events to ClientView (and registering to handle those events in Avatar and World)
Diffstat (limited to 'OpenSim.RegionServer/ClientView.ProcessPackets.cs')
-rw-r--r--OpenSim.RegionServer/ClientView.ProcessPackets.cs160
1 files changed, 99 insertions, 61 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)