aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/world/Avatar.Update.cs
diff options
context:
space:
mode:
authorMW2007-05-21 16:06:58 +0000
committerMW2007-05-21 16:06:58 +0000
commitfe46b045f75dec5ecdd0a29273c70df3e6ea540e (patch)
tree554c0fb47e513fc6a89f496d99b7b67de24edde7 /OpenSim.RegionServer/world/Avatar.Update.cs
parentIncreased version number to 0.2! ZOMG! (diff)
downloadopensim-SC_OLD-fe46b045f75dec5ecdd0a29273c70df3e6ea540e.zip
opensim-SC_OLD-fe46b045f75dec5ecdd0a29273c70df3e6ea540e.tar.gz
opensim-SC_OLD-fe46b045f75dec5ecdd0a29273c70df3e6ea540e.tar.bz2
opensim-SC_OLD-fe46b045f75dec5ecdd0a29273c70df3e6ea540e.tar.xz
Start of a redesign of SimClient (now renamed ClientView)/World/Avatar/Prim , switching to a event based system (World/Avatar register as event handlers). It is possible that I've broke something with this commit but it doesn't matter as I'll just hide and no one will find me.
Diffstat (limited to 'OpenSim.RegionServer/world/Avatar.Update.cs')
-rw-r--r--OpenSim.RegionServer/world/Avatar.Update.cs57
1 files changed, 21 insertions, 36 deletions
diff --git a/OpenSim.RegionServer/world/Avatar.Update.cs b/OpenSim.RegionServer/world/Avatar.Update.cs
index ba2965d..75f0bb4 100644
--- a/OpenSim.RegionServer/world/Avatar.Update.cs
+++ b/OpenSim.RegionServer/world/Avatar.Update.cs
@@ -28,9 +28,10 @@ namespace OpenSim.world
28 terse.RegionData.TimeDilation = 64096; 28 terse.RegionData.TimeDilation = 64096;
29 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; 29 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
30 terse.ObjectData[0] = terseBlock; 30 terse.ObjectData[0] = terseBlock;
31 foreach (SimClient client in m_clientThreads.Values) 31 List<Avatar> avList = this.m_world.RequestAvatarList();
32 foreach (Avatar client in avList)
32 { 33 {
33 client.OutPacket(terse); 34 client.SendPacketToViewer(terse);
34 } 35 }
35 36
36 updateflag = false; 37 updateflag = false;
@@ -51,9 +52,10 @@ namespace OpenSim.world
51 terse.RegionData.TimeDilation = 64096; 52 terse.RegionData.TimeDilation = 64096;
52 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; 53 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
53 terse.ObjectData[0] = terseBlock; 54 terse.ObjectData[0] = terseBlock;
54 foreach (SimClient client in m_clientThreads.Values) 55 List<Avatar> avList = this.m_world.RequestAvatarList();
56 foreach (Avatar client in avList)
55 { 57 {
56 client.OutPacket(terse); 58 client.SendPacketToViewer(terse);
57 } 59 }
58 _updateCount = 0; 60 _updateCount = 0;
59 } 61 }
@@ -134,15 +136,13 @@ namespace OpenSim.world
134 byte[] pb = pos2.GetBytes(); 136 byte[] pb = pos2.GetBytes();
135 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); 137 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
136 m_world._localNumber++; 138 m_world._localNumber++;
137 foreach (SimClient client in m_clientThreads.Values) 139
140 List<Avatar> avList = this.m_world.RequestAvatarList();
141 foreach (Avatar client in avList)
138 { 142 {
139 client.OutPacket(objupdate); 143 client.SendPacketToViewer(objupdate);
140 if (client.AgentID != ControllingClient.AgentID) 144 if (client.ControllingClient.AgentID != this.ControllingClient.AgentID)
141 { 145 {
142 //the below line is already in Simclient.cs at line number 245 , directly below the call to this method
143 //if there is a problem/bug with that , then lets fix it there rather than duplicating it here
144 //client.ClientAvatar.SendAppearanceToOtherAgent(this.ControllingClient);
145
146 SendAppearanceToOtherAgent(client); 146 SendAppearanceToOtherAgent(client);
147 } 147 }
148 } 148 }
@@ -169,30 +169,12 @@ namespace OpenSim.world
169 ControllingClient.OutPacket(aw); 169 ControllingClient.OutPacket(aw);
170 } 170 }
171 171
172 public void SendAppearanceToOtherAgent(SimClient userInfo) 172 public void SendAppearanceToOtherAgent(Avatar avatarInfo)
173 { 173 {
174 AvatarAppearancePacket avp = new AvatarAppearancePacket(); 174 AvatarAppearancePacket avp = new AvatarAppearancePacket();
175 avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; 175 avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218];
176 avp.ObjectData.TextureEntry = this.avatarAppearanceTexture.ToBytes(); 176 avp.ObjectData.TextureEntry = this.avatarAppearanceTexture.ToBytes();
177 177
178 //a wearable update packets should only be sent about the viewers/agents own avatar not for other avatars
179 //but it seems that the following code only created the packets and never actually sent them anyway
180 /*AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
181 aw.AgentData.AgentID = this.ControllingClient.AgentID;
182 aw.AgentData.SessionID = userInfo.SessionID;
183 aw.AgentData.SerialNum = 0; //removed the use of a random number as a random number could be less than the last number, should have a counter variable for this
184
185 aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13];
186 AgentWearablesUpdatePacket.WearableDataBlock awb;
187 for (int i = 0; i < 13; i++)
188 {
189 awb = new AgentWearablesUpdatePacket.WearableDataBlock();
190 awb.WearableType = (byte)i;
191 awb.AssetID = this.Wearables[i].AssetID;
192 awb.ItemID = this.Wearables[i].ItemID;
193 aw.WearableData[i] = awb;
194 }*/
195
196 AvatarAppearancePacket.VisualParamBlock avblock = null; 178 AvatarAppearancePacket.VisualParamBlock avblock = null;
197 for (int i = 0; i < 218; i++) 179 for (int i = 0; i < 218; i++)
198 { 180 {
@@ -203,7 +185,7 @@ namespace OpenSim.world
203 185
204 avp.Sender.IsTrial = false; 186 avp.Sender.IsTrial = false;
205 avp.Sender.ID = ControllingClient.AgentID; 187 avp.Sender.ID = ControllingClient.AgentID;
206 userInfo.OutPacket(avp); 188 avatarInfo.SendPacketToViewer(avp);
207 } 189 }
208 190
209 public void SetAppearance(AgentSetAppearancePacket appear) 191 public void SetAppearance(AgentSetAppearancePacket appear)
@@ -214,9 +196,11 @@ namespace OpenSim.world
214 { 196 {
215 this.visualParams[i] = appear.VisualParam[i].ParamValue; 197 this.visualParams[i] = appear.VisualParam[i].ParamValue;
216 } 198 }
217 foreach (SimClient client in m_clientThreads.Values) 199
200 List<Avatar> avList = this.m_world.RequestAvatarList();
201 foreach (Avatar client in avList)
218 { 202 {
219 if (client.AgentID != ControllingClient.AgentID) 203 if (client.ControllingClient.AgentID != this.ControllingClient.AgentID)
220 { 204 {
221 SendAppearanceToOtherAgent(client); 205 SendAppearanceToOtherAgent(client);
222 } 206 }
@@ -320,11 +304,12 @@ namespace OpenSim.world
320 ani.AnimationList[0].AnimID = this.current_anim; 304 ani.AnimationList[0].AnimID = this.current_anim;
321 ani.AnimationList[0].AnimSequenceID = this.anim_seq; 305 ani.AnimationList[0].AnimSequenceID = this.anim_seq;
322 306
323 //ControllingClient.OutPacket(ani); 307 List<Avatar> avList = this.m_world.RequestAvatarList();
324 foreach (SimClient client in m_clientThreads.Values) 308 foreach (Avatar client in avList)
325 { 309 {
326 client.OutPacket(ani); 310 client.SendPacketToViewer(ani);
327 } 311 }
312
328 } 313 }
329 314
330 } 315 }