From 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 19 May 2019 21:24:15 +1000 Subject: Dump OpenSim 0.9.0.1 into it's own branch. --- OpenSim/Region/ScriptEngine/Shared/Helpers.cs | 91 ++++++++++++++++++++------- 1 file changed, 70 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Helpers.cs') 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; using OpenSim.Framework; using OpenSim.Region.CoreModules; using OpenSim.Region.Framework.Scenes; +using OpenSim.Services.Interfaces; using OpenSim.Region.Framework.Interfaces; namespace OpenSim.Region.ScriptEngine.Shared @@ -47,7 +48,7 @@ namespace OpenSim.Region.ScriptEngine.Shared } protected EventAbortException( - SerializationInfo info, + SerializationInfo info, StreamingContext context) { } @@ -61,7 +62,7 @@ namespace OpenSim.Region.ScriptEngine.Shared } protected SelfDeleteException( - SerializationInfo info, + SerializationInfo info, StreamingContext context) { } @@ -75,14 +76,14 @@ namespace OpenSim.Region.ScriptEngine.Shared } protected ScriptDeleteException( - SerializationInfo info, + SerializationInfo info, StreamingContext context) { } } /// - /// Used to signal when the script is stopping in co-operation with the script engine + /// Used to signal when the script is stopping in co-operation with the script engine /// (instead of through Thread.Abort()). /// [Serializable] @@ -93,7 +94,7 @@ namespace OpenSim.Region.ScriptEngine.Shared } protected ScriptCoopStopException( - SerializationInfo info, + SerializationInfo info, StreamingContext context) { } @@ -198,6 +199,7 @@ namespace OpenSim.Region.ScriptEngine.Shared return; Name = presence.Firstname + " " + presence.Lastname; + Owner = Key; Position = new LSL_Types.Vector3(presence.AbsolutePosition); Rotation = new LSL_Types.Quaternion( @@ -207,22 +209,9 @@ namespace OpenSim.Region.ScriptEngine.Shared presence.Rotation.W); Velocity = new LSL_Types.Vector3(presence.Velocity); - if (presence.PresenceType != PresenceType.Npc) - { - Type = AGENT; - } - else - { - Type = OS_NPC; - - INPCModule npcModule = scene.RequestModuleInterface(); - INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene); - - if (npcData.SenseAsAgent) - { - Type |= AGENT; - } - } + Type = 0x01; // Avatar + if (presence.PresenceType == PresenceType.Npc) + Type = 0x20; if (presence.Velocity != Vector3.Zero) Type |= ACTIVE; @@ -260,6 +249,66 @@ namespace OpenSim.Region.ScriptEngine.Shared Velocity = new LSL_Types.Vector3(part.Velocity); } + + public void Populate(Scene scene, DetectedObject obj) + { + if(obj.keyUUID == UUID.Zero) // land + { + Position = new LSL_Types.Vector3(obj.posVector); + Rotation.s = 1.0; + return; + } + + if((obj.colliderType & 0x21) != 0) // avatar or npc + { + ScenePresence presence = scene.GetScenePresence(obj.keyUUID); + if (presence == null) + return; + + Name = obj.nameStr; + Key = obj.keyUUID; + Owner = obj.ownerUUID; + Group = obj.groupUUID; + Position = new LSL_Types.Vector3(obj.posVector); + Rotation = new LSL_Types.Quaternion(obj.rotQuat); + Velocity = new LSL_Types.Vector3(obj.velVector); + LinkNum = obj.linkNumber; + Type = obj.colliderType; + return; + } + + SceneObjectPart part = scene.GetSceneObjectPart(obj.keyUUID); + if(part == null) + return; + + Name = obj.nameStr; + Key = obj.keyUUID; + Owner = obj.ownerUUID; + Group = obj.groupUUID; + Position = new LSL_Types.Vector3(obj.posVector); + Rotation = new LSL_Types.Quaternion(obj.rotQuat); + Velocity = new LSL_Types.Vector3(obj.velVector); + LinkNum = obj.linkNumber; + if(obj.velVector == Vector3.Zero) + Type = 4; + else + Type = 2; + + part = part.ParentGroup.RootPart; + foreach (SceneObjectPart p in part.ParentGroup.Parts) + { + if (p.Inventory.ContainsScripts()) + { + // at sl a physical prim is active also if has active scripts + // assuming all scripts are in run state to save time + if((part.Flags & PrimFlags.Physics) != 0 ) + Type = 10; // script + active + else + Type |= SCRIPTED; // Scripted + break; + } + } + } } /// -- cgit v1.1