aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs
diff options
context:
space:
mode:
authorMW2007-05-25 19:09:19 +0000
committerMW2007-05-25 19:09:19 +0000
commit64741b55a6d68eb2853ca2f33047e6a2f459b513 (patch)
tree01ebe1336f9e2e0391bea8baf8618bd81f69ec12 /OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs
parentPossible my last ever OpenSim/OGS contribution (if I continue to feel like th... (diff)
downloadopensim-SC_OLD-64741b55a6d68eb2853ca2f33047e6a2f459b513.zip
opensim-SC_OLD-64741b55a6d68eb2853ca2f33047e6a2f459b513.tar.gz
opensim-SC_OLD-64741b55a6d68eb2853ca2f33047e6a2f459b513.tar.bz2
opensim-SC_OLD-64741b55a6d68eb2853ca2f33047e6a2f459b513.tar.xz
First part of border crossing fix.
Diffstat (limited to 'OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs')
-rw-r--r--OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs130
1 files changed, 67 insertions, 63 deletions
diff --git a/OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs b/OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs
index e49fab3..ed1ffc0 100644
--- a/OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs
+++ b/OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs
@@ -10,89 +10,93 @@ namespace OpenSim.world
10 { 10 {
11 public override void update() 11 public override void update()
12 { 12 {
13 if (this._physActor == null) 13 if (!this.childAvatar)
14 { 14 {
15 //HACKHACK: Note to work out why this entity does not have a physics actor 15 if (this._physActor == null)
16 // and prehaps create one.
17 return;
18 }
19 libsecondlife.LLVector3 pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z);
20 if (this.updateflag)
21 {
22 //need to send movement info
23 //so create the improvedterseobjectupdate packet
24 //use CreateTerseBlock()
25 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
26 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
27 terse.RegionData.RegionHandle = m_regionHandle; // FIXME
28 terse.RegionData.TimeDilation = 64096;
29 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
30 terse.ObjectData[0] = terseBlock;
31 List<Avatar> avList = this.m_world.RequestAvatarList();
32 foreach (Avatar client in avList)
33 { 16 {
34 client.SendPacketToViewer(terse); 17 //HACKHACK: Note to work out why this entity does not have a physics actor
18 // and prehaps create one.
19 return;
35 } 20 }
21 libsecondlife.LLVector3 pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z);
22 if (this.updateflag)
23 {
24 //need to send movement info
25 //so create the improvedterseobjectupdate packet
26 //use CreateTerseBlock()
27 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
28 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
29 terse.RegionData.RegionHandle = m_regionHandle; // FIXME
30 terse.RegionData.TimeDilation = 64096;
31 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
32 terse.ObjectData[0] = terseBlock;
33 List<Avatar> avList = this.m_world.RequestAvatarList();
34 foreach (Avatar client in avList)
35 {
36 client.SendPacketToViewer(terse);
37 }
36 38
37 updateflag = false; 39 updateflag = false;
38 //this._updateCount = 0; 40 //this._updateCount = 0;
39 } 41 }
40 else 42 else
41 {
42
43 if ((pos2 != this.positionLastFrame) || (this.movementflag == 16))
44 { 43 {
45 _updateCount++; 44
46 if (((!PhysicsEngineFlying) && (_updateCount > 3)) || (PhysicsEngineFlying) && (_updateCount > 0)) 45 if ((pos2 != this.positionLastFrame) || (this.movementflag == 16))
47 { 46 {
48 //It has been a while since last update was sent so lets send one. 47 _updateCount++;
49 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); 48 if (((!PhysicsEngineFlying) && (_updateCount > 3)) || (PhysicsEngineFlying) && (_updateCount > 0))
50 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
51 terse.RegionData.RegionHandle = m_regionHandle; // FIXME
52 terse.RegionData.TimeDilation = 64096;
53 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
54 terse.ObjectData[0] = terseBlock;
55 List<Avatar> avList = this.m_world.RequestAvatarList();
56 foreach (Avatar client in avList)
57 { 49 {
58 client.SendPacketToViewer(terse); 50 //It has been a while since last update was sent so lets send one.
51 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
52 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
53 terse.RegionData.RegionHandle = m_regionHandle; // FIXME
54 terse.RegionData.TimeDilation = 64096;
55 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
56 terse.ObjectData[0] = terseBlock;
57 List<Avatar> avList = this.m_world.RequestAvatarList();
58 foreach (Avatar client in avList)
59 {
60 client.SendPacketToViewer(terse);
61 }
62 _updateCount = 0;
59 } 63 }
60 _updateCount = 0;
61 }
62 64
63 if (this.movementflag == 16) 65 if (this.movementflag == 16)
64 { 66 {
65 movementflag = 0; 67 movementflag = 0;
68 }
66 } 69 }
67 }
68
69 }
70 this.positionLastFrame = pos2;
71 70
72 if (!this.ControllingClient.m_sandboxMode)
73 {
74 if (pos2.X < 0)
75 {
76 ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z));
77 } 71 }
72 this.positionLastFrame = pos2;
78 73
79 if (pos2.Y < 0) 74 if (!this.ControllingClient.m_sandboxMode)
80 { 75 {
81 ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); 76 if (pos2.X < 0)
82 } 77 {
78 ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z));
79 }
83 80
84 if (pos2.X > 255) 81 if (pos2.Y < 0)
85 { 82 {
86 ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); 83 ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z));
87 } 84 }
88 85
89 if (pos2.Y > 255) 86 if (pos2.X > 255)
90 { 87 {
91 ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); 88 ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z));
89 }
90
91 if (pos2.Y > 255)
92 {
93 ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z));
94 }
92 } 95 }
93 } 96 }
94 97
95 } 98 }
99
96 public void SendUpdateToOtherClient(Avatar remoteAvatar) 100 public void SendUpdateToOtherClient(Avatar remoteAvatar)
97 { 101 {
98 ObjectUpdatePacket objupdate = CreateUpdatePacket(); 102 ObjectUpdatePacket objupdate = CreateUpdatePacket();