* Introduced IScriptHost as an interface to fetching object data from scripts.

* This meant introducing AbsolutePosition on all objects (since SimChat wants that)
afrisby
lbsa71 2007-08-16 17:08:03 +00:00
parent 67873b8614
commit 25fd8d0273
21 changed files with 148 additions and 78 deletions

View File

@ -186,7 +186,7 @@ namespace OpenSim.Region.Environment.LandManagement
List<ScenePresence> avatars = m_scene.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++)
{
Land over = m_scene.LandManager.getLandObject((int)Math.Round(avatars[i].Pos.X), (int)Math.Round(avatars[i].Pos.Y));
Land over = m_scene.LandManager.getLandObject((int)Math.Round(avatars[i].AbsolutePosition.X), (int)Math.Round(avatars[i].AbsolutePosition.Y));
if (over.landData.localID == this.landData.localID)
{
sendLandProperties(0, false, 0, avatars[i].ControllingClient);

View File

@ -532,7 +532,7 @@ namespace OpenSim.Region.Environment.LandManagement
ScenePresence clientAvatar = m_scene.RequestAvatar(remote_client.AgentId);
if (clientAvatar != null)
{
Land over = getLandObject(clientAvatar.Pos.X,clientAvatar.Pos.Y);
Land over = getLandObject(clientAvatar.AbsolutePosition.X,clientAvatar.AbsolutePosition.Y);
if (over != null)
{
over.sendLandProperties(0, false, 0, remote_client);
@ -554,7 +554,7 @@ namespace OpenSim.Region.Environment.LandManagement
public void addPrimToLandPrimCounts(SceneObjectGroup obj)
{
LLVector3 position = obj.Pos;
LLVector3 position = obj.AbsolutePosition;
Land landUnderPrim = getLandObject(position.X, position.Y);
if (landUnderPrim != null)
{

View File

@ -115,7 +115,7 @@ namespace OpenSim.Region.Environment
permission = true;
// Users should be able to edit what is over their land.
if (m_scene.LandManager.getLandObject(task.Pos.X, task.Pos.Y).landData.ownerID == user)
if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID == user)
permission = true;
// Estate users should be able to edit anything in the sim

View File

@ -38,7 +38,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <summary>
///
/// </summary>
public override LLVector3 Pos
public override LLVector3 AbsolutePosition
{
get
{

View File

@ -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<EntityBase> m_children;
@ -37,7 +38,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <summary>
///
/// </summary>
public virtual LLVector3 Pos
public virtual LLVector3 AbsolutePosition
{
get { return m_pos; }
set { m_pos = value; }

View File

@ -57,14 +57,14 @@ namespace OpenSim.Region.Environment.Scenes
/// If rootprim, will return world position
/// otherwise will return local offset from rootprim
/// </summary>
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
/// <param name="rootParent"></param>
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);

View File

@ -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();

View File

@ -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);

View File

@ -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
/// <param name="remoteClient"></param>
public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
{
this.rootPrimitive.Pos = pos;
this.rootPrimitive.AbsolutePosition = pos;
this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient);
}

View File

@ -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
/// <param name="remoteClient"></param>
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
/// <param name="pos"></param>
public void UpdateGroupPosition(LLVector3 pos)
{
this.Pos = pos;
this.AbsolutePosition = pos;
}
/// <summary>
@ -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;
}
/// <summary>
@ -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
{

View File

@ -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
/// <param name="position"></param>
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;

View File

@ -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
/// <param name="pos"></param>
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
/// <param name="RemoteClient"></param>
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
/// <param name="remoteAvatar"></param>
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
/// </summary>
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
/// </summary>
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
/// </summary>
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;

View File

@ -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; }
}
}

View File

@ -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; }
}
}
}

View File

@ -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)");

View File

@ -60,7 +60,7 @@ namespace SimpleApp
m_parts.Remove(part.UUID);
remoteClient.SendKillObject(m_regionHandle, part.LocalID);
remoteClient.AddMoney(1);
remoteClient.SendChatMessage("Poof!", 1, Pos, "Party Party", LLUUID.Zero);
remoteClient.SendChatMessage("Poof!", 1, this.AbsolutePosition, "Party Party", LLUUID.Zero);
}
public override void OnGrabGroup( LLVector3 offsetPos, IClientAPI remoteClient)
@ -71,7 +71,7 @@ namespace SimpleApp
m_scene.RemoveEntity(this);
remoteClient.SendKillObject(m_regionHandle, m_rootPart.LocalID);
remoteClient.AddMoney(50);
remoteClient.SendChatMessage("KABLAM!!!", 1, Pos, "Groupie Groupie", LLUUID.Zero);
remoteClient.SendChatMessage("KABLAM!!!", 1, AbsolutePosition, "Groupie Groupie", LLUUID.Zero);
}
}
}

View File

@ -67,7 +67,7 @@ namespace SimpleApp
SubscribeToClientEvents(client);
ScenePresence avatar = CreateAndAddScenePresence(client);
avatar.Pos = new LLVector3(128, 128, 26);
avatar.AbsolutePosition = new LLVector3(128, 128, 26);
LLVector3 pos = new LLVector3(128, 128, 128);

View File

@ -229,6 +229,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
// Add namespace, class name and inheritance
Return = "namespace SecondLife {\r\n";
Return += "public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass {\r\n";
Return += "public Script( OpenSim.Region.Environment.Scenes.Scripting.IScriptHost host ) : base( host ) { }\r\n";
Return += Script;
Return += "} }\r\n";

View File

@ -2,6 +2,10 @@ using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler;
using libsecondlife;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Scenes.Scripting;
using OpenSim.Framework.Console;
namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
{
@ -11,11 +15,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
internal OpenSim.Region.Environment.Scenes.Scene World;
private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
IScriptHost m_host;
public LSL_BaseClass( IScriptHost host )
{
m_host = host;
}
public void Start(OpenSim.Region.Environment.Scenes.Scene _World, string FullScriptID)
{
World = _World;
Console.WriteLine("ScriptEngine", "LSL_BaseClass.Start() called. FullScriptID: " + FullScriptID);
MainLog.Instance.Notice( "ScriptEngine", "LSL_BaseClass.Start() called. FullScriptID: " + FullScriptID + ": Hosted by [" + m_host.Name + ":" + m_host.UUID + "@"+m_host.AbsolutePosition +"]");
return;
}
@ -59,8 +69,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
//Common.SendToDebug("INTERNAL FUNCTION llSay(" + (int)channelID + ", \"" + (string)text + "\");");
Console.WriteLine("llSay Channel " + channelID + ", Text: \"" + text + "\"");
//type for say is 1
//World.SimChat(enc.GetBytes(text), 1, World.Objects[World.ConvertLocalIDToFullID(MY_OBJECT_ID)], MY_OBJECT_NAME, World.Objects[World.ConvertLocalIDToFullID(MY_OBJECT_ID)]);
LLVector3 fromPos = m_host.AbsolutePosition; // Position of parent
string fromName = m_host.Name; // Name of script parent
LLUUID fromUUID = m_host.UUID; // UUID of parent
World.SimChat( Helpers.StringToField( text ), 1, fromPos, fromName, fromUUID );
}
public void llShout(int channelID, string text)
{
Console.WriteLine("llShout Channel " + channelID + ", Text: \"" + text + "\"");
@ -68,6 +84,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
//World.SimChat(enc.GetBytes(text), 2, World.Objects[World.ConvertLocalIDToFullID(MY_OBJECT_ID)], MY_OBJECT_NAME, World.Objects[World.ConvertLocalIDToFullID(MY_OBJECT_ID)]);
}
public int llListen(int channelID, string name, string ID, string msg) { return 0; }
public void llListenControl(int number, int active) { return; }
public void llListenRemove(int number) { return; }

View File

@ -31,6 +31,7 @@ using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Reflection;
using OpenSim.Region.Environment.Scenes.Scripting;
namespace OpenSim.Region.ScriptEngine.DotNetEngine
{
@ -148,10 +149,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
// * Find next available AppDomain to put it in
AppDomain FreeAppDomain = GetFreeAppDomain();
// * Load and start script
// * Load and start script, for now with dummy host
//OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName);
OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName);
string FullScriptID = ScriptID + "." + ObjectID;
OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName, new NullScriptHost() );
string FullScriptID = ScriptID + "." + ObjectID;
// Add it to our temporary active script keeper
//Scripts.Add(FullScriptID, Script);
SetScript(ObjectID, ScriptID, Script);
@ -161,6 +163,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
// Start the script - giving it BuiltIns
//myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager initializing script, handing over private builtin command interface");
Script.Start(myScriptEngine.World, ScriptID);
}
@ -189,7 +192,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
/// <param name="FreeAppDomain">AppDomain to load script into</param>
/// <param name="FileName">FileName of script assembly (.dll)</param>
/// <returns></returns>
private OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass LoadAndInitAssembly(AppDomain FreeAppDomain, string FileName)
private OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass LoadAndInitAssembly(AppDomain FreeAppDomain, string FileName, IScriptHost host)
{
//myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager Loading Assembly " + FileName);
// Load .Net Assembly (.dll)
@ -228,7 +231,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
//{
//}
return (OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass)Activator.CreateInstance(t);
object[] args = new object[] { host };
return (OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass)Activator.CreateInstance(t, args );
}

View File

@ -253,7 +253,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage
// of sucks. No idea if there is a shortcut here or not.
prim.ParentID = Convert.ToUInt32(row["ParentID"]);
prim.CreationDate = Convert.ToInt32(row["CreationDate"]);
prim.PartName = (String)row["Name"];
prim.Name = (String)row["Name"];
// various text fields
prim.Text = (String)row["Text"];
prim.Description = (String)row["Description"];
@ -311,7 +311,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage
row["UUID"] = prim.UUID;
row["ParentID"] = prim.ParentID;
row["CreationDate"] = prim.CreationDate;
row["Name"] = prim.PartName;
row["Name"] = prim.Name;
row["SceneGroupID"] = sceneGroupID; // the UUID of the root part for this SceneObjectGroup
// various text fields
row["Text"] = prim.Text;