diff options
Diffstat (limited to 'OpenSim/OpenSim.Region/Scenes/ScenePresence.Update.cs')
-rw-r--r-- | OpenSim/OpenSim.Region/Scenes/ScenePresence.Update.cs | 224 |
1 files changed, 224 insertions, 0 deletions
diff --git a/OpenSim/OpenSim.Region/Scenes/ScenePresence.Update.cs b/OpenSim/OpenSim.Region/Scenes/ScenePresence.Update.cs new file mode 100644 index 0000000..3885c0d --- /dev/null +++ b/OpenSim/OpenSim.Region/Scenes/ScenePresence.Update.cs | |||
@@ -0,0 +1,224 @@ | |||
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 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using libsecondlife; | ||
32 | using libsecondlife.Packets; | ||
33 | using OpenSim.Physics.Manager; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework.Types; | ||
36 | |||
37 | namespace 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 | /// <returns></returns> | ||
80 | public ObjectUpdatePacket CreateUpdatePacket() | ||
81 | { | ||
82 | return null; | ||
83 | } | ||
84 | |||
85 | /// <summary> | ||
86 | /// | ||
87 | /// </summary> | ||
88 | public void SendInitialPosition() | ||
89 | { | ||
90 | this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos); | ||
91 | } | ||
92 | |||
93 | /// <summary> | ||
94 | /// | ||
95 | /// </summary> | ||
96 | public void SendOurAppearance() | ||
97 | { | ||
98 | |||
99 | } | ||
100 | |||
101 | /// <summary> | ||
102 | /// | ||
103 | /// </summary> | ||
104 | /// <param name="OurClient"></param> | ||
105 | public void SendOurAppearance(IClientAPI OurClient) | ||
106 | { | ||
107 | this.ControllingClient.SendWearables(this.Wearables); | ||
108 | } | ||
109 | |||
110 | /// <summary> | ||
111 | /// | ||
112 | /// </summary> | ||
113 | /// <param name="avatarInfo"></param> | ||
114 | public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) | ||
115 | { | ||
116 | |||
117 | } | ||
118 | |||
119 | /// <summary> | ||
120 | /// | ||
121 | /// </summary> | ||
122 | /// <param name="texture"></param> | ||
123 | /// <param name="visualParam"></param> | ||
124 | public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) | ||
125 | { | ||
126 | |||
127 | } | ||
128 | |||
129 | /// <summary> | ||
130 | /// | ||
131 | /// </summary> | ||
132 | public void StopMovement() | ||
133 | { | ||
134 | |||
135 | } | ||
136 | |||
137 | /// <summary> | ||
138 | /// | ||
139 | /// </summary> | ||
140 | /// <param name="animID"></param> | ||
141 | /// <param name="seq"></param> | ||
142 | public void SendAnimPack(LLUUID animID, int seq) | ||
143 | { | ||
144 | |||
145 | |||
146 | } | ||
147 | |||
148 | /// <summary> | ||
149 | /// | ||
150 | /// </summary> | ||
151 | public void SendAnimPack() | ||
152 | { | ||
153 | |||
154 | } | ||
155 | |||
156 | /// <summary> | ||
157 | /// | ||
158 | /// </summary> | ||
159 | protected void CheckForBorderCrossing() | ||
160 | { | ||
161 | LLVector3 pos2 = this.Pos; | ||
162 | LLVector3 vel = this.Velocity; | ||
163 | |||
164 | float timeStep = 0.2f; | ||
165 | pos2.X = pos2.X + (vel.X * timeStep); | ||
166 | pos2.Y = pos2.Y + (vel.Y * timeStep); | ||
167 | pos2.Z = pos2.Z + (vel.Z * timeStep); | ||
168 | |||
169 | if ((pos2.X < 0) || (pos2.X > 256)) | ||
170 | { | ||
171 | this.CrossToNewRegion(); | ||
172 | } | ||
173 | |||
174 | if ((pos2.Y < 0) || (pos2.Y > 256)) | ||
175 | { | ||
176 | this.CrossToNewRegion(); | ||
177 | } | ||
178 | } | ||
179 | |||
180 | /// <summary> | ||
181 | /// | ||
182 | /// </summary> | ||
183 | protected void CrossToNewRegion() | ||
184 | { | ||
185 | LLVector3 pos = this.Pos; | ||
186 | LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z); | ||
187 | uint neighbourx = this.m_regionInfo.RegionLocX; | ||
188 | uint neighboury = this.m_regionInfo.RegionLocY; | ||
189 | |||
190 | if (pos.X < 2) | ||
191 | { | ||
192 | neighbourx -= 1; | ||
193 | newpos.X = 254; | ||
194 | } | ||
195 | if (pos.X > 253) | ||
196 | { | ||
197 | neighbourx += 1; | ||
198 | newpos.X = 1; | ||
199 | } | ||
200 | if (pos.Y < 2) | ||
201 | { | ||
202 | neighboury -= 1; | ||
203 | newpos.Y = 254; | ||
204 | } | ||
205 | if (pos.Y > 253) | ||
206 | { | ||
207 | neighboury += 1; | ||
208 | newpos.Y = 1; | ||
209 | } | ||
210 | |||
211 | LLVector3 vel = this.velocity; | ||
212 | ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury* 256)); | ||
213 | RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle); | ||
214 | if (neighbourRegion != null) | ||
215 | { | ||
216 | this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos); | ||
217 | this.DownGradeAvatar(); | ||
218 | this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, System.Net.IPAddress.Parse(neighbourRegion.IPListenAddr), (ushort)neighbourRegion.IPListenPort); | ||
219 | |||
220 | } | ||
221 | } | ||
222 | |||
223 | } | ||
224 | } | ||