diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 95713e9b87..6786ac56cc 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1,10 +1,39 @@ -using System; +/* + * 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; using System.Collections; using System.Collections.Generic; using System.IO; using System.Reflection; +using System.Text; using OpenMetaverse; +using OpenMetaverse.StructuredData; using Nini.Config; using log4net; @@ -12,11 +41,14 @@ using OpenSim.Framework; using OpenSim.Framework.Capabilities; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Scenes.Serialization; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Services.Interfaces; using Caps = OpenSim.Framework.Capabilities.Caps; +using OSDArray = OpenMetaverse.StructuredData.OSDArray; +using OSDMap = OpenMetaverse.StructuredData.OSDMap; namespace OpenSim.Region.ClientStack.Linden { @@ -79,7 +111,7 @@ namespace OpenSim.Region.ClientStack.Linden private bool m_persistBakedTextures = false; private IAssetService m_assetService; - private bool m_dumpAssetsToFile; + private bool m_dumpAssetsToFile = false; private string m_regionName; public BunchOfCaps(Scene scene, Caps caps) @@ -439,7 +471,7 @@ namespace OpenSim.Region.ClientStack.Linden } /// - /// + /// Convert raw uploaded data into the appropriate asset and item. /// /// /// @@ -448,6 +480,10 @@ namespace OpenSim.Region.ClientStack.Linden UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, string assetType) { + m_log.DebugFormat( + "Uploaded asset {0} for inventory item {1}, inv type {2}, asset type {3}", + assetID, inventoryItem, inventoryType, assetType); + sbyte assType = 0; sbyte inType = 0; @@ -474,6 +510,156 @@ namespace OpenSim.Region.ClientStack.Linden break; } } + else if (inventoryType == "object") + { + inType = (sbyte)InventoryType.Object; + assType = (sbyte)AssetType.Object; + + List positions = new List(); + List rotations = new List(); + OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data); + OSDArray instance_list = (OSDArray)request["instance_list"]; + OSDArray mesh_list = (OSDArray)request["mesh_list"]; + OSDArray texture_list = (OSDArray)request["texture_list"]; + SceneObjectGroup grp = null; + + List textures = new List(); + for (int i = 0; i < texture_list.Count; i++) + { + AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, ""); + textureAsset.Data = texture_list[i].AsBinary(); + m_assetService.Store(textureAsset); + textures.Add(textureAsset.FullID); + } + + for (int i = 0; i < mesh_list.Count; i++) + { + PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox(); + + Primitive.TextureEntry textureEntry + = new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE); + OSDMap inner_instance_list = (OSDMap)instance_list[i]; + + OSDArray face_list = (OSDArray)inner_instance_list["face_list"]; + for (uint face = 0; face < face_list.Count; face++) + { + OSDMap faceMap = (OSDMap)face_list[(int)face]; + Primitive.TextureEntryFace f = pbs.Textures.CreateFace(face); + if(faceMap.ContainsKey("fullbright")) + f.Fullbright = faceMap["fullbright"].AsBoolean(); + if (faceMap.ContainsKey ("diffuse_color")) + f.RGBA = faceMap["diffuse_color"].AsColor4(); + + int textureNum = faceMap["image"].AsInteger(); + float imagerot = faceMap["imagerot"].AsInteger(); + float offsets = (float)faceMap["offsets"].AsReal(); + float offsett = (float)faceMap["offsett"].AsReal(); + float scales = (float)faceMap["scales"].AsReal(); + float scalet = (float)faceMap["scalet"].AsReal(); + + if(imagerot != 0) + f.Rotation = imagerot; + + if(offsets != 0) + f.OffsetU = offsets; + + if (offsett != 0) + f.OffsetV = offsett; + + if (scales != 0) + f.RepeatU = scales; + + if (scalet != 0) + f.RepeatV = scalet; + + if (textures.Count > textureNum) + f.TextureID = textures[textureNum]; + else + f.TextureID = Primitive.TextureEntry.WHITE_TEXTURE; + + textureEntry.FaceTextures[face] = f; + } + + pbs.TextureEntry = textureEntry.GetBytes(); + + AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, ""); + meshAsset.Data = mesh_list[i].AsBinary(); + m_assetService.Store(meshAsset); + + pbs.SculptEntry = true; + pbs.SculptTexture = meshAsset.FullID; + pbs.SculptType = (byte)SculptType.Mesh; + pbs.SculptData = meshAsset.Data; + + Vector3 position = inner_instance_list["position"].AsVector3(); + Vector3 scale = inner_instance_list["scale"].AsVector3(); + Quaternion rotation = inner_instance_list["rotation"].AsQuaternion(); + +// int physicsShapeType = inner_instance_list["physics_shape_type"].AsInteger(); +// int material = inner_instance_list["material"].AsInteger(); +// int mesh = inner_instance_list["mesh"].AsInteger(); + + OSDMap permissions = (OSDMap)inner_instance_list["permissions"]; + int base_mask = permissions["base_mask"].AsInteger(); + int everyone_mask = permissions["everyone_mask"].AsInteger(); + UUID creator_id = permissions["creator_id"].AsUUID(); + UUID group_id = permissions["group_id"].AsUUID(); + int group_mask = permissions["group_mask"].AsInteger(); +// bool is_owner_group = permissions["is_owner_group"].AsBoolean(); +// UUID last_owner_id = permissions["last_owner_id"].AsUUID(); + int next_owner_mask = permissions["next_owner_mask"].AsInteger(); + UUID owner_id = permissions["owner_id"].AsUUID(); + int owner_mask = permissions["owner_mask"].AsInteger(); + + SceneObjectPart prim + = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); + + prim.Scale = scale; + prim.OffsetPosition = position; + rotations.Add(rotation); + positions.Add(position); + prim.UUID = UUID.Random(); + prim.CreatorID = creator_id; + prim.OwnerID = owner_id; + prim.GroupID = group_id; + prim.LastOwnerID = prim.OwnerID; + prim.CreationDate = Util.UnixTimeSinceEpoch(); + prim.Name = assetName; + prim.Description = ""; + + prim.BaseMask = (uint)base_mask; + prim.EveryoneMask = (uint)everyone_mask; + prim.GroupMask = (uint)group_mask; + prim.NextOwnerMask = (uint)next_owner_mask; + prim.OwnerMask = (uint)owner_mask; + + if (grp == null) + grp = new SceneObjectGroup(prim); + else + grp.AddPart(prim); + } + + // Fix first link number + if (grp.Parts.Length > 1) + grp.RootPart.LinkNum++; + + Vector3 rootPos = positions[0]; + grp.AbsolutePosition = rootPos; + for (int i = 0; i < positions.Count; i++) + { + Vector3 offset = positions[i] - rootPos; + grp.Parts[i].OffsetPosition = offset; + } + + for (int i = 0; i < rotations.Count; i++) + { + if (i != 0) + grp.Parts[i].RotationOffset = rotations[i]; + } + + grp.UpdateGroupRotationR(rotations[0]); + data = ASCIIEncoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(grp)); + } AssetBase asset; asset = new AssetBase(assetID, assetName, assType, m_HostCapsObj.AgentID.ToString()); @@ -506,8 +692,6 @@ namespace OpenSim.Region.ClientStack.Linden } } - - /// /// /// @@ -632,7 +816,7 @@ namespace OpenSim.Region.ClientStack.Linden } /// - /// + /// Handle raw asset upload data via the capability. /// /// /// @@ -670,6 +854,7 @@ namespace OpenSim.Region.ClientStack.Linden return res; } + ///Left this in and commented in case there are unforseen issues //private void SaveAssetToFile(string filename, byte[] data) //{ @@ -679,6 +864,7 @@ namespace OpenSim.Region.ClientStack.Linden // bw.Close(); // fs.Close(); //} + private static void SaveAssetToFile(string filename, byte[] data) { string assetPath = "UserAssets"; @@ -719,7 +905,7 @@ namespace OpenSim.Region.ClientStack.Linden } /// - /// + /// Handle raw uploaded asset data. /// /// /// @@ -752,6 +938,7 @@ namespace OpenSim.Region.ClientStack.Linden return res; } + ///Left this in and commented in case there are unforseen issues //private void SaveAssetToFile(string filename, byte[] data) //{ @@ -761,6 +948,7 @@ namespace OpenSim.Region.ClientStack.Linden // bw.Close(); // fs.Close(); //} + private static void SaveAssetToFile(string filename, byte[] data) { string assetPath = "UserAssets"; @@ -839,7 +1027,7 @@ namespace OpenSim.Region.ClientStack.Linden uploadComplete.new_asset = inventoryItemID; uploadComplete.compiled = errors.Count > 0 ? false : true; uploadComplete.state = "complete"; - uploadComplete.errors = new OSDArray(); + uploadComplete.errors = new OpenSim.Framework.Capabilities.OSDArray(); uploadComplete.errors.Array = errors; res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); @@ -905,7 +1093,7 @@ namespace OpenSim.Region.ClientStack.Linden } /// - /// + /// Handle raw uploaded baked texture data. /// /// /// diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index e92f072183..d02a3055b8 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -162,12 +162,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // one and we're done otherwise, ask for a rebake if (checkonly) return false; - m_log.InfoFormat("[AVFACTORY]: missing baked texture {0}, requesting rebake",face.TextureID); + m_log.InfoFormat("[AVFACTORY]: missing baked texture {0}, requesting rebake", face.TextureID); client.SendRebakeAvatarTextures(face.TextureID); } } - m_log.DebugFormat("[AVFACTORY]: completed texture check for {0}", client.AgentId); + m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0}", client.AgentId); // If we only found default textures, then the appearance is not cached return (defonly ? false : true); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 02efcd87d8..a00e240827 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -50,6 +50,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// + /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer. + /// + public int MaxTransferDistance { get; set; } + protected bool m_Enabled = false; protected Scene m_aScene; protected List m_Scenes = new List(); @@ -78,13 +83,26 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer string name = moduleConfig.GetString("EntityTransferModule", ""); if (name == Name) { - m_agentsInTransit = new List(); - m_Enabled = true; - m_log.InfoFormat("[ENTITY TRANSFER MODULE]: {0} enabled.", Name); + InitialiseCommon(source); + m_log.DebugFormat("[ENTITY TRANSFER MODULE]: {0} enabled.", Name); } } } + /// + /// Initialize config common for this module and any descendents. + /// + /// + protected virtual void InitialiseCommon(IConfigSource source) + { + IConfig transferConfig = source.Configs["EntityTransfer"]; + if (transferConfig != null) + MaxTransferDistance = transferConfig.GetInt("max_distance", 4095); + + m_agentsInTransit = new List(); + m_Enabled = true; + } + public virtual void PostInitialise() { } @@ -114,7 +132,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return; } - public virtual void RemoveRegion(Scene scene) { if (!m_Enabled) @@ -129,7 +146,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer { if (!m_Enabled) return; - } #endregion @@ -205,8 +221,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.ControllingClient.SendTeleportFailed("Problem at destination"); return; } - m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} {2}@{3}", - finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID, finalDestination.ServerURI); + + uint curX = 0, curY = 0; + Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY); + int curCellX = (int)(curX / Constants.RegionSize); + int curCellY = (int)(curY / Constants.RegionSize); + int destCellX = (int)(finalDestination.RegionLocX / Constants.RegionSize); + int destCellY = (int)(finalDestination.RegionLocY / Constants.RegionSize); + +// m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Source co-ords are x={0} y={1}", curRegionX, curRegionY); +// +// m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final dest is x={0} y={1} {2}@{3}", +// destRegionX, destRegionY, finalDestination.RegionID, finalDestination.ServerURI); // Check that these are not the same coordinates if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && @@ -217,6 +243,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return; } + if (Math.Abs(curCellX - destCellX) > MaxTransferDistance || Math.Abs(curCellY - destCellY) > MaxTransferDistance) + { + sp.ControllingClient.SendTeleportFailed( + string.Format( + "Can't teleport to {0} ({1},{2}) from {3} ({4},{5}), destination is more than {6} regions way", + finalDestination.RegionName, destCellX, destCellY, + sp.Scene.RegionInfo.RegionName, curCellX, curCellY, + MaxTransferDistance)); + + return; + } + // // This is it // diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 8858ad57c3..6daae62c03 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -67,10 +67,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer string name = moduleConfig.GetString("EntityTransferModule", ""); if (name == Name) { - m_agentsInTransit = new List(); - - m_Enabled = true; - m_log.InfoFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); + InitialiseCommon(source); + m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); } } } diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index cfd8ffba50..27eb178d05 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -297,9 +297,10 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement if (m_UserCache.ContainsKey(id)) return; +// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, craetorData {1}", id, creatorData); + UserData user = new UserData(); user.Id = id; - UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); if (account != null) diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 56c59bd3ce..ced27730d1 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs @@ -91,6 +91,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap remoteClient.SendAlertMessage("Use a search string with at least 2 characters"); return; } + +m_log.DebugFormat("MAP NAME=({0})", mapName); // try to fetch from GridServer List regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); @@ -103,7 +105,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap if (info != null) regionInfos.Add(info); } - else if (regionInfos.Count == 0 && mapName.StartsWith("http://")) + else if (regionInfos.Count == 0) remoteClient.SendAlertMessage("Hyperlink could not be established."); //m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count); diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs index 22795fc97d..d0e56098c7 100644 --- a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs +++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs @@ -36,4 +36,4 @@ namespace OpenSim.Region.Framework.Interfaces void QueueAppearanceSend(UUID agentid); void QueueAppearanceSave(UUID agentid); } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index c04bbb4c5a..28c0276a40 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1347,7 +1347,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}", // contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName); - if (containingFolder != null && containingFolder != null) + if (containingFolder != null) { // If the folder requested contains links, then we need to send those folders first, otherwise the links // will be broken in the viewer. @@ -1359,15 +1359,25 @@ namespace OpenSim.Region.Framework.Scenes InventoryItemBase linkedItem = InventoryService.GetItem(new InventoryItemBase(item.AssetID)); // Take care of genuinely broken links where the target doesn't exist - if (linkedItem != null) - linkedItemFolderIdsToSend.Add(linkedItem.Folder); + // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate, + // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles + // rather than having to keep track of every folder requested in the recursion. + if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link) + { + // We don't need to send the folder if source and destination of the link are in the same + // folder. + if (linkedItem.Folder != containingFolder.ID) + linkedItemFolderIdsToSend.Add(linkedItem.Folder); + } } } foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend) SendInventoryUpdate(client, new InventoryFolderBase(linkedItemFolderId), false, true); - client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, containingFolder.Version, fetchFolders, fetchItems); + client.SendInventoryFolderDetails( + client.AgentId, folder.ID, contents.Items, contents.Folders, + containingFolder.Version, fetchFolders, fetchItems); } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 1575e50fda..253adae92d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2706,8 +2706,10 @@ namespace OpenSim.Region.Framework.Scenes { string homeURL = string.Empty; string first = aCircuit.firstname, last = aCircuit.lastname; + if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); + if (aCircuit.lastname.StartsWith("@")) { string[] parts = aCircuit.firstname.Split('.'); @@ -2717,6 +2719,7 @@ namespace OpenSim.Region.Framework.Scenes last = parts[1]; } } + uMan.AddUser(aCircuit.AgentID, first, last, homeURL); } } @@ -3530,7 +3533,6 @@ namespace OpenSim.Region.Framework.Scenes } } - // In all cases, add or update the circuit data with the new agent circuit data and teleport flags agent.teleportFlags = teleportFlags; m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index e3744bd306..ff1d520bb3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -806,7 +806,8 @@ namespace OpenSim.Region.Framework.Scenes actor.Orientation = GetWorldRotation(); // Tell the physics engines that this prim changed. - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); + if (m_parentGroup.Scene != null) + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); } if (!m_parentGroup.m_dupeInProgress) @@ -1117,6 +1118,9 @@ namespace OpenSim.Region.Framework.Scenes { get { + if (IsAttachment) + return GroupPosition; + return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset); } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index af6f89c22b..d2f84e3ba4 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2251,10 +2251,9 @@ namespace OpenSim.Region.Framework.Scenes m_log.Warn("Sit requested on unknown object: " + targetID.ToString()); } - - SendSitResponse(remoteClient, targetID, offset, Quaternion.Identity); } + /* public void SitRayCastAvatarPosition(SceneObjectPart part) { @@ -2797,7 +2796,6 @@ namespace OpenSim.Region.Framework.Scenes /// public void SendTerseUpdateToClient(IClientAPI remoteClient) { - // If the client is inactive, it's getting its updates from another // server. if (remoteClient.IsActive) @@ -2912,7 +2910,7 @@ namespace OpenSim.Region.Framework.Scenes } // If we aren't using a cached appearance, then clear out the baked textures - if (! cachedappearance) + if (!cachedappearance) { m_appearance.ResetAppearance(); if (m_scene.AvatarFactory != null) diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs index 7304145c1b..77e7acf15e 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs @@ -113,7 +113,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance { bool bakedTextureValid = scene.AvatarFactory.ValidateBakedTextureCache(client); MainConsole.Instance.OutputFormat( - "{0} baked apperance texture is {1}", client.Name, bakedTextureValid ? "OK" : "corrupt"); + "{0} baked appearance texture is {1}", client.Name, bakedTextureValid ? "OK" : "corrupt"); } }); } diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index 4f1097e22f..4f86e422ef 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs @@ -417,9 +417,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice public string ParcelVoiceInfoRequest(Scene scene, string request, string path, string param, UUID agentID, Caps caps) { -// m_log.DebugFormat( -// "[FreeSwitchVoice][PARCELVOICE]: ParcelVoiceInfoRequest() on {0} for {1}", -// scene.RegionInfo.RegionName, agentID); + m_log.DebugFormat( + "[FreeSwitchVoice][PARCELVOICE]: ParcelVoiceInfoRequest() on {0} for {1}", + scene.RegionInfo.RegionName, agentID); ScenePresence avatar = scene.GetScenePresence(agentID); string avatarName = avatar.Name; diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs index 2bf8489df8..0800e98f0b 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs @@ -70,7 +70,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // if groups aren't enabled, we're not needed. // if we're not specified as the connector to use, then we're not wanted if ((groupsConfig.GetBoolean("Enabled", false) == false) - || (groupsConfig.GetString("MessagingModule", "Default") != Name)) + || (groupsConfig.GetString("MessagingModule", "GroupsMessagingModule") != Name)) { m_groupMessagingEnabled = false; return; diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs index 02751eafa7..42008dae43 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs @@ -200,7 +200,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // if groups aren't enabled, we're not needed. // if we're not specified as the connector to use, then we're not wanted if ((groupsConfig.GetBoolean("Enabled", false) == false) - || (groupsConfig.GetString("ServicesConnectorModule", "Default") != Name)) + || (groupsConfig.GetString("ServicesConnectorModule", "XmlRpcGroupsServicesConnector") != Name)) { m_connectorEnabled = false; return; diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 2631ac10d3..a08bcd0e8a 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -109,7 +109,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // if groups aren't enabled, we're not needed. // if we're not specified as the connector to use, then we're not wanted if ((groupsConfig.GetBoolean("Enabled", false) == false) - || (groupsConfig.GetString("ServicesConnectorModule", "Default") != Name)) + || (groupsConfig.GetString("ServicesConnectorModule", "XmlRpcGroupsServicesConnector") != Name)) { m_connectorEnabled = false; return; diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index eed64506ac..05c729a0d7 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs @@ -36,6 +36,7 @@ using log4net; using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; +using OpenSim.Services.Interfaces; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; @@ -175,6 +176,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady m_scene.EventManager.TriggerOnChatBroadcast(this, c); m_scene.EventManager.TriggerLoginsEnabled(m_scene.RegionInfo.RegionName); + m_scene.SceneGridService.InformNeighborsThatRegionisUp(m_scene.RequestModuleInterface(), m_scene.RegionInfo); } } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index c471636743..48d236fc58 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -25,10 +25,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; using System.Collections.Generic; +using System.Reflection; using System.Threading; -using OpenMetaverse; +using log4net; using Nini.Config; +using OpenMetaverse; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.CoreModules.Avatar.NPC; @@ -40,6 +43,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC { public class NPCModule : IRegionModule, INPCModule { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + // private const bool m_enabled = false; private Mutex m_createMutex; @@ -59,6 +64,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC private UUID p_cloneAppearanceFrom; private UUID p_returnUuid; + public void Initialise(Scene scene, IConfigSource source) + { + m_createMutex = new Mutex(false); + + m_timer = new Timer(500); + m_timer.Elapsed += m_timer_Elapsed; + m_timer.Start(); + + scene.RegisterModuleInterface(this); + } + private AvatarAppearance GetAppearance(UUID target, Scene scene) { if (m_appearanceCache.ContainsKey(target)) @@ -76,6 +92,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC public UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom) { + m_log.DebugFormat( + "[NPC MODULE]: Queueing request to create NPC {0} {1} at {2} in {3} cloning appearance of {4}", + firstname, lastname, position, scene.RegionInfo.RegionName, cloneAppearanceFrom); + // Block. m_createMutex.WaitOne(); @@ -137,46 +157,67 @@ namespace OpenSim.Region.OptionalModules.World.NPC } } - - public void Initialise(Scene scene, IConfigSource source) - { - m_createMutex = new Mutex(false); - - m_timer = new Timer(500); - m_timer.Elapsed += m_timer_Elapsed; - m_timer.Start(); - - scene.RegisterModuleInterface(this); - } - void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { - lock (p_lock) + try { - if (p_inUse) + lock (p_lock) { - p_inUse = false; - - NPCAvatar npcAvatar = new NPCAvatar(p_firstname, p_lastname, p_position, p_scene); - npcAvatar.CircuitCode = (uint) Util.RandomClass.Next(0, int.MaxValue); - - p_scene.AddNewClient(npcAvatar); - - ScenePresence sp; - if (p_scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) + if (p_inUse) { - AvatarAppearance x = GetAppearance(p_cloneAppearanceFrom, p_scene); + p_inUse = false; + + NPCAvatar npcAvatar = new NPCAvatar(p_firstname, p_lastname, p_position, p_scene); + npcAvatar.CircuitCode = (uint) Util.RandomClass.Next(0, int.MaxValue); + + m_log.DebugFormat( + "[NPC MODULE]: Creating NPC {0} {1} {2} at {3} in {4}", + p_firstname, p_lastname, npcAvatar.AgentId, p_position, p_scene.RegionInfo.RegionName); + + AgentCircuitData acd = new AgentCircuitData(); + acd.AgentID = npcAvatar.AgentId; + acd.firstname = p_firstname; + acd.lastname = p_lastname; + acd.ServiceURLs = new Dictionary(); + + AvatarAppearance originalAppearance = GetAppearance(p_cloneAppearanceFrom, p_scene); + AvatarAppearance npcAppearance = new AvatarAppearance(originalAppearance, true); + acd.Appearance = npcAppearance; + + p_scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd); + p_scene.AddNewClient(npcAvatar); + + ScenePresence sp; + if (p_scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) + { + m_log.DebugFormat( + "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID); + + // Shouldn't call this - temporary. + sp.CompleteMovement(npcAvatar); + + // sp.SendAppearanceToAllOtherAgents(); + // + // // Send animations back to the avatar as well + // sp.Animator.SendAnimPack(); + } + else + { + m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID); + } + + m_avatars.Add(npcAvatar.AgentId, npcAvatar); + + p_returnUuid = npcAvatar.AgentId; - sp.Appearance.SetTextureEntries(x.Texture); - sp.Appearance.SetVisualParams((byte[])x.VisualParams.Clone()); - sp.SendAppearanceToAllOtherAgents(); + m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", p_returnUuid); } - - m_avatars.Add(npcAvatar.AgentId, npcAvatar); - - p_returnUuid = npcAvatar.AgentId; } } + catch (Exception ex) + { + m_log.ErrorFormat("[NPC MODULE]: NPC creation failed with exception {0} {1}", ex.Message, ex.StackTrace); + } } public void PostInitialise() diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 39e1a27a94..2b8155fbd0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -977,7 +977,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public string osDrawPolygon(string drawList, LSL_List x, LSL_List y) { - CheckThreatLevel(ThreatLevel.None, "osDrawFilledPolygon"); + CheckThreatLevel(ThreatLevel.None, "osDrawPolygon"); m_host.AddScriptLPS(1); @@ -1248,7 +1248,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return String.Empty; } - public void osSetWindParam(string plugin, string param, float value) + public void osSetWindParam(string plugin, string param, LSL_Float value) { CheckThreatLevel(ThreatLevel.VeryLow, "osSetWindParam"); m_host.AddScriptLPS(1); @@ -1258,13 +1258,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { try { - module.WindParamSet(plugin, param, value); + module.WindParamSet(plugin, param, (float)value); } catch (Exception) { } } } - public float osGetWindParam(string plugin, string param) + public LSL_Float osGetWindParam(string plugin, string param) { CheckThreatLevel(ThreatLevel.VeryLow, "osGetWindParam"); m_host.AddScriptLPS(1); @@ -1416,7 +1416,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { // What actually is the difference to the LL function? // - CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL"); + CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelSIPAddress"); m_host.AddScriptLPS(1); @@ -2222,12 +2222,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return (int)pws; } - public void osSetSpeed(string UUID, float SpeedModifier) + public void osSetSpeed(string UUID, LSL_Float SpeedModifier) { CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); m_host.AddScriptLPS(1); ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); - avatar.SpeedModifier = SpeedModifier; + avatar.SpeedModifier = (float)SpeedModifier; } public void osKickAvatar(string FirstName,string SurName,string alert) @@ -2308,14 +2308,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams"); m_host.AddScriptLPS(1); + InitLSL(); return m_LSL_Api.GetLinkPrimitiveParamsEx(prim, rules); } public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) { - CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams"); + CheckThreatLevel(ThreatLevel.High, "osSetPrimitiveParams"); m_host.AddScriptLPS(1); + InitLSL(); m_LSL_Api.SetPrimitiveParamsEx(prim, rules); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index c08ad3b3f4..5a809e656d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -129,8 +129,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces // Wind Module Functions string osWindActiveModelPluginName(); - void osSetWindParam(string plugin, string param, float value); - float osGetWindParam(string plugin, string param); + void osSetWindParam(string plugin, string param, LSL_Float value); + LSL_Float osGetWindParam(string plugin, string param); // Parcel commands void osParcelJoin(vector pos1, vector pos2); @@ -180,7 +180,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces int osGetSimulatorMemory(); void osKickAvatar(string FirstName,string SurName,string alert); - void osSetSpeed(string UUID, float SpeedModifier); + void osSetSpeed(string UUID, LSL_Float SpeedModifier); void osCauseHealing(string avatar, double healing); void osCauseDamage(string avatar, double damage); LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index e3ea556e5e..7c59098a11 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -106,16 +106,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osWindActiveModelPluginName(); } -// Not yet plugged in as available OSSL functions, so commented out -// void osSetWindParam(string plugin, string param, float value) -// { -// m_OSSL_Functions.osSetWindParam(plugin, param, value); -// } -// -// float osGetWindParam(string plugin, string param) -// { -// return m_OSSL_Functions.osGetWindParam(plugin, param); -// } + public void osSetWindParam(string plugin, string param, LSL_Float value) + { + m_OSSL_Functions.osSetWindParam(plugin, param, value); + } + + public LSL_Float osGetWindParam(string plugin, string param) + { + return m_OSSL_Functions.osGetWindParam(plugin, param); + } public void osParcelJoin(vector pos1, vector pos2) { @@ -714,7 +713,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osKickAvatar(FirstName, SurName, alert); } - public void osSetSpeed(string UUID, float SpeedModifier) + public void osSetSpeed(string UUID, LSL_Float SpeedModifier) { m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier); } diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index 49d6abec07..734d4d5beb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs @@ -106,6 +106,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools // Get some config WriteScriptSourceToDebugFile = m_scriptEngine.Config.GetBoolean("WriteScriptSourceToDebugFile", false); CompileWithDebugInformation = m_scriptEngine.Config.GetBoolean("CompileWithDebugInformation", true); + bool DeleteScriptsOnStartup = m_scriptEngine.Config.GetBoolean("DeleteScriptsOnStartup", true); // Get file prefix from scriptengine name and make it file system safe: FilePrefix = "CommonCompiler"; @@ -114,11 +115,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools FilePrefix = FilePrefix.Replace(c, '_'); } - // First time we start? Delete old files if (in_startup) { in_startup = false; - DeleteOldFiles(); + CreateScriptsDirectory(); + + // First time we start? Delete old files + if (DeleteScriptsOnStartup) + DeleteOldFiles(); } // Map name and enum type of our supported languages @@ -187,11 +191,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools } /// - /// Delete old script files + /// Create the directory where compiled scripts are stored. /// - private void DeleteOldFiles() + private void CreateScriptsDirectory() { - // CREATE FOLDER IF IT DOESNT EXIST if (!Directory.Exists(ScriptEnginesPath)) { try @@ -218,7 +221,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools m_scriptEngine.World.RegionInfo.RegionID.ToString()) + "\": " + ex.ToString()); } } + } + /// + /// Delete old script files + /// + private void DeleteOldFiles() + { foreach (string file in Directory.GetFiles(Path.Combine(ScriptEnginesPath, m_scriptEngine.World.RegionInfo.RegionID.ToString()), FilePrefix + "_compiled*")) { diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 6d63748e87..186ca714bf 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -63,7 +63,7 @@ namespace OpenSim.Services.GridService protected GatekeeperServiceConnector m_GatekeeperConnector; protected UUID m_ScopeID = UUID.Zero; - protected bool m_Check4096 = true; +// protected bool m_Check4096 = true; protected string m_MapTileDirectory = string.Empty; protected string m_ThisGatekeeper = string.Empty; protected Uri m_ThisGatekeeperURI = null; @@ -121,7 +121,7 @@ namespace OpenSim.Services.GridService if (scope != string.Empty) UUID.TryParse(scope, out m_ScopeID); - m_Check4096 = gridConfig.GetBoolean("Check4096", true); +// m_Check4096 = gridConfig.GetBoolean("Check4096", true); m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); @@ -311,14 +311,18 @@ namespace OpenSim.Services.GridService return true; } - uint x, y; - if (m_Check4096 && !Check4096(handle, out x, out y)) - { - RemoveHyperlinkRegion(regInfo.RegionID); - reason = "Region is too far (" + x + ", " + y + ")"; - m_log.Info("[HYPERGRID LINKER]: Unable to link, region is too far (" + x + ", " + y + ")"); - return false; - } + // We are now performing this check for each individual teleport in the EntityTransferModule instead. This + // allows us to give better feedback when teleports fail because of the distance reason (which can't be + // done here) and it also hypergrid teleports that are within range (possibly because the source grid + // itself has regions that are very far apart). +// uint x, y; +// if (m_Check4096 && !Check4096(handle, out x, out y)) +// { +// //RemoveHyperlinkRegion(regInfo.RegionID); +// reason = "Region is too far (" + x + ", " + y + ")"; +// m_log.Info("[HYPERGRID LINKER]: Unable to link, region is too far (" + x + ", " + y + ")"); +// //return false; +// } regInfo.RegionID = regionID; @@ -369,60 +373,59 @@ namespace OpenSim.Services.GridService } } - /// - /// Cope with this viewer limitation. - /// - /// - /// - public bool Check4096(ulong realHandle, out uint x, out uint y) - { - uint ux = 0, uy = 0; - Utils.LongToUInts(realHandle, out ux, out uy); - x = ux / Constants.RegionSize; - y = uy / Constants.RegionSize; - - const uint limit = (4096 - 1) * Constants.RegionSize; - uint xmin = ux - limit; - uint xmax = ux + limit; - uint ymin = uy - limit; - uint ymax = uy + limit; - // World map boundary checks - if (xmin < 0 || xmin > ux) - xmin = 0; - if (xmax > int.MaxValue || xmax < ux) - xmax = int.MaxValue; - if (ymin < 0 || ymin > uy) - ymin = 0; - if (ymax > int.MaxValue || ymax < uy) - ymax = int.MaxValue; - - // Check for any regions that are within the possible teleport range to the linked region - List regions = m_GridService.GetRegionRange(m_ScopeID, (int)xmin, (int)xmax, (int)ymin, (int)ymax); - if (regions.Count == 0) - { - return false; - } - else - { - // Check for regions which are not linked regions - List hyperlinks = m_GridService.GetHyperlinks(m_ScopeID); - IEnumerable availableRegions = regions.Except(hyperlinks); - if (availableRegions.Count() == 0) - return false; - } - - return true; - } +// Not currently used +// /// +// /// Cope with this viewer limitation. +// /// +// /// +// /// +// public bool Check4096(ulong realHandle, out uint x, out uint y) +// { +// uint ux = 0, uy = 0; +// Utils.LongToUInts(realHandle, out ux, out uy); +// x = ux / Constants.RegionSize; +// y = uy / Constants.RegionSize; +// +// const uint limit = (4096 - 1) * Constants.RegionSize; +// uint xmin = ux - limit; +// uint xmax = ux + limit; +// uint ymin = uy - limit; +// uint ymax = uy + limit; +// // World map boundary checks +// if (xmin < 0 || xmin > ux) +// xmin = 0; +// if (xmax > int.MaxValue || xmax < ux) +// xmax = int.MaxValue; +// if (ymin < 0 || ymin > uy) +// ymin = 0; +// if (ymax > int.MaxValue || ymax < uy) +// ymax = int.MaxValue; +// +// // Check for any regions that are within the possible teleport range to the linked region +// List regions = m_GridService.GetRegionRange(m_ScopeID, (int)xmin, (int)xmax, (int)ymin, (int)ymax); +// if (regions.Count == 0) +// { +// return false; +// } +// else +// { +// // Check for regions which are not linked regions +// List hyperlinks = m_GridService.GetHyperlinks(m_ScopeID); +// IEnumerable availableRegions = regions.Except(hyperlinks); +// if (availableRegions.Count() == 0) +// return false; +// } +// +// return true; +// } 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; rdata.Data["flags"] = flags.ToString(); m_Database.Store(rdata); - } private void RemoveHyperlinkRegion(UUID regionID) diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index cbd6f35e10..dbf5ef4ded 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs @@ -83,9 +83,24 @@ namespace OpenSim.Services.UserAccountService "create user", "create user [ [ [ []]]]", "Create a new user", HandleCreateUser); - MainConsole.Instance.Commands.AddCommand("UserService", false, "reset user password", + + MainConsole.Instance.Commands.AddCommand("UserService", false, + "reset user password", "reset user password [ [ []]]", "Reset a user password", HandleResetUserPassword); + + MainConsole.Instance.Commands.AddCommand("UserService", false, + "set user level", + "set user level [ [ []]]", + "Set user level. If >= 200 and 'allow_grid_gods = true' in OpenSim.ini, " + + "this account will be treated as god-moded. " + + "It will also affect the 'login level' command. ", + HandleSetUserLevel); + + MainConsole.Instance.Commands.AddCommand("UserService", false, + "show account", + "show account ", + "Show account details for the given user", HandleShowAccount); } } @@ -337,6 +352,36 @@ namespace OpenSim.Services.UserAccountService CreateUser(firstName, lastName, password, email); } + protected void HandleShowAccount(string module, string[] cmdparams) + { + if (cmdparams.Length != 4) + { + MainConsole.Instance.Output("Usage: show account "); + return; + } + + string firstName = cmdparams[2]; + string lastName = cmdparams[3]; + + UserAccount ua = GetUserAccount(UUID.Zero, firstName, lastName); + + if (ua == null) + { + MainConsole.Instance.OutputFormat("No user named {0} {1}", firstName, lastName); + return; + } + + MainConsole.Instance.OutputFormat("Name: {0}", ua.Name); + MainConsole.Instance.OutputFormat("ID: {0}", ua.PrincipalID); + MainConsole.Instance.OutputFormat("Title: {0}", ua.UserTitle); + MainConsole.Instance.OutputFormat("E-mail: {0}", ua.Email); + MainConsole.Instance.OutputFormat("Created: {0}", Utils.UnixTimeToDateTime(ua.Created)); + MainConsole.Instance.OutputFormat("Level: {0}", ua.UserLevel); + MainConsole.Instance.OutputFormat("Flags: {0}", ua.UserFlags); + foreach (KeyValuePair kvp in ua.ServiceURLs) + MainConsole.Instance.OutputFormat("{0}: {1}", kvp.Key, kvp.Value); + } + protected void HandleResetUserPassword(string module, string[] cmdparams) { string firstName; @@ -357,16 +402,58 @@ namespace OpenSim.Services.UserAccountService UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); if (account == null) - m_log.ErrorFormat("[USER ACCOUNT SERVICE]: No such user"); + { + MainConsole.Instance.OutputFormat("No such user as {0} {1}", firstName, lastName); + return; + } bool success = false; if (m_AuthenticationService != null) success = m_AuthenticationService.SetPassword(account.PrincipalID, newPassword); + if (!success) - m_log.ErrorFormat("[USER ACCOUNT SERVICE]: Unable to reset password for account {0} {1}.", - firstName, lastName); + MainConsole.Instance.OutputFormat("Unable to reset password for account {0} {1}.", firstName, lastName); else - m_log.InfoFormat("[USER ACCOUNT SERVICE]: Password reset for user {0} {1}", firstName, lastName); + MainConsole.Instance.OutputFormat("Password reset for user {0} {1}", firstName, lastName); + } + + protected void HandleSetUserLevel(string module, string[] cmdparams) + { + string firstName; + string lastName; + string rawLevel; + int level; + + if (cmdparams.Length < 4) + firstName = MainConsole.Instance.CmdPrompt("First name"); + else firstName = cmdparams[3]; + + if (cmdparams.Length < 5) + lastName = MainConsole.Instance.CmdPrompt("Last name"); + else lastName = cmdparams[4]; + + UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); + if (account == null) { + MainConsole.Instance.OutputFormat("No such user"); + return; + } + + if (cmdparams.Length < 6) + rawLevel = MainConsole.Instance.CmdPrompt("User level"); + else rawLevel = cmdparams[5]; + + if(int.TryParse(rawLevel, out level) == false) { + MainConsole.Instance.OutputFormat("Invalid user level"); + return; + } + + account.UserLevel = level; + + bool success = StoreUserAccount(account); + if (!success) + MainConsole.Instance.OutputFormat("Unable to set user level for account {0} {1}.", firstName, lastName); + else + MainConsole.Instance.OutputFormat("User level set for user {0} {1} to {2}", firstName, lastName, level); } #endregion diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index bab118fd63..98bb355d7a 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -443,8 +443,8 @@ ;; to ConfigurableWind and uncomment the following. ; avg_strength = 5.0 ; avg_direction = 0.0 - ; var_strength = 0.0 - ; var_direction = 0.0 + ; var_strength = 5.0 + ; var_direction = 30.0 ; rate_change = 1.0 ;# {strength} {enabled:true wind_plugin:SimpleRandomWind} {Wind strength?} {} 1.0 diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 860e7583e7..fd39fe62e6 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -504,6 +504,10 @@ ; Distance in meters that shouts should travel. Default is 100m shout_distance = 100 +[EntityTransfer] + ; The maximum distance in regions that an agent is allowed to teleport along the x or y axis + ; This is set to 4095 because current viewers can't handle teleports that are greater than this distance + max_distance = 4095 [Messaging] ; Control which region module is used for instant messaging. @@ -855,11 +859,6 @@ ;exclude_list=User 1,User 2,User 3 -[CMS] - enabled = false - ;channel = 345 - - ; The following settings control the progression of daytime ; in the Sim. The defaults are the same as the commented out settings [Sun] @@ -1120,6 +1119,12 @@ ;; Path to script assemblies ; ScriptEnginesPath = "ScriptEngines" + ; Whether to delete previously compiled scripts when the sim starts. If you disable this + ; then startup will be faster. However, then it becomes your responsibility to delete the + ; compiled scripts if OpenSim has changed enough that previously compiled scripts are no + ; longer compatible. + DeleteScriptsOnStartup = true + [OpenGridProtocol] ;These are the settings for the Open Grid Protocol.. the Agent Domain, Region Domain, you know.. diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index cbe3fa0aef..ee0523f91a 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example @@ -63,9 +63,6 @@ ;;--- For MySql region storage (alternative) ;StorageProvider = "OpenSim.Data.MySQL.dll:MySqlRegionData" - ;; With hypergrid, perform distance check for the creation of a linked region - ; Check4096 = true - ;; Directory for map tile images of remote regions ; MapTileDirectory = "./maptiles"