From 4cb8d6379ddb39cfb8b30a63475e154a00a78110 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 10 Aug 2011 00:59:31 +0100
Subject: Stop trying to deregister caps or close child agents when an NPC is
removed
---
OpenSim/Region/Framework/Scenes/Scene.cs | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index b3b6cbc..9aa9bf5 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3091,11 +3091,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- ///
- /// Remove the given client from the scene.
- ///
- ///
- public override void RemoveClient(UUID agentID)
+ public override void RemoveClient(UUID agentID, bool closeChildAgents)
{
CheckHeartbeat();
bool childagentYN = false;
@@ -3116,15 +3112,17 @@ namespace OpenSim.Region.Framework.Scenes
(childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName);
m_sceneGraph.removeUserCount(!childagentYN);
-
- if (CapsModule != null)
+
+ // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop
+ // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI
+ if (closeChildAgents && CapsModule != null)
CapsModule.RemoveCaps(agentID);
// REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever
// this method is doing is HORRIBLE!!!
avatar.Scene.NeedSceneCacheClear(avatar.UUID);
- if (!avatar.IsChildAgent)
+ if (closeChildAgents && !avatar.IsChildAgent)
{
//List childknownRegions = new List();
//List ckn = avatar.KnownChildRegionHandles;
@@ -3136,6 +3134,7 @@ namespace OpenSim.Region.Framework.Scenes
regions.Remove(RegionInfo.RegionHandle);
m_sceneGridService.SendCloseChildAgentConnections(agentID, regions);
}
+
m_eventManager.TriggerClientClosed(agentID, this);
}
catch (NullReferenceException)
--
cgit v1.1
From 9a6ad1535e83a4d1b216ae879173ab8c524da60b Mon Sep 17 00:00:00 2001
From: Snoopy Pfeffer
Date: Mon, 15 Aug 2011 17:46:51 +0200
Subject: Added console command "delete object outside" to delete all objects
outside region boundaries. This is especiyll useful in cases where physical
objects outside regions boundaries cause much physics engine lag.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 39 ++++++++++++++++++++++++++++++--
1 file changed, 37 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 9aa9bf5..13b4cbc 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -611,6 +611,10 @@ namespace OpenSim.Region.Framework.Scenes
"delete object name ",
"Delete object by name", HandleDeleteObject);
+ MainConsole.Instance.Commands.AddCommand("region", false, "delete object outside",
+ "delete object outside",
+ "Delete all objects outside boundaries", HandleDeleteObject);
+
//Bind Storage Manager functions to some land manager functions for this scene
EventManager.OnLandObjectAdded +=
new EventManager.LandObjectAdded(simDataService.StoreLandObject);
@@ -4941,11 +4945,19 @@ namespace OpenSim.Region.Framework.Scenes
private void HandleDeleteObject(string module, string[] cmd)
{
- if (cmd.Length < 4)
+ if (cmd.Length < 3)
return;
string mode = cmd[2];
- string o = cmd[3];
+ string o = "";
+
+ if (mode != "outside")
+ {
+ if (cmd.Length < 4)
+ return;
+
+ o = cmd[3];
+ }
List deletes = new List();
@@ -4987,10 +4999,33 @@ namespace OpenSim.Region.Framework.Scenes
deletes.Add(g);
});
break;
+ case "outside":
+ ForEachSOG(delegate (SceneObjectGroup g)
+ {
+ SceneObjectPart rootPart = g.RootPart;
+ bool delete = false;
+
+ if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0)
+ {
+ delete = true;
+ } else {
+ ILandObject parcel = LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y);
+
+ if (parcel == null || parcel.LandData.Name == "NO LAND")
+ delete = true;
+ }
+
+ if (delete && !rootPart.IsAttachment && !deletes.Contains(g))
+ deletes.Add(g);
+ });
+ break;
}
foreach (SceneObjectGroup g in deletes)
+ {
+ m_log.InfoFormat("[SCENE]: Deleting object {0}", g.UUID);
DeleteSceneObject(g, false);
+ }
}
private void HandleReloadEstate(string module, string[] cmd)
--
cgit v1.1
From c1a34cd8da293e63d3cba70b5271c9a297789db2 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 18 Aug 2011 00:53:05 +0100
Subject: 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
---
OpenSim/Region/Framework/Scenes/Scene.cs | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
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
#region Add/Remove Avatar Methods
///
- /// Adding a New Client and Create a Presence for it.
+ /// Add a new client and create a child agent for it.
///
///
- public override void AddNewClient(IClientAPI client)
+ /// The type of agent to add.
+ public override void AddNewClient(IClientAPI client, PresenceType type)
{
AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
bool vialogin = false;
@@ -2566,7 +2567,7 @@ namespace OpenSim.Region.Framework.Scenes
m_clientManager.Add(client);
SubscribeToClientEvents(client);
- ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance);
+ ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type);
m_eventManager.TriggerOnNewPresence(sp);
sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags;
@@ -3149,7 +3150,7 @@ namespace OpenSim.Region.Framework.Scenes
m_eventManager.TriggerOnRemovePresence(agentID);
- if (avatar != null && (!avatar.IsChildAgent))
+ if (avatar != null && (!avatar.IsChildAgent) && avatar.PresenceType != PresenceType.Npc)
avatar.SaveChangedAttachments();
ForEachClient(
--
cgit v1.1
From c9e6b7bd10b2cdaa917e41259ae0d612f2171f7a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 19 Aug 2011 00:45:22 +0100
Subject: Stop NPC's getting hypergrid like names in some circumstances.
This meant punching in another AddUser() method in IUserManagement to do a direct name to UUID associated without the account check (since NPCs don't have accounts).
May address http://opensimulator.org/mantis/view.php?id=5645
---
OpenSim/Region/Framework/Scenes/Scene.cs | 42 +++++++++++++++++++++-----------
1 file changed, 28 insertions(+), 14 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ae88a87..513c0ea 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2582,12 +2582,13 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- if (GetScenePresence(client.AgentId) != null)
+ ScenePresence createdSp = GetScenePresence(client.AgentId);
+ if (createdSp != null)
{
m_LastLogin = Util.EnvironmentTickCount();
// Cache the user's name
- CacheUserName(aCircuit);
+ CacheUserName(createdSp, aCircuit);
EventManager.TriggerOnNewClient(client);
if (vialogin)
@@ -2595,28 +2596,41 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- private void CacheUserName(AgentCircuitData aCircuit)
+ ///
+ /// Cache the user name for later use.
+ ///
+ ///
+ ///
+ private void CacheUserName(ScenePresence sp, AgentCircuitData aCircuit)
{
IUserManagement uMan = RequestModuleInterface();
if (uMan != null)
{
- string homeURL = string.Empty;
string first = aCircuit.firstname, last = aCircuit.lastname;
- if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
- homeURL = aCircuit.ServiceURLs["HomeURI"].ToString();
-
- if (aCircuit.lastname.StartsWith("@"))
+ if (sp.PresenceType == PresenceType.Npc)
+ {
+ uMan.AddUser(aCircuit.AgentID, first, last);
+ }
+ else
{
- string[] parts = aCircuit.firstname.Split('.');
- if (parts.Length >= 2)
+ string homeURL = string.Empty;
+
+ if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
+ homeURL = aCircuit.ServiceURLs["HomeURI"].ToString();
+
+ if (aCircuit.lastname.StartsWith("@"))
{
- first = parts[0];
- last = parts[1];
+ string[] parts = aCircuit.firstname.Split('.');
+ if (parts.Length >= 2)
+ {
+ first = parts[0];
+ last = parts[1];
+ }
}
- }
- uMan.AddUser(aCircuit.AgentID, first, last, homeURL);
+ uMan.AddUser(aCircuit.AgentID, first, last, homeURL);
+ }
}
}
--
cgit v1.1