UbitUmarov пре 3 дана
родитељ
комит
1ff28960f1

+ 1 - 1
OpenSim/Data/MySQL/MySQLGroupsData.cs

@@ -199,7 +199,7 @@ namespace OpenSim.Data.MySQL
         public RoleMembershipData[] RetrieveMemberRoles(UUID groupID, string principalID)
         {
             RoleMembershipData[] data = m_RoleMembership.Get(new string[] { "GroupID", "PrincipalID" },
-                                                             new string[] { groupID.ToString(), principalID.ToString() });
+                                                             new string[] { groupID.ToString(), principalID });
 
             return data;
         }

+ 0 - 2
OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs

@@ -1228,8 +1228,6 @@ namespace OpenSim.Region.CoreModules.World.Land
                     for (int y = start_y; y < end_y; y++)
                     {
                         ILandObject tempLandObject = GetLandObject(x, y);
-                        if (tempLandObject is null)
-                            return;
                         if (tempLandObject != startLandObject)
                             return;
                         area++;

+ 3 - 4
OpenSim/Region/Framework/Scenes/Scene.cs

@@ -1694,7 +1694,7 @@ namespace OpenSim.Region.Framework.Scenes
                     terrainMS = (float)(nowMS - lastMS);
                     lastMS = nowMS;
 
-                    if (PhysicsEnabled && Frame % m_update_physics == 0)
+                    if (m_physicsEnabled && Frame % m_update_physics == 0)
                         m_sceneGraph.UpdatePreparePhysics();
 
                     nowMS = Util.GetTimeStampMS();
@@ -1731,10 +1731,9 @@ namespace OpenSim.Region.Framework.Scenes
 
                     // Perform the main physics update.  This will do the actual work of moving objects and avatars according to their
                     // velocity
-                    if (Frame % m_update_physics == 0)
+                    if (m_physicsEnabled && Frame % m_update_physics == 0)
                     {
-                        if (PhysicsEnabled)
-                            physicsFPS = m_sceneGraph.UpdatePhysics(FrameTime);
+                        physicsFPS = m_sceneGraph.UpdatePhysics(FrameTime);
                     }
 
                     nowMS = Util.GetTimeStampMS();

+ 1 - 1
OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs

@@ -192,7 +192,7 @@ namespace OpenSim.Region.Framework.Scenes
             // TODO: These are pending addition of those fields to TaskInventoryItem
             // taskItem.SalePrice = item.SalePrice;
             // taskItem.SaleType = item.SaleType;
-                
+
             bool addFromAllowedDrop;
             if(withModRights)
                 addFromAllowedDrop = false;

+ 11 - 24
OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs

@@ -28,17 +28,13 @@
 using System;
 using System.Text;
 using System.Xml;
-using System.IO;
 using System.Collections.Generic;
 using System.Collections;
 using System.Reflection;
-using System.Threading;
 using OpenMetaverse;
 using log4net;
 using OpenSim.Framework;
 using OpenSim.Region.Framework.Interfaces;
-using OpenSim.Region.Framework.Scenes.Scripting;
-using OpenSim.Region.Framework.Scenes.Serialization;
 using PermissionMask = OpenSim.Framework.PermissionMask;
 
 namespace OpenSim.Region.Framework.Scenes
@@ -1388,9 +1384,7 @@ namespace OpenSim.Region.Framework.Scenes
                 if (m_inventoryFileData.Length < 2)
                     changed = true;
 
-                bool includeAssets = false;
-                if (m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.AgentId))
-                    includeAssets = true;
+                bool includeAssets = m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.AgentId);
 
                 if (m_inventoryPrivileged != includeAssets)
                     changed = true;
@@ -1412,38 +1406,31 @@ namespace OpenSim.Region.Framework.Scenes
 
                 foreach (TaskInventoryItem item in m_items.Values)
                 {
-                    UUID ownerID = item.OwnerID;
-                    UUID groupID = item.GroupID;
-                    uint everyoneMask = item.EveryonePermissions;
-                    uint baseMask = item.BasePermissions;
-                    uint ownerMask = item.CurrentPermissions;
-                    uint groupMask = item.GroupPermissions;
-
                     invString.AddItemStart();
                     invString.AddNameValueLine("item_id", item.ItemID.ToString());
                     invString.AddNameValueLine("parent_id", m_part.UUID.ToString());
 
                     invString.AddPermissionsStart();
 
-                    invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask));
-                    invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask));
-                    invString.AddNameValueLine("group_mask", Utils.UIntToHexString(groupMask));
-                    invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask));
+                    invString.AddNameValueLine("base_mask", Utils.UIntToHexString(item.BasePermissions));
+                    invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(item.CurrentPermissions));
+                    invString.AddNameValueLine("group_mask", Utils.UIntToHexString(item.GroupPermissions));
+                    invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(item.EveryonePermissions));
                     invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions));
 
                     invString.AddNameValueLine("creator_id", item.CreatorID.ToString());
 
                     invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString());
 
-                    invString.AddNameValueLine("group_id",groupID.ToString());
-                    if(!groupID.IsZero() && ownerID.Equals(groupID))
+                    invString.AddNameValueLine("group_id", item.GroupID.ToString());
+                    if(item.GroupID.IsNotZero() && item.OwnerID.Equals(item.GroupID))
                     {
                         invString.AddNameValueLine("owner_id", UUID.ZeroString);
                         invString.AddNameValueLine("group_owned","1");
                     }
                     else
                     {
-                        invString.AddNameValueLine("owner_id", ownerID.ToString());
+                        invString.AddNameValueLine("owner_id", item.OwnerID.ToString());
                         invString.AddNameValueLine("group_owned","0");
                     }
 
@@ -1452,7 +1439,7 @@ namespace OpenSim.Region.Framework.Scenes
                     if (includeAssets)
                         invString.AddNameValueLine("asset_id", item.AssetID.ToString());
                     else
-                        invString.AddNameValueLine("asset_id", UUID.Zero.ToString());
+                        invString.AddNameValueLine("asset_id", UUID.ZeroString);
                     invString.AddNameValueLine("type", Utils.AssetTypeToString((AssetType)item.Type));
                     invString.AddNameValueLine("inv_type", Utils.InventoryTypeToString((InventoryType)item.InvType));
                     invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags));
@@ -1558,9 +1545,9 @@ namespace OpenSim.Region.Framework.Scenes
             {
                 BuildString.Append("\t\t");
                 BuildString.Append(name);
-                BuildString.Append("\t");
+                BuildString.Append('\t');
                 BuildString.Append(value);
-                BuildString.Append("\n");
+                BuildString.Append('\n');
             }
 
             public String GetString()

+ 10 - 10
OpenSim/Region/Framework/Scenes/ScenePresence.cs

@@ -1143,20 +1143,20 @@ namespace OpenSim.Region.Framework.Scenes
             IsInLocalTransit = true;
 
             UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid);
-            if (account != null)
+            if (account is not null)
+            { 
                 m_userFlags = account.UserFlags;
+                GodController = new GodController(world, this, account.UserLevel);
+            }
             else
+            {
                 m_userFlags = 0;
+                GodController = new GodController(world, this, 0);
+            }
 
-            int userlevel = 0;
-            if (account != null)
-                userlevel = account.UserLevel;
-
-            GodController = new GodController(world, this, userlevel);
-
- //           IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
- //           if (gm != null)
- //              Grouptitle = gm.GetGroupTitle(m_uuid);
+            //IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
+            //if (gm != null)
+            //    Grouptitle = gm.GetGroupTitle(m_uuid);
 
             m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>();
 

+ 15 - 24
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs

@@ -2351,38 +2351,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
 
         protected static LSL_String GetTexture(SceneObjectPart part, int face)
         {
+            if (face == ScriptBaseClass.ALL_SIDES)
+                face = 0;
+            if (face < 0)
+                return ScriptBaseClass.NULL_KEY;
+
             Primitive.TextureEntry tex = part.Shape.Textures;
             int nsides = GetNumberOfSides(part);
+            if (face >= nsides)
+                return ScriptBaseClass.NULL_KEY;
 
-            if (face == ScriptBaseClass.ALL_SIDES)
-            {
-                face = 0;
-            }
+            Primitive.TextureEntryFace texface;
+            texface = tex.GetFace((uint)face);
 
-            if (face >= 0 && face < nsides)
+            lock (part.TaskInventory)
             {
-                Primitive.TextureEntryFace texface;
-                texface = tex.GetFace((uint)face);
-                string texture = texface.TextureID.ToString();
-
-                lock (part.TaskInventory)
+                foreach (KeyValuePair<UUID, TaskInventoryItem> inv in part.TaskInventory)
                 {
-                    foreach (KeyValuePair<UUID, TaskInventoryItem> inv in part.TaskInventory)
-                    {
-                        if (inv.Value.AssetID.Equals(texface.TextureID))
-                        {
-                            texture = inv.Value.Name.ToString();
-                            break;
-                        }
-                    }
+                    if (inv.Value.AssetID.Equals(texface.TextureID))
+                        return inv.Value.Name.ToString();
                 }
-
-                return texture;
-            }
-            else
-            {
-                return ScriptBaseClass.NULL_KEY;
             }
+
+            return texface.TextureID.ToString();
         }
 
         public void llSetPos(LSL_Vector pos)

+ 10 - 17
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs

@@ -4106,33 +4106,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
         }
 
         /// <summary>
-        /// Sets terrain estate texture
+        /// Sets terrain texture
         /// </summary>
         /// <param name="level"></param>
         /// <param name="texture"></param>
         /// <returns></returns>
         public void osSetTerrainTexture(int level, LSL_Key texture)
         {
+            if (level < 0 || level > 3)
+                return;
+            if (!UUID.TryParse(texture, out UUID textureID))
+                return;
+
             CheckThreatLevel(ThreatLevel.High, "osSetTerrainTexture");
 
-            //Check to make sure that the script's owner is the estate manager/master
-            //World.Permissions.GenericEstatePermission(
             if (World.Permissions.IsGod(m_host.OwnerID))
             {
-                if (level < 0 || level > 3)
-                    return;
-
-                if (!UUID.TryParse(texture, out UUID textureID))
-                    return;
-
-                // estate module is required
                 IEstateModule estate = World.RequestModuleInterface<IEstateModule>();
                 estate?.setEstateTerrainBaseTexture(level, textureID);
             }
         }
 
         /// <summary>
-        /// Sets terrain heights of estate
+        /// Sets terrain textures heights
         /// </summary>
         /// <param name="corner"></param>
         /// <param name="low"></param>
@@ -4140,16 +4136,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
         /// <returns></returns>
         public void osSetTerrainTextureHeight(int corner, double low, double high)
         {
+            if (corner < 0 || corner > 3)
+                return;
+
             CheckThreatLevel(ThreatLevel.High, "osSetTerrainTextureHeight");
 
-            //Check to make sure that the script's owner is the estate manager/master
-            //World.Permissions.GenericEstatePermission(
             if (World.Permissions.IsGod(m_host.OwnerID))
             {
-                if (corner < 0 || corner > 3)
-                    return;
-
-                // estate module is required
                 IEstateModule estate = World.RequestModuleInterface<IEstateModule>();
                 estate?.setEstateTerrainTextureHeights(corner, (float)low, (float)high);
             }