From 25fd8d02738e61e81f93ac784b02ab84697ee528 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Thu, 16 Aug 2007 17:08:03 +0000 Subject: * Introduced IScriptHost as an interface to fetching object data from scripts. * This meant introducing AbsolutePosition on all objects (since SimChat wants that) --- OpenSim/Region/Environment/Scenes/Entity.cs | 2 +- OpenSim/Region/Environment/Scenes/EntityBase.cs | 5 ++-- .../Region/Environment/Scenes/Primitive(Old).cs | 32 +++++++++++----------- .../Environment/Scenes/Scene.PacketHandlers.cs | 6 ++-- OpenSim/Region/Environment/Scenes/Scene.cs | 2 +- .../Region/Environment/Scenes/SceneObject(Old).cs | 6 ++-- .../Region/Environment/Scenes/SceneObjectGroup.cs | 26 +++++++++--------- .../Region/Environment/Scenes/SceneObjectPart.cs | 24 ++++++++++------ OpenSim/Region/Environment/Scenes/ScenePresence.cs | 24 ++++++++-------- .../Environment/Scenes/Scripting/IScriptHost.cs | 14 ++++++++++ .../Environment/Scenes/Scripting/NullScriptHost.cs | 26 ++++++++++++++++++ .../Scenes/Scripting/ScriptInterpretedAPI.cs | 2 +- 12 files changed, 108 insertions(+), 61 deletions(-) create mode 100644 OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs create mode 100644 OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/Entity.cs b/OpenSim/Region/Environment/Scenes/Entity.cs index 204b68f..d9f41e3 100644 --- a/OpenSim/Region/Environment/Scenes/Entity.cs +++ b/OpenSim/Region/Environment/Scenes/Entity.cs @@ -38,7 +38,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public override LLVector3 Pos + public override LLVector3 AbsolutePosition { get { diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs index 5f2634d..a4d9ac5 100644 --- a/OpenSim/Region/Environment/Scenes/EntityBase.cs +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs @@ -1,10 +1,11 @@ using System.Collections.Generic; using Axiom.Math; using libsecondlife; +using OpenSim.Region.Environment.Scenes.Scripting; namespace OpenSim.Region.Environment.Scenes { - public abstract class EntityBase + public abstract class EntityBase : IScriptHost { protected List m_children; @@ -37,7 +38,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public virtual LLVector3 Pos + public virtual LLVector3 AbsolutePosition { get { return m_pos; } set { m_pos = value; } diff --git a/OpenSim/Region/Environment/Scenes/Primitive(Old).cs b/OpenSim/Region/Environment/Scenes/Primitive(Old).cs index 64976a8..2f51ab3 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive(Old).cs +++ b/OpenSim/Region/Environment/Scenes/Primitive(Old).cs @@ -57,14 +57,14 @@ namespace OpenSim.Region.Environment.Scenes /// If rootprim, will return world position /// otherwise will return local offset from rootprim /// - public override LLVector3 Pos + public override LLVector3 AbsolutePosition { get { if (m_isRootPrim) { //if we are rootprim then our offset should be zero - return m_pos + m_Parent.Pos; + return m_pos + m_Parent.AbsolutePosition; } else { @@ -75,9 +75,9 @@ namespace OpenSim.Region.Environment.Scenes { if (m_isRootPrim) { - m_Parent.Pos = value; + m_Parent.AbsolutePosition = value; } - m_pos = value - m_Parent.Pos; + m_pos = value - m_Parent.AbsolutePosition; } } @@ -99,7 +99,7 @@ namespace OpenSim.Region.Environment.Scenes } else { - return Pos; + return AbsolutePosition; } } } @@ -284,7 +284,7 @@ namespace OpenSim.Region.Environment.Scenes OwnerID = ownerID; CreatorID = OwnerID; LastOwnerID = LLUUID.Zero; - Pos = pos; + AbsolutePosition = pos; m_uuid = LLUUID.Random(); m_localId = (uint)(localID); @@ -335,13 +335,13 @@ namespace OpenSim.Region.Environment.Scenes /// public void SetNewParent(Primitive newParent, SceneObjectOLD rootParent) { - LLVector3 oldPos = new LLVector3(Pos.X, Pos.Y, Pos.Z); + LLVector3 oldPos = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); m_isRootPrim = false; m_Parent = newParent; ParentID = newParent.LocalId; m_RootParent = rootParent; m_RootParent.AddChildToList(this); - Pos = oldPos; + AbsolutePosition = oldPos; Vector3 axPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z); axPos = m_Parent.Rotation.Inverse() * axPos; m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); @@ -366,7 +366,7 @@ namespace OpenSim.Region.Environment.Scenes public void SetRootParent(SceneObjectOLD newRoot, Primitive newParent, LLVector3 oldParentPosition, Quaternion oldParentRotation) { - LLVector3 oldPos = new LLVector3(Pos.X, Pos.Y, Pos.Z); + LLVector3 oldPos = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); Vector3 axOldPos = new Vector3(oldPos.X, oldPos.Y, oldPos.Z); axOldPos = oldParentRotation * axOldPos; oldPos = new LLVector3(axOldPos.x, axOldPos.y, axOldPos.z); @@ -379,7 +379,7 @@ namespace OpenSim.Region.Environment.Scenes m_RootParent = newRoot; m_RootParent.AddChildToList(this); - Pos = oldPos; + AbsolutePosition = oldPos; Vector3 axPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z); axPos = m_Parent.Rotation.Inverse() * axPos; m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); @@ -445,7 +445,7 @@ namespace OpenSim.Region.Environment.Scenes { LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); - Pos = newPos; + AbsolutePosition = newPos; ScheduleTerseUpdate(); OnPrimCountTainted(); @@ -461,14 +461,14 @@ namespace OpenSim.Region.Environment.Scenes if (m_isRootPrim) { LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); - LLVector3 oldPos = new LLVector3(Pos.X, Pos.Y, Pos.Z); + LLVector3 oldPos = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); LLVector3 diff = oldPos - newPos; Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); axDiff = Rotation.Inverse() * axDiff; diff.X = axDiff.x; diff.Y = axDiff.y; diff.Z = axDiff.z; - Pos = newPos; + AbsolutePosition = newPos; foreach (Primitive prim in m_children) { @@ -507,7 +507,7 @@ namespace OpenSim.Region.Environment.Scenes public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot) { Rotation = new Quaternion(rot.W, rot.X, rot.Y, rot.Z); - Pos = pos; + AbsolutePosition = pos; ScheduleTerseUpdate(); } @@ -644,7 +644,7 @@ namespace OpenSim.Region.Environment.Scenes public void SendFullUpdateToClient(IClientAPI remoteClient) { LLVector3 lPos; - lPos = Pos; + lPos = AbsolutePosition; LLQuaternion lRot; lRot = new LLQuaternion(Rotation.x, Rotation.y, Rotation.z, Rotation.w); @@ -690,7 +690,7 @@ namespace OpenSim.Region.Environment.Scenes LLVector3 lPos; Quaternion lRot; - lPos = Pos; + lPos = AbsolutePosition; lRot = Rotation; LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w); diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index b901d23..3f90723 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -159,7 +159,7 @@ namespace OpenSim.Region.Environment.Scenes if (this.Avatars.ContainsKey(fromAgentID)) { avatar = this.Avatars[fromAgentID]; - fromPos = avatar.Pos; + fromPos = avatar.AbsolutePosition; fromName = avatar.Firstname + " " + avatar.Lastname; avatar = null; } @@ -170,7 +170,7 @@ namespace OpenSim.Region.Environment.Scenes if (this.Avatars.ContainsKey(presence.ControllingClient.AgentId)) { avatar = this.Avatars[presence.ControllingClient.AgentId]; - dis = (int)avatar.Pos.GetDistanceTo(fromPos); + dis = (int)avatar.AbsolutePosition.GetDistanceTo(fromPos); } switch (type) @@ -354,7 +354,7 @@ namespace OpenSim.Region.Environment.Scenes if (originPrim != null) { SceneObjectGroup copy = originPrim.Copy(); - copy.Pos = copy.Pos + offset; + copy.AbsolutePosition = copy.AbsolutePosition + offset; this.Entities.Add(copy.UUID, copy); copy.ScheduleGroupForFullUpdate(); diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 96bb97a..7b2d0c5 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -645,7 +645,7 @@ namespace OpenSim.Region.Environment.Scenes MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Adding new avatar to world"); MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Starting RegionHandshake "); - PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); + PhysicsVector pVec = new PhysicsVector(newAvatar.AbsolutePosition.X, newAvatar.AbsolutePosition.Y, newAvatar.AbsolutePosition.Z); lock (m_syncRoot) { newAvatar.PhysActor = phyScene.AddAvatar(pVec); diff --git a/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs b/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs index 882b72e..f32c952 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs @@ -92,7 +92,7 @@ namespace OpenSim.Region.Environment.Scenes m_scene = world; m_eventManager = eventManager; - this.Pos = pos; + this.AbsolutePosition = pos; this.CreateRootFromShape(ownerID, localID, shape, pos); registerEvents(); @@ -176,7 +176,7 @@ namespace OpenSim.Region.Environment.Scenes dupe.rootPrimitive = newRoot; dupe.m_children.Add(dupe.rootPrimitive); - dupe.rootPrimitive.Pos = this.Pos; + dupe.rootPrimitive.AbsolutePosition = this.AbsolutePosition; dupe.Rotation = this.Rotation; dupe.LocalId = m_scene.PrimIDAllocate(); @@ -274,7 +274,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) { - this.rootPrimitive.Pos = pos; + this.rootPrimitive.AbsolutePosition = pos; this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient); } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 73f199e..a5ad2e6 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -76,7 +76,7 @@ namespace OpenSim.Region.Environment.Scenes } } - public override LLVector3 Pos + public override LLVector3 AbsolutePosition { get { return m_rootPart.GroupPosition; } set @@ -248,7 +248,7 @@ namespace OpenSim.Region.Environment.Scenes { SceneObjectGroup dupe = (SceneObjectGroup)this.MemberwiseClone(); dupe.m_parts.Clear(); - dupe.Pos = new LLVector3(Pos.X, Pos.Y, Pos.Z); + dupe.AbsolutePosition = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); dupe.m_scene = m_scene; dupe.m_regionHandle = this.m_regionHandle; @@ -427,8 +427,8 @@ namespace OpenSim.Region.Environment.Scenes public void LinkToGroup(SceneObjectGroup objectGroup) { SceneObjectPart linkPart = objectGroup.m_rootPart; - linkPart.OffsetPosition = linkPart.GroupPosition - this.Pos; - linkPart.GroupPosition = this.Pos; + linkPart.OffsetPosition = linkPart.GroupPosition - this.AbsolutePosition; + linkPart.GroupPosition = this.AbsolutePosition; Vector3 axPos = new Vector3(linkPart.OffsetPosition.X, linkPart.OffsetPosition.Y, linkPart.OffsetPosition.Z); Quaternion parentRot = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z); @@ -456,7 +456,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void GrabMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) { - this.Pos = pos; + this.AbsolutePosition = pos; this.m_rootPart.SendTerseUpdateToAllClients(); } @@ -482,7 +482,7 @@ namespace OpenSim.Region.Environment.Scenes proper.ObjectData[0].TouchName = enc.GetBytes(this.m_rootPart.TouchName + "\0"); proper.ObjectData[0].TextureID = new byte[0]; proper.ObjectData[0].SitName = enc.GetBytes(this.m_rootPart.SitName + "\0"); - proper.ObjectData[0].Name = enc.GetBytes(this.m_rootPart.PartName + "\0"); + proper.ObjectData[0].Name = enc.GetBytes(this.m_rootPart.Name + "\0"); proper.ObjectData[0].Description = enc.GetBytes(this.m_rootPart.Description + "\0"); proper.ObjectData[0].OwnerMask = this.m_rootPart.OwnerMask; proper.ObjectData[0].NextOwnerMask = this.m_rootPart.NextOwnerMask; @@ -502,7 +502,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectPart part = this.GetChildPrim(localID); if (part != null) { - part.PartName = name; + part.Name = name; } } @@ -636,7 +636,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void UpdateGroupPosition(LLVector3 pos) { - this.Pos = pos; + this.AbsolutePosition = pos; } /// @@ -667,7 +667,7 @@ namespace OpenSim.Region.Environment.Scenes private void UpdateRootPosition(LLVector3 pos) { LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); - LLVector3 oldPos = new LLVector3(this.Pos.X + this.m_rootPart.OffsetPosition.X, this.Pos.Y + this.m_rootPart.OffsetPosition.Y, this.Pos.Z + this.m_rootPart.OffsetPosition.Z); + LLVector3 oldPos = new LLVector3(this.AbsolutePosition.X + this.m_rootPart.OffsetPosition.X, this.AbsolutePosition.Y + this.m_rootPart.OffsetPosition.Y, this.AbsolutePosition.Z + this.m_rootPart.OffsetPosition.Z); LLVector3 diff = oldPos - newPos; Axiom.Math.Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); Axiom.Math.Quaternion partRotation = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z); @@ -683,7 +683,7 @@ namespace OpenSim.Region.Environment.Scenes obPart.OffsetPosition = obPart.OffsetPosition + diff; } } - this.Pos = newPos; + this.AbsolutePosition = newPos; pos.X = newPos.X; pos.Y = newPos.Y; pos.Z = newPos.Z; @@ -708,7 +708,7 @@ namespace OpenSim.Region.Environment.Scenes public void UpdateGroupRotation(LLVector3 pos, LLQuaternion rot) { this.m_rootPart.UpdateRotation(rot); - this.Pos = pos; + this.AbsolutePosition = pos; } /// @@ -828,7 +828,7 @@ namespace OpenSim.Region.Environment.Scenes { if (m_rootPart == part) { - part.SendFullUpdateToClient(remoteClient, Pos); + part.SendFullUpdateToClient(remoteClient, AbsolutePosition); } else { @@ -845,7 +845,7 @@ namespace OpenSim.Region.Environment.Scenes { if (m_rootPart == part) { - part.SendTerseUpdateToClient(remoteClient, Pos); + part.SendTerseUpdateToClient(remoteClient, AbsolutePosition); } else { diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 8e570d4..54bb5e6 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -9,11 +9,12 @@ using libsecondlife; using libsecondlife.Packets; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; +using OpenSim.Region.Environment.Scenes.Scripting; namespace OpenSim.Region.Environment.Scenes { - public class SceneObjectPart + public class SceneObjectPart : IScriptHost { private const uint FULL_MASK_PERMISSIONS = 2147483647; @@ -55,11 +56,11 @@ namespace OpenSim.Region.Environment.Scenes set { m_localID = value; } } - protected string m_partName; - public virtual string PartName + protected string m_name; + public virtual string Name { - get { return m_partName; } - set { m_partName = value; } + get { return m_name; } + set { m_name = value; } } protected LLObject.ObjectFlags m_flags = (LLObject.ObjectFlags)32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128; @@ -91,11 +92,16 @@ namespace OpenSim.Region.Environment.Scenes set { m_groupPosition = value; } } - protected LLVector3 m_offset; + protected LLVector3 m_offsetPosition; public LLVector3 OffsetPosition { - get { return m_offset; } - set { m_offset = value; } + get { return m_offsetPosition; } + set { m_offsetPosition = value; } + } + + public LLVector3 AbsolutePosition + { + get { return m_offsetPosition + m_groupPosition; } } protected LLQuaternion m_rotationOffset; @@ -195,7 +201,7 @@ namespace OpenSim.Region.Environment.Scenes /// public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, PrimitiveBaseShape shape, LLVector3 groupPosition, LLVector3 offsetPosition) { - this.m_partName = "Primitive"; + this.m_name = "Primitive"; this.m_regionHandle = regionHandle; this.m_parentGroup = parent; diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 6e4fcda..5dbf643 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -156,7 +156,7 @@ namespace OpenSim.Region.Environment.Scenes this.m_firstname = ControllingClient.FirstName; this.m_lastname = ControllingClient.LastName; m_localId = m_scene.NextLocalId; - Pos = ControllingClient.StartPos; + AbsolutePosition = ControllingClient.StartPos; visualParams = new byte[218]; for (int i = 0; i < 218; i++) @@ -205,7 +205,7 @@ namespace OpenSim.Region.Environment.Scenes if (this.childAgent == true) { this.Velocity = new LLVector3(0, 0, 0); - this.Pos = new LLVector3(128, 128, 70); + this.AbsolutePosition = new LLVector3(128, 128, 70); } } @@ -217,7 +217,7 @@ namespace OpenSim.Region.Environment.Scenes public void MakeAvatar(LLVector3 pos, bool isFlying) { //this.childAvatar = false; - this.Pos = pos; + this.AbsolutePosition = pos; this._physActor.Flying = isFlying; this.newAvatar = true; this.childAgent = false; @@ -236,7 +236,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void Teleport(LLVector3 pos) { - this.Pos = pos; + this.AbsolutePosition = pos; this.SendTerseUpdateToALLClients(); } @@ -278,7 +278,7 @@ namespace OpenSim.Region.Environment.Scenes { look = new LLVector3(0.99f, 0.042f, 0); } - this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, Pos, look); + this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); if (this.childAgent) { this.childAgent = false; @@ -427,7 +427,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void SendTerseUpdateToClient(IClientAPI RemoteClient) { - LLVector3 pos = this.Pos; + LLVector3 pos = this.AbsolutePosition; LLVector3 vel = this.Velocity; RemoteClient.SendAvatarTerseUpdate(this.m_regionHandle, 64096, this.LocalId, new LLVector3(pos.X, pos.Y, pos.Z), new LLVector3(vel.X, vel.Y, vel.Z)); } @@ -450,7 +450,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) { - remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.m_firstname, this.m_lastname, this.m_uuid, this.LocalId, this.Pos, this.m_textureEntry.ToBytes()); + remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.m_firstname, this.m_lastname, this.m_uuid, this.LocalId, this.AbsolutePosition, this.m_textureEntry.ToBytes()); } public void SendFullUpdateToALLClients() @@ -472,7 +472,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void SendInitialData() { - this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.m_firstname, this.m_lastname, this.m_uuid, this.LocalId, this.Pos, this.m_textureEntry.ToBytes()); + this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.m_firstname, this.m_lastname, this.m_uuid, this.LocalId, this.AbsolutePosition, this.m_textureEntry.ToBytes()); if (!this.childAgent) { this.m_scene.InformClientOfNeighbours(this.ControllingClient); @@ -547,9 +547,9 @@ namespace OpenSim.Region.Environment.Scenes protected void CheckForSignificantMovement() { - if (libsecondlife.Helpers.VecDist(this.Pos, this.posLastSignificantMove) > 2.0) + if (libsecondlife.Helpers.VecDist(this.AbsolutePosition, this.posLastSignificantMove) > 2.0) { - this.posLastSignificantMove = this.Pos; + this.posLastSignificantMove = this.AbsolutePosition; if (OnSignificantClientMovement != null) { OnSignificantClientMovement(this.ControllingClient); @@ -564,7 +564,7 @@ namespace OpenSim.Region.Environment.Scenes /// protected void CheckForBorderCrossing() { - LLVector3 pos2 = this.Pos; + LLVector3 pos2 = this.AbsolutePosition; LLVector3 vel = this.Velocity; float timeStep = 0.1f; @@ -588,7 +588,7 @@ namespace OpenSim.Region.Environment.Scenes /// protected void CrossToNewRegion() { - LLVector3 pos = this.Pos; + LLVector3 pos = this.AbsolutePosition; LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z); uint neighbourx = this.m_regionInfo.RegionLocX; uint neighboury = this.m_regionInfo.RegionLocY; diff --git a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs new file mode 100644 index 0000000..1c14264 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; + +namespace OpenSim.Region.Environment.Scenes.Scripting +{ + public interface IScriptHost + { + string Name { get; } + LLUUID UUID { get; } + LLVector3 AbsolutePosition { get; } + } +} diff --git a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs new file mode 100644 index 0000000..a55c87e --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; + +namespace OpenSim.Region.Environment.Scenes.Scripting +{ + public class NullScriptHost : IScriptHost + { + LLVector3 m_pos = new LLVector3( 128, 128, 30 ); + public string Name + { + get { return "Object"; } + } + + public LLUUID UUID + { + get { return LLUUID.Zero; } + } + + public LLVector3 AbsolutePosition + { + get { return m_pos; } + } + } +} diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptInterpretedAPI.cs b/OpenSim/Region/Environment/Scenes/Scripting/ScriptInterpretedAPI.cs index a5898b7..4617feb 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/ScriptInterpretedAPI.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/ScriptInterpretedAPI.cs @@ -74,7 +74,7 @@ namespace OpenSim.Region.Scripting [Obsolete("Unimplemented")] public void osAddToLandPassList(Key avatar, float hours) { - Vector myPosition = Task.Pos; + Vector myPosition = Task.AbsolutePosition; Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y); OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)"); -- cgit v1.1