aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Region
diff options
context:
space:
mode:
authorMW2007-06-21 16:13:06 +0000
committerMW2007-06-21 16:13:06 +0000
commit596b3690fc59ce90efb5132d5c35a46dbd91c7d7 (patch)
tree6cb78288a9e174454ce2fbfc73f5b13076d05da6 /OpenSim/OpenSim.Region
parent* Attempted fix for Mono bug. (diff)
downloadopensim-SC-596b3690fc59ce90efb5132d5c35a46dbd91c7d7.zip
opensim-SC-596b3690fc59ce90efb5132d5c35a46dbd91c7d7.tar.gz
opensim-SC-596b3690fc59ce90efb5132d5c35a46dbd91c7d7.tar.bz2
opensim-SC-596b3690fc59ce90efb5132d5c35a46dbd91c7d7.tar.xz
Some refactoring.
Diffstat (limited to 'OpenSim/OpenSim.Region')
-rw-r--r--OpenSim/OpenSim.Region/OpenSim.Region.csproj7
-rw-r--r--OpenSim/OpenSim.Region/OpenSim.Region.dll.build3
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Entity.cs4
-rw-r--r--OpenSim/OpenSim.Region/Scenes/IScenePresenceBody.cs19
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Scene.cs4
-rw-r--r--OpenSim/OpenSim.Region/Scenes/ScenePresence.Body.cs90
-rw-r--r--OpenSim/OpenSim.Region/Scenes/ScenePresence.Update.cs212
-rw-r--r--OpenSim/OpenSim.Region/Scenes/ScenePresence.cs313
8 files changed, 371 insertions, 281 deletions
diff --git a/OpenSim/OpenSim.Region/OpenSim.Region.csproj b/OpenSim/OpenSim.Region/OpenSim.Region.csproj
index a531e5c..7ab7ed1 100644
--- a/OpenSim/OpenSim.Region/OpenSim.Region.csproj
+++ b/OpenSim/OpenSim.Region/OpenSim.Region.csproj
@@ -145,6 +145,9 @@
145 <Compile Include="Scenes\Entity.cs"> 145 <Compile Include="Scenes\Entity.cs">
146 <SubType>Code</SubType> 146 <SubType>Code</SubType>
147 </Compile> 147 </Compile>
148 <Compile Include="Scenes\IScenePresenceBody.cs">
149 <SubType>Code</SubType>
150 </Compile>
148 <Compile Include="Scenes\Primitive.cs"> 151 <Compile Include="Scenes\Primitive.cs">
149 <SubType>Code</SubType> 152 <SubType>Code</SubType>
150 </Compile> 153 </Compile>
@@ -166,10 +169,10 @@
166 <Compile Include="Scenes\ScenePresence.Animations.cs"> 169 <Compile Include="Scenes\ScenePresence.Animations.cs">
167 <SubType>Code</SubType> 170 <SubType>Code</SubType>
168 </Compile> 171 </Compile>
169 <Compile Include="Scenes\ScenePresence.cs"> 172 <Compile Include="Scenes\ScenePresence.Body.cs">
170 <SubType>Code</SubType> 173 <SubType>Code</SubType>
171 </Compile> 174 </Compile>
172 <Compile Include="Scenes\ScenePresence.Update.cs"> 175 <Compile Include="Scenes\ScenePresence.cs">
173 <SubType>Code</SubType> 176 <SubType>Code</SubType>
174 </Compile> 177 </Compile>
175 <Compile Include="Scenes\scripting\IScriptContext.cs"> 178 <Compile Include="Scenes\scripting\IScriptContext.cs">
diff --git a/OpenSim/OpenSim.Region/OpenSim.Region.dll.build b/OpenSim/OpenSim.Region/OpenSim.Region.dll.build
index e277ec7..4a8ca9e 100644
--- a/OpenSim/OpenSim.Region/OpenSim.Region.dll.build
+++ b/OpenSim/OpenSim.Region/OpenSim.Region.dll.build
@@ -14,6 +14,7 @@
14 <include name="EstateManager.cs" /> 14 <include name="EstateManager.cs" />
15 <include name="ParcelManager.cs" /> 15 <include name="ParcelManager.cs" />
16 <include name="Scenes/Entity.cs" /> 16 <include name="Scenes/Entity.cs" />
17 <include name="Scenes/IScenePresenceBody.cs" />
17 <include name="Scenes/Primitive.cs" /> 18 <include name="Scenes/Primitive.cs" />
18 <include name="Scenes/Scene.cs" /> 19 <include name="Scenes/Scene.cs" />
19 <include name="Scenes/Scene.PacketHandlers.cs" /> 20 <include name="Scenes/Scene.PacketHandlers.cs" />
@@ -21,8 +22,8 @@
21 <include name="Scenes/SceneBase.cs" /> 22 <include name="Scenes/SceneBase.cs" />
22 <include name="Scenes/SceneObject.cs" /> 23 <include name="Scenes/SceneObject.cs" />
23 <include name="Scenes/ScenePresence.Animations.cs" /> 24 <include name="Scenes/ScenePresence.Animations.cs" />
25 <include name="Scenes/ScenePresence.Body.cs" />
24 <include name="Scenes/ScenePresence.cs" /> 26 <include name="Scenes/ScenePresence.cs" />
25 <include name="Scenes/ScenePresence.Update.cs" />
26 <include name="Scenes/scripting/IScriptContext.cs" /> 27 <include name="Scenes/scripting/IScriptContext.cs" />
27 <include name="Scenes/scripting/IScriptEntity.cs" /> 28 <include name="Scenes/scripting/IScriptEntity.cs" />
28 <include name="Scenes/scripting/IScriptHandler.cs" /> 29 <include name="Scenes/scripting/IScriptHandler.cs" />
diff --git a/OpenSim/OpenSim.Region/Scenes/Entity.cs b/OpenSim/OpenSim.Region/Scenes/Entity.cs
index bd9309b..f8754f5 100644
--- a/OpenSim/OpenSim.Region/Scenes/Entity.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Entity.cs
@@ -156,11 +156,11 @@ namespace OpenSim.Region.Scenes
156 /// <summary> 156 /// <summary>
157 /// 157 ///
158 /// </summary> 158 /// </summary>
159 public virtual void addForces() 159 public virtual void updateMovement()
160 { 160 {
161 foreach (Entity child in children) 161 foreach (Entity child in children)
162 { 162 {
163 child.addForces(); 163 child.updateMovement();
164 } 164 }
165 } 165 }
166 166
diff --git a/OpenSim/OpenSim.Region/Scenes/IScenePresenceBody.cs b/OpenSim/OpenSim.Region/Scenes/IScenePresenceBody.cs
new file mode 100644
index 0000000..65077e6
--- /dev/null
+++ b/OpenSim/OpenSim.Region/Scenes/IScenePresenceBody.cs
@@ -0,0 +1,19 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6using OpenSim.Physics.Manager;
7using OpenSim.Framework.Interfaces;
8using OpenSim.Framework.Types;
9
10namespace OpenSim.Region.Scenes
11{
12 public interface IScenePresenceBody
13 {
14 void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation);
15 void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam);
16 void SendOurAppearance(IClientAPI OurClient);
17 void SendAppearanceToOtherAgent(ScenePresence avatarInfo);
18 }
19}
diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.cs b/OpenSim/OpenSim.Region/Scenes/Scene.cs
index 91f07c3..7716410 100644
--- a/OpenSim/OpenSim.Region/Scenes/Scene.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Scene.cs
@@ -175,7 +175,7 @@ namespace OpenSim.Region.Scenes
175 175
176 foreach (libsecondlife.LLUUID UUID in Entities.Keys) 176 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
177 { 177 {
178 Entities[UUID].addForces(); 178 Entities[UUID].updateMovement();
179 } 179 }
180 180
181 lock (this.m_syncRoot) 181 lock (this.m_syncRoot)
@@ -731,7 +731,7 @@ namespace OpenSim.Region.Scenes
731 { 731 {
732 if (this.Avatars.ContainsKey(agentID)) 732 if (this.Avatars.ContainsKey(agentID))
733 { 733 {
734 this.Avatars[agentID].UpGradeAvatar(position); 734 this.Avatars[agentID].MakeAvatar(position);
735 } 735 }
736 } 736 }
737 } 737 }
diff --git a/OpenSim/OpenSim.Region/Scenes/ScenePresence.Body.cs b/OpenSim/OpenSim.Region/Scenes/ScenePresence.Body.cs
new file mode 100644
index 0000000..24278da
--- /dev/null
+++ b/OpenSim/OpenSim.Region/Scenes/ScenePresence.Body.cs
@@ -0,0 +1,90 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using libsecondlife;
32using libsecondlife.Packets;
33using OpenSim.Physics.Manager;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Types;
36
37namespace OpenSim.Region.Scenes
38{
39 partial class ScenePresence
40 {
41 public class Avatar : IScenePresenceBody
42 {
43 public Avatar()
44 {
45
46 }
47
48 public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
49 {
50 }
51
52 public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam)
53 {
54 }
55
56 public void SendOurAppearance(IClientAPI OurClient)
57 {
58 }
59
60 public void SendAppearanceToOtherAgent(ScenePresence avatarInfo)
61 {
62 }
63 }
64
65 public class ChildAgent : IScenePresenceBody //is a ghost
66 {
67 public ChildAgent()
68 {
69
70 }
71
72 public void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
73 {
74 }
75
76 public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam)
77 {
78 }
79
80 public void SendOurAppearance(IClientAPI OurClient)
81 {
82 }
83
84 public void SendAppearanceToOtherAgent(ScenePresence avatarInfo)
85 {
86 }
87 }
88 }
89
90}
diff --git a/OpenSim/OpenSim.Region/Scenes/ScenePresence.Update.cs b/OpenSim/OpenSim.Region/Scenes/ScenePresence.Update.cs
deleted file mode 100644
index b14db31..0000000
--- a/OpenSim/OpenSim.Region/Scenes/ScenePresence.Update.cs
+++ /dev/null
@@ -1,212 +0,0 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using libsecondlife;
32using libsecondlife.Packets;
33using OpenSim.Physics.Manager;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Types;
36
37namespace OpenSim.Region.Scenes
38{
39 partial class ScenePresence
40 {
41 /// <summary>
42 ///
43 /// </summary>
44 public override void update()
45 {
46 if (this.childAvatar == false)
47 {
48 if (this.newForce)
49 {
50 this.SendTerseUpdateToALLClients();
51 _updateCount = 0;
52 }
53 else if (movementflag != 0)
54 {
55 _updateCount++;
56 if (_updateCount > 3)
57 {
58 this.SendTerseUpdateToALLClients();
59 _updateCount = 0;
60 }
61 }
62
63 this.CheckForBorderCrossing();
64 }
65 }
66
67 /// <summary>
68 ///
69 /// </summary>
70 /// <param name="remoteAvatar"></param>
71 public void SendUpdateToOtherClient(ScenePresence remoteAvatar)
72 {
73
74 }
75
76 /// <summary>
77 ///
78 /// </summary>
79 public void SendInitialPosition()
80 {
81 this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos);
82 if (this.newAvatar)
83 {
84 this.m_world.InformClientOfNeighbours(this.ControllingClient);
85 this.newAvatar = false;
86 }
87 }
88
89 /// <summary>
90 ///
91 /// </summary>
92 /// <param name="OurClient"></param>
93 public void SendOurAppearance(IClientAPI OurClient)
94 {
95 this.ControllingClient.SendWearables(this.Wearables);
96 }
97
98 /// <summary>
99 ///
100 /// </summary>
101 /// <param name="avatarInfo"></param>
102 public void SendAppearanceToOtherAgent(ScenePresence avatarInfo)
103 {
104
105 }
106
107 /// <summary>
108 ///
109 /// </summary>
110 /// <param name="texture"></param>
111 /// <param name="visualParam"></param>
112 public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam)
113 {
114
115 }
116
117 /// <summary>
118 ///
119 /// </summary>
120 public void StopMovement()
121 {
122
123 }
124
125 /// <summary>
126 ///
127 /// </summary>
128 /// <param name="animID"></param>
129 /// <param name="seq"></param>
130 public void SendAnimPack(LLUUID animID, int seq)
131 {
132
133
134 }
135
136 /// <summary>
137 ///
138 /// </summary>
139 public void SendAnimPack()
140 {
141
142 }
143
144 /// <summary>
145 ///
146 /// </summary>
147 protected void CheckForBorderCrossing()
148 {
149 LLVector3 pos2 = this.Pos;
150 LLVector3 vel = this.Velocity;
151
152 float timeStep = 0.2f;
153 pos2.X = pos2.X + (vel.X * timeStep);
154 pos2.Y = pos2.Y + (vel.Y * timeStep);
155 pos2.Z = pos2.Z + (vel.Z * timeStep);
156
157 if ((pos2.X < 0) || (pos2.X > 256))
158 {
159 this.CrossToNewRegion();
160 }
161
162 if ((pos2.Y < 0) || (pos2.Y > 256))
163 {
164 this.CrossToNewRegion();
165 }
166 }
167
168 /// <summary>
169 ///
170 /// </summary>
171 protected void CrossToNewRegion()
172 {
173 LLVector3 pos = this.Pos;
174 LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z);
175 uint neighbourx = this.m_regionInfo.RegionLocX;
176 uint neighboury = this.m_regionInfo.RegionLocY;
177
178 if (pos.X < 2)
179 {
180 neighbourx -= 1;
181 newpos.X = 254;
182 }
183 if (pos.X > 253)
184 {
185 neighbourx += 1;
186 newpos.X = 1;
187 }
188 if (pos.Y < 2)
189 {
190 neighboury -= 1;
191 newpos.Y = 254;
192 }
193 if (pos.Y > 253)
194 {
195 neighboury += 1;
196 newpos.Y = 1;
197 }
198
199 LLVector3 vel = this.velocity;
200 ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury* 256));
201 RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle);
202 if (neighbourRegion != null)
203 {
204 this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos);
205 this.DownGradeAvatar();
206 this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, System.Net.IPAddress.Parse(neighbourRegion.IPListenAddr), (ushort)neighbourRegion.IPListenPort);
207
208 }
209 }
210
211 }
212}
diff --git a/OpenSim/OpenSim.Region/Scenes/ScenePresence.cs b/OpenSim/OpenSim.Region/Scenes/ScenePresence.cs
index e22528a..1255606 100644
--- a/OpenSim/OpenSim.Region/Scenes/ScenePresence.cs
+++ b/OpenSim/OpenSim.Region/Scenes/ScenePresence.cs
@@ -48,7 +48,6 @@ namespace OpenSim.Region.Scenes
48 public IClientAPI ControllingClient; 48 public IClientAPI ControllingClient;
49 public LLUUID current_anim; 49 public LLUUID current_anim;
50 public int anim_seq; 50 public int anim_seq;
51 private static libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
52 private bool updateflag = false; 51 private bool updateflag = false;
53 private byte movementflag = 0; 52 private byte movementflag = 0;
54 private List<NewForce> forcesList = new List<NewForce>(); 53 private List<NewForce> forcesList = new List<NewForce>();
@@ -59,11 +58,31 @@ namespace OpenSim.Region.Scenes
59 private AvatarWearable[] Wearables; 58 private AvatarWearable[] Wearables;
60 private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); 59 private LLVector3 positionLastFrame = new LLVector3(0, 0, 0);
61 private ulong m_regionHandle; 60 private ulong m_regionHandle;
62 private bool childAvatar = false; 61 private bool childAgent = false;
63 private bool newForce = false; 62 private bool newForce = false;
64 private bool newAvatar = false; 63 private bool newAvatar = false;
64 private IScenePresenceBody m_body;
65 65
66 protected RegionInfo m_regionInfo; 66 protected RegionInfo m_regionInfo;
67
68 #region Properties
69 /// <summary>
70 ///
71 /// </summary>
72 public PhysicsActor PhysActor
73 {
74 set
75 {
76 this._physActor = value;
77 }
78 get
79 {
80 return _physActor;
81 }
82 }
83 #endregion
84
85 #region Constructor(s)
67 /// <summary> 86 /// <summary>
68 /// 87 ///
69 /// </summary> 88 /// </summary>
@@ -99,38 +118,25 @@ namespace OpenSim.Region.Scenes
99 ControllingClient.OnRequestWearables += this.SendOurAppearance; 118 ControllingClient.OnRequestWearables += this.SendOurAppearance;
100 //ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance); 119 //ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance);
101 ControllingClient.OnCompleteMovementToRegion += this.CompleteMovement; 120 ControllingClient.OnCompleteMovementToRegion += this.CompleteMovement;
102 ControllingClient.OnCompleteMovementToRegion += this.SendInitialPosition; 121 ControllingClient.OnCompleteMovementToRegion += this.SendInitialData;
103 ControllingClient.OnAgentUpdate += this.HandleAgentUpdate; 122 ControllingClient.OnAgentUpdate += this.HandleAgentUpdate;
104 // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); 123 // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
105 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); 124 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
106 //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); 125 //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
107
108 }
109 126
110 /// <summary>
111 ///
112 /// </summary>
113 public PhysicsActor PhysActor
114 {
115 set
116 {
117 this._physActor = value;
118 }
119 get
120 {
121 return _physActor;
122 }
123 } 127 }
128 #endregion
124 129
130 #region Status Methods
125 /// <summary> 131 /// <summary>
126 /// 132 /// Not Used, most likely can be deleted
127 /// </summary> 133 /// </summary>
128 /// <param name="status"></param> 134 /// <param name="status"></param>
129 public void ChildStatusChange(bool status) 135 public void ChildStatusChange(bool status)
130 { 136 {
131 this.childAvatar = status; 137 this.childAgent = status;
132 138
133 if (this.childAvatar == true) 139 if (this.childAgent == true)
134 { 140 {
135 this.Velocity = new LLVector3(0, 0, 0); 141 this.Velocity = new LLVector3(0, 0, 0);
136 this.Pos = new LLVector3(128, 128, 70); 142 this.Pos = new LLVector3(128, 128, 70);
@@ -142,18 +148,19 @@ namespace OpenSim.Region.Scenes
142 /// 148 ///
143 /// </summary> 149 /// </summary>
144 /// <param name="pos"></param> 150 /// <param name="pos"></param>
145 public void UpGradeAvatar(LLVector3 pos) 151 public void MakeAvatar(LLVector3 pos)
146 { 152 {
147 //this.childAvatar = false; 153 //this.childAvatar = false;
148 this.Pos = pos; 154 this.Pos = pos;
149 this.newAvatar = true; 155 this.newAvatar = true;
156 this.childAgent = false;
150 } 157 }
151 158
152 protected void DownGradeAvatar() 159 protected void MakeChildAgent()
153 { 160 {
154 this.Velocity = new LLVector3(0, 0, 0); 161 this.Velocity = new LLVector3(0, 0, 0);
155 this.Pos = new LLVector3(128, 128, 70); 162 this.Pos = new LLVector3(128, 128, 70);
156 this.childAvatar = true; 163 this.childAgent = true;
157 } 164 }
158 165
159 /// <summary> 166 /// <summary>
@@ -169,46 +176,21 @@ namespace OpenSim.Region.Scenes
169 /// <summary> 176 /// <summary>
170 /// 177 ///
171 /// </summary> 178 /// </summary>
172 public override void addForces() 179 public void StopMovement()
173 { 180 {
174 newForce = false;
175 lock (this.forcesList)
176 {
177 if (this.forcesList.Count > 0)
178 {
179 for (int i = 0; i < this.forcesList.Count; i++)
180 {
181 NewForce force = this.forcesList[i];
182
183 this.updateflag = true;
184 this.Velocity = new LLVector3(force.X, force.Y, force.Z);
185 this.newForce = true;
186 }
187 for (int i = 0; i < this.forcesList.Count; i++)
188 {
189 this.forcesList.RemoveAt(0);
190 }
191 }
192 }
193 }
194 181
195 public void SendTerseUpdateToClient(IClientAPI RemoteClient)
196 {
197 LLVector3 pos = this.Pos;
198 LLVector3 vel = this.Velocity;
199 RemoteClient.SendAvatarTerseUpdate(this.m_regionHandle, 64096, this.LocalId, new LLVector3(pos.X, pos.Y, pos.Z), new LLVector3(vel.X, vel.Y, vel.Z));
200 } 182 }
183 #endregion
201 184
185 #region Event Handlers
202 /// <summary> 186 /// <summary>
203 /// 187 ///
204 /// </summary> 188 /// </summary>
205 public void SendTerseUpdateToALLClients() 189 /// <param name="texture"></param>
190 /// <param name="visualParam"></param>
191 public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam)
206 { 192 {
207 List<ScenePresence> avatars = this.m_world.RequestAvatarList(); 193
208 for (int i = 0; i < avatars.Count; i++)
209 {
210 this.SendTerseUpdateToClient(avatars[i].ControllingClient);
211 }
212 } 194 }
213 195
214 /// <summary> 196 /// <summary>
@@ -222,9 +204,9 @@ namespace OpenSim.Region.Scenes
222 look = new LLVector3(0.99f, 0.042f, 0); 204 look = new LLVector3(0.99f, 0.042f, 0);
223 } 205 }
224 this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, Pos, look); 206 this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, Pos, look);
225 if (this.childAvatar) 207 if (this.childAgent)
226 { 208 {
227 this.childAvatar = false; 209 this.childAgent = false;
228 } 210 }
229 } 211 }
230 212
@@ -272,25 +254,232 @@ namespace OpenSim.Region.Scenes
272 movementflag = 0; 254 movementflag = 0;
273 } 255 }
274 } 256 }
275 257
276 } 258 }
259 #endregion
277 260
261 #region Overridden Methods
278 /// <summary> 262 /// <summary>
279 /// 263 ///
280 /// </summary> 264 /// </summary>
281 public static void LoadAnims() 265 public override void LandRenegerated()
282 { 266 {
283 267
284 } 268 }
285 269
286 /// <summary> 270 /// <summary>
287 /// 271 ///
288 /// </summary> 272 /// </summary>
289 public override void LandRenegerated() 273 public override void update()
274 {
275 if (this.childAgent == false)
276 {
277 if (this.newForce)
278 {
279 this.SendTerseUpdateToALLClients();
280 _updateCount = 0;
281 }
282 else if (movementflag != 0)
283 {
284 _updateCount++;
285 if (_updateCount > 3)
286 {
287 this.SendTerseUpdateToALLClients();
288 _updateCount = 0;
289 }
290 }
291
292 this.CheckForBorderCrossing();
293 }
294 }
295 #endregion
296
297 #region Update Client(s)
298 /// <summary>
299 ///
300 /// </summary>
301 /// <param name="RemoteClient"></param>
302 public void SendTerseUpdateToClient(IClientAPI RemoteClient)
303 {
304 LLVector3 pos = this.Pos;
305 LLVector3 vel = this.Velocity;
306 RemoteClient.SendAvatarTerseUpdate(this.m_regionHandle, 64096, this.LocalId, new LLVector3(pos.X, pos.Y, pos.Z), new LLVector3(vel.X, vel.Y, vel.Z));
307 }
308
309 /// <summary>
310 ///
311 /// </summary>
312 public void SendTerseUpdateToALLClients()
313 {
314 List<ScenePresence> avatars = this.m_world.RequestAvatarList();
315 for (int i = 0; i < avatars.Count; i++)
316 {
317 this.SendTerseUpdateToClient(avatars[i].ControllingClient);
318 }
319 }
320
321 /// <summary>
322 ///
323 /// </summary>
324 /// <param name="remoteAvatar"></param>
325 public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar)
326 {
327 remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos);
328 }
329
330 /// <summary>
331 ///
332 /// </summary>
333 public void SendInitialData()
334 {
335 this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos);
336 if (this.newAvatar)
337 {
338 this.m_world.InformClientOfNeighbours(this.ControllingClient);
339 this.newAvatar = false;
340 }
341 }
342
343 /// <summary>
344 ///
345 /// </summary>
346 /// <param name="OurClient"></param>
347 public void SendOurAppearance(IClientAPI OurClient)
348 {
349 this.ControllingClient.SendWearables(this.Wearables);
350 }
351
352 /// <summary>
353 ///
354 /// </summary>
355 /// <param name="avatarInfo"></param>
356 public void SendAppearanceToOtherAgent(ScenePresence avatarInfo)
290 { 357 {
291 358
292 } 359 }
293 360
361 /// <summary>
362 ///
363 /// </summary>
364 /// <param name="animID"></param>
365 /// <param name="seq"></param>
366 public void SendAnimPack(LLUUID animID, int seq)
367 {
368
369
370 }
371
372 /// <summary>
373 ///
374 /// </summary>
375 public void SendAnimPack()
376 {
377
378 }
379 #endregion
380
381 #region Border Crossing Methods
382 /// <summary>
383 ///
384 /// </summary>
385 protected void CheckForBorderCrossing()
386 {
387 LLVector3 pos2 = this.Pos;
388 LLVector3 vel = this.Velocity;
389
390 float timeStep = 0.2f;
391 pos2.X = pos2.X + (vel.X * timeStep);
392 pos2.Y = pos2.Y + (vel.Y * timeStep);
393 pos2.Z = pos2.Z + (vel.Z * timeStep);
394
395 if ((pos2.X < 0) || (pos2.X > 256))
396 {
397 this.CrossToNewRegion();
398 }
399
400 if ((pos2.Y < 0) || (pos2.Y > 256))
401 {
402 this.CrossToNewRegion();
403 }
404 }
405
406 /// <summary>
407 ///
408 /// </summary>
409 protected void CrossToNewRegion()
410 {
411 LLVector3 pos = this.Pos;
412 LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z);
413 uint neighbourx = this.m_regionInfo.RegionLocX;
414 uint neighboury = this.m_regionInfo.RegionLocY;
415
416 if (pos.X < 2)
417 {
418 neighbourx -= 1;
419 newpos.X = 254;
420 }
421 if (pos.X > 253)
422 {
423 neighbourx += 1;
424 newpos.X = 1;
425 }
426 if (pos.Y < 2)
427 {
428 neighboury -= 1;
429 newpos.Y = 254;
430 }
431 if (pos.Y > 253)
432 {
433 neighboury += 1;
434 newpos.Y = 1;
435 }
436
437 LLVector3 vel = this.velocity;
438 ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256));
439 RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle);
440 if (neighbourRegion != null)
441 {
442 this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos);
443 this.MakeChildAgent();
444 this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, System.Net.IPAddress.Parse(neighbourRegion.IPListenAddr), (ushort)neighbourRegion.IPListenPort);
445
446 }
447 }
448 #endregion
449
450 /// <summary>
451 ///
452 /// </summary>
453 public static void LoadAnims()
454 {
455
456 }
457
458 /// <summary>
459 ///
460 /// </summary>
461 public override void updateMovement()
462 {
463 newForce = false;
464 lock (this.forcesList)
465 {
466 if (this.forcesList.Count > 0)
467 {
468 for (int i = 0; i < this.forcesList.Count; i++)
469 {
470 NewForce force = this.forcesList[i];
471
472 this.updateflag = true;
473 this.Velocity = new LLVector3(force.X, force.Y, force.Z);
474 this.newForce = true;
475 }
476 for (int i = 0; i < this.forcesList.Count; i++)
477 {
478 this.forcesList.RemoveAt(0);
479 }
480 }
481 }
482 }
294 483
295 public class NewForce 484 public class NewForce
296 { 485 {