* Extended Script API with GetRandomAvatar

* The script will now get a IScriptEntity to it's host object with get/sets
* The script gets a IScriptReadnlyEntity interface to entities other than the host object.
* the test script now follows a random avatar.
This commit is contained in:
lbsa71
2007-04-03 19:12:07 +00:00
parent 6d8dcd1d1d
commit 7169acc47e
12 changed files with 276 additions and 155 deletions

View File

@@ -2,31 +2,78 @@ using System;
using System.Collections.Generic;
using System.Text;
using Axiom.MathLib;
using OpenSim.Physics.Manager;
using OpenSim.types;
using libsecondlife;
using OpenSim.RegionServer.world.scripting;
namespace OpenSim.world
{
public class Entity
public abstract class Entity : IScriptReadonlyEntity
{
public libsecondlife.LLUUID uuid;
public uint localid;
public LLVector3 position;
public LLVector3 velocity;
public Quaternion rotation;
protected string name;
protected List<Entity> children;
protected string m_name;
public virtual string Name
{
get { return m_name; }
}
private LLVector3 m_pos;
protected PhysicsActor _physActor;
protected World m_world;
public LLVector3 Pos
{
get
{
if (this._physActor != null)
{
m_pos.X = _physActor.Position.X;
m_pos.Y = _physActor.Position.Y;
m_pos.Z = _physActor.Position.Z;
}
return m_pos;
}
set
{
if (this._physActor != null)
{
try
{
lock (this.m_world.LockPhysicsEngine)
{
this._physActor.Position = new PhysicsVector(value.X, value.Y, value.Z);
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
m_pos = value;
}
}
public Entity()
{
uuid = new libsecondlife.LLUUID();
localid = 0;
position = new LLVector3();
m_pos = new LLVector3();
velocity = new LLVector3();
rotation = new Quaternion();
name = "(basic entity)";
m_name = "(basic entity)";
children = new List<Entity>();
}
public virtual void addForces()
{
foreach (Entity child in children)
@@ -42,11 +89,6 @@ namespace OpenSim.world
}
}
public virtual string getName()
{
return name;
}
public virtual Mesh getMesh()
{
Mesh mesh = new Mesh();