aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs4
5 files changed, 20 insertions, 12 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 13b4cbc..ae88a87 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2543,10 +2543,11 @@ namespace OpenSim.Region.Framework.Scenes
2543 #region Add/Remove Avatar Methods 2543 #region Add/Remove Avatar Methods
2544 2544
2545 /// <summary> 2545 /// <summary>
2546 /// Adding a New Client and Create a Presence for it. 2546 /// Add a new client and create a child agent for it.
2547 /// </summary> 2547 /// </summary>
2548 /// <param name="client"></param> 2548 /// <param name="client"></param>
2549 public override void AddNewClient(IClientAPI client) 2549 /// <param name="type">The type of agent to add.</param>
2550 public override void AddNewClient(IClientAPI client, PresenceType type)
2550 { 2551 {
2551 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); 2552 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
2552 bool vialogin = false; 2553 bool vialogin = false;
@@ -2566,7 +2567,7 @@ namespace OpenSim.Region.Framework.Scenes
2566 m_clientManager.Add(client); 2567 m_clientManager.Add(client);
2567 SubscribeToClientEvents(client); 2568 SubscribeToClientEvents(client);
2568 2569
2569 ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance); 2570 ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type);
2570 m_eventManager.TriggerOnNewPresence(sp); 2571 m_eventManager.TriggerOnNewPresence(sp);
2571 2572
2572 sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags; 2573 sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags;
@@ -3149,7 +3150,7 @@ namespace OpenSim.Region.Framework.Scenes
3149 3150
3150 m_eventManager.TriggerOnRemovePresence(agentID); 3151 m_eventManager.TriggerOnRemovePresence(agentID);
3151 3152
3152 if (avatar != null && (!avatar.IsChildAgent)) 3153 if (avatar != null && (!avatar.IsChildAgent) && avatar.PresenceType != PresenceType.Npc)
3153 avatar.SaveChangedAttachments(); 3154 avatar.SaveChangedAttachments();
3154 3155
3155 ForEachClient( 3156 ForEachClient(
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index 2f1cdc1..ec94f10 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -175,7 +175,7 @@ namespace OpenSim.Region.Framework.Scenes
175 175
176 #region Add/Remove Agent/Avatar 176 #region Add/Remove Agent/Avatar
177 177
178 public abstract void AddNewClient(IClientAPI client); 178 public abstract void AddNewClient(IClientAPI client, PresenceType type);
179 public abstract void RemoveClient(UUID agentID, bool closeChildAgents); 179 public abstract void RemoveClient(UUID agentID, bool closeChildAgents);
180 180
181 public bool TryGetScenePresence(UUID agentID, out object scenePresence) 181 public bool TryGetScenePresence(UUID agentID, out object scenePresence)
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 65dc2c9..f40b373 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -590,12 +590,13 @@ namespace OpenSim.Region.Framework.Scenes
590 } 590 }
591 } 591 }
592 592
593 protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) 593 protected internal ScenePresence CreateAndAddChildScenePresence(
594 IClientAPI client, AvatarAppearance appearance, PresenceType type)
594 { 595 {
595 ScenePresence newAvatar = null; 596 ScenePresence newAvatar = null;
596 597
597 // ScenePresence always defaults to child agent 598 // ScenePresence always defaults to child agent
598 newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance); 599 newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance, type);
599 600
600 AddScenePresence(newAvatar); 601 AddScenePresence(newAvatar);
601 602
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 90c4706..e3bd393 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -75,6 +75,11 @@ namespace OpenSim.Region.Framework.Scenes
75 75
76 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 76 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
77 77
78 /// <summary>
79 /// What type of presence is this? User, NPC, etc.
80 /// </summary>
81 public PresenceType PresenceType { get; private set; }
82
78// private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes(); 83// private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes();
79 private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags)); 84 private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags));
80 private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f); 85 private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f);
@@ -715,8 +720,9 @@ namespace OpenSim.Region.Framework.Scenes
715 m_animator = new ScenePresenceAnimator(this); 720 m_animator = new ScenePresenceAnimator(this);
716 } 721 }
717 722
718 private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this() 723 private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, PresenceType type) : this()
719 { 724 {
725 PresenceType = type;
720 m_DrawDistance = world.DefaultDrawDistance; 726 m_DrawDistance = world.DefaultDrawDistance;
721 m_rootRegionHandle = reginfo.RegionHandle; 727 m_rootRegionHandle = reginfo.RegionHandle;
722 m_controllingClient = client; 728 m_controllingClient = client;
@@ -764,8 +770,8 @@ namespace OpenSim.Region.Framework.Scenes
764 SetDirectionVectors(); 770 SetDirectionVectors();
765 } 771 }
766 772
767 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance) 773 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance, PresenceType type)
768 : this(client, world, reginfo) 774 : this(client, world, reginfo, type)
769 { 775 {
770 m_appearance = appearance; 776 m_appearance = appearance;
771 } 777 }
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index dd2c717..35b41fb 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -207,7 +207,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
207 scene.NewUserConnection(acd1, 0, out reason); 207 scene.NewUserConnection(acd1, 0, out reason);
208 if (testclient == null) 208 if (testclient == null)
209 testclient = new TestClient(acd1, scene); 209 testclient = new TestClient(acd1, scene);
210 scene.AddNewClient(testclient); 210 scene.AddNewClient(testclient, PresenceType.User);
211 211
212 ScenePresence presence = scene.GetScenePresence(agent1); 212 ScenePresence presence = scene.GetScenePresence(agent1);
213 presence.MakeRootAgent(new Vector3(90,90,90),false); 213 presence.MakeRootAgent(new Vector3(90,90,90),false);
@@ -257,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
257 // Adding child agent to region 1001 257 // Adding child agent to region 1001
258 string reason; 258 string reason;
259 scene2.NewUserConnection(acd1,0, out reason); 259 scene2.NewUserConnection(acd1,0, out reason);
260 scene2.AddNewClient(testclient); 260 scene2.AddNewClient(testclient, PresenceType.User);
261 261
262 ScenePresence presence = scene.GetScenePresence(agent1); 262 ScenePresence presence = scene.GetScenePresence(agent1);
263 presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true); 263 presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true);