diff --git a/OpenSim/Data/MySQL/MySQLGroupsData.cs b/OpenSim/Data/MySQL/MySQLGroupsData.cs index 77cb2f4db4..6d88616606 100644 --- a/OpenSim/Data/MySQL/MySQLGroupsData.cs +++ b/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; } diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index ed1ddc7b70..057992b72a 100755 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/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++; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 38b7e7a02f..ddff39f1a3 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/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(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 7d95ce74df..525122d5c6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/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; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index c0dad7ac42..9f7def89c5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/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() diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c9193274d2..b03c38f445 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/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(); - // if (gm != null) - // Grouptitle = gm.GetGroupTitle(m_uuid); + //IGroupsModule gm = m_scene.RequestModuleInterface(); + //if (gm != null) + // Grouptitle = gm.GetGroupTitle(m_uuid); m_scriptEngines = m_scene.RequestModuleInterfaces(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 1d914d3770..d97d883f63 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/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 == ScriptBaseClass.ALL_SIDES) - { - face = 0; - } - - if (face >= 0 && face < nsides) - { - Primitive.TextureEntryFace texface; - texface = tex.GetFace((uint)face); - string texture = texface.TextureID.ToString(); - - lock (part.TaskInventory) - { - foreach (KeyValuePair inv in part.TaskInventory) - { - if (inv.Value.AssetID.Equals(texface.TextureID)) - { - texture = inv.Value.Name.ToString(); - break; - } - } - } - - return texture; - } - else - { + if (face >= nsides) return ScriptBaseClass.NULL_KEY; + + Primitive.TextureEntryFace texface; + texface = tex.GetFace((uint)face); + + lock (part.TaskInventory) + { + foreach (KeyValuePair inv in part.TaskInventory) + { + if (inv.Value.AssetID.Equals(texface.TextureID)) + return inv.Value.Name.ToString(); + } } + + return texface.TextureID.ToString(); } public void llSetPos(LSL_Vector pos) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 2bfa6c047d..eaf2ba583b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -4106,33 +4106,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } /// - /// Sets terrain estate texture + /// Sets terrain texture /// /// /// /// 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(); estate?.setEstateTerrainBaseTexture(level, textureID); } } /// - /// Sets terrain heights of estate + /// Sets terrain textures heights /// /// /// @@ -4140,16 +4136,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// 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(); estate?.setEstateTerrainTextureHeights(corner, (float)low, (float)high); }