123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- using System;
- using System.IO;
- using System.Threading;
- using System.Collections;
- using System.Collections.Generic;
- using System.Runtime.Serialization;
- using OpenMetaverse;
- using OpenSim.Framework;
- using OpenSim.Region.CoreModules;
- using OpenSim.Region.Framework.Scenes;
- namespace OpenSim.Region.ScriptEngine.Shared
- {
- [Serializable]
- public class EventAbortException : Exception
- {
- public EventAbortException()
- {
- }
- protected EventAbortException(
- SerializationInfo info,
- StreamingContext context)
- {
- }
- }
- [Serializable]
- public class SelfDeleteException : Exception
- {
- public SelfDeleteException()
- {
- }
- protected SelfDeleteException(
- SerializationInfo info,
- StreamingContext context)
- {
- }
- }
- [Serializable]
- public class ScriptDeleteException : Exception
- {
- public ScriptDeleteException()
- {
- }
- protected ScriptDeleteException(
- SerializationInfo info,
- StreamingContext context)
- {
- }
- }
- public class DetectParams
- {
- public DetectParams()
- {
- Key = UUID.Zero;
- OffsetPos = new LSL_Types.Vector3();
- LinkNum = 0;
- Group = UUID.Zero;
- Name = String.Empty;
- Owner = UUID.Zero;
- Position = new LSL_Types.Vector3();
- Rotation = new LSL_Types.Quaternion();
- Type = 0;
- Velocity = new LSL_Types.Vector3();
- initializeSurfaceTouch();
- }
- public UUID Key;
- public LSL_Types.Vector3 OffsetPos;
- public int LinkNum;
- public UUID Group;
- public string Name;
- public UUID Owner;
- public LSL_Types.Vector3 Position;
- public LSL_Types.Quaternion Rotation;
- public int Type;
- public LSL_Types.Vector3 Velocity;
- private LSL_Types.Vector3 touchST;
- public LSL_Types.Vector3 TouchST { get { return touchST; } }
- private LSL_Types.Vector3 touchNormal;
- public LSL_Types.Vector3 TouchNormal { get { return touchNormal; } }
- private LSL_Types.Vector3 touchBinormal;
- public LSL_Types.Vector3 TouchBinormal { get { return touchBinormal; } }
- private LSL_Types.Vector3 touchPos;
- public LSL_Types.Vector3 TouchPos { get { return touchPos; } }
- private LSL_Types.Vector3 touchUV;
- public LSL_Types.Vector3 TouchUV { get { return touchUV; } }
- private int touchFace;
- public int TouchFace { get { return touchFace; } }
-
-
- private void initializeSurfaceTouch()
- {
- touchST = new LSL_Types.Vector3(-1.0, -1.0, 0.0);
- touchNormal = new LSL_Types.Vector3();
- touchBinormal = new LSL_Types.Vector3();
- touchPos = new LSL_Types.Vector3();
- touchUV = new LSL_Types.Vector3(-1.0, -1.0, 0.0);
- touchFace = -1;
- }
-
- public SurfaceTouchEventArgs SurfaceTouchArgs
- {
- set
- {
- if (value == null)
- {
-
- initializeSurfaceTouch();
- }
- else
- {
-
- touchST = new LSL_Types.Vector3(value.STCoord.X, value.STCoord.Y, value.STCoord.Z);
- touchUV = new LSL_Types.Vector3(value.UVCoord.X, value.UVCoord.Y, value.UVCoord.Z);
- touchNormal = new LSL_Types.Vector3(value.Normal.X, value.Normal.Y, value.Normal.Z);
- touchBinormal = new LSL_Types.Vector3(value.Binormal.X, value.Binormal.Y, value.Binormal.Z);
- touchPos = new LSL_Types.Vector3(value.Position.X, value.Position.Y, value.Position.Z);
- touchFace = value.FaceIndex;
- }
- }
- }
- public void Populate(Scene scene)
- {
- SceneObjectPart part = scene.GetSceneObjectPart(Key);
- if (part == null)
- {
- ScenePresence presence = scene.GetScenePresence(Key);
- if (presence == null)
- return;
- Name = presence.Firstname + " " + presence.Lastname;
- Owner = Key;
- Position = new LSL_Types.Vector3(
- presence.AbsolutePosition.X,
- presence.AbsolutePosition.Y,
- presence.AbsolutePosition.Z);
- Rotation = new LSL_Types.Quaternion(
- presence.Rotation.X,
- presence.Rotation.Y,
- presence.Rotation.Z,
- presence.Rotation.W);
- Velocity = new LSL_Types.Vector3(
- presence.Velocity.X,
- presence.Velocity.Y,
- presence.Velocity.Z);
- Type = 0x01;
- if (presence.Velocity != Vector3.Zero)
- Type |= 0x02;
- Group = presence.ControllingClient.ActiveGroupId;
- return;
- }
- part=part.ParentGroup.RootPart;
- LinkNum = 0;
- Group = part.GroupID;
- Name = part.Name;
- Owner = part.OwnerID;
- if (part.Velocity == Vector3.Zero)
- Type = 0x04;
- else
- Type = 0x02;
- foreach (SceneObjectPart p in part.ParentGroup.Parts)
- {
- if (p.Inventory.ContainsScripts())
- {
- Type |= 0x08;
- break;
- }
- }
- Position = new LSL_Types.Vector3(part.AbsolutePosition.X,
- part.AbsolutePosition.Y,
- part.AbsolutePosition.Z);
- Quaternion wr = part.ParentGroup.GroupRotation;
- Rotation = new LSL_Types.Quaternion(wr.X, wr.Y, wr.Z, wr.W);
- Velocity = new LSL_Types.Vector3(part.Velocity.X,
- part.Velocity.Y,
- part.Velocity.Z);
- }
- }
-
-
-
- public class EventParams
- {
- public EventParams(string eventName, Object[] eventParams, DetectParams[] detectParams)
- {
- EventName = eventName;
- Params = eventParams;
- DetectParams = detectParams;
- }
- public string EventName;
- public Object[] Params;
- public DetectParams[] DetectParams;
- }
- }
|