From 6f220a867981db8e3357484feff1fe1977170561 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Fri, 5 Oct 2012 17:30:27 -0700 Subject: [PATCH 1/8] Trigger ObjectAddedToScene when loading objects from oarfile. Already triggers when creating, duplicating or loading from database, incoming attachments, etc --- OpenSim/Region/Framework/Scenes/Scene.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e6b8c16275..671feda958 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2139,7 +2139,14 @@ namespace OpenSim.Region.Framework.Scenes public bool AddRestoredSceneObject( SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) { - return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates); + if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) + { + EventManager.TriggerObjectAddedToScene(sceneObject); + return true; + } + + return false; + } /// From 91ca3117cb35444e6b0e4300468959ed43c048c3 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Fri, 5 Oct 2012 17:32:07 -0700 Subject: [PATCH 2/8] Add bool to TriggerSceneObjectPartUpdated where full = true indicates a full update. There should be a better way to indicate which properties have changed that is non LLUDP-centric --- OpenSim/Region/Framework/Scenes/EventManager.cs | 6 +++--- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index e25fa94191..a8ff2180ad 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -913,7 +913,7 @@ namespace OpenSim.Region.Framework.Scenes public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy; public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed); - public delegate void SceneObjectPartUpdated(SceneObjectPart sop); + public delegate void SceneObjectPartUpdated(SceneObjectPart sop, bool full); public event SceneObjectPartUpdated OnSceneObjectPartUpdated; public delegate void ScenePresenceUpdated(ScenePresence sp); @@ -2837,7 +2837,7 @@ namespace OpenSim.Region.Framework.Scenes } } - public void TriggerSceneObjectPartUpdated(SceneObjectPart sop) + public void TriggerSceneObjectPartUpdated(SceneObjectPart sop, bool full) { SceneObjectPartUpdated handler = OnSceneObjectPartUpdated; if (handler != null) @@ -2846,7 +2846,7 @@ namespace OpenSim.Region.Framework.Scenes { try { - d(sop); + d(sop, full); } catch (Exception e) { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3f10b34d7b..199526e1c6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2465,7 +2465,7 @@ namespace OpenSim.Region.Framework.Scenes // UUID, Name, TimeStampFull); if (ParentGroup.Scene != null) - ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this); + ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, true); } /// @@ -2499,7 +2499,7 @@ namespace OpenSim.Region.Framework.Scenes } if (ParentGroup.Scene != null) - ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this); + ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, false); } public void ScriptSetPhysicsStatus(bool UsePhysics) From 73c9abf5f2e2017bf924d6183502e337d28a7232 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 9 Oct 2012 01:35:27 +0100 Subject: [PATCH 3/8] Move OpenSim.Data.RegionFlags -> OpenSim.Framework.RegionFlags to make it easier for other code to use (e.g. LSL_Api) without having to reference OpenSim.Data just for this. --- OpenSim/Data/IRegionData.cs | 15 ------ OpenSim/Data/MSSQL/MSSQLRegionData.cs | 1 + OpenSim/Data/MySQL/MySQLRegionData.cs | 4 +- .../ClientStack/Linden/UDP/LLClientView.cs | 1 + .../EntityTransfer/HGEntityTransferModule.cs | 8 ++-- .../World/Estate/EstateManagementModule.cs | 1 + .../CoreModules/World/Land/LandObject.cs | 1 + .../SimianGrid/SimianGridServiceConnector.cs | 4 +- OpenSim/Services/GridService/GridService.cs | 48 +++++++++---------- .../Services/GridService/HypergridLinker.cs | 6 +-- 10 files changed, 39 insertions(+), 50 deletions(-) diff --git a/OpenSim/Data/IRegionData.cs b/OpenSim/Data/IRegionData.cs index 546b5e8cba..70e10653de 100644 --- a/OpenSim/Data/IRegionData.cs +++ b/OpenSim/Data/IRegionData.cs @@ -85,21 +85,6 @@ namespace OpenSim.Data List GetHyperlinks(UUID scopeID); } - [Flags] - public enum RegionFlags : int - { - DefaultRegion = 1, // Used for new Rez. Random if multiple defined - FallbackRegion = 2, // Regions we redirect to when the destination is down - RegionOnline = 4, // Set when a region comes online, unset when it unregisters and DeleteOnUnregister is false - NoDirectLogin = 8, // Region unavailable for direct logins (by name) - Persistent = 16, // Don't remove on unregister - LockedOut = 32, // Don't allow registration - NoMove = 64, // Don't allow moving this region - Reservation = 128, // This is an inactive reservation - Authenticate = 256, // Require authentication - Hyperlink = 512 // Record represents a HG link - } - public class RegionDataDistanceCompare : IComparer { private Vector2 m_origin; diff --git a/OpenSim/Data/MSSQL/MSSQLRegionData.cs b/OpenSim/Data/MSSQL/MSSQLRegionData.cs index 3ae87c3804..0d89706566 100644 --- a/OpenSim/Data/MSSQL/MSSQLRegionData.cs +++ b/OpenSim/Data/MSSQL/MSSQLRegionData.cs @@ -37,6 +37,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using RegionFlags = OpenSim.Framework.RegionFlags; namespace OpenSim.Data.MSSQL { diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index 0614879061..a2d4ae4647 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs @@ -30,11 +30,11 @@ using System.Collections; using System.Collections.Generic; using System.Data; using System.Reflection; - +using MySql.Data.MySqlClient; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Data; -using MySql.Data.MySqlClient; +using RegionFlags = OpenSim.Framework.RegionFlags; namespace OpenSim.Data.MySQL { diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 0869bd527a..62f51d9520 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -47,6 +47,7 @@ using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; using Timer = System.Timers.Timer; using AssetLandmark = OpenSim.Framework.AssetLandmark; +using RegionFlags = OpenMetaverse.RegionFlags; using Nini.Config; using System.IO; diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index aa1e127eb2..679be18121 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -212,7 +212,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, region.RegionID); m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionID, flags); - if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) + if ((flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0) { m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID); GridRegion real_destination = m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID); @@ -232,7 +232,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return true; int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, reg.RegionID); - if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) + if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0) return true; return false; @@ -256,7 +256,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer reason = string.Empty; logout = false; int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, reg.RegionID); - if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) + if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0) { // this user is going to another grid // check if HyperGrid teleport is allowed, based on user level @@ -298,7 +298,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // The rest is only needed for controlling appearance int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, reg.RegionID); - if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) + if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0) { // this user is going to another grid if (Scene.UserManagementModule.IsLocalGridUser(sp.UUID)) diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 58bbd2405a..0e6d663000 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -39,6 +39,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using RegionFlags = OpenMetaverse.RegionFlags; namespace OpenSim.Region.CoreModules.World.Estate { diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 0536f6ec6e..8829f27a97 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -33,6 +33,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using RegionFlags = OpenMetaverse.RegionFlags; namespace OpenSim.Region.CoreModules.World.Land { diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 35cb408a91..038a4bf2b6 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -384,8 +384,8 @@ namespace OpenSim.Services.Connectors.SimianGrid if (response["Success"].AsBoolean()) { OSDMap extraData = response["ExtraData"] as OSDMap; - int enabled = response["Enabled"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.RegionOnline : 0; - int hypergrid = extraData["HyperGrid"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.Hyperlink : 0; + int enabled = response["Enabled"].AsBoolean() ? (int)OpenSim.Framework.RegionFlags.RegionOnline : 0; + int hypergrid = extraData["HyperGrid"].AsBoolean() ? (int)OpenSim.Framework.RegionFlags.Hyperlink : 0; int flags = enabled | hypergrid; m_log.DebugFormat("[SGGC] enabled - {0} hg - {1} flags - {2}", enabled, hypergrid, flags); return flags; diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 5bdea06847..ee3b858867 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -151,11 +151,11 @@ namespace OpenSim.Services.GridService // // Get it's flags // - OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(region.Data["flags"]); + OpenSim.Framework.RegionFlags rflags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(region.Data["flags"]); // Is this a reservation? // - if ((rflags & OpenSim.Data.RegionFlags.Reservation) != 0) + if ((rflags & OpenSim.Framework.RegionFlags.Reservation) != 0) { // Regions reserved for the null key cannot be taken. if ((string)region.Data["PrincipalID"] == UUID.Zero.ToString()) @@ -166,10 +166,10 @@ namespace OpenSim.Services.GridService // NOTE: Fudging the flags value here, so these flags // should not be used elsewhere. Don't optimize // this with the later retrieval of the same flags! - rflags |= OpenSim.Data.RegionFlags.Authenticate; + rflags |= OpenSim.Framework.RegionFlags.Authenticate; } - if ((rflags & OpenSim.Data.RegionFlags.Authenticate) != 0) + if ((rflags & OpenSim.Framework.RegionFlags.Authenticate) != 0) { // Can we authenticate at all? // @@ -205,10 +205,10 @@ namespace OpenSim.Services.GridService if ((region != null) && (region.RegionID == regionInfos.RegionID) && ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) { - if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.NoMove) != 0) + if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.NoMove) != 0) return "Can't move this region"; - if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.LockedOut) != 0) + if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.LockedOut) != 0) return "Region locked out"; // Region reregistering in other coordinates. Delete the old entry @@ -233,7 +233,7 @@ namespace OpenSim.Services.GridService { int oldFlags = Convert.ToInt32(region.Data["flags"]); - oldFlags &= ~(int)OpenSim.Data.RegionFlags.Reservation; + oldFlags &= ~(int)OpenSim.Framework.RegionFlags.Reservation; rdata.Data["flags"] = oldFlags.ToString(); // Preserve flags } @@ -252,7 +252,7 @@ namespace OpenSim.Services.GridService } int flags = Convert.ToInt32(rdata.Data["flags"]); - flags |= (int)OpenSim.Data.RegionFlags.RegionOnline; + flags |= (int)OpenSim.Framework.RegionFlags.RegionOnline; rdata.Data["flags"] = flags.ToString(); try @@ -283,9 +283,9 @@ namespace OpenSim.Services.GridService int flags = Convert.ToInt32(region.Data["flags"]); - if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Data.RegionFlags.Persistent) != 0) + if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Framework.RegionFlags.Persistent) != 0) { - flags &= ~(int)OpenSim.Data.RegionFlags.RegionOnline; + flags &= ~(int)OpenSim.Framework.RegionFlags.RegionOnline; region.Data["flags"] = flags.ToString(); region.Data["last_seen"] = Util.UnixTimeSinceEpoch(); try @@ -320,7 +320,7 @@ namespace OpenSim.Services.GridService if (rdata.RegionID != regionID) { int flags = Convert.ToInt32(rdata.Data["flags"]); - if ((flags & (int)Data.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours + if ((flags & (int)Framework.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours rinfos.Add(RegionData2RegionInfo(rdata)); } } @@ -470,7 +470,7 @@ namespace OpenSim.Services.GridService foreach (RegionData r in regions) { - if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0) + if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.RegionOnline) != 0) ret.Add(RegionData2RegionInfo(r)); } @@ -486,7 +486,7 @@ namespace OpenSim.Services.GridService foreach (RegionData r in regions) { - if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0) + if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.RegionOnline) != 0) ret.Add(RegionData2RegionInfo(r)); } @@ -502,7 +502,7 @@ namespace OpenSim.Services.GridService foreach (RegionData r in regions) { - if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0) + if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.RegionOnline) != 0) ret.Add(RegionData2RegionInfo(r)); } @@ -629,7 +629,7 @@ namespace OpenSim.Services.GridService private void OutputRegionToConsole(RegionData r) { - OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); + OpenSim.Framework.RegionFlags flags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(r.Data["flags"]); ConsoleDisplayList dispList = new ConsoleDisplayList(); dispList.AddRow("Region Name", r.RegionName); @@ -659,7 +659,7 @@ namespace OpenSim.Services.GridService foreach (RegionData r in regions) { - OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); + OpenSim.Framework.RegionFlags flags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(r.Data["flags"]); dispTable.AddRow( r.RegionName, r.RegionID.ToString(), @@ -673,7 +673,7 @@ namespace OpenSim.Services.GridService private int ParseFlags(int prev, string flags) { - OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)prev; + OpenSim.Framework.RegionFlags f = (OpenSim.Framework.RegionFlags)prev; string[] parts = flags.Split(new char[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries); @@ -685,18 +685,18 @@ namespace OpenSim.Services.GridService { if (p.StartsWith("+")) { - val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p.Substring(1)); - f |= (OpenSim.Data.RegionFlags)val; + val = (int)Enum.Parse(typeof(OpenSim.Framework.RegionFlags), p.Substring(1)); + f |= (OpenSim.Framework.RegionFlags)val; } else if (p.StartsWith("-")) { - val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p.Substring(1)); - f &= ~(OpenSim.Data.RegionFlags)val; + val = (int)Enum.Parse(typeof(OpenSim.Framework.RegionFlags), p.Substring(1)); + f &= ~(OpenSim.Framework.RegionFlags)val; } else { - val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p); - f |= (OpenSim.Data.RegionFlags)val; + val = (int)Enum.Parse(typeof(OpenSim.Framework.RegionFlags), p); + f |= (OpenSim.Framework.RegionFlags)val; } } catch (Exception) @@ -728,7 +728,7 @@ namespace OpenSim.Services.GridService int flags = Convert.ToInt32(r.Data["flags"]); flags = ParseFlags(flags, cmd[4]); r.Data["flags"] = flags.ToString(); - OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)flags; + OpenSim.Framework.RegionFlags f = (OpenSim.Framework.RegionFlags)flags; MainConsole.Instance.Output(String.Format("Set region {0} to {1}", r.RegionName, f)); m_Database.Store(r); diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 78eab3dd2b..743d08947f 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -390,8 +390,8 @@ namespace OpenSim.Services.GridService List regions = m_Database.Get(mapName, m_ScopeID); if (regions != null && regions.Count > 0) { - OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(regions[0].Data["flags"]); - if ((rflags & OpenSim.Data.RegionFlags.Hyperlink) != 0) + OpenSim.Framework.RegionFlags rflags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(regions[0].Data["flags"]); + if ((rflags & OpenSim.Framework.RegionFlags.Hyperlink) != 0) { regInfo = new GridRegion(); regInfo.RegionID = regions[0].RegionID; @@ -460,7 +460,7 @@ namespace OpenSim.Services.GridService private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle) { RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo); - int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline; + int flags = (int)OpenSim.Framework.RegionFlags.Hyperlink + (int)OpenSim.Framework.RegionFlags.NoDirectLogin + (int)OpenSim.Framework.RegionFlags.RegionOnline; rdata.Data["flags"] = flags.ToString(); m_Database.Store(rdata); From a0d047413b2e8bac626f13ff224e4794955fa244 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 9 Oct 2012 01:37:02 +0100 Subject: [PATCH 4/8] Once again, forgot to add a file. --- OpenSim/Framework/RegionFlags.cs | 52 ++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 OpenSim/Framework/RegionFlags.cs diff --git a/OpenSim/Framework/RegionFlags.cs b/OpenSim/Framework/RegionFlags.cs new file mode 100644 index 0000000000..c0630c8f75 --- /dev/null +++ b/OpenSim/Framework/RegionFlags.cs @@ -0,0 +1,52 @@ +/* + * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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; + +namespace OpenSim.Framework +{ + /// + /// Region flags used internally by OpenSimulator to store installation specific information about regions. + /// + /// + /// Don't confuse with OpenMetaverse.RegionFlags which are client facing flags (i.e. they go over the wire). + /// + [Flags] + public enum RegionFlags : int + { + DefaultRegion = 1, // Used for new Rez. Random if multiple defined + FallbackRegion = 2, // Regions we redirect to when the destination is down + RegionOnline = 4, // Set when a region comes online, unset when it unregisters and DeleteOnUnregister is false + NoDirectLogin = 8, // Region unavailable for direct logins (by name) + Persistent = 16, // Don't remove on unregister + LockedOut = 32, // Don't allow registration + NoMove = 64, // Don't allow moving this region + Reservation = 128, // This is an inactive reservation + Authenticate = 256, // Require authentication + Hyperlink = 512 // Record represents a HG link + } +} \ No newline at end of file From ef3cc2e507a545bfcffc804015ee3ec5b8a260e0 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 9 Oct 2012 01:40:40 +0100 Subject: [PATCH 5/8] minor: Add documentation to IGridService.GetRegionFlags() --- OpenSim/Framework/RegionFlags.cs | 1 + OpenSim/Services/Interfaces/IGridService.cs | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/OpenSim/Framework/RegionFlags.cs b/OpenSim/Framework/RegionFlags.cs index c0630c8f75..a3089b077d 100644 --- a/OpenSim/Framework/RegionFlags.cs +++ b/OpenSim/Framework/RegionFlags.cs @@ -34,6 +34,7 @@ namespace OpenSim.Framework /// /// /// Don't confuse with OpenMetaverse.RegionFlags which are client facing flags (i.e. they go over the wire). + /// Returned by IGridService.GetRegionFlags() /// [Flags] public enum RegionFlags : int diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index d80999649f..d7da05688e 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -100,6 +100,19 @@ namespace OpenSim.Services.Interfaces List GetFallbackRegions(UUID scopeID, int x, int y); List GetHyperlinks(UUID scopeID); + /// + /// Get internal OpenSimulator region flags. + /// + /// + /// See OpenSimulator.Framework.RegionFlags. These are not returned in the GridRegion structure - + /// they currently need to be requested separately. Possibly this should change to avoid multiple service calls + /// in some situations. + /// + /// + /// The region flags. + /// + /// + /// int GetRegionFlags(UUID scopeID, UUID regionID); } From 764270a0d81ef3aeba9ceb2eb50eab74a4707a95 Mon Sep 17 00:00:00 2001 From: teravus Date: Tue, 9 Oct 2012 09:26:11 -0400 Subject: [PATCH 6/8] Add config option to plant avatar where they are reducing avatar avatar 'pushability' av_planted see OpenSimDefaults.ini. Use when you have unruly visitors that rudely push each other around. Still allows a small amount of movement based on the avatar movement PID controller settings. You can increase the spring tension in the PID controller and really prevent any movement if you would like. --- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 4 ++-- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 8 +++++++- bin/OpenSimDefaults.ini | 6 ++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index f3b0630843..c73655791b 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -100,7 +100,7 @@ namespace OpenSim.Region.Physics.OdePlugin private bool m_hackSentFly = false; private int m_requestedUpdateFrequency = 0; private Vector3 m_taintPosition; - + internal bool m_avatarplanted = false; /// /// Hold set forces so we can process them outside physics calculations. This prevents race conditions if we set force /// while calculatios are going on @@ -413,7 +413,7 @@ namespace OpenSim.Region.Physics.OdePlugin set { m_iscollidingObj = value; - if (value) + if (value && !m_avatarplanted) m_pidControllerActive = false; else m_pidControllerActive = true; diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 7a50c4c66a..8421cdfff6 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -501,6 +501,8 @@ namespace OpenSim.Region.Physics.OdePlugin public int physics_logging_interval = 0; public bool physics_logging_append_existing_logfile = false; + private bool avplanted = false; + public d.Vector3 xyz = new d.Vector3(128.1640f, 128.3079f, 25.7600f); public d.Vector3 hpr = new d.Vector3(125.5000f, -17.0000f, 0.0000f); @@ -644,6 +646,8 @@ namespace OpenSim.Region.Physics.OdePlugin avMovementDivisorWalk = physicsconfig.GetFloat("av_movement_divisor_walk", 1.3f); avMovementDivisorRun = physicsconfig.GetFloat("av_movement_divisor_run", 0.8f); avCapRadius = physicsconfig.GetFloat("av_capsule_radius", 0.37f); + avplanted = physicsconfig.GetBoolean("av_planted", false); + IsAvCapsuleTilted = physicsconfig.GetBoolean("av_capsule_tilted", false); contactsPerCollision = physicsconfig.GetInt("contacts_per_collision", 80); @@ -1972,7 +1976,8 @@ namespace OpenSim.Region.Physics.OdePlugin newAv.Flying = isFlying; newAv.MinimumGroundFlightOffset = minimumGroundFlightOffset; - + newAv.m_avatarplanted = avplanted; + return newAv; } @@ -1987,6 +1992,7 @@ namespace OpenSim.Region.Physics.OdePlugin internal void AddCharacter(OdeCharacter chr) { + chr.m_avatarplanted = avplanted; if (!_characters.Contains(chr)) { _characters.Add(chr); diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 677ac746ce..b380a73127 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -844,6 +844,12 @@ ; When the avatar flies, it will be moved up by this amount off the ground (in meters) minimum_ground_flight_offset = 3.0 + ; Plant avatar. This reduces the effect of physical contacts with the avatar. + ; If you have a group of unruly and rude visitors that bump each other, turn this on to make that less attractive. + ; The avatar still allows a small movement based on the PID settings above. Stronger PID settings AND this active + ; will lock the avatar in place + av_planted = false + ; ## ; ## Object options ; ## From 7e90ea355120c717d1639d817b2b38326a4d5528 Mon Sep 17 00:00:00 2001 From: teravus Date: Tue, 9 Oct 2012 10:41:16 -0400 Subject: [PATCH 7/8] av_av_collisions_off = false OdePhysics Settings in OpenSimDefaults.ini - No Avatar Avatar Collisions. This causes avatar to be able to walk through each other as if they're ghosts but still interact with the environment. --- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 11 +++++++++-- bin/OpenSimDefaults.ini | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 8421cdfff6..cbe21e20f9 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -502,7 +502,7 @@ namespace OpenSim.Region.Physics.OdePlugin public bool physics_logging_append_existing_logfile = false; private bool avplanted = false; - + private bool av_av_collisions_off = false; public d.Vector3 xyz = new d.Vector3(128.1640f, 128.3079f, 25.7600f); public d.Vector3 hpr = new d.Vector3(125.5000f, -17.0000f, 0.0000f); @@ -647,7 +647,8 @@ namespace OpenSim.Region.Physics.OdePlugin avMovementDivisorRun = physicsconfig.GetFloat("av_movement_divisor_run", 0.8f); avCapRadius = physicsconfig.GetFloat("av_capsule_radius", 0.37f); avplanted = physicsconfig.GetBoolean("av_planted", false); - + av_av_collisions_off = physicsconfig.GetBoolean("av_av_collisions_off", false); + IsAvCapsuleTilted = physicsconfig.GetBoolean("av_capsule_tilted", false); contactsPerCollision = physicsconfig.GetInt("contacts_per_collision", 80); @@ -667,6 +668,8 @@ namespace OpenSim.Region.Physics.OdePlugin meshSculptLOD = physicsconfig.GetFloat("mesh_lod", 32f); MeshSculptphysicalLOD = physicsconfig.GetFloat("mesh_physical_lod", 16f); m_filterCollisions = physicsconfig.GetBoolean("filter_collisions", false); + + if (Environment.OSVersion.Platform == PlatformID.Unix) { @@ -1313,6 +1316,10 @@ namespace OpenSim.Region.Physics.OdePlugin if ((p1 is OdePrim) && (((OdePrim)p1).m_isVolumeDetect)) skipThisContact = true; // No collision on volume detect prims + if (av_av_collisions_off) + if ((p1 is OdeCharacter) && (p2 is OdeCharacter)) + skipThisContact = true; + if (!skipThisContact && (p2 is OdePrim) && (((OdePrim)p2).m_isVolumeDetect)) skipThisContact = true; // No collision on volume detect prims diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index b380a73127..2fca6cedc9 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -850,6 +850,9 @@ ; will lock the avatar in place av_planted = false + ; No Avatar Avatar Collissions. This causes avatar to be able to walk through each other as if they're ghosts but still interact with the environment + av_av_collisions_off = false + ; ## ; ## Object options ; ## From 40bf789ad718eb345d79d4aed9d5ee8140cbd9e0 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 9 Oct 2012 17:20:01 +0100 Subject: [PATCH 8/8] Disambiguate use of RegionFlags in NullRegionData This was not necessary with the nant build but is for xbuild, since xbuild includes associated project DLLs And so picks up OpenMetaverse.dll even though it isn't referenced by OpenSim.Data.Null.dll --- OpenSim/Data/Null/NullRegionData.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs index deb50cb4df..b4d701af50 100644 --- a/OpenSim/Data/Null/NullRegionData.cs +++ b/OpenSim/Data/Null/NullRegionData.cs @@ -33,6 +33,7 @@ using OpenSim.Framework; using OpenSim.Data; using System.Reflection; using log4net; +using RegionFlags = OpenSim.Framework.RegionFlags; namespace OpenSim.Data.Null {