From de20f0603fa419ba16c56d16c2ad55301cad8b83 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 24 Jun 2011 19:49:05 +0100 Subject: [PATCH 01/20] Tell hypergridders when their teleports fail because of the 4096 limit rather than just saying "destination not found" Instead of performing the 4096 check when the region is linked (and subsequently removing the link), leave the link in place and perform the check in the entity transfer module This allows us to explicitly tell the hypergridder why the teleport failed (region out of range). It also allows people on regions that are within range (on a large source grid) to teleport. The Check4096 config parameter in the [GridService] section is replaced by a max_distance paramter in a new [EntityTransfer] section in OpenSimDefaults.ini Since the parameter is in OpenSimDefaults.ini no action needs to be taken unless you want to increase this limit. It could also be decreased. The check is being made in the base entity transfer module, since I believe the viewer problem occurs both on extremely large grids and while hypergridding. --- .../EntityTransfer/EntityTransferModule.cs | 52 ++++++-- .../EntityTransfer/HGEntityTransferModule.cs | 6 +- .../World/WorldMap/MapSearchModule.cs | 4 +- .../FreeSwitchVoice/FreeSwitchVoiceModule.cs | 8 +- .../Services/GridService/HypergridLinker.cs | 115 +++++++++--------- bin/OpenSimDefaults.ini | 4 + .../StandaloneCommon.ini.example | 3 - 7 files changed, 117 insertions(+), 75 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 1341533167..d54216a8fe 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 @@ -204,8 +220,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 && @@ -216,6 +242,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 4d77ef478d..a87279aed9 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/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 00959b04c4..2e3b21fac4 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 3 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. Flags={2}", mapName, regionInfos.Count, flags); diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index 42efd67d53..a5bba4f136 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; @@ -885,4 +885,4 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice #endregion } -} \ No newline at end of file +} diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 52625980cc..83ec1229ac 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"); @@ -347,14 +347,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; @@ -405,60 +409,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/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index fa5392dc42..7321cad5a7 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. 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" From 37a7c167343d90b4fb13cd4b8254801489794410 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 24 Jun 2011 21:01:48 +0100 Subject: [PATCH 02/20] minor: method documentation --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 95713e9b87..d52ebda1d4 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -439,7 +439,7 @@ namespace OpenSim.Region.ClientStack.Linden } /// - /// + /// Convert raw uploaded data into the appropriate asset and item. /// /// /// @@ -506,8 +506,6 @@ namespace OpenSim.Region.ClientStack.Linden } } - - /// /// /// @@ -632,7 +630,7 @@ namespace OpenSim.Region.ClientStack.Linden } /// - /// + /// Handle raw asset upload data via the capability. /// /// /// @@ -670,6 +668,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 +678,7 @@ namespace OpenSim.Region.ClientStack.Linden // bw.Close(); // fs.Close(); //} + private static void SaveAssetToFile(string filename, byte[] data) { string assetPath = "UserAssets"; @@ -719,7 +719,7 @@ namespace OpenSim.Region.ClientStack.Linden } /// - /// + /// Handle raw uploaded asset data. /// /// /// @@ -752,6 +752,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 +762,7 @@ namespace OpenSim.Region.ClientStack.Linden // bw.Close(); // fs.Close(); //} + private static void SaveAssetToFile(string filename, byte[] data) { string assetPath = "UserAssets"; @@ -905,7 +907,7 @@ namespace OpenSim.Region.ClientStack.Linden } /// - /// + /// Handle raw uploaded baked texture data. /// /// /// From 75199a0d2cc3280f3ede74ad85c773527354187d Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 24 Jun 2011 16:20:13 -0400 Subject: [PATCH 03/20] RegionReady Module: Add notification to neighbors when logins are enabled. --- .../Scripting/RegionReadyModule/RegionReadyModule.cs | 2 ++ 1 file changed, 2 insertions(+) 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); } } From 1a0a9d229013ff7abba17ccd95159ca7d4b47e9f Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 24 Jun 2011 21:54:01 +0100 Subject: [PATCH 04/20] Implement the latest mesh mechanism so that rezzing the uploaded mesh now works again. Many thanks to the aurora project for pioneering this. This code is almost certainly not bug free, but it does at least appear to handle simple meshes (except when the viewer crashes - but it is beta!). --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 192 +++++++++++++++++- .../Framework/Scenes/SceneObjectPart.cs | 9 +- 2 files changed, 195 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index d52ebda1d4..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) @@ -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()); @@ -841,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); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c6d8c73015..f3879f0bc1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -800,7 +800,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); } } } @@ -1085,11 +1086,13 @@ namespace OpenSim.Region.Framework.Scenes public Vector3 AbsolutePosition { - get { + get + { if (IsAttachment) return GroupPosition; - return m_offsetPosition + m_groupPosition; } + return m_offsetPosition + m_groupPosition; + } } public SceneObjectGroup ParentGroup From 0dd3281caf09090e86036d67a34939b0e31c1b16 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Tue, 21 Jun 2011 12:43:44 +0300 Subject: [PATCH 05/20] Optionally, don't delete previously compiled scripts on startup --- .../ScriptEngine/Shared/CodeTools/Compiler.cs | 19 ++++++++++++++----- bin/OpenSimDefaults.ini | 6 ++++++ 2 files changed, 20 insertions(+), 5 deletions(-) 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/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 7321cad5a7..db4836ab6d 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -1124,6 +1124,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.. From 7545692f32a6d5326c008464dda1bd3b0ebd5a08 Mon Sep 17 00:00:00 2001 From: Makopoppo Date: Mon, 13 Jun 2011 22:09:03 +0900 Subject: [PATCH 06/20] Changed actual default values of 'ServiceConnectorModule' and 'MessagingModule' in [Groups] section in accordance with OpenSim.ini.example descriptions --- .../Avatar/XmlRpcGroups/GroupsMessagingModule.cs | 2 +- .../Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs | 2 +- .../Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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; From 56dcc5109486e6ef721f065135b8c87c3501d8e2 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 24 Jun 2011 23:54:37 +0100 Subject: [PATCH 07/20] Add a command "show account " to the user account service that will show the given user details --- .../UserAccountService/UserAccountService.cs | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index f376cf825b..3525912842 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs @@ -83,9 +83,16 @@ 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, + "show account", + "show account ", + "Show account details for the given user", HandleShowAccount); } } @@ -318,6 +325,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; From 296774495b8544cbb3463e0a0694d7de910a5d7c Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 25 Jun 2011 00:03:34 +0100 Subject: [PATCH 08/20] Implement "set user level" console command to set the user level (which determines whether a user has a god account) Adapted from Makopoppo's patch in http://opensimulator.org/mantis/view.php?id=5552. Thanks! --- .../UserAccountService/UserAccountService.cs | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index 3525912842..a65c04b3fd 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs @@ -89,6 +89,14 @@ namespace OpenSim.Services.UserAccountService "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 ", @@ -387,6 +395,45 @@ namespace OpenSim.Services.UserAccountService m_log.InfoFormat("[USER ACCOUNT SERVICE]: 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 /// From 5daac0584aed1a6764060b6c6a0a1f74360859f1 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 25 Jun 2011 00:08:14 +0100 Subject: [PATCH 09/20] Fix bug in reset user password where entering an invalid name would cause an exception. Also, convert this commands log output to console output. Console output is more appropriate for console commands. The log only gets one side of the conversation anyway (since it doesn't necessarily record command inputs). --- .../Services/UserAccountService/UserAccountService.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index a65c04b3fd..8b8a8f9fe8 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs @@ -383,16 +383,19 @@ 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) From 698cd0b3c2b9827cfbb83df5c587b7740238a2bb Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 25 Jun 2011 01:33:09 +0100 Subject: [PATCH 10/20] Remove the now unused [cms] section from OpenSimDefaults.ini --- bin/OpenSimDefaults.ini | 5 ----- 1 file changed, 5 deletions(-) diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index db4836ab6d..57db852bfd 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -859,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] From 36e205476073d1b93b8adf37ab995410f8664273 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 27 Jun 2011 23:12:54 +0100 Subject: [PATCH 11/20] minor: temporarily comment out the local status notify friends messages seen on login/logout, since it's a bit noisy on the console. Please uncomment if/when this is still needed. --- OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index daee4ca3fc..3a7178c33a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -830,7 +830,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends public bool LocalStatusNotification(UUID userID, UUID friendID, bool online) { - m_log.DebugFormat("[FRIENDS]: Local Status Notify {0} that user {1} is {2}", friendID, userID, online); +// m_log.DebugFormat("[FRIENDS]: Local Status Notify {0} that user {1} is {2}", friendID, userID, online); IClientAPI friendClient = LocateClientObject(friendID); if (friendClient != null) { From e11c959400380ff7ef05e972ed6f730efa7a6f48 Mon Sep 17 00:00:00 2001 From: Makopoppo Date: Mon, 27 Jun 2011 22:28:33 +0900 Subject: [PATCH 12/20] [PATCH] Changed Wind parameters default value in OpenSim.ini.example according to implementation Signed-off-by: BlueWall --- bin/OpenSim.ini.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From 882d5c82b308a95c4897893d2b8e6b816f827d31 Mon Sep 17 00:00:00 2001 From: Makopoppo Date: Fri, 24 Jun 2011 19:40:21 +0900 Subject: [PATCH 13/20] [PATCH 1/2] Fixed the function names of some OSSL functions shown as threat-level check error message Signed-off-by: BlueWall --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 64931d06c5..201fef470b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -970,7 +970,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); @@ -1409,7 +1409,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); @@ -2301,7 +2301,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) { - CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams"); + CheckThreatLevel(ThreatLevel.High, "osSetPrimitiveParams"); m_host.AddScriptLPS(1); m_LSL_Api.SetPrimitiveParamsEx(prim, rules); From ffa790d69d4e9b1b50470f84b0ad198098dc2736 Mon Sep 17 00:00:00 2001 From: Makopoppo Date: Mon, 27 Jun 2011 19:30:42 +0900 Subject: [PATCH 14/20] [PATCH] Get osGetWindParam() and osSetWindParam() accessible Signed-off-by: BlueWall --- .../Shared/Api/Implementation/OSSL_Api.cs | 6 +++--- .../Shared/Api/Interface/IOSSL_Api.cs | 4 ++-- .../Shared/Api/Runtime/OSSL_Stub.cs | 19 +++++++++---------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 201fef470b..f32ecca01d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1241,7 +1241,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); @@ -1251,13 +1251,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); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 63007c64f8..7227b40a1b 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); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index e3ea556e5e..f5bdc6816a 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) { From 80010f89085af9517e26af01dfe7cbc99788aa31 Mon Sep 17 00:00:00 2001 From: Makopoppo Date: Tue, 28 Jun 2011 22:21:53 +0900 Subject: [PATCH 15/20] [PATCH] osSetSpeed() will accept float number Signed-off-by: BlueWall --- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 ++-- OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 2 +- OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index f32ecca01d..b098f09af4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2209,12 +2209,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) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 7227b40a1b..19352f0166 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -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 f5bdc6816a..7c59098a11 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -713,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); } From ee92f22f2ab9a1f2926ac3a9d4e1b9c26945d898 Mon Sep 17 00:00:00 2001 From: Makopoppo Date: Sat, 25 Jun 2011 11:13:55 +0900 Subject: [PATCH 16/20] [PATCH 2/2] [FIX] osGetPrimitiveParams() and osSetPrimitiveParams() crashes throwing System.NullReferenceException Signed-off-by: BlueWall --- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index b098f09af4..963727ded8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2295,6 +2295,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams"); m_host.AddScriptLPS(1); + InitLSL(); return m_LSL_Api.GetLinkPrimitiveParamsEx(prim, rules); } @@ -2303,6 +2304,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { CheckThreatLevel(ThreatLevel.High, "osSetPrimitiveParams"); m_host.AddScriptLPS(1); + InitLSL(); m_LSL_Api.SetPrimitiveParamsEx(prim, rules); } From 22f25fae387a801e8545f6ab6e2c9700926ae6e4 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 29 Jun 2011 00:28:22 +0100 Subject: [PATCH 17/20] Hack around with the NPC module to get osNpcCreate() partially working again. This now creates an avatar but appearance is always cloudy. Move doesn't work. Really, creating an NPC should only involve a ScenePresence rather than doing anything with IClientAPI, since an NPC has no viewer to communicate with! --- .../AvatarFactory/AvatarFactoryModule.cs | 4 +- .../UserManagement/UserManagementModule.cs | 3 +- .../Framework/Interfaces/IAvatarFactory.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 4 +- .../Region/Framework/Scenes/ScenePresence.cs | 6 +- .../Avatar/Appearance/AppearanceInfoModule.cs | 2 +- .../OptionalModules/World/NPC/NPCModule.cs | 105 ++++++++++++------ 7 files changed, 84 insertions(+), 42 deletions(-) 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/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index accd09443c..a4861ec0d5 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/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.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index bdf3d1dcd8..ad41e88db5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2593,8 +2593,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('.'); @@ -2604,6 +2606,7 @@ namespace OpenSim.Region.Framework.Scenes last = parts[1]; } } + uMan.AddUser(aCircuit.AgentID, first, last, homeURL); } } @@ -3389,7 +3392,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/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 80aafd0733..83b761c7a2 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1944,10 +1944,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) { @@ -2380,7 +2379,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) @@ -2495,7 +2493,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/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() From 3f0b8db0c18afaa44fa2f6b453d60bec34a3cd98 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 29 Jun 2011 00:54:31 +0100 Subject: [PATCH 18/20] If an inventory link target is in the same folder as the source, then don't recursively request that folder. Currently, this should never actually happen but certainly best to handle this case --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index f37f94ad32..8453d35e2c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1341,7 +1341,12 @@ namespace OpenSim.Region.Framework.Scenes // Take care of genuinely broken links where the target doesn't exist if (linkedItem != null) - linkedItemFolderIdsToSend.Add(linkedItem.Folder); + { + // 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); + } } } From 1b4c08730e068a6554befda6af728eeeea174830 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 29 Jun 2011 00:56:35 +0100 Subject: [PATCH 19/20] refactor: simplify redundant double containing folder check --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 8453d35e2c..07507b2e63 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1328,7 +1328,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. @@ -1353,7 +1353,9 @@ namespace OpenSim.Region.Framework.Scenes 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); } } From c84a1bd99f5f37e371135d7c3a7121841c778864 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 29 Jun 2011 01:33:41 +0100 Subject: [PATCH 20/20] Don't follow inventory links of links. This is to avoid problems with corrupt inventories where an inventory link target points back at the source's folder No viewer has been observed to set these up as of yet. If this ever happens, we will need a more sophisticated solution to track sent folders within the recursion --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 07507b2e63..13085e3838 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1340,7 +1340,10 @@ 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) + // 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.