aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/world/Entity.cs
diff options
context:
space:
mode:
authorlbsa712007-04-03 19:12:07 +0000
committerlbsa712007-04-03 19:12:07 +0000
commit7169acc47e8bb56581bd28c3bd921ca9236ba3c3 (patch)
tree4565785736fb759f0c665aac28cd88937042bdd3 /OpenSim.RegionServer/world/Entity.cs
parentAnother temporary bug fix attempt, this time for the packet overflow problem,... (diff)
downloadopensim-SC-7169acc47e8bb56581bd28c3bd921ca9236ba3c3.zip
opensim-SC-7169acc47e8bb56581bd28c3bd921ca9236ba3c3.tar.gz
opensim-SC-7169acc47e8bb56581bd28c3bd921ca9236ba3c3.tar.bz2
opensim-SC-7169acc47e8bb56581bd28c3bd921ca9236ba3c3.tar.xz
* 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.
Diffstat (limited to 'OpenSim.RegionServer/world/Entity.cs')
-rw-r--r--OpenSim.RegionServer/world/Entity.cs62
1 files changed, 52 insertions, 10 deletions
diff --git a/OpenSim.RegionServer/world/Entity.cs b/OpenSim.RegionServer/world/Entity.cs
index 567c0b7..424d395 100644
--- a/OpenSim.RegionServer/world/Entity.cs
+++ b/OpenSim.RegionServer/world/Entity.cs
@@ -2,31 +2,78 @@ using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using Axiom.MathLib; 4using Axiom.MathLib;
5using OpenSim.Physics.Manager;
5using OpenSim.types; 6using OpenSim.types;
6using libsecondlife; 7using libsecondlife;
8using OpenSim.RegionServer.world.scripting;
7 9
8namespace OpenSim.world 10namespace OpenSim.world
9{ 11{
10 public class Entity 12 public abstract class Entity : IScriptReadonlyEntity
11 { 13 {
12 public libsecondlife.LLUUID uuid; 14 public libsecondlife.LLUUID uuid;
13 public uint localid; 15 public uint localid;
14 public LLVector3 position;
15 public LLVector3 velocity; 16 public LLVector3 velocity;
16 public Quaternion rotation; 17 public Quaternion rotation;
17 protected string name;
18 protected List<Entity> children; 18 protected List<Entity> children;
19 19
20 protected string m_name;
21 public virtual string Name
22 {
23 get { return m_name; }
24 }
25
26 private LLVector3 m_pos;
27 protected PhysicsActor _physActor;
28 protected World m_world;
29
30 public LLVector3 Pos
31 {
32 get
33 {
34 if (this._physActor != null)
35 {
36 m_pos.X = _physActor.Position.X;
37 m_pos.Y = _physActor.Position.Y;
38 m_pos.Z = _physActor.Position.Z;
39 }
40
41 return m_pos;
42 }
43 set
44 {
45 if (this._physActor != null)
46 {
47 try
48 {
49 lock (this.m_world.LockPhysicsEngine)
50 {
51
52 this._physActor.Position = new PhysicsVector(value.X, value.Y, value.Z);
53 }
54 }
55 catch (Exception e)
56 {
57 Console.WriteLine(e.Message);
58 }
59 }
60
61 m_pos = value;
62 }
63 }
64
65
20 public Entity() 66 public Entity()
21 { 67 {
22 uuid = new libsecondlife.LLUUID(); 68 uuid = new libsecondlife.LLUUID();
23 localid = 0; 69 localid = 0;
24 position = new LLVector3(); 70 m_pos = new LLVector3();
25 velocity = new LLVector3(); 71 velocity = new LLVector3();
26 rotation = new Quaternion(); 72 rotation = new Quaternion();
27 name = "(basic entity)"; 73 m_name = "(basic entity)";
28 children = new List<Entity>(); 74 children = new List<Entity>();
29 } 75 }
76
30 public virtual void addForces() 77 public virtual void addForces()
31 { 78 {
32 foreach (Entity child in children) 79 foreach (Entity child in children)
@@ -42,11 +89,6 @@ namespace OpenSim.world
42 } 89 }
43 } 90 }
44 91
45 public virtual string getName()
46 {
47 return name;
48 }
49
50 public virtual Mesh getMesh() 92 public virtual Mesh getMesh()
51 { 93 {
52 Mesh mesh = new Mesh(); 94 Mesh mesh = new Mesh();