diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs index a6c5476bb6..d5c55f1c4c 100755 --- a/OpenSim/Framework/Console/LocalConsole.cs +++ b/OpenSim/Framework/Console/LocalConsole.cs @@ -181,11 +181,9 @@ namespace OpenSim.Framework.Console { // mono seems to fail unless we do check both left and top ranges, even current int left = System.Console.CursorLeft; - if (left < 0) - { - System.Console.CursorLeft = 0; - } - else if(left > 0) + if (left <= 0) + left = 0; + else { int bufferWidth = System.Console.BufferWidth; // On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657) @@ -194,17 +192,16 @@ namespace OpenSim.Framework.Console } if (top <= 0) + top = 0; + else { - System.Console.CursorTop = 0; - return 0; + int bufferHeight = System.Console.BufferHeight; + // On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657) + if (bufferHeight > 0 && top >= bufferHeight) + top = bufferHeight - 1; } - int bufferHeight = System.Console.BufferHeight; - // On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657) - if (bufferHeight > 0 && top >= bufferHeight) - top = bufferHeight - 1; - - System.Console.CursorTop = top; + System.Console.SetCursorPosition(left, top); return top; } @@ -222,9 +219,9 @@ namespace OpenSim.Framework.Console private int SetCursorLeft(int left) { int top = System.Console.CursorTop; - if (top < 0) - System.Console.CursorTop = 0; - else if( top > 0) + if (top <= 0) + top = 0; + else { int bufferHeight = System.Console.BufferHeight; if (bufferHeight > 0 && top >= bufferHeight) @@ -232,16 +229,16 @@ namespace OpenSim.Framework.Console } if (left <= 0) + left = 0; + else { - System.Console.CursorLeft = 0; - return 0; + int bufferWidth = System.Console.BufferWidth; + // On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657) + if (bufferWidth > 0 && left >= bufferWidth) + left = bufferWidth - 1; } - int bufferWidth = System.Console.BufferWidth; - // On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657) - if (bufferWidth > 0 && left >= bufferWidth) - left = bufferWidth - 1; - System.Console.CursorLeft = left; + System.Console.SetCursorPosition(left, top); return left; } @@ -267,7 +264,7 @@ namespace OpenSim.Framework.Console System.Console.SetCursorPosition(left, top); } - private int SetCursorTopZeroLeft(int top) + private int SetCursorZeroLeft(int top) { if (top <= 0) { @@ -279,26 +276,9 @@ namespace OpenSim.Framework.Console if (bufferHeight > 0 && top >= bufferHeight) { top = bufferHeight - 1; - System.Console.SetCursorPosition(0, top); } - else - System.Console.CursorLeft = 0; - return top; - } - - private int SetCursorZeroLeft(int top) - { - System.Console.CursorLeft = 0; - if (top <= 0) - { - System.Console.CursorTop = 0; - return 0; - } - int bufferHeight = System.Console.BufferHeight; - if (bufferHeight > 0 && top >= bufferHeight) - top = bufferHeight - 1; - System.Console.CursorTop = top; + System.Console.SetCursorPosition(0, top); return top; } @@ -319,11 +299,11 @@ namespace OpenSim.Framework.Console { m_cursorYPosition--; new_y--; - SetCursorTopZeroLeft(System.Console.BufferHeight - 1); + SetCursorZeroLeft(System.Console.BufferHeight - 1); System.Console.WriteLine(" "); } - m_cursorYPosition = SetCursorTopZeroLeft(m_cursorYPosition); + m_cursorYPosition = SetCursorZeroLeft(m_cursorYPosition); if (m_echo) System.Console.Write("{0}{1}", prompt, m_commandLine); @@ -341,16 +321,13 @@ namespace OpenSim.Framework.Console { if (m_cursorYPosition != -1) { - m_cursorYPosition = SetCursorTopZeroLeft(m_cursorYPosition); + m_cursorYPosition = SetCursorZeroLeft(m_cursorYPosition); int count = m_commandLine.Length + prompt.Length; if(count > 0) System.Console.Write(new string(' ', count)); - while (count-- > 0) - System.Console.Write(" "); - - m_cursorYPosition = SetCursorTopZeroLeft(m_cursorYPosition); + m_cursorYPosition = SetCursorZeroLeft(m_cursorYPosition); } } catch (Exception) @@ -462,13 +439,15 @@ namespace OpenSim.Framework.Console return; } - m_cursorYPosition = SetCursorTopZeroLeft(m_cursorYPosition); + m_cursorYPosition = SetCursorZeroLeft(m_cursorYPosition); int count = m_commandLine.Length + prompt.Length - text.Length; WriteLocalText(text, level); - for (int i = 0; i < count; ++i) - System.Console.Write(" "); - System.Console.WriteLine(); + if(count > 0) + System.Console.WriteLine(new string(' ', count)); + else + System.Console.WriteLine(); + m_cursorYPosition = System.Console.CursorTop; Show(); } @@ -505,9 +484,10 @@ namespace OpenSim.Framework.Console lock (m_commandLine) { SetCursorLeft(0); // Needed for mono - System.Console.Write(" "); // Needed for mono - m_cursorYPosition = System.Console.CursorTop; + // mono is silly + if (m_cursorYPosition >= System.Console.BufferHeight) + m_cursorYPosition = System.Console.BufferHeight - 1; m_commandLine.Clear(); } @@ -552,7 +532,7 @@ namespace OpenSim.Framework.Console m_commandLine.Remove(m_cursorXPosition-1, 1); m_cursorXPosition--; - m_cursorYPosition = SetCursorTopZeroLeft(m_cursorYPosition); + m_cursorYPosition = SetCursorZeroLeft(m_cursorYPosition); if (m_echo) System.Console.Write("{0}{1} ", prompt, m_commandLine); diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs index f5055ff124..6fb2459d9f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs @@ -70,6 +70,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if(client is not null) { m_log.DebugFormat("[HG STATUS NOTIFIER]: Notifying {0} friends in {1}", friendsOnline.Count, kvp.Key); + m_FriendsModule.CacheFriendsOnline(userID, friendsOnline, online); if(online) client?.SendAgentOnline(friendsOnline.ToArray()); else @@ -97,7 +98,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends HGFriendsServicesConnector fConn = new(friendsServerURI); List friendsOnline = fConn.StatusNotification(new List { friendID.ToString() }, userID, online); - if (friendsOnline.Count > 0) { IClientAPI client = m_FriendsModule.LocateClientObject(userID); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 8f4bd78186..3810157dab 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -758,32 +758,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } } - if (!newPosition.IsZero()) - defso.RootPart.GroupPosition = newPosition; - - if (!Scene.AddSceneObject(defso)) - { - m_log.DebugFormat( - "[HG ENTITY TRANSFER MODULE]: Problem adding scene object {0} {1} into {2} ", - defso.Name, defso.UUID, Scene.Name); - - return; - } - - if (defso.IsAttachment) - { - ScenePresence sp = Scene.GetScenePresence(defso.OwnerID); - if (sp != null && !sp.IsChildAgent) - { - m_log.DebugFormat( - "[HG ENTITY TRANSFER MODULE]: Resuming scripts in attachment {0} for HG root agent {1}", - defso.Name, defso.OwnerID); - defso.RootPart.ParentGroup.CreateScriptInstances( - 0, false, Scene.DefaultScriptEngine, GetStateSource(defso)); - defso.aggregateScriptEvents(); - defso.ResumeScripts(); - } - } + base.HandleIncomingSceneObject(defso, newPosition); defso = null; aCircuit = null; diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 06f6e0b232..007e497dec 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -858,12 +858,12 @@ namespace OpenSim.Region.CoreModules.World.Land private bool IsRestrictedFromLand_inner(UUID avatar) { - if ((LandData.Flags & (uint)ParcelFlags.UseAccessList) == 0) + if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) == 0) { bool adults = m_estateSettings.DoDenyMinors || - (m_estateSettings.DenyMinors || ((LandData.Flags & (uint)ParcelFlags.DenyAgeUnverified) != 0)); + (m_estateSettings.DenyMinors || ((LandData.Flags & (uint)ParcelFlags.DenyAgeUnverified) != 0)); bool anonymous = m_estateSettings.DoDenyAnonymous || - (m_estateSettings.DenyAnonymous || ((LandData.Flags & (uint)ParcelFlags.DenyAnonymous) != 0)); + (m_estateSettings.DenyAnonymous || ((LandData.Flags & (uint)ParcelFlags.DenyAnonymous) != 0)); if(adults || anonymous) { int userflags; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 1a14dd7165..a5d6f9f38d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3100,7 +3100,21 @@ namespace OpenSim.Region.Framework.Scenes /// null if no child part with that linknum or child part public SceneObjectPart GetLinkNumPart(int linknum) { - SceneObjectPart[] parts = m_parts.GetArray(); + if (linknum < 2) + { + // unlike SL 0 or 1 will mean root + // one reason is that we do not consider siting avatars on root linknumber + return linknum < 0 ? null : RootPart; + } + + Span parts = m_parts.GetArray().AsSpan(); + if (linknum <= parts.Length) + { + SceneObjectPart sop = parts[linknum - 1]; + if (sop.LinkNum == linknum) + return sop; + } + for (int i = 0; i < parts.Length; i++) { if (parts[i].LinkNum == linknum) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 423a5685fd..54ab1b16f3 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3089,8 +3089,8 @@ namespace OpenSim.Region.Framework.Scenes if(IsNPC) { if (!Flying) - shouldfly = noFly ? false : (pos.Z > AbsolutePosition.Z + (Appearance.AvatarHeight*2)); - LandAtTarget = landAtTarget & shouldfly; + shouldfly = !noFly && (pos.Z > AbsolutePosition.Z + (Appearance.AvatarHeight*2)); + LandAtTarget = landAtTarget && shouldfly; } else {