From 4dbad04b9f00924eb58fa371887ab8901faa6ab7 Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 15 Jul 2007 22:11:03 +0000 Subject: It wasn't me who messed up flying when adding a test NPC class. (honestly!) --- OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 2 +- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 2 +- OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | 13 ++++++++----- OpenSim/Region/Examples/SimpleApp/Program.cs | 9 ++++++--- 4 files changed, 16 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 8456b6b..e5a73fd 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -84,7 +84,7 @@ namespace OpenSim.Region.Communications.OGS1 // Initialise the background listeners RegionCommsListener regListener = new RegionCommsListener(); - if (this.listeners.ContainsKey(regionInfo.RegionHandle)) + if (!this.listeners.ContainsKey(regionInfo.RegionHandle)) { this.listeners.Add(regionInfo.RegionHandle, regListener); } diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 3558ca3..b619b59 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -75,7 +75,7 @@ namespace OpenSim.Region.Environment.Scenes DIR_CONTROL_FLAG_LEFT = MainAvatar.ControlFlags.AGENT_CONTROL_LEFT_POS, DIR_CONTROL_FLAG_RIGHT = MainAvatar.ControlFlags.AGENT_CONTROL_LEFT_NEG, DIR_CONTROL_FLAG_UP = MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS, - DIR_CONTROL_FLAG_DOWN = MainAvatar.ControlFlags.AGENT_CONTROL_AT_NEG + DIR_CONTROL_FLAG_DOWN = MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG } /// /// Position at which a significant movement was made diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 1c267c6..e6bc715 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs @@ -20,6 +20,7 @@ namespace SimpleApp private uint movementDirection = 0; private bool fly = true; private LLQuaternion bodyDirection = LLQuaternion.Identity; + private short count = 0; public event ImprovedInstantMessage OnInstantMessage; public event ChatFromViewer OnChatFromViewer; @@ -144,13 +145,12 @@ namespace SimpleApp { Timer timer = new Timer(); timer.Enabled = true; - timer.Interval = 10000; + timer.Interval = 500; timer.Elapsed += new ElapsedEventHandler(this.Heartbeat); } public void Heartbeat(object sender, EventArgs e) { - Encoding enc = Encoding.ASCII; this.OnAgentUpdate(this, movementDirection, bodyDirection); @@ -165,10 +165,13 @@ namespace SimpleApp movementDirection = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS; fly = true; } + if (count >= 40) + { + this.OnChatFromViewer(enc.GetBytes("Kind of quiet around here isn't it! \0"), 2, new LLVector3(128, 128, 26), this.FirstName + " " + this.LastName, this.AgentId); + count = -1; + } - this.OnChatFromViewer(enc.GetBytes("Kind of quiet around here isn't it! \0"), 2, new LLVector3(128, 128, 26), this.FirstName + " " + this.LastName, this.AgentId); - - + count++; } } } diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 0c688ba..3e4bfee 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -47,6 +47,9 @@ namespace SimpleApp AssetCache assetCache = new AssetCache(assetServer); + ScenePresence.LoadTextureFile("avatar-texture.dat"); + ScenePresence.PhysicsEngineFlying = true; + PhysicsManager physManager = new PhysicsManager(); physManager.LoadPlugins(); @@ -65,7 +68,7 @@ namespace SimpleApp world = new MyWorld( regionInfo, m_circuitManager, communicationsManager, assetCache, storeMan, httpServer); world.PhysScene = physManager.GetPhysicsScene("basicphysics"); //PhysicsScene.Null; - + world.LoadWorldMap(); world.PhysScene.SetTerrain(world.Terrain.getHeights1D()); @@ -81,6 +84,8 @@ namespace SimpleApp world.ParcelManager.NoParcelDataFromStorage(); } + world.StartTimer(); + PrimitiveBaseShape shape = PrimitiveBaseShape.DefaultBox(); shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f); LLVector3 pos = new LLVector3(138, 129, 27); @@ -91,8 +96,6 @@ namespace SimpleApp m_character = new MyNpcCharacter(); world.AddNewClient(m_character, false); - world.StartTimer(); - m_log.WriteLine(LogPriority.NORMAL, "Press enter to quit."); m_log.ReadLine(); -- cgit v1.1