From 1c593d9e19debc3021c7c005c443f700280ccd28 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Thu, 6 Dec 2007 04:01:56 +0000 Subject: minor cleanup of Scene.cs (parameter naming, function documentation stubs, duplicated UUID, you know...) --- OpenSim/Region/Environment/Scenes/Scene.cs | 320 ++++++++++++++++++++--------- 1 file changed, 225 insertions(+), 95 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index f3ea89a..40de870 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -346,7 +346,7 @@ namespace OpenSim.Region.Environment.Scenes ForEachScenePresence(delegate(ScenePresence agent) { - if (!(agent.IsChildAgent)) + if (!agent.IsChildAgent) { //agent.ControllingClient.new //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); @@ -368,24 +368,21 @@ namespace OpenSim.Region.Environment.Scenes public override void Close() { ForEachScenePresence(delegate(ScenePresence avatar) - { - if (avatar.KnownChildRegions.Contains(RegionInfo.RegionHandle)) - avatar.KnownChildRegions.Remove(RegionInfo.RegionHandle); + { + if (avatar.KnownChildRegions.Contains(RegionInfo.RegionHandle)) + avatar.KnownChildRegions.Remove(RegionInfo.RegionHandle); - if (!avatar.IsChildAgent) - avatar.ControllingClient.Kick("The simulator is going down."); + if (!avatar.IsChildAgent) + avatar.ControllingClient.Kick("The simulator is going down."); - avatar.ControllingClient.OutPacket(new libsecondlife.Packets.DisableSimulatorPacket(), ThrottleOutPacketType.Task); - + avatar.ControllingClient.OutPacket(new libsecondlife.Packets.DisableSimulatorPacket(), ThrottleOutPacketType.Task); }); Thread.Sleep(500); ForEachScenePresence(delegate(ScenePresence avatar) { - avatar.ControllingClient.Stop(); - }); m_heartbeatTimer.Close(); @@ -837,7 +834,6 @@ namespace OpenSim.Region.Environment.Scenes bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) { - rootPart.PhysActor = PhysicsScene.AddPrimShape( rootPart.Name, @@ -912,8 +908,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - /// + /// public override void AddNewClient(IClientAPI client, bool child) { @@ -1029,17 +1024,17 @@ namespace OpenSim.Region.Environment.Scenes ScenePresence avatar = GetScenePresence(agentID); - Broadcast(delegate(IClientAPI client) { - try - { - client.SendKillObject(avatar.RegionHandle, avatar.LocalId); - } - catch (System.NullReferenceException) - { - //We can safely ignore null reference exceptions. It means the avatar are dead and cleaned up anyway. - - } - }); + Broadcast(delegate(IClientAPI client) + { + try + { + client.SendKillObject(avatar.RegionHandle, avatar.LocalId); + } + catch (System.NullReferenceException) + { + //We can safely ignore null reference exceptions. It means the avatar are dead and cleaned up anyway. + } + }); ForEachScenePresence( delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); @@ -1061,7 +1056,6 @@ namespace OpenSim.Region.Environment.Scenes catch (System.NullReferenceException) { //We can safely ignore null reference exceptions. It means the avatar are dead and cleaned up anyway. - } catch (Exception e) { @@ -1117,7 +1111,9 @@ namespace OpenSim.Region.Environment.Scenes m_sceneGridService.KillObject = SendKillObject; } - + /// + /// + /// public void UnRegisterReginWithComms() { m_sceneGridService.OnRegionUp -= OtherRegionUp; @@ -1163,6 +1159,13 @@ namespace OpenSim.Region.Environment.Scenes } } + /// + /// + /// + /// + /// + /// + /// public virtual void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) { if (regionHandle == m_regInfo.RegionHandle) @@ -1174,6 +1177,11 @@ namespace OpenSim.Region.Environment.Scenes } } + /// + /// + /// + /// + /// public void CloseConnection(ulong regionHandle, LLUUID agentID) { if (regionHandle == m_regionHandle) @@ -1187,15 +1195,20 @@ namespace OpenSim.Region.Environment.Scenes } } - /// /// /// + /// public void InformClientOfNeighbours(ScenePresence presence) { m_sceneGridService.EnableNeighbourChildAgents(presence); } + /// + /// + /// + /// + /// public void InformClientOfNeighbor(ScenePresence presence, RegionInfo region) { m_sceneGridService.InformNeighborChildAgent(presence, region); @@ -1214,6 +1227,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// + /// /// /// /// @@ -1227,7 +1241,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - /// + /// /// /// /// @@ -1243,18 +1257,25 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - /// + /// /// /// - public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position, bool isFlying) + /// + /// + public bool InformNeighbourOfCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) { - return m_sceneGridService.CrossToNeighbouringRegion(regionhandle, agentID, position, isFlying); + return m_sceneGridService.CrossToNeighbouringRegion(regionHandle, agentID, position, isFlying); } #endregion #region Module Methods + /// + /// + /// + /// + /// public void AddModule(string name, IRegionModule module) { if (!Modules.ContainsKey(name)) @@ -1263,6 +1284,10 @@ namespace OpenSim.Region.Environment.Scenes } } + /// + /// + /// + /// public void RegisterModuleInterface(M mod) { if (!ModuleInterfaces.ContainsKey(typeof(M))) @@ -1271,6 +1296,10 @@ namespace OpenSim.Region.Environment.Scenes } } + /// + /// + /// + /// public T RequestModuleInterface() { if (ModuleInterfaces.ContainsKey(typeof(T))) @@ -1287,21 +1316,42 @@ namespace OpenSim.Region.Environment.Scenes #region Other Methods + /// + /// + /// + /// public void SetTimePhase(int phase) { m_timePhase = phase; } - public void SendUrlToUser(LLUUID avatarID, string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public void SendUrlToUser(LLUUID avatarID, string objectName, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url) { if (m_scenePresences.ContainsKey(avatarID)) { - m_scenePresences[avatarID].ControllingClient.SendLoadURL(objectname, objectID, ownerID, groupOwned, + m_scenePresences[avatarID].ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url); } } + /// + /// + /// + /// + /// + /// + /// public LLUUID MakeHttpRequest(string url, string type, string body) { if (m_httpRequestModule != null) @@ -1311,6 +1361,9 @@ namespace OpenSim.Region.Environment.Scenes return LLUUID.Zero; } + /// + /// + /// public void performParcelPrimCountUpdate() { m_LandManager.resetAllLandPrimCounts(); @@ -1319,6 +1372,9 @@ namespace OpenSim.Region.Environment.Scenes m_LandManager.landPrimCountTainted = false; } + /// + /// + /// public void addPrimsToParcelCounts() { foreach (EntityBase obj in Entities.Values) @@ -1340,6 +1396,10 @@ namespace OpenSim.Region.Environment.Scenes SendAlertToUser(user, reason, false); } + /// + /// + /// + /// public void SendGeneralAlert(string message) { foreach (ScenePresence presence in m_scenePresences.Values) @@ -1348,6 +1408,12 @@ namespace OpenSim.Region.Environment.Scenes } } + /// + /// + /// + /// + /// + /// public void SendAlertToUser(LLUUID agentID, string message, bool modal) { if (m_scenePresences.ContainsKey(agentID)) @@ -1356,13 +1422,18 @@ namespace OpenSim.Region.Environment.Scenes } } - public void handleRequestGodlikePowers(LLUUID agentID, LLUUID sessionID, LLUUID token, IClientAPI controllingclient) + /// + /// + /// + /// + /// + /// + /// + public void handleRequestGodlikePowers(LLUUID agentID, LLUUID sessionID, LLUUID token, IClientAPI controllingClient) { // First check that this is the sim owner - if (agentID == RegionInfo.MasterAvatarAssignedUUID) { - // User needs to be logged into this sim if (m_scenePresences.ContainsKey(agentID)) { @@ -1370,14 +1441,11 @@ namespace OpenSim.Region.Environment.Scenes LLUUID testSessionID = m_scenePresences[agentID].ControllingClient.SessionId; if (sessionID == testSessionID) { - if (sessionID == controllingclient.SessionId) + if (sessionID == controllingClient.SessionId) { m_scenePresences[agentID].GrantGodlikePowers(agentID, testSessionID, token); - } - } - } } else @@ -1386,82 +1454,94 @@ namespace OpenSim.Region.Environment.Scenes } } - public void handleGodlikeKickUser(LLUUID godid, LLUUID sessionid, LLUUID agentid, uint kickflags, byte[] reason) + /// + /// + /// + /// + /// + /// + /// + /// + public void handleGodlikeKickUser(LLUUID godID, LLUUID sessionID, LLUUID agentID, uint kickflags, byte[] reason) { - // For some reason the client sends the seemingly hard coded, 44e87126e7944ded05b37c42da3d5cdb - // for kicking everyone. Dun-know. - if (m_scenePresences.ContainsKey(agentid) || agentid == new LLUUID("44e87126e7944ded05b37c42da3d5cdb")) + // For some reason the client sends this seemingly hard coded UUID for kicking everyone. Dun-know. + LLUUID kickUserID = new LLUUID("44e87126e7944ded05b37c42da3d5cdb"); + if (m_scenePresences.ContainsKey(agentID) || agentID == kickUserID) { - if (godid == RegionInfo.MasterAvatarAssignedUUID) + if (godID == RegionInfo.MasterAvatarAssignedUUID) { - if (agentid == new LLUUID("44e87126e7944ded05b37c42da3d5cdb")) + if (agentID == kickUserID) { - ClientManager.ForEachClient(delegate(IClientAPI controller) - { - ScenePresence p = GetScenePresence(controller.AgentId); - bool childagent = false; - if (!p.Equals(null)) - if (p.IsChildAgent) - childagent = true; - if (controller.AgentId != godid && !childagent) // Do we really want to kick the initiator of this madness? - { - controller.Kick(Helpers.FieldToUTF8String(reason)); - - } - } - ); + { + ScenePresence p = GetScenePresence(controller.AgentId); + bool childagent = !p.Equals(null) && p.IsChildAgent; + if (controller.AgentId != godID && !childagent) // Do we really want to kick the initiator of this madness? + { + controller.Kick(Helpers.FieldToUTF8String(reason)); + } + } + ); // This is a bit crude. It seems the client will be null before it actually stops the thread // The thread will kill itself eventually :/ // Is there another way to make sure *all* clients get this 'inter region' message? ClientManager.ForEachClient(delegate(IClientAPI controller) - { - ScenePresence p = GetScenePresence(controller.AgentId); - bool childagent = false; - if (!p.Equals(null)) - if (p.IsChildAgent) - childagent = true; - - if (controller.AgentId != godid && !childagent) // Do we really want to kick the initiator of this madness? - { - controller.Close(); - } - } - ); + { + ScenePresence p = GetScenePresence(controller.AgentId); + bool childagent = !p.Equals(null) && p.IsChildAgent; + if (controller.AgentId != godID && !childagent) // Do we really want to kick the initiator of this madness? + { + controller.Close(); + } + } + ); } else { - m_scenePresences[agentid].ControllingClient.Kick(Helpers.FieldToUTF8String(reason)); - m_scenePresences[agentid].ControllingClient.Close(); + m_scenePresences[agentID].ControllingClient.Kick(Helpers.FieldToUTF8String(reason)); + m_scenePresences[agentID].ControllingClient.Close(); } } else { - if (m_scenePresences.ContainsKey(godid)) - m_scenePresences[godid].ControllingClient.SendAgentAlertMessage("Kick request denied", false); + if (m_scenePresences.ContainsKey(godID)) + m_scenePresences[godID].ControllingClient.SendAgentAlertMessage("Kick request denied", false); } } } - public void HandleObjectPermissionsUpdate (IClientAPI controller, LLUUID AgentID, LLUUID SessionID, List permChanges) + + /// + /// + /// + /// + /// + /// + /// + public void HandleObjectPermissionsUpdate (IClientAPI controller, LLUUID agentID, LLUUID sessionID, List permChanges) { // Check for spoofing.. since this is permissions we're talking about here! - if ((controller.SessionId == SessionID) && (controller.AgentId == AgentID)) + if ((controller.SessionId == sessionID) && (controller.AgentId == agentID)) { for (int i = 0; i < permChanges.Count; i++) { - // Tell the object to do permission update byte field = permChanges[i].Field; uint localID = permChanges[i].ObjectLocalID; uint mask = permChanges[i].Mask; byte addRemTF = permChanges[i].Set; SceneObjectGroup chObjectGroup = GetGroupByPrim(localID); - chObjectGroup.UpdatePermissions(AgentID, field, localID, mask, addRemTF); - + chObjectGroup.UpdatePermissions(agentID, field, localID, mask, addRemTF); } } - } + + /// + /// + /// + /// + /// + /// + /// public void SendAlertToUser(string firstName, string lastName, string message, bool modal) { foreach (ScenePresence presence in m_scenePresences.Values) @@ -1474,6 +1554,10 @@ namespace OpenSim.Region.Environment.Scenes } } + /// + /// + /// + /// public void HandleAlertCommand(string[] commandParams) { if (commandParams[0] == "general") @@ -1500,6 +1584,9 @@ namespace OpenSim.Region.Environment.Scenes #endregion + /// + /// + /// public void ForceClientUpdate() { foreach (EntityBase ent in Entities.Values) @@ -1511,9 +1598,13 @@ namespace OpenSim.Region.Environment.Scenes } } - public void HandleEditCommand(string[] cmmdparams) + /// + /// + /// + /// + public void HandleEditCommand(string[] cmdparams) { - Console.WriteLine("Searching for Primitive: '" + cmmdparams[0] + "'"); + Console.WriteLine("Searching for Primitive: '" + cmdparams[0] + "'"); foreach (EntityBase ent in Entities.Values) { if (ent is SceneObjectGroup) @@ -1521,11 +1612,11 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectPart part = ((SceneObjectGroup)ent).GetChildPart(((SceneObjectGroup)ent).UUID); if (part != null) { - if (part.Name == cmmdparams[0]) + if (part.Name == cmdparams[0]) { part.Resize( - new LLVector3(Convert.ToSingle(cmmdparams[1]), Convert.ToSingle(cmmdparams[2]), - Convert.ToSingle(cmmdparams[3]))); + new LLVector3(Convert.ToSingle(cmdparams[1]), Convert.ToSingle(cmdparams[2]), + Convert.ToSingle(cmdparams[3]))); Console.WriteLine("Edited scale of Primitive: " + part.Name); } @@ -1534,9 +1625,13 @@ namespace OpenSim.Region.Environment.Scenes } } - public void Show(string ShowWhat) + /// + /// + /// + /// + public void Show(string showWhat) { - switch (ShowWhat) + switch (showWhat) { case "users": MainLog.Instance.Error("Current Region: " + RegionInfo.RegionName); @@ -1574,6 +1669,10 @@ namespace OpenSim.Region.Environment.Scenes #region Script Handling Methods + /// + /// + /// + /// public void SendCommandToPlugins(string[] args) { m_eventManager.TriggerOnPluginConsole(args); @@ -1586,22 +1685,35 @@ namespace OpenSim.Region.Environment.Scenes private List ScriptEngines = new List(); private bool m_dumpAssetsToFile; - public void AddScriptEngine(ScriptEngineInterface ScriptEngine, LogBase m_logger) + /// + /// + /// + /// + /// + public void AddScriptEngine(ScriptEngineInterface scriptEngine, LogBase logger) { - ScriptEngines.Add(ScriptEngine); - - ScriptEngine.InitializeEngine(this, m_logger); + ScriptEngines.Add(scriptEngine); + scriptEngine.InitializeEngine(this, logger); } #endregion #region InnerScene wrapper methods + /// + /// + /// + /// + /// public LLUUID ConvertLocalIDToFullID(uint localID) { return m_innerScene.ConvertLocalIDToFullID(localID); } + /// + /// + /// + /// public void SendAllSceneObjectsToClient(ScenePresence presence) { m_innerScene.SendAllSceneObjectsToClient(presence); @@ -1610,6 +1722,10 @@ namespace OpenSim.Region.Environment.Scenes //The idea is to have a group of method that return a list of avatars meeting some requirement // ie it could be all m_scenePresences within a certain range of the calling prim/avatar. + /// + /// + /// + /// public List GetAvatars() { return m_innerScene.GetAvatars(); @@ -1627,6 +1743,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// Request a filtered list of m_scenePresences in this World /// + /// /// public List GetScenePresences(FilterAvatarList filter) { @@ -1659,6 +1776,10 @@ namespace OpenSim.Region.Environment.Scenes } } + /// + /// + /// + /// public void ForEachObject(Action action) { foreach (SceneObjectGroup presence in m_sceneObjects.Values) @@ -1667,11 +1788,21 @@ namespace OpenSim.Region.Environment.Scenes } } + /// + /// + /// + /// + /// public SceneObjectPart GetSceneObjectPart(uint localID) { return m_innerScene.GetSceneObjectPart(localID); } + /// + /// + /// + /// + /// public SceneObjectPart GetSceneObjectPart(LLUUID fullID) { return m_innerScene.GetSceneObjectPart(fullID); @@ -1682,7 +1813,6 @@ namespace OpenSim.Region.Environment.Scenes return m_innerScene.TryGetAvatar(avatarId, out avatar); } - internal bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) { return m_innerScene.TryGetAvatarByName(avatarName, out avatar); -- cgit v1.1