aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs312
-rw-r--r--OpenSim/Framework/InterregionData.cs88
-rw-r--r--OpenSim/Region/Environment/Interfaces/IInterregionComms.cs89
-rw-r--r--prebuild.xml1
4 files changed, 360 insertions, 130 deletions
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index 260d6cf..2730c70 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -26,9 +26,18 @@
26 */ 26 */
27 27
28using System; 28using System;
29using OpenMetaverse;
30using System.Collections;
31using System.Collections.Generic;
32
33using OSD = OpenMetaverse.StructuredData.OSD;
34using OSDMap = OpenMetaverse.StructuredData.OSDMap;
35using OSDArray = OpenMetaverse.StructuredData.OSDArray;
36using OSDParser = OpenMetaverse.StructuredData.OSDParser;
29 37
30namespace OpenSim.Framework 38namespace OpenSim.Framework
31{ 39{
40 // Soon to be dismissed
32 [Serializable] 41 [Serializable]
33 public class ChildAgentDataUpdate 42 public class ChildAgentDataUpdate
34 { 43 {
@@ -48,5 +57,308 @@ namespace OpenSim.Framework
48 public ChildAgentDataUpdate() 57 public ChildAgentDataUpdate()
49 { 58 {
50 } 59 }
60
61 public ChildAgentDataUpdate(AgentData agent)
62 {
63 if (agent.ActiveGroupID != null)
64 ActiveGroupID = agent.ActiveGroupID.Guid;
65 if (agent.AgentID != null)
66 AgentID = agent.AgentID.Guid;
67 alwaysrun = agent.AlwaysRun;
68 if (agent.Size != null)
69 AVHeight = agent.Size.Z;
70 if (agent.Center != null)
71 cameraPosition = new sLLVector3(agent.Center);
72 drawdistance = agent.Far;
73 godlevel = (float)agent.GodLevel;
74 if (agent.Groups.Length > 0)
75 GroupAccess = (uint)agent.Groups[0].GroupPowers;
76 if (agent.Position != null)
77 Position = new sLLVector3(agent.Position);
78 regionHandle = agent.RegionHandle;
79 throttles = agent.Throttles;
80 if (agent.Velocity != null)
81 Velocity = new sLLVector3(agent.Velocity);
82 }
83 }
84
85 public class AgentGroupData
86 {
87 public UUID GroupID;
88 public ulong GroupPowers;
89 public bool AcceptNotices;
90
91 public AgentGroupData(UUID id, ulong powers, bool notices)
92 {
93 GroupID = id;
94 GroupPowers = powers;
95 AcceptNotices = notices;
96 }
97 }
98
99 public class AgentAnimationData
100 {
101 public UUID Animation;
102 public UUID ObjectID;
103 }
104
105 public class AgentData
106 {
107 public ulong RegionHandle;
108 public uint CircuitCode;
109
110 public UUID AgentID;
111 public UUID SessionID;
112
113 public Vector3 Position;
114 public Vector3 Velocity;
115 public Vector3 Center;
116 public Vector3 Size;
117 public Vector3 AtAxis;
118 public Vector3 LeftAxis;
119 public Vector3 UpAxis;
120 public bool ChangedGrid;
121
122 public float Far;
123 public float Aspect;
124 //public int[] Throttles;
125 public byte[] Throttles;
126
127 public uint LocomotionState;
128 public Quaternion HeadRotation;
129 public Quaternion BodyRotation;
130 public uint ControlFlags;
131 public float EnergyLevel;
132 public Byte GodLevel;
133 public bool AlwaysRun;
134 public UUID PreyAgent;
135 public Byte AgentAccess;
136 public UUID[] AgentTextures;
137 public UUID ActiveGroupID;
138
139 public AgentGroupData[] Groups;
140 public AgentAnimationData[] Anims;
141
142 public UUID GranterID;
143 public Dictionary<string, string> NVPairs;
144
145 byte[] VisualParams;
146
147
148 public OSDMap PackUpdateMessage()
149 {
150 OSDMap args = new OSDMap();
151 args["region_handle"] = OSD.FromString(RegionHandle.ToString());
152 args["circuit_code"] = OSD.FromString(CircuitCode.ToString());
153 if (AgentID != null)
154 args["agent_uuid"] = OSD.FromUUID(AgentID);
155 if (SessionID != null)
156 args["session_uuid"] = OSD.FromUUID(SessionID);
157
158 if (Position != null)
159 args["position"] = OSD.FromString(Position.ToString());
160
161 if (Velocity != null)
162 args["velocity"] = OSD.FromString(Velocity.ToString());
163 if (Center != null)
164 args["center"] = OSD.FromString(Center.ToString());
165 if (Size != null)
166 args["size"] = OSD.FromString(Size.ToString());
167 if (AtAxis != null)
168 args["at_axis"] = OSD.FromString(AtAxis.ToString());
169 if (LeftAxis != null)
170 args["left_axis"] = OSD.FromString(LeftAxis.ToString());
171 if (UpAxis != null)
172 args["up_axis"] = OSD.FromString(UpAxis.ToString());
173
174 args["changed_grid"] = OSD.FromBoolean(ChangedGrid);
175 args["far"] = OSD.FromReal(Far);
176 args["aspect"] = OSD.FromReal(Aspect);
177
178 if ((Throttles != null) && (Throttles.Length > 0))
179 args["throttles"] = OSD.FromBinary(Throttles);
180
181 args["locomotion_state"] = OSD.FromString(LocomotionState.ToString());
182 if (HeadRotation != null)
183 args["head_rotation"] = OSD.FromString(HeadRotation.ToString());
184 if (BodyRotation != null)
185 args["body_rotation"] = OSD.FromString(BodyRotation.ToString());
186 args["control_flags"] = OSD.FromString(ControlFlags.ToString());
187
188 args["energy_level"] = OSD.FromReal(EnergyLevel);
189 args["god_level"] = OSD.FromString(GodLevel.ToString());
190 args["always_run"] = OSD.FromBoolean(AlwaysRun);
191 if (PreyAgent != null)
192 args["prey_agent"] = OSD.FromUUID(PreyAgent);
193 args["agent_access"] = OSD.FromString(AgentAccess.ToString());
194
195 if ((AgentTextures != null) && (AgentTextures.Length > 0))
196 {
197 OSDArray textures = new OSDArray(AgentTextures.Length);
198 foreach (UUID uuid in AgentTextures)
199 textures.Add(OSD.FromUUID(uuid));
200 args["agent_textures"] = textures;
201 }
202
203 if (ActiveGroupID != null)
204 args["active_group_id"] = OSD.FromUUID(ActiveGroupID);
205
206 // Last few fields are still missing
207
208 return args;
209 }
210
211 /// <summary>
212 /// Deserialization of agent data.
213 /// Avoiding reflection makes it painful to write, but that's the price!
214 /// </summary>
215 /// <param name="hash"></param>
216 public void UnpackUpdateMessage(OSDMap args)
217 {
218 if (args.ContainsKey("region_handle"))
219 UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle);
220
221 if (args["circuit_code"] != null)
222 UInt32.TryParse((string)args["circuit_code"].AsString(), out CircuitCode);
223
224 if (args["agent_uuid"] != null)
225 AgentID = args["agent_uuid"].AsUUID();
226
227 if (args["session_uuid"] != null)
228 SessionID = args["session_uuid"].AsUUID();
229
230 if (args["position"] != null)
231 Vector3.TryParse(args["position"].AsString(), out Position);
232
233 if (args["velocity"] != null)
234 Vector3.TryParse(args["velocity"].AsString(), out Velocity);
235
236 if (args["center"] != null)
237 Vector3.TryParse(args["center"].AsString(), out Center);
238
239 if (args["size"] != null)
240 Vector3.TryParse(args["size"].AsString(), out Size);
241
242 if (args["at_axis"] != null)
243 Vector3.TryParse(args["at_axis"].AsString(), out AtAxis);
244
245 if (args["left_axis"] != null)
246 Vector3.TryParse(args["left_axis"].AsString(), out AtAxis);
247
248 if (args["up_axis"] != null)
249 Vector3.TryParse(args["up_axis"].AsString(), out AtAxis);
250
251 if (args["changed_grid"] != null)
252 ChangedGrid = args["changed_grid"].AsBoolean();
253
254 if (args["far"] != null)
255 Far = (float)(args["far"].AsReal());
256
257 if (args["aspect"] != null)
258 Aspect = (float)args["aspect"].AsReal();
259
260 if (args["throttles"] != null)
261 Throttles = args["throttles"].AsBinary();
262
263 if (args["locomotion_state"] != null)
264 UInt32.TryParse(args["locomotion_state"].AsString(), out LocomotionState);
265
266 if (args["head_rotation"] != null)
267 Quaternion.TryParse(args["head_rotation"].AsString(), out HeadRotation);
268
269 if (args["body_rotation"] != null)
270 Quaternion.TryParse(args["body_rotation"].AsString(), out BodyRotation);
271
272 if (args["control_flags"] != null)
273 UInt32.TryParse(args["control_flags"].AsString(), out ControlFlags);
274
275 if (args["energy_level"] != null)
276 EnergyLevel = (float)(args["energy_level"].AsReal());
277
278 if (args["god_level"] != null)
279 Byte.TryParse(args["god_level"].AsString(), out GodLevel);
280
281 if (args["always_run"] != null)
282 AlwaysRun = args["always_run"].AsBoolean();
283
284 if (args["prey_agent"] != null)
285 PreyAgent = args["prey_agent"].AsUUID();
286
287 if (args["agent_access"] != null)
288 Byte.TryParse(args["agent_access"].AsString(), out AgentAccess);
289
290 if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OpenMetaverse.StructuredData.OSDType.Array)
291 {
292 OSDArray textures = (OSDArray)(args["agent_textures"]);
293 AgentTextures = new UUID[textures.Count];
294 int i = 0;
295 foreach (OSD o in textures)
296 AgentTextures[i++] = o.AsUUID();
297 }
298
299 if (args["active_group_id"] != null)
300 ActiveGroupID = args["active_group_id"].AsUUID();
301 }
302
303 public AgentData()
304 {
305 }
306
307 public AgentData(Hashtable hash)
308 {
309 //UnpackUpdateMessage(hash);
310 }
311
312 /// <summary>
313 /// Soon to be decommissioned
314 /// </summary>
315 /// <param name="cAgent"></param>
316 public void CopyFrom(ChildAgentDataUpdate cAgent)
317 {
318 if (cAgent.ActiveGroupID != null)
319 ActiveGroupID = new UUID(cAgent.ActiveGroupID);
320
321 if (cAgent.AgentID != null)
322 AgentID = new UUID(cAgent.AgentID);
323
324 AlwaysRun = cAgent.alwaysrun;
325
326 // next: ???
327 Size = new Vector3();
328 Size.Z = cAgent.AVHeight;
329
330 if (cAgent.cameraPosition != null)
331 Center = new Vector3(cAgent.cameraPosition.x, cAgent.cameraPosition.y, cAgent.cameraPosition.z);
332
333 Far = cAgent.drawdistance;
334
335 // downcasting ???
336 GodLevel = (byte)(cAgent.godlevel);
337
338 if (cAgent.ActiveGroupID != null)
339 {
340 Groups = new AgentGroupData[1];
341 Groups[0] = new AgentGroupData(new UUID(cAgent.ActiveGroupID), cAgent.GroupAccess, true);
342 }
343
344 if (cAgent.Position != null)
345 Position = new Vector3(cAgent.Position.x, cAgent.Position.y, cAgent.Position.z);
346
347 RegionHandle = cAgent.regionHandle;
348
349 Throttles = cAgent.throttles;
350
351 if (cAgent.Velocity != null)
352 Velocity = new Vector3(cAgent.Velocity.x, cAgent.Velocity.y, cAgent.Velocity.z);
353 }
354
355 public void Dump()
356 {
357 System.Console.WriteLine("------------ AgentData ------------");
358 System.Console.WriteLine("UUID: " + AgentID);
359 System.Console.WriteLine("Region: " + RegionHandle);
360 System.Console.WriteLine("Position: " + Position);
361 }
51 } 362 }
363
52} 364}
diff --git a/OpenSim/Framework/InterregionData.cs b/OpenSim/Framework/InterregionData.cs
deleted file mode 100644
index 94f9d66..0000000
--- a/OpenSim/Framework/InterregionData.cs
+++ /dev/null
@@ -1,88 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.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 OpenMetaverse;
30using System.Collections.Generic;
31
32namespace OpenSim.Framework
33{
34 public struct InterregionGroupData
35 {
36 public UUID GroupID;
37 public ulong GroupPowers;
38 public bool AcceptNotices;
39 }
40
41 public struct InterregionAnimationData
42 {
43 public UUID Animation;
44 public UUID ObjectID;
45 }
46
47 public struct InterregionData
48 {
49 public ulong RegionHandle;
50 public uint CircuitCode;
51
52 public UUID AgentID;
53 public UUID SessionID;
54
55 public Vector3 AgentPos;
56 public Vector3 AgentVel;
57 public Vector3 Center;
58 public Vector3 Size;
59 public Vector3 AtAxis;
60 public Vector3 LeftAxis;
61 public Vector3 UpAxis;
62 public bool ChangedGrid;
63
64 public float Far;
65 public float Aspect;
66 public int[] Throttles;
67
68 public uint LocomotionState;
69 public Quaternion HeadRotation;
70 public Quaternion BodyRotation;
71 public uint ControlFlags;
72 public float EnergyLevel;
73 public Byte GodLevel;
74 public bool AlwaysRun;
75 public UUID PreyAgent;
76 public Byte AgentAccess;
77 public UUID[] AgentTextures;
78 public UUID ActiveGroupID;
79
80 public InterregionGroupData[] Groups;
81 public InterregionAnimationData[] Anims;
82
83 public UUID GranterID;
84 public Dictionary<string, string> NVPairs;
85
86 byte[] VisualParams;
87 }
88}
diff --git a/OpenSim/Region/Environment/Interfaces/IInterregionComms.cs b/OpenSim/Region/Environment/Interfaces/IInterregionComms.cs
index 37cf2de..7964d98 100644
--- a/OpenSim/Region/Environment/Interfaces/IInterregionComms.cs
+++ b/OpenSim/Region/Environment/Interfaces/IInterregionComms.cs
@@ -1,42 +1,47 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using OpenSim.Framework; 29using OpenSim.Framework;
30using OpenMetaverse; 30using OpenMetaverse;
31 31
32namespace OpenSim.Region.Environment.Interfaces 32namespace OpenSim.Region.Environment.Interfaces
33{ 33{
34 public delegate void InterregionDataReceived(InterregionData data); 34 public delegate bool ChildAgentUpdateReceived(AgentData data);
35 35
36 public interface IInterregionComms : IRegionModule 36 public interface IInterregionCommsOut
37 { 37 {
38 event InterregionDataReceived OnInterregionData; 38 bool SendChildAgentUpdate(ulong regionHandle, AgentData data);
39 39 }
40 bool SendInterregionData(UUID destination, InterregionData data); 40
41 } 41 // This may not be needed, but having it here for now.
42} 42 public interface IInterregionCommsIn
43 {
44 event ChildAgentUpdateReceived OnChildAgentUpdate;
45 }
46
47}
diff --git a/prebuild.xml b/prebuild.xml
index 91d3215..5bab081 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -93,6 +93,7 @@
93 <Reference name="System.Data"/> 93 <Reference name="System.Data"/>
94 <Reference name="OpenMetaverseTypes.dll"/> 94 <Reference name="OpenMetaverseTypes.dll"/>
95 <Reference name="OpenMetaverse.dll"/> 95 <Reference name="OpenMetaverse.dll"/>
96 <Reference name="OpenMetaverse.StructuredData.dll"/>
96 <Reference name="XMLRPC.dll"/> 97 <Reference name="XMLRPC.dll"/>
97 <Reference name="OpenSim.Framework.Console"/> 98 <Reference name="OpenSim.Framework.Console"/>
98 <Reference name="Nini.dll" /> 99 <Reference name="Nini.dll" />