diff options
author | Justin Clark-Casey (justincc) | 2011-08-18 00:53:05 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-18 00:53:05 +0100 |
commit | c1a34cd8da293e63d3cba70b5271c9a297789db2 (patch) | |
tree | f6d87f42151ca8891cb37ed1bf2a5d5361c86ddf /OpenSim/Region | |
parent | comment out noisy attachments logging (diff) | |
download | opensim-SC-c1a34cd8da293e63d3cba70b5271c9a297789db2.zip opensim-SC-c1a34cd8da293e63d3cba70b5271c9a297789db2.tar.gz opensim-SC-c1a34cd8da293e63d3cba70b5271c9a297789db2.tar.bz2 opensim-SC-c1a34cd8da293e63d3cba70b5271c9a297789db2.tar.xz |
Don't try to save changed attachment states when an NPC with attachments is removed from the scene.
This is done by introducing a PresenceType enum into ScenePresence which currently has two values, User and Npc.
This seems better than a SaveAttachments flag in terms of code comprehension, though I'm still slightly uneasy about introducing these semantics to core objects
Diffstat (limited to 'OpenSim/Region')
10 files changed, 26 insertions, 18 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 1d35973..f71871e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -692,7 +692,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
692 | 692 | ||
693 | public virtual void Start() | 693 | public virtual void Start() |
694 | { | 694 | { |
695 | m_scene.AddNewClient(this); | 695 | m_scene.AddNewClient(this, PresenceType.User); |
696 | 696 | ||
697 | RefreshGroupMembership(); | 697 | RefreshGroupMembership(); |
698 | } | 698 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index a3639e8..97a1be6 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -501,10 +501,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
501 | /// <summary> | 501 | /// <summary> |
502 | /// Update the attachment asset for the new sog details if they have changed. | 502 | /// Update the attachment asset for the new sog details if they have changed. |
503 | /// </summary> | 503 | /// </summary> |
504 | /// | 504 | /// <remarks> |
505 | /// This is essential for preserving attachment attributes such as permission. Unlike normal scene objects, | 505 | /// This is essential for preserving attachment attributes such as permission. Unlike normal scene objects, |
506 | /// these details are not stored on the region. | 506 | /// these details are not stored on the region. |
507 | /// | 507 | /// </remarks> |
508 | /// <param name="remoteClient"></param> | 508 | /// <param name="remoteClient"></param> |
509 | /// <param name="grp"></param> | 509 | /// <param name="grp"></param> |
510 | /// <param name="itemID"></param> | 510 | /// <param name="itemID"></param> |
diff --git a/OpenSim/Region/Examples/SimpleModule/RegionModule.cs b/OpenSim/Region/Examples/SimpleModule/RegionModule.cs index 088b818..3b8ce37 100644 --- a/OpenSim/Region/Examples/SimpleModule/RegionModule.cs +++ b/OpenSim/Region/Examples/SimpleModule/RegionModule.cs | |||
@@ -95,7 +95,7 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
95 | for (int i = 0; i < 1; i++) | 95 | for (int i = 0; i < 1; i++) |
96 | { | 96 | { |
97 | MyNpcCharacter m_character = new MyNpcCharacter(m_scene); | 97 | MyNpcCharacter m_character = new MyNpcCharacter(m_scene); |
98 | m_scene.AddNewClient(m_character); | 98 | m_scene.AddNewClient(m_character, PresenceType.Npc); |
99 | m_scene.AgentCrossing(m_character.AgentId, Vector3.Zero, false); | 99 | m_scene.AgentCrossing(m_character.AgentId, Vector3.Zero, false); |
100 | } | 100 | } |
101 | 101 | ||
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); |
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 15201da..c413634 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs | |||
@@ -893,7 +893,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
893 | 893 | ||
894 | public void Start() | 894 | public void Start() |
895 | { | 895 | { |
896 | Scene.AddNewClient(this); | 896 | Scene.AddNewClient(this, PresenceType.User); |
897 | 897 | ||
898 | // Mimicking LLClientView which gets always set appearance from client. | 898 | // Mimicking LLClientView which gets always set appearance from client. |
899 | Scene scene = (Scene)Scene; | 899 | Scene scene = (Scene)Scene; |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 3b7ae9d..c1da803 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -190,7 +190,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
190 | // } | 190 | // } |
191 | 191 | ||
192 | scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd); | 192 | scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd); |
193 | scene.AddNewClient(npcAvatar); | 193 | scene.AddNewClient(npcAvatar, PresenceType.Npc); |
194 | 194 | ||
195 | ScenePresence sp; | 195 | ScenePresence sp; |
196 | if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) | 196 | if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) |