aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
diff options
context:
space:
mode:
authoronefang2019-05-19 21:24:15 +1000
committeronefang2019-05-19 21:24:15 +1000
commit5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch)
treea9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Region/ScriptEngine/Shared/Helpers.cs
parentAdd a build script. (diff)
downloadopensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip
opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz
opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2
opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Helpers.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Helpers.cs91
1 files changed, 70 insertions, 21 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
index e02d35e..7db6b6d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
@@ -35,6 +35,7 @@ using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Region.CoreModules; 36using OpenSim.Region.CoreModules;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces;
38using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
39 40
40namespace OpenSim.Region.ScriptEngine.Shared 41namespace OpenSim.Region.ScriptEngine.Shared
@@ -47,7 +48,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
47 } 48 }
48 49
49 protected EventAbortException( 50 protected EventAbortException(
50 SerializationInfo info, 51 SerializationInfo info,
51 StreamingContext context) 52 StreamingContext context)
52 { 53 {
53 } 54 }
@@ -61,7 +62,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
61 } 62 }
62 63
63 protected SelfDeleteException( 64 protected SelfDeleteException(
64 SerializationInfo info, 65 SerializationInfo info,
65 StreamingContext context) 66 StreamingContext context)
66 { 67 {
67 } 68 }
@@ -75,14 +76,14 @@ namespace OpenSim.Region.ScriptEngine.Shared
75 } 76 }
76 77
77 protected ScriptDeleteException( 78 protected ScriptDeleteException(
78 SerializationInfo info, 79 SerializationInfo info,
79 StreamingContext context) 80 StreamingContext context)
80 { 81 {
81 } 82 }
82 } 83 }
83 84
84 /// <summary> 85 /// <summary>
85 /// Used to signal when the script is stopping in co-operation with the script engine 86 /// Used to signal when the script is stopping in co-operation with the script engine
86 /// (instead of through Thread.Abort()). 87 /// (instead of through Thread.Abort()).
87 /// </summary> 88 /// </summary>
88 [Serializable] 89 [Serializable]
@@ -93,7 +94,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
93 } 94 }
94 95
95 protected ScriptCoopStopException( 96 protected ScriptCoopStopException(
96 SerializationInfo info, 97 SerializationInfo info,
97 StreamingContext context) 98 StreamingContext context)
98 { 99 {
99 } 100 }
@@ -198,6 +199,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
198 return; 199 return;
199 200
200 Name = presence.Firstname + " " + presence.Lastname; 201 Name = presence.Firstname + " " + presence.Lastname;
202
201 Owner = Key; 203 Owner = Key;
202 Position = new LSL_Types.Vector3(presence.AbsolutePosition); 204 Position = new LSL_Types.Vector3(presence.AbsolutePosition);
203 Rotation = new LSL_Types.Quaternion( 205 Rotation = new LSL_Types.Quaternion(
@@ -207,22 +209,9 @@ namespace OpenSim.Region.ScriptEngine.Shared
207 presence.Rotation.W); 209 presence.Rotation.W);
208 Velocity = new LSL_Types.Vector3(presence.Velocity); 210 Velocity = new LSL_Types.Vector3(presence.Velocity);
209 211
210 if (presence.PresenceType != PresenceType.Npc) 212 Type = 0x01; // Avatar
211 { 213 if (presence.PresenceType == PresenceType.Npc)
212 Type = AGENT; 214 Type = 0x20;
213 }
214 else
215 {
216 Type = OS_NPC;
217
218 INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
219 INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
220
221 if (npcData.SenseAsAgent)
222 {
223 Type |= AGENT;
224 }
225 }
226 215
227 if (presence.Velocity != Vector3.Zero) 216 if (presence.Velocity != Vector3.Zero)
228 Type |= ACTIVE; 217 Type |= ACTIVE;
@@ -260,6 +249,66 @@ namespace OpenSim.Region.ScriptEngine.Shared
260 249
261 Velocity = new LSL_Types.Vector3(part.Velocity); 250 Velocity = new LSL_Types.Vector3(part.Velocity);
262 } 251 }
252
253 public void Populate(Scene scene, DetectedObject obj)
254 {
255 if(obj.keyUUID == UUID.Zero) // land
256 {
257 Position = new LSL_Types.Vector3(obj.posVector);
258 Rotation.s = 1.0;
259 return;
260 }
261
262 if((obj.colliderType & 0x21) != 0) // avatar or npc
263 {
264 ScenePresence presence = scene.GetScenePresence(obj.keyUUID);
265 if (presence == null)
266 return;
267
268 Name = obj.nameStr;
269 Key = obj.keyUUID;
270 Owner = obj.ownerUUID;
271 Group = obj.groupUUID;
272 Position = new LSL_Types.Vector3(obj.posVector);
273 Rotation = new LSL_Types.Quaternion(obj.rotQuat);
274 Velocity = new LSL_Types.Vector3(obj.velVector);
275 LinkNum = obj.linkNumber;
276 Type = obj.colliderType;
277 return;
278 }
279
280 SceneObjectPart part = scene.GetSceneObjectPart(obj.keyUUID);
281 if(part == null)
282 return;
283
284 Name = obj.nameStr;
285 Key = obj.keyUUID;
286 Owner = obj.ownerUUID;
287 Group = obj.groupUUID;
288 Position = new LSL_Types.Vector3(obj.posVector);
289 Rotation = new LSL_Types.Quaternion(obj.rotQuat);
290 Velocity = new LSL_Types.Vector3(obj.velVector);
291 LinkNum = obj.linkNumber;
292 if(obj.velVector == Vector3.Zero)
293 Type = 4;
294 else
295 Type = 2;
296
297 part = part.ParentGroup.RootPart;
298 foreach (SceneObjectPart p in part.ParentGroup.Parts)
299 {
300 if (p.Inventory.ContainsScripts())
301 {
302 // at sl a physical prim is active also if has active scripts
303 // assuming all scripts are in run state to save time
304 if((part.Flags & PrimFlags.Physics) != 0 )
305 Type = 10; // script + active
306 else
307 Type |= SCRIPTED; // Scripted
308 break;
309 }
310 }
311 }
263 } 312 }
264 313
265 /// <summary> 314 /// <summary>