From 3e484d1aaf6d2d893f258e7372003de9bf5e8bdb Mon Sep 17 00:00:00 2001
From: MW
Date: Wed, 20 Jun 2007 17:32:21 +0000
Subject: Renamed Avatar to ScenePresence to avoid clash with libsl Avatar
class. Added ThirdPartyLicenses folder containing the licenses for the
various third party libraries we use. Plus some other small changes.
---
OpenSim/OpenSim.Region/EstateManager.cs | 2 +-
OpenSim/OpenSim.Region/OpenSim.Region.csproj | 18 +-
OpenSim/OpenSim.Region/OpenSim.Region.dll.build | 6 +-
OpenSim/OpenSim.Region/ParcelManager.cs | 2 +-
OpenSim/OpenSim.Region/Scenes/Avatar.Animations.cs | 76 -----
OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs | 224 ---------------
OpenSim/OpenSim.Region/Scenes/Avatar.cs | 306 ---------------------
OpenSim/OpenSim.Region/Scenes/Primitive.cs | 4 +-
.../OpenSim.Region/Scenes/Scene.PacketHandlers.cs | 2 +-
OpenSim/OpenSim.Region/Scenes/Scene.Scripting.cs | 2 +-
OpenSim/OpenSim.Region/Scenes/Scene.cs | 77 +++---
OpenSim/OpenSim.Region/Scenes/SceneBase.cs | 6 +-
.../Scenes/ScenePresence.Animations.cs | 76 +++++
.../OpenSim.Region/Scenes/ScenePresence.Update.cs | 224 +++++++++++++++
OpenSim/OpenSim.Region/Scenes/ScenePresence.cs | 306 +++++++++++++++++++++
.../Scenes/scripting/IScriptHandler.cs | 2 +-
16 files changed, 669 insertions(+), 664 deletions(-)
delete mode 100644 OpenSim/OpenSim.Region/Scenes/Avatar.Animations.cs
delete mode 100644 OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs
delete mode 100644 OpenSim/OpenSim.Region/Scenes/Avatar.cs
create mode 100644 OpenSim/OpenSim.Region/Scenes/ScenePresence.Animations.cs
create mode 100644 OpenSim/OpenSim.Region/Scenes/ScenePresence.Update.cs
create mode 100644 OpenSim/OpenSim.Region/Scenes/ScenePresence.cs
(limited to 'OpenSim/OpenSim.Region')
diff --git a/OpenSim/OpenSim.Region/EstateManager.cs b/OpenSim/OpenSim.Region/EstateManager.cs
index 3b918b1..fbcab33 100644
--- a/OpenSim/OpenSim.Region/EstateManager.cs
+++ b/OpenSim/OpenSim.Region/EstateManager.cs
@@ -35,7 +35,7 @@ using OpenSim.Region.Scenes;
using OpenSim;
using libsecondlife;
using libsecondlife.Packets;
-using Avatar = OpenSim.Region.Scenes.Avatar;
+using Avatar = OpenSim.Region.Scenes.ScenePresence;
namespace OpenSim.Region
diff --git a/OpenSim/OpenSim.Region/OpenSim.Region.csproj b/OpenSim/OpenSim.Region/OpenSim.Region.csproj
index 94efbed..a531e5c 100644
--- a/OpenSim/OpenSim.Region/OpenSim.Region.csproj
+++ b/OpenSim/OpenSim.Region/OpenSim.Region.csproj
@@ -142,15 +142,6 @@
Code
-
- Code
-
-
- Code
-
-
- Code
-
Code
@@ -172,6 +163,15 @@
Code
+
+ Code
+
+
+ Code
+
+
+ Code
+
Code
diff --git a/OpenSim/OpenSim.Region/OpenSim.Region.dll.build b/OpenSim/OpenSim.Region/OpenSim.Region.dll.build
index 6d47576..e277ec7 100644
--- a/OpenSim/OpenSim.Region/OpenSim.Region.dll.build
+++ b/OpenSim/OpenSim.Region/OpenSim.Region.dll.build
@@ -13,9 +13,6 @@
-
-
-
@@ -23,6 +20,9 @@
+
+
+
diff --git a/OpenSim/OpenSim.Region/ParcelManager.cs b/OpenSim/OpenSim.Region/ParcelManager.cs
index 3b0785f..d15d77d 100644
--- a/OpenSim/OpenSim.Region/ParcelManager.cs
+++ b/OpenSim/OpenSim.Region/ParcelManager.cs
@@ -33,7 +33,7 @@ using libsecondlife.Packets;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
using OpenSim.Region.Scenes;
-using Avatar = OpenSim.Region.Scenes.Avatar;
+using Avatar = OpenSim.Region.Scenes.ScenePresence;
namespace OpenSim.Region
{
diff --git a/OpenSim/OpenSim.Region/Scenes/Avatar.Animations.cs b/OpenSim/OpenSim.Region/Scenes/Avatar.Animations.cs
deleted file mode 100644
index cc0fb7a..0000000
--- a/OpenSim/OpenSim.Region/Scenes/Avatar.Animations.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
-* Copyright (c) Contributors, http://www.openmetaverse.org/
-* See CONTRIBUTORS.TXT for a full list of copyright holders.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the OpenSim Project nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using libsecondlife;
-using System.Xml;
-
-namespace OpenSim.Region.Scenes
-{
- partial class Avatar
- {
- public class AvatarAnimations
- {
-
- public Dictionary AnimsLLUUID = new Dictionary();
- public Dictionary AnimsNames = new Dictionary();
-
- public AvatarAnimations()
- {
- }
-
- public void LoadAnims()
- {
- //OpenSim.Framework.Console.MainLog.Instance.Verbose("Avatar.cs:LoadAnims() - Loading avatar animations");
- XmlTextReader reader = new XmlTextReader("data/avataranimations.xml");
-
- XmlDocument doc = new XmlDocument();
- doc.Load(reader);
- foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
- {
-
- if (nod.Attributes["name"] != null)
- {
- AnimsLLUUID.Add(nod.Attributes["name"].Value, nod.InnerText);
- }
-
- }
-
- reader.Close();
-
- // OpenSim.Framework.Console.MainLog.Instance.Verbose("Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)");
-
- foreach (KeyValuePair kp in OpenSim.Region.Scenes.Avatar.Animations.AnimsLLUUID)
- {
- AnimsNames.Add(kp.Value, kp.Key);
- }
- }
- }
- }
-}
diff --git a/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs b/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs
deleted file mode 100644
index 8b27efe..0000000
--- a/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
-* Copyright (c) Contributors, http://www.openmetaverse.org/
-* See CONTRIBUTORS.TXT for a full list of copyright holders.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the OpenSim Project nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-using System;
-using System.Collections.Generic;
-using System.Text;
-using libsecondlife;
-using libsecondlife.Packets;
-using OpenSim.Physics.Manager;
-using OpenSim.Framework.Interfaces;
-using OpenSim.Framework.Types;
-
-namespace OpenSim.Region.Scenes
-{
- partial class Avatar
- {
- ///
- ///
- ///
- public override void update()
- {
- if (this.childAvatar == false)
- {
- if (this.newForce)
- {
- this.SendTerseUpdateToALLClients();
- _updateCount = 0;
- }
- else if (movementflag != 0)
- {
- _updateCount++;
- if (_updateCount > 3)
- {
- this.SendTerseUpdateToALLClients();
- _updateCount = 0;
- }
- }
-
- this.CheckForBorderCrossing();
- }
- }
-
- ///
- ///
- ///
- ///
- public void SendUpdateToOtherClient(Avatar remoteAvatar)
- {
-
- }
-
- ///
- ///
- ///
- ///
- public ObjectUpdatePacket CreateUpdatePacket()
- {
- return null;
- }
-
- ///
- ///
- ///
- public void SendInitialPosition()
- {
- this.ControllingClient.SendAvatarData(m_regionInfo, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos);
- }
-
- ///
- ///
- ///
- public void SendOurAppearance()
- {
-
- }
-
- ///
- ///
- ///
- ///
- public void SendOurAppearance(IClientAPI OurClient)
- {
- this.ControllingClient.SendWearables(this.Wearables);
- }
-
- ///
- ///
- ///
- ///
- public void SendAppearanceToOtherAgent(Avatar avatarInfo)
- {
-
- }
-
- ///
- ///
- ///
- ///
- ///
- public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam)
- {
-
- }
-
- ///
- ///
- ///
- public void StopMovement()
- {
-
- }
-
- ///
- ///
- ///
- ///
- ///
- public void SendAnimPack(LLUUID animID, int seq)
- {
-
-
- }
-
- ///
- ///
- ///
- public void SendAnimPack()
- {
-
- }
-
- ///
- ///
- ///
- protected void CheckForBorderCrossing()
- {
- LLVector3 pos2 = this.Pos;
- LLVector3 vel = this.Velocity;
-
- float timeStep = 0.3f;
- pos2.X = pos2.X + (vel.X * timeStep);
- pos2.Y = pos2.Y + (vel.Y * timeStep);
- pos2.Z = pos2.Z + (vel.Z * timeStep);
-
- if ((pos2.X < 0) || (pos2.X > 256))
- {
- this.CrossToNewRegion();
- }
-
- if ((pos2.Y < 0) || (pos2.Y > 256))
- {
- this.CrossToNewRegion();
- }
- }
-
- ///
- ///
- ///
- protected void CrossToNewRegion()
- {
- LLVector3 pos = this.Pos;
- LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z);
- uint neighbourx = this.m_regionInfo.RegionLocX;
- uint neighboury = this.m_regionInfo.RegionLocY;
-
- if (pos.X < 2)
- {
- neighbourx -= 1;
- newpos.X = 254;
- }
- if (pos.X > 253)
- {
- neighbourx += 1;
- newpos.X = 1;
- }
- if (pos.Y < 2)
- {
- neighboury -= 1;
- newpos.Y = 254;
- }
- if (pos.Y > 253)
- {
- neighboury += 1;
- newpos.Y = 1;
- }
-
- LLVector3 vel = this.velocity;
- ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury* 256));
- RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle);
- if (neighbourRegion != null)
- {
- this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos);
- this.DownGradeAvatar();
- this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, System.Net.IPAddress.Parse(neighbourRegion.IPListenAddr), (ushort)neighbourRegion.IPListenPort);
-
- }
- }
-
- }
-}
diff --git a/OpenSim/OpenSim.Region/Scenes/Avatar.cs b/OpenSim/OpenSim.Region/Scenes/Avatar.cs
deleted file mode 100644
index 1149896..0000000
--- a/OpenSim/OpenSim.Region/Scenes/Avatar.cs
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
-* Copyright (c) Contributors, http://www.openmetaverse.org/
-* See CONTRIBUTORS.TXT for a full list of copyright holders.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the OpenSim Project nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-using libsecondlife;
-using libsecondlife.Packets;
-using OpenSim.Physics.Manager;
-using OpenSim.Framework.Inventory;
-using OpenSim.Framework.Interfaces;
-using OpenSim.Framework.Types;
-using Axiom.MathLib;
-
-namespace OpenSim.Region.Scenes
-{
- public partial class Avatar : Entity
- {
- public static bool PhysicsEngineFlying = false;
- public static AvatarAnimations Animations;
- public string firstname;
- public string lastname;
- public IClientAPI ControllingClient;
- public LLUUID current_anim;
- public int anim_seq;
- private static libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
- private bool updateflag = false;
- private byte movementflag = 0;
- private List forcesList = new List();
- private short _updateCount = 0;
- private Axiom.MathLib.Quaternion bodyRot;
- private LLObject.TextureEntry avatarAppearanceTexture = null;
- private byte[] visualParams;
- private AvatarWearable[] Wearables;
- private LLVector3 positionLastFrame = new LLVector3(0, 0, 0);
- private ulong m_regionHandle;
- private bool childAvatar = false;
- private bool newForce = false;
-
- protected RegionInfo m_regionInfo;
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public Avatar(IClientAPI theClient, Scene world, RegionInfo reginfo)
- {
-
- m_world = world;
- this.uuid = theClient.AgentId;
-
- m_regionInfo = reginfo;
- m_regionHandle = reginfo.RegionHandle;
- OpenSim.Framework.Console.MainLog.Instance.Verbose( "Avatar.cs - Loading details from grid (DUMMY)");
- ControllingClient = theClient;
- this.firstname = ControllingClient.FirstName;
- this.lastname = ControllingClient.LastName;
- m_localId = m_world.NextLocalId;
- Pos = ControllingClient.StartPos;
- visualParams = new byte[218];
- for (int i = 0; i < 218; i++)
- {
- visualParams[i] = 100;
- }
-
- Wearables = AvatarWearable.DefaultWearables;
-
- this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
-
- //register for events
- ControllingClient.OnRequestWearables += new GenericCall(this.SendOurAppearance);
- //ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance);
- ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.CompleteMovement);
- ControllingClient.OnCompleteMovementToRegion += new GenericCall2(this.SendInitialPosition);
- ControllingClient.OnAgentUpdate += new UpdateAgent(this.HandleAgentUpdate);
- // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
- // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
- //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
-
- }
-
- ///
- ///
- ///
- public PhysicsActor PhysActor
- {
- set
- {
- this._physActor = value;
- }
- get
- {
- return _physActor;
- }
- }
-
- ///
- ///
- ///
- ///
- public void ChildStatusChange(bool status)
- {
- this.childAvatar = status;
-
- if (this.childAvatar == true)
- {
- this.Velocity = new LLVector3(0, 0, 0);
- this.Pos = new LLVector3(128, 128, 70);
-
- }
- }
-
- ///
- ///
- ///
- ///
- public void UpGradeAvatar(LLVector3 pos)
- {
- //this.childAvatar = false;
- this.Pos = pos;
- }
-
- protected void DownGradeAvatar()
- {
- this.Velocity = new LLVector3(0, 0, 0);
- this.Pos = new LLVector3(128, 128, 70);
- this.childAvatar = true;
- }
-
- ///
- ///
- ///
- ///
- public void Teleport(LLVector3 pos)
- {
- this.Pos = pos;
- this.SendTerseUpdateToALLClients();
- }
-
- ///
- ///
- ///
- public override void addForces()
- {
- newForce = false;
- lock (this.forcesList)
- {
- if (this.forcesList.Count > 0)
- {
- for (int i = 0; i < this.forcesList.Count; i++)
- {
- NewForce force = this.forcesList[i];
-
- this.updateflag = true;
- this.Velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this
- this.newForce = true;
- }
- for (int i = 0; i < this.forcesList.Count; i++)
- {
- this.forcesList.RemoveAt(0);
- }
- }
- }
- }
-
- public void SendTerseUpdateToClient(IClientAPI RemoteClient)
- {
- LLVector3 pos = this.Pos;
- 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));
- }
-
- ///
- ///
- ///
- public void SendTerseUpdateToALLClients()
- {
- List avatars = this.m_world.RequestAvatarList();
- for (int i = 0; i < avatars.Count; i++)
- {
- this.SendTerseUpdateToClient(avatars[i].ControllingClient);
- }
- }
-
- ///
- /// Complete Avatar's movement into the region
- ///
- public void CompleteMovement()
- {
- LLVector3 look = this.Velocity;
- if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
- {
- look = new LLVector3(0.99f, 0.042f, 0);
- }
- this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, Pos, look);
- if (this.childAvatar)
- {
- this.childAvatar = false;
- }
- }
-
- ///
- ///
- ///
- ///
- public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
- {
-
- if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS) != 0)
- {
- Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
- if (((movementflag & 1) == 0) || (q != this.bodyRot))
- {
- //we should add a new force to the list
- // but for now we will deal with velocities
- NewForce newVelocity = new NewForce();
- Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0);
- Axiom.MathLib.Vector3 direc = q * v3;
- direc.Normalize();
-
- //work out velocity for sim physics system
- direc = direc * ((0.03f) * 128f);
- if (this._physActor.Flying)
- direc *= 4;
-
- newVelocity.X = direc.x;
- newVelocity.Y = direc.y;
- newVelocity.Z = direc.z;
- this.forcesList.Add(newVelocity);
- movementflag = 1;
- this.bodyRot = q;
- }
- }
- else
- {
- if ((movementflag) != 0)
- {
- NewForce newVelocity = new NewForce();
- newVelocity.X = 0;
- newVelocity.Y = 0;
- newVelocity.Z = 0;
- this.forcesList.Add(newVelocity);
- movementflag = 0;
- }
- }
-
- }
-
- ///
- ///
- ///
- public static void LoadAnims()
- {
-
- }
-
- ///
- ///
- ///
- public override void LandRenegerated()
- {
-
- }
-
-
- public class NewForce
- {
- public float X;
- public float Y;
- public float Z;
-
- public NewForce()
- {
-
- }
- }
- }
-
-}
diff --git a/OpenSim/OpenSim.Region/Scenes/Primitive.cs b/OpenSim/OpenSim.Region/Scenes/Primitive.cs
index 929f0b5..39b3fbc 100644
--- a/OpenSim/OpenSim.Region/Scenes/Primitive.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Primitive.cs
@@ -419,7 +419,7 @@ namespace OpenSim.Region.Scenes
///
public void SendFullUpdateToAllClients()
{
- List avatars = this.m_world.RequestAvatarList();
+ List avatars = this.m_world.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++)
{
this.SendFullUpdateToClient(avatars[i].ControllingClient);
@@ -452,7 +452,7 @@ namespace OpenSim.Region.Scenes
///
public void SendTerseUpdateToALLClients()
{
- List avatars = this.m_world.RequestAvatarList();
+ List avatars = this.m_world.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++)
{
this.SendTerseUpdateToClient(avatars[i].ControllingClient);
diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.PacketHandlers.cs b/OpenSim/OpenSim.Region/Scenes/Scene.PacketHandlers.cs
index 35a3bda..75fe779 100644
--- a/OpenSim/OpenSim.Region/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Scene.PacketHandlers.cs
@@ -75,7 +75,7 @@ namespace OpenSim.Region.Scenes
public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
{
Console.WriteLine("Chat message");
- Avatar avatar = null;
+ ScenePresence avatar = null;
foreach (IClientAPI client in m_clientThreads.Values)
{
int dis = -1000;
diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.Scripting.cs b/OpenSim/OpenSim.Region/Scenes/Scene.Scripting.cs
index 6317e43..7b53388 100644
--- a/OpenSim/OpenSim.Region/Scenes/Scene.Scripting.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Scene.Scripting.cs
@@ -169,7 +169,7 @@ namespace OpenSim.Region.Scenes
uint res = 0;
foreach (Entity entity in this.Entities.Values)
{
- if (entity is Avatar)
+ if (entity is ScenePresence)
{
res = entity.LocalId;
}
diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.cs b/OpenSim/OpenSim.Region/Scenes/Scene.cs
index ffcc0c8..74b4945 100644
--- a/OpenSim/OpenSim.Region/Scenes/Scene.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Scene.cs
@@ -46,12 +46,12 @@ using OpenSim.Caches;
namespace OpenSim.Region.Scenes
{
- public delegate bool FilterAvatarList(Avatar avatar);
+ public delegate bool FilterAvatarList(ScenePresence avatar);
public partial class Scene : SceneBase, ILocalStorageReceiver, IScriptAPI
{
protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer();
- protected Dictionary Avatars;
+ protected Dictionary Avatars;
protected Dictionary Prims;
private PhysicsScene phyScene;
private float timeStep = 0.1f;
@@ -66,7 +66,7 @@ namespace OpenSim.Region.Scenes
protected AuthenticateSessionsBase authenticateHandler;
protected RegionCommsListener regionCommsHost;
protected CommunicationsManager commsManager;
-
+
public ParcelManager parcelManager;
public EstateManager estateManager;
@@ -119,14 +119,14 @@ namespace OpenSim.Region.Scenes
OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating new entitities instance");
Entities = new Dictionary();
- Avatars = new Dictionary();
+ Avatars = new Dictionary();
Prims = new Dictionary();
OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating LandMap");
TerrainManager = new TerrainManager(new SecondLife());
Terrain = new TerrainEngine();
-
- Avatar.LoadAnims();
+
+ ScenePresence.LoadAnims();
}
catch (Exception e)
{
@@ -209,7 +209,7 @@ namespace OpenSim.Region.Scenes
OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: Update() - Failed with exception " + e.ToString());
}
updateLock.ReleaseMutex();
-
+
}
///
@@ -408,6 +408,7 @@ namespace OpenSim.Region.Scenes
///
/// Loads the World heightmap
///
+ ///
public override void LoadWorldMap()
{
try
@@ -415,16 +416,16 @@ namespace OpenSim.Region.Scenes
float[] map = this.localStorage.LoadWorld();
if (map == null)
{
- // Console.WriteLine("creating new terrain");
- // this.Terrain.hills();
+ // Console.WriteLine("creating new terrain");
+ // this.Terrain.hills();
- // this.localStorage.SaveMap(this.Terrain.getHeights1D());
+ // this.localStorage.SaveMap(this.Terrain.getHeights1D());
if (string.IsNullOrEmpty(this.m_regInfo.estateSettings.terrainFile))
{
Console.WriteLine("No default terrain, procedurally generating...");
this.Terrain.hills();
- // this.localStorage.SaveMap(this.Terrain.getHeights1D());
+ // this.localStorage.SaveMap(this.Terrain.getHeights1D());
}
else
{
@@ -438,7 +439,7 @@ namespace OpenSim.Region.Scenes
Console.WriteLine("Unable to load default terrain, procedurally generating instead...");
Terrain.hills();
}
- // this.localStorage.SaveMap(this.Terrain.getHeights1D());
+ // this.localStorage.SaveMap(this.Terrain.getHeights1D());
}
}
else
@@ -447,7 +448,7 @@ namespace OpenSim.Region.Scenes
}
CreateTerrainTexture();
-
+
}
catch (Exception e)
{
@@ -455,7 +456,6 @@ namespace OpenSim.Region.Scenes
}
}
-
///
///
///
@@ -520,15 +520,19 @@ namespace OpenSim.Region.Scenes
{
try
{
+
// MainLog.Instance.Notice("World.cs: AddNewPrim() - Creating new prim");
+
Primitive prim = new Primitive(m_regionHandle, this, addPacket, ownerID, this._primCount);
-
+
this.Entities.Add(prim.uuid, prim);
this._primCount++;
}
catch (Exception e)
{
+
// MainLog.Instance.Warn("World.cs: AddNewPrim() - Failed with exception " + e.ToString());
+
}
}
@@ -542,16 +546,16 @@ namespace OpenSim.Region.Scenes
///
///
- public override void AddNewAvatar(IClientAPI remoteClient, LLUUID agentID, bool child)
+ public override void AddNewClient(IClientAPI remoteClient, LLUUID agentID, bool child)
{
- remoteClient.OnRegionHandShakeReply += new GenericCall(this.SendLayerData);
+ remoteClient.OnRegionHandShakeReply += this.SendLayerData;
//remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims);
- remoteClient.OnChatFromViewer += new ChatFromViewer(this.SimChat);
- remoteClient.OnRequestWearables += new GenericCall(this.InformClientOfNeighbours);
- remoteClient.OnAddPrim += new GenericCall4(this.AddNewPrim);
- remoteClient.OnUpdatePrimPosition += new UpdatePrimVector(this.UpdatePrimPosition);
- remoteClient.OnRequestMapBlocks += new RequestMapBlocks(this.RequestMapBlocks);
- remoteClient.OnTeleportLocationRequest += new TeleportLocationRequest(this.RequestTeleportLocation);
+ remoteClient.OnChatFromViewer += this.SimChat;
+ remoteClient.OnRequestWearables += this.InformClientOfNeighbours;
+ remoteClient.OnAddPrim += this.AddNewPrim;
+ remoteClient.OnUpdatePrimPosition += this.UpdatePrimPosition;
+ remoteClient.OnRequestMapBlocks += this.RequestMapBlocks;
+ remoteClient.OnTeleportLocationRequest += this.RequestTeleportLocation;
/* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest);
remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest);
@@ -560,11 +564,12 @@ namespace OpenSim.Region.Scenes
remoteClient.OnEstateOwnerMessage += new EstateOwnerMessageRequest(estateManager.handleEstateOwnerMessage);
*/
- Avatar newAvatar = null;
+ ScenePresence newAvatar = null;
try
{
+
OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
- newAvatar = new Avatar(remoteClient, this, this.m_regInfo);
+ newAvatar = new ScenePresence(remoteClient, this, this.m_regInfo);
OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Adding new avatar to world");
OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Starting RegionHandshake ");
@@ -607,13 +612,13 @@ namespace OpenSim.Region.Scenes
return;
}
-
+
///
///
///
///
- public override void RemoveAvatar(LLUUID agentID)
+ public override void RemoveClient(LLUUID agentID)
{
return;
}
@@ -627,11 +632,11 @@ namespace OpenSim.Region.Scenes
/// Request a List of all Avatars in this World
///
///
- public List RequestAvatarList()
+ public List RequestAvatarList()
{
- List result = new List();
+ List result = new List();
- foreach (Avatar avatar in Avatars.Values)
+ foreach (ScenePresence avatar in Avatars.Values)
{
result.Add(avatar);
}
@@ -643,11 +648,11 @@ namespace OpenSim.Region.Scenes
/// Request a filtered list of Avatars in this World
///
///
- public List RequestAvatarList(FilterAvatarList filter)
+ public List RequestAvatarList(FilterAvatarList filter)
{
- List result = new List();
+ List result = new List();
- foreach (Avatar avatar in Avatars.Values)
+ foreach (ScenePresence avatar in Avatars.Values)
{
if (filter(avatar))
{
@@ -663,7 +668,7 @@ namespace OpenSim.Region.Scenes
///
///
///
- public Avatar RequestAvatar(LLUUID avatarID)
+ public ScenePresence RequestAvatar(LLUUID avatarID)
{
if (this.Avatars.ContainsKey(avatarID))
{
@@ -712,7 +717,7 @@ namespace OpenSim.Region.Scenes
///
public void NewUserConnection(ulong regionHandle, AgentCircuitData agent)
{
- // Console.WriteLine("World.cs - add new user connection");
+ // Console.WriteLine("World.cs - add new user connection");
//should just check that its meant for this region
if (regionHandle == this.m_regInfo.RegionHandle)
{
@@ -777,7 +782,7 @@ namespace OpenSim.Region.Scenes
{
List mapBlocks;
mapBlocks = this.commsManager.GridServer.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
-
+
remoteClient.SendMapBlock(mapBlocks);
}
diff --git a/OpenSim/OpenSim.Region/Scenes/SceneBase.cs b/OpenSim/OpenSim.Region/Scenes/SceneBase.cs
index 05c2aba..e650127 100644
--- a/OpenSim/OpenSim.Region/Scenes/SceneBase.cs
+++ b/OpenSim/OpenSim.Region/Scenes/SceneBase.cs
@@ -43,7 +43,7 @@ using OpenSim.Caches;
namespace OpenSim.Region.Scenes
{
- public abstract class SceneBase : IWorld
+ public abstract class SceneBase : IWorld
{
public Dictionary Entities;
protected Dictionary m_clientThreads;
@@ -98,13 +98,13 @@ namespace OpenSim.Region.Scenes
///
///
///
- public abstract void AddNewAvatar(IClientAPI remoteClient, LLUUID agentID, bool child);
+ public abstract void AddNewClient(IClientAPI remoteClient, LLUUID agentID, bool child);
///
///
///
///
- public abstract void RemoveAvatar(LLUUID agentID);
+ public abstract void RemoveClient(LLUUID agentID);
#endregion
diff --git a/OpenSim/OpenSim.Region/Scenes/ScenePresence.Animations.cs b/OpenSim/OpenSim.Region/Scenes/ScenePresence.Animations.cs
new file mode 100644
index 0000000..f0a8721
--- /dev/null
+++ b/OpenSim/OpenSim.Region/Scenes/ScenePresence.Animations.cs
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) Contributors, http://www.openmetaverse.org/
+* See CONTRIBUTORS.TXT for a full list of copyright holders.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the OpenSim Project nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using libsecondlife;
+using System.Xml;
+
+namespace OpenSim.Region.Scenes
+{
+ partial class ScenePresence
+ {
+ public class AvatarAnimations
+ {
+
+ public Dictionary AnimsLLUUID = new Dictionary();
+ public Dictionary AnimsNames = new Dictionary();
+
+ public AvatarAnimations()
+ {
+ }
+
+ public void LoadAnims()
+ {
+ //OpenSim.Framework.Console.MainLog.Instance.Verbose("Avatar.cs:LoadAnims() - Loading avatar animations");
+ XmlTextReader reader = new XmlTextReader("data/avataranimations.xml");
+
+ XmlDocument doc = new XmlDocument();
+ doc.Load(reader);
+ foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
+ {
+
+ if (nod.Attributes["name"] != null)
+ {
+ AnimsLLUUID.Add(nod.Attributes["name"].Value, nod.InnerText);
+ }
+
+ }
+
+ reader.Close();
+
+ // OpenSim.Framework.Console.MainLog.Instance.Verbose("Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)");
+
+ foreach (KeyValuePair kp in OpenSim.Region.Scenes.ScenePresence.Animations.AnimsLLUUID)
+ {
+ AnimsNames.Add(kp.Value, kp.Key);
+ }
+ }
+ }
+ }
+}
diff --git a/OpenSim/OpenSim.Region/Scenes/ScenePresence.Update.cs b/OpenSim/OpenSim.Region/Scenes/ScenePresence.Update.cs
new file mode 100644
index 0000000..3885c0d
--- /dev/null
+++ b/OpenSim/OpenSim.Region/Scenes/ScenePresence.Update.cs
@@ -0,0 +1,224 @@
+/*
+* Copyright (c) Contributors, http://www.openmetaverse.org/
+* See CONTRIBUTORS.TXT for a full list of copyright holders.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the OpenSim Project nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using libsecondlife;
+using libsecondlife.Packets;
+using OpenSim.Physics.Manager;
+using OpenSim.Framework.Interfaces;
+using OpenSim.Framework.Types;
+
+namespace OpenSim.Region.Scenes
+{
+ partial class ScenePresence
+ {
+ ///
+ ///
+ ///
+ public override void update()
+ {
+ if (this.childAvatar == false)
+ {
+ if (this.newForce)
+ {
+ this.SendTerseUpdateToALLClients();
+ _updateCount = 0;
+ }
+ else if (movementflag != 0)
+ {
+ _updateCount++;
+ if (_updateCount > 3)
+ {
+ this.SendTerseUpdateToALLClients();
+ _updateCount = 0;
+ }
+ }
+
+ this.CheckForBorderCrossing();
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public void SendUpdateToOtherClient(ScenePresence remoteAvatar)
+ {
+
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public ObjectUpdatePacket CreateUpdatePacket()
+ {
+ return null;
+ }
+
+ ///
+ ///
+ ///
+ public void SendInitialPosition()
+ {
+ this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.uuid, this.LocalId, this.Pos);
+ }
+
+ ///
+ ///
+ ///
+ public void SendOurAppearance()
+ {
+
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public void SendOurAppearance(IClientAPI OurClient)
+ {
+ this.ControllingClient.SendWearables(this.Wearables);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public void SendAppearanceToOtherAgent(ScenePresence avatarInfo)
+ {
+
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam)
+ {
+
+ }
+
+ ///
+ ///
+ ///
+ public void StopMovement()
+ {
+
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void SendAnimPack(LLUUID animID, int seq)
+ {
+
+
+ }
+
+ ///
+ ///
+ ///
+ public void SendAnimPack()
+ {
+
+ }
+
+ ///
+ ///
+ ///
+ protected void CheckForBorderCrossing()
+ {
+ LLVector3 pos2 = this.Pos;
+ LLVector3 vel = this.Velocity;
+
+ float timeStep = 0.2f;
+ pos2.X = pos2.X + (vel.X * timeStep);
+ pos2.Y = pos2.Y + (vel.Y * timeStep);
+ pos2.Z = pos2.Z + (vel.Z * timeStep);
+
+ if ((pos2.X < 0) || (pos2.X > 256))
+ {
+ this.CrossToNewRegion();
+ }
+
+ if ((pos2.Y < 0) || (pos2.Y > 256))
+ {
+ this.CrossToNewRegion();
+ }
+ }
+
+ ///
+ ///
+ ///
+ protected void CrossToNewRegion()
+ {
+ LLVector3 pos = this.Pos;
+ LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z);
+ uint neighbourx = this.m_regionInfo.RegionLocX;
+ uint neighboury = this.m_regionInfo.RegionLocY;
+
+ if (pos.X < 2)
+ {
+ neighbourx -= 1;
+ newpos.X = 254;
+ }
+ if (pos.X > 253)
+ {
+ neighbourx += 1;
+ newpos.X = 1;
+ }
+ if (pos.Y < 2)
+ {
+ neighboury -= 1;
+ newpos.Y = 254;
+ }
+ if (pos.Y > 253)
+ {
+ neighboury += 1;
+ newpos.Y = 1;
+ }
+
+ LLVector3 vel = this.velocity;
+ ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury* 256));
+ RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle);
+ if (neighbourRegion != null)
+ {
+ this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos);
+ this.DownGradeAvatar();
+ this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, System.Net.IPAddress.Parse(neighbourRegion.IPListenAddr), (ushort)neighbourRegion.IPListenPort);
+
+ }
+ }
+
+ }
+}
diff --git a/OpenSim/OpenSim.Region/Scenes/ScenePresence.cs b/OpenSim/OpenSim.Region/Scenes/ScenePresence.cs
new file mode 100644
index 0000000..3fbda39
--- /dev/null
+++ b/OpenSim/OpenSim.Region/Scenes/ScenePresence.cs
@@ -0,0 +1,306 @@
+/*
+* Copyright (c) Contributors, http://www.openmetaverse.org/
+* See CONTRIBUTORS.TXT for a full list of copyright holders.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the OpenSim Project nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using libsecondlife;
+using libsecondlife.Packets;
+using OpenSim.Physics.Manager;
+using OpenSim.Framework.Inventory;
+using OpenSim.Framework.Interfaces;
+using OpenSim.Framework.Types;
+using Axiom.MathLib;
+
+namespace OpenSim.Region.Scenes
+{
+ public partial class ScenePresence : Entity
+ {
+ public static bool PhysicsEngineFlying = false;
+ public static AvatarAnimations Animations;
+ public string firstname;
+ public string lastname;
+ public IClientAPI ControllingClient;
+ public LLUUID current_anim;
+ public int anim_seq;
+ private static libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
+ private bool updateflag = false;
+ private byte movementflag = 0;
+ private List forcesList = new List();
+ private short _updateCount = 0;
+ private Axiom.MathLib.Quaternion bodyRot;
+ private LLObject.TextureEntry avatarAppearanceTexture = null;
+ private byte[] visualParams;
+ private AvatarWearable[] Wearables;
+ private LLVector3 positionLastFrame = new LLVector3(0, 0, 0);
+ private ulong m_regionHandle;
+ private bool childAvatar = false;
+ private bool newForce = false;
+
+ protected RegionInfo m_regionInfo;
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public ScenePresence(IClientAPI theClient, Scene world, RegionInfo reginfo)
+ {
+
+ m_world = world;
+ this.uuid = theClient.AgentId;
+
+ m_regionInfo = reginfo;
+ m_regionHandle = reginfo.RegionHandle;
+ OpenSim.Framework.Console.MainLog.Instance.Verbose( "Avatar.cs - Loading details from grid (DUMMY)");
+ ControllingClient = theClient;
+ this.firstname = ControllingClient.FirstName;
+ this.lastname = ControllingClient.LastName;
+ m_localId = m_world.NextLocalId;
+ Pos = ControllingClient.StartPos;
+ visualParams = new byte[218];
+ for (int i = 0; i < 218; i++)
+ {
+ visualParams[i] = 100;
+ }
+
+ Wearables = AvatarWearable.DefaultWearables;
+
+ this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
+
+ //register for events
+ ControllingClient.OnRequestWearables += this.SendOurAppearance;
+ //ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance);
+ ControllingClient.OnCompleteMovementToRegion += this.CompleteMovement;
+ ControllingClient.OnCompleteMovementToRegion += this.SendInitialPosition;
+ ControllingClient.OnAgentUpdate += this.HandleAgentUpdate;
+ // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
+ // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
+ //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
+
+ }
+
+ ///
+ ///
+ ///
+ public PhysicsActor PhysActor
+ {
+ set
+ {
+ this._physActor = value;
+ }
+ get
+ {
+ return _physActor;
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public void ChildStatusChange(bool status)
+ {
+ this.childAvatar = status;
+
+ if (this.childAvatar == true)
+ {
+ this.Velocity = new LLVector3(0, 0, 0);
+ this.Pos = new LLVector3(128, 128, 70);
+
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public void UpGradeAvatar(LLVector3 pos)
+ {
+ //this.childAvatar = false;
+ this.Pos = pos;
+ }
+
+ protected void DownGradeAvatar()
+ {
+ this.Velocity = new LLVector3(0, 0, 0);
+ this.Pos = new LLVector3(128, 128, 70);
+ this.childAvatar = true;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public void Teleport(LLVector3 pos)
+ {
+ this.Pos = pos;
+ this.SendTerseUpdateToALLClients();
+ }
+
+ ///
+ ///
+ ///
+ public override void addForces()
+ {
+ newForce = false;
+ lock (this.forcesList)
+ {
+ if (this.forcesList.Count > 0)
+ {
+ for (int i = 0; i < this.forcesList.Count; i++)
+ {
+ NewForce force = this.forcesList[i];
+
+ this.updateflag = true;
+ this.Velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this
+ this.newForce = true;
+ }
+ for (int i = 0; i < this.forcesList.Count; i++)
+ {
+ this.forcesList.RemoveAt(0);
+ }
+ }
+ }
+ }
+
+ public void SendTerseUpdateToClient(IClientAPI RemoteClient)
+ {
+ LLVector3 pos = this.Pos;
+ 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));
+ }
+
+ ///
+ ///
+ ///
+ public void SendTerseUpdateToALLClients()
+ {
+ List avatars = this.m_world.RequestAvatarList();
+ for (int i = 0; i < avatars.Count; i++)
+ {
+ this.SendTerseUpdateToClient(avatars[i].ControllingClient);
+ }
+ }
+
+ ///
+ /// Complete Avatar's movement into the region
+ ///
+ public void CompleteMovement()
+ {
+ LLVector3 look = this.Velocity;
+ if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
+ {
+ look = new LLVector3(0.99f, 0.042f, 0);
+ }
+ this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, Pos, look);
+ if (this.childAvatar)
+ {
+ this.childAvatar = false;
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
+ {
+
+ if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS) != 0)
+ {
+ Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
+ if (((movementflag & 1) == 0) || (q != this.bodyRot))
+ {
+ //we should add a new force to the list
+ // but for now we will deal with velocities
+ NewForce newVelocity = new NewForce();
+ Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0);
+ Axiom.MathLib.Vector3 direc = q * v3;
+ direc.Normalize();
+
+ //work out velocity for sim physics system
+ direc = direc * ((0.03f) * 128f);
+ if (this._physActor.Flying)
+ direc *= 4;
+
+ newVelocity.X = direc.x;
+ newVelocity.Y = direc.y;
+ newVelocity.Z = direc.z;
+ this.forcesList.Add(newVelocity);
+ movementflag = 1;
+ this.bodyRot = q;
+ }
+ }
+ else
+ {
+ if ((movementflag) != 0)
+ {
+ NewForce newVelocity = new NewForce();
+ newVelocity.X = 0;
+ newVelocity.Y = 0;
+ newVelocity.Z = 0;
+ this.forcesList.Add(newVelocity);
+ movementflag = 0;
+ }
+ }
+
+ }
+
+ ///
+ ///
+ ///
+ public static void LoadAnims()
+ {
+
+ }
+
+ ///
+ ///
+ ///
+ public override void LandRenegerated()
+ {
+
+ }
+
+
+ public class NewForce
+ {
+ public float X;
+ public float Y;
+ public float Z;
+
+ public NewForce()
+ {
+
+ }
+ }
+ }
+
+}
diff --git a/OpenSim/OpenSim.Region/Scenes/scripting/IScriptHandler.cs b/OpenSim/OpenSim.Region/Scenes/scripting/IScriptHandler.cs
index 581ad43..797998d 100644
--- a/OpenSim/OpenSim.Region/Scenes/scripting/IScriptHandler.cs
+++ b/OpenSim/OpenSim.Region/Scenes/scripting/IScriptHandler.cs
@@ -32,7 +32,7 @@ using libsecondlife;
using OpenSim.Physics.Manager;
using OpenSim.Region;
using OpenSim.Region.Scenes;
-using Avatar=OpenSim.Region.Scenes.Avatar;
+using Avatar=OpenSim.Region.Scenes.ScenePresence;
using Primitive = OpenSim.Region.Scenes.Primitive;
namespace OpenSim.Region.Scripting
--
cgit v1.1