aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/world/Avatar.cs
diff options
context:
space:
mode:
authorMW2007-03-07 20:18:20 +0000
committerMW2007-03-07 20:18:20 +0000
commit48b05c6784e8e3c647b4efc8ffdee7c51b59251f (patch)
tree74b45ca30273152b2ee5b1cfc3a73cc3c8f4b4e8 /src/world/Avatar.cs
parentfixed genvers.sh (diff)
downloadopensim-SC_OLD-48b05c6784e8e3c647b4efc8ffdee7c51b59251f.zip
opensim-SC_OLD-48b05c6784e8e3c647b4efc8ffdee7c51b59251f.tar.gz
opensim-SC_OLD-48b05c6784e8e3c647b4efc8ffdee7c51b59251f.tar.bz2
opensim-SC_OLD-48b05c6784e8e3c647b4efc8ffdee7c51b59251f.tar.xz
Hopefully fixed the Session logout bug.
Should now see avatars for other users connected to the same sim.
Diffstat (limited to 'src/world/Avatar.cs')
-rw-r--r--src/world/Avatar.cs69
1 files changed, 63 insertions, 6 deletions
diff --git a/src/world/Avatar.cs b/src/world/Avatar.cs
index c8469f8..1a53acc 100644
--- a/src/world/Avatar.cs
+++ b/src/world/Avatar.cs
@@ -15,7 +15,7 @@ namespace OpenSim.world
15 public string lastname; 15 public string lastname;
16 public OpenSimClient ControllingClient; 16 public OpenSimClient ControllingClient;
17 private PhysicsActor _physActor; 17 private PhysicsActor _physActor;
18 private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; 18 private static libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
19 private bool updateflag; 19 private bool updateflag;
20 private bool walking; 20 private bool walking;
21 private List<NewForce> forcesList = new List<NewForce>(); 21 private List<NewForce> forcesList = new List<NewForce>();
@@ -24,7 +24,6 @@ namespace OpenSim.world
24 public Avatar(OpenSimClient TheClient) { 24 public Avatar(OpenSimClient TheClient) {
25 ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); 25 ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
26 ControllingClient=TheClient; 26 ControllingClient=TheClient;
27 SetupTemplate("avatar-template.dat");
28 position = new LLVector3(100.0f,100.0f,30.0f); 27 position = new LLVector3(100.0f,100.0f,30.0f);
29 position.Z = OpenSim_Main.local_world.LandMap[(int)position.Y * 256 + (int)position.X]+1; 28 position.Z = OpenSim_Main.local_world.LandMap[(int)position.Y * 256 + (int)position.X]+1;
30 } 29 }
@@ -103,7 +102,7 @@ namespace OpenSim.world
103 } 102 }
104 } 103 }
105 104
106 private void SetupTemplate(string name) 105 public static void SetupTemplate(string name)
107 { 106 {
108 107
109 int i = 0; 108 int i = 0;
@@ -127,7 +126,7 @@ namespace OpenSim.world
127 byte[] pb = pos.GetBytes(); 126 byte[] pb = pos.GetBytes();
128 Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length); 127 Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length);
129 128
130 AvatarTemplate = objdata; 129 Avatar.AvatarTemplate = objdata;
131 130
132 } 131 }
133 132
@@ -166,7 +165,16 @@ namespace OpenSim.world
166 165
167 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); 166 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
168 OpenSim_Main.local_world._localNumber++; 167 OpenSim_Main.local_world._localNumber++;
169 this.ControllingClient.OutPacket(objupdate); 168
169 foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values)
170 {
171 client.OutPacket(objupdate);
172 if(client.AgentID != ControllingClient.AgentID)
173 {
174 SendAppearanceToOtherAgent(client);
175 }
176 }
177 //this.ControllingClient.OutPacket(objupdate);
170 } 178 }
171 179
172 public void SendInitialAppearance() { 180 public void SendInitialAppearance() {
@@ -182,7 +190,8 @@ namespace OpenSim.world
182 awb.ItemID = LLUUID.Random(); 190 awb.ItemID = LLUUID.Random();
183 aw.WearableData[0] = awb; 191 aw.WearableData[0] = awb;
184 192
185 for(int i=1; i<13; i++) { 193 for(int i=1; i<13; i++)
194 {
186 awb = new AgentWearablesUpdatePacket.WearableDataBlock(); 195 awb = new AgentWearablesUpdatePacket.WearableDataBlock();
187 awb.WearableType = (byte)i; 196 awb.WearableType = (byte)i;
188 awb.AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); 197 awb.AssetID = new LLUUID("00000000-0000-0000-0000-000000000000");
@@ -193,6 +202,54 @@ namespace OpenSim.world
193 ControllingClient.OutPacket(aw); 202 ControllingClient.OutPacket(aw);
194 } 203 }
195 204
205 public ObjectUpdatePacket CreateUpdatePacket()
206 {
207 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
208 //send a objectupdate packet with information about the clients avatar
209 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
210 objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle;
211 objupdate.RegionData.TimeDilation = 64096;
212 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
213
214 objupdate.ObjectData[0] = AvatarTemplate;
215 //give this avatar object a local id and assign the user a name
216 objupdate.ObjectData[0].ID = this.localid;
217 objupdate.ObjectData[0].FullID = ControllingClient.AgentID;
218 objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0");
219
220 libsecondlife.LLVector3 pos2 = new LLVector3((float)this._physActor.Position.X, (float)this._physActor.Position.Y, (float)this._physActor.Position.Z);
221
222 byte[] pb = pos2.GetBytes();
223
224 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
225 return objupdate;
226 }
227
228 public void SendAppearanceToOtherAgent(OpenSimClient userInfo)
229 {
230 AvatarAppearancePacket avp = new AvatarAppearancePacket();
231
232
233 avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218];
234 //avp.ObjectData.TextureEntry=this.avatar_template.TextureEntry;// br.ReadBytes((int)numBytes);
235
236 LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-0000-000000000005"));
237 avp.ObjectData.TextureEntry = ntex.ToBytes();
238
239 AvatarAppearancePacket.VisualParamBlock avblock = null;
240 for(int i = 0; i < 218; i++)
241 {
242 avblock = new AvatarAppearancePacket.VisualParamBlock();
243 avblock.ParamValue = (byte)100;
244 avp.VisualParam[i] = avblock;
245 }
246
247 avp.Sender.IsTrial = false;
248 avp.Sender.ID = ControllingClient.AgentID;
249 userInfo.OutPacket(avp);
250
251 }
252
196 public void HandleUpdate(AgentUpdatePacket pack) { 253 public void HandleUpdate(AgentUpdatePacket pack) {
197 if(((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) !=0) { 254 if(((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) !=0) {
198 if(!walking) 255 if(!walking)