diff options
author | gareth | 2007-03-03 01:49:56 +0000 |
---|---|---|
committer | gareth | 2007-03-03 01:49:56 +0000 |
commit | b968ff83a998b82d8bce9a4175178c7cd710be19 (patch) | |
tree | 4e3808e89610bede8ad63879b5fd3968f3c2800e | |
parent | Lock the world so we don't cause nastiness and crashes (diff) | |
download | opensim-SC_OLD-b968ff83a998b82d8bce9a4175178c7cd710be19.zip opensim-SC_OLD-b968ff83a998b82d8bce9a4175178c7cd710be19.tar.gz opensim-SC_OLD-b968ff83a998b82d8bce9a4175178c7cd710be19.tar.bz2 opensim-SC_OLD-b968ff83a998b82d8bce9a4175178c7cd710be19.tar.xz |
Begun porting a (STABLE) version of MW's movement code
Diffstat (limited to '')
-rw-r--r-- | src/world/Avatar.cs | 18 | ||||
-rw-r--r-- | src/world/Entity.cs | 10 | ||||
-rw-r--r-- | src/world/PhysicsEngine.cs | 7 |
3 files changed, 30 insertions, 5 deletions
diff --git a/src/world/Avatar.cs b/src/world/Avatar.cs index f3905cd..fc1b4a2 100644 --- a/src/world/Avatar.cs +++ b/src/world/Avatar.cs | |||
@@ -12,6 +12,8 @@ namespace OpenSim.world | |||
12 | public string firstname; | 12 | public string firstname; |
13 | public string lastname; | 13 | public string lastname; |
14 | public OpenSimClient ControllingClient; | 14 | public OpenSimClient ControllingClient; |
15 | public uint CurrentKeyMask; | ||
16 | |||
15 | private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; | 17 | private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; |
16 | 18 | ||
17 | public Avatar(OpenSimClient TheClient) { | 19 | public Avatar(OpenSimClient TheClient) { |
@@ -21,7 +23,21 @@ namespace OpenSim.world | |||
21 | } | 23 | } |
22 | 24 | ||
23 | public void update() { | 25 | public void update() { |
24 | base.update(); | 26 | lock(this) { |
27 | base.update(); | ||
28 | |||
29 | if((this.CurrentKeyMask & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) != 0) { | ||
30 | if((this.velocity.X>230) & (this.velocity.Y>230)) { | ||
31 | this.velocity.X=230; | ||
32 | this.velocity.Y=230; | ||
33 | this.velocity.Z=0; | ||
34 | } | ||
35 | } else { | ||
36 | this.velocity.X=0; | ||
37 | this.velocity.Y=0; | ||
38 | this.velocity.Z=0; | ||
39 | } | ||
40 | } | ||
25 | } | 41 | } |
26 | 42 | ||
27 | private void SetupTemplate(string name) | 43 | private void SetupTemplate(string name) |
diff --git a/src/world/Entity.cs b/src/world/Entity.cs index 92ab2da..0f75c8a 100644 --- a/src/world/Entity.cs +++ b/src/world/Entity.cs | |||
@@ -2,6 +2,7 @@ using System; | |||
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using Axiom.MathLib; | 4 | using Axiom.MathLib; |
5 | using libsecondlife; | ||
5 | using OpenSim.types; | 6 | using OpenSim.types; |
6 | 7 | ||
7 | namespace OpenSim.world | 8 | namespace OpenSim.world |
@@ -9,8 +10,8 @@ namespace OpenSim.world | |||
9 | public class Entity | 10 | public class Entity |
10 | { | 11 | { |
11 | protected libsecondlife.LLUUID uuid; | 12 | protected libsecondlife.LLUUID uuid; |
12 | protected Vector3 position; | 13 | public LLVector3 position; |
13 | protected Vector3 velocity; | 14 | public LLVector3 velocity; |
14 | protected Quaternion rotation; | 15 | protected Quaternion rotation; |
15 | protected string name; | 16 | protected string name; |
16 | protected List<Entity> children; | 17 | protected List<Entity> children; |
@@ -19,8 +20,8 @@ namespace OpenSim.world | |||
19 | public Entity() | 20 | public Entity() |
20 | { | 21 | { |
21 | uuid = new libsecondlife.LLUUID(); | 22 | uuid = new libsecondlife.LLUUID(); |
22 | position = new Vector3(); | 23 | position = new LLVector3(); |
23 | velocity = new Vector3(); | 24 | velocity = new LLVector3(); |
24 | rotation = new Quaternion(); | 25 | rotation = new Quaternion(); |
25 | name = "(basic entity)"; | 26 | name = "(basic entity)"; |
26 | children = new List<Entity>(); | 27 | children = new List<Entity>(); |
@@ -33,6 +34,7 @@ namespace OpenSim.world | |||
33 | if(child.needupdate) | 34 | if(child.needupdate) |
34 | child.update(); | 35 | child.update(); |
35 | } | 36 | } |
37 | this.needupdate=false; | ||
36 | } | 38 | } |
37 | 39 | ||
38 | public virtual string getName() | 40 | public virtual string getName() |
diff --git a/src/world/PhysicsEngine.cs b/src/world/PhysicsEngine.cs index 7585135..4379aa0 100644 --- a/src/world/PhysicsEngine.cs +++ b/src/world/PhysicsEngine.cs | |||
@@ -18,6 +18,13 @@ namespace OpenSim.world | |||
18 | } | 18 | } |
19 | 19 | ||
20 | public void DoStuff(World simworld) { | 20 | public void DoStuff(World simworld) { |
21 | foreach (libsecondlife.LLUUID UUID in simworld.Entities.Keys) | ||
22 | { | ||
23 | if(simworld.Entities[UUID].needupdate) { | ||
24 | simworld.Entities[UUID].position += simworld.Entities[UUID].velocity; | ||
25 | } | ||
26 | |||
27 | } | ||
21 | } | 28 | } |
22 | } | 29 | } |
23 | } | 30 | } |