From 6dcc4ab466134008c28f82d85cc4dabec984dd10 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 8 Feb 2010 22:50:59 +0000 Subject: [PATCH 01/10] Add license header and change branded namespace to generic --- .../Tools/Configger/ConfigurationLoader.cs | 29 ++++++++++++++++++- OpenSim/Tools/Configger/Main.cs | 29 ++++++++++++++++++- OpenSim/Tools/Configger/Util.cs | 29 ++++++++++++++++++- 3 files changed, 84 insertions(+), 3 deletions(-) diff --git a/OpenSim/Tools/Configger/ConfigurationLoader.cs b/OpenSim/Tools/Configger/ConfigurationLoader.cs index 49af4172a8..1619a22fe3 100644 --- a/OpenSim/Tools/Configger/ConfigurationLoader.cs +++ b/OpenSim/Tools/Configger/ConfigurationLoader.cs @@ -1,3 +1,30 @@ +/* + * 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.Generic; using System.IO; @@ -7,7 +34,7 @@ using System.Xml; using log4net; using Nini.Config; -namespace Careminster +namespace OpenSim.Tools.Configger { /// /// Loads the Configuration files into nIni diff --git a/OpenSim/Tools/Configger/Main.cs b/OpenSim/Tools/Configger/Main.cs index 192cfcea5b..61a12e32a5 100644 --- a/OpenSim/Tools/Configger/Main.cs +++ b/OpenSim/Tools/Configger/Main.cs @@ -1,7 +1,34 @@ +/* + * 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 Nini.Config; using System; -namespace Careminster +namespace OpenSim.Tools.Configger { public class Configger { diff --git a/OpenSim/Tools/Configger/Util.cs b/OpenSim/Tools/Configger/Util.cs index 6f8aa76411..fe7744d0b6 100644 --- a/OpenSim/Tools/Configger/Util.cs +++ b/OpenSim/Tools/Configger/Util.cs @@ -1,3 +1,30 @@ +/* + * 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; @@ -13,7 +40,7 @@ using System.Threading; using log4net; using Nini.Config; -namespace Careminster +namespace OpenSim.Tools.Configger { public static class Util { From 1d4d6c821adec37060341e62010973b860cc900a Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 9 Feb 2010 20:25:24 +0000 Subject: [PATCH 02/10] Add missing refernce to prebuild (backport from presence-refactor) --- prebuild.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/prebuild.xml b/prebuild.xml index ac4400dc68..8761a150a5 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -2900,6 +2900,7 @@ ../../../bin/ + From 802a969267da9ed2780ea66c736c3d531e336dfa Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 12 Feb 2010 21:32:03 +0000 Subject: [PATCH 03/10] Fix http://opensimulator.org/mantis/view.php?id=4224 This resolves the problem where eyes and hair would turn white on standalone configurations When a client receives body part information, for some insane reason or other it always ends up uploading this back to the server and then immediately re-requesting it. This should have been okay since we stored that asset in cache. However, the standalone asset service connector was not checking this cache properly, so every time the client made the request for the asset it has just loaded it would get a big fat null back in the face, causing it to make clothes and hair white. This bug did not affect grids since they use a different service connector. --- OpenSim/Data/MySQL/MySQLUserData.cs | 5 -- OpenSim/Framework/AvatarAppearance.cs | 16 ++----- .../Communications/UserManagerBase.cs | 3 +- .../ClientStack/LindenUDP/LLClientView.cs | 6 +-- .../AssetTransactionModule.cs | 8 +++- .../AssetTransaction/AssetXferUploader.cs | 3 +- .../CoreModules/Asset/CenomeAssetCache.cs | 27 ++++++----- .../Asset/LocalAssetServiceConnector.cs | 48 +++++++++++-------- .../LocalInventoryServiceConnector.cs | 25 ++++++---- OpenSim/Region/Framework/Scenes/Scene.cs | 1 - .../Region/Framework/Scenes/ScenePresence.cs | 2 + OpenSim/Services/AssetService/AssetService.cs | 8 ++-- .../Connectors/Asset/AssetServiceConnector.cs | 2 +- 13 files changed, 82 insertions(+), 72 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs index 2cf88b876e..0a9d2e3fd8 100644 --- a/OpenSim/Data/MySQL/MySQLUserData.cs +++ b/OpenSim/Data/MySQL/MySQLUserData.cs @@ -622,11 +622,6 @@ namespace OpenSim.Data.MySQL return false; } - /// - /// Appearance - /// TODO: stubs for now to get us to a compiling state gently - /// override - /// public override AvatarAppearance GetUserAppearance(UUID user) { try diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 56fcc150aa..a3ea499357 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -69,9 +69,7 @@ namespace OpenSim.Framework private static UUID HAIR_ASSET = new UUID("d342e6c0-b9d2-11dc-95ff-0800200c9a66"); private static UUID HAIR_ITEM = new UUID("d342e6c1-b9d2-11dc-95ff-0800200c9a66"); - public readonly static int VISUALPARAM_COUNT = 218; - - + public readonly static int VISUALPARAM_COUNT = 218; protected UUID m_owner; @@ -346,11 +344,7 @@ namespace OpenSim.Framework } */ - - public AvatarAppearance() - : this(UUID.Zero) - { - } + public AvatarAppearance() : this(UUID.Zero) {} public AvatarAppearance(UUID owner) { @@ -367,10 +361,8 @@ namespace OpenSim.Framework // This sets Visual Params with *less* weirder values then default. Instead of a ugly alien, it looks like a fat scientist SetDefaultParams(m_visualparams); SetDefaultWearables(); - m_texture = GetDefaultTexture(); - + m_texture = GetDefaultTexture(); } - public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, byte[] visualParams) { @@ -1481,4 +1473,4 @@ namespace OpenSim.Framework SKIRT_SKIRT_BLUE = 217 } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 4f0af0664d..02be1416c0 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -785,7 +785,8 @@ namespace OpenSim.Framework.Communications } catch (Exception e) { - m_log.ErrorFormat("[USERSTORAGE]: Unable to find user appearance {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString()); + m_log.ErrorFormat( + "[USERSTORAGE]: Unable to find user appearance {0} via {1} ({2})", user, plugin.Name, e); } } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 6dc6f011fd..e38232ca4a 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3301,9 +3301,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP awb.ItemID = wearables[i].ItemID; aw.WearableData[i] = awb; - // m_log.DebugFormat( - // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", - // awb.ItemID, awb.AssetID, i, Name); +// m_log.DebugFormat( +// "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", +// awb.ItemID, awb.AssetID, i, Name); } OutPacket(aw, ThrottleOutPacketType.Task); diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs index 1077f4a22f..7e08ecf688 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs @@ -27,6 +27,8 @@ using System; using System.Collections.Generic; +using System.Reflection; +using log4net; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -37,6 +39,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction { public class AssetTransactionModule : IRegionModule, IAgentAssetTransactions { +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private readonly Dictionary RegisteredScenes = new Dictionary(); private bool m_dumpAssetsToFile = false; private Scene m_scene = null; @@ -226,7 +230,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction public void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type, byte[] data, bool storeLocal, bool tempFile) { - //m_log.Debug("HandleUDPUploadRequest - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile); +// m_log.Debug("HandleUDPUploadRequest - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile); + if (((AssetType)type == AssetType.Texture || (AssetType)type == AssetType.Sound || (AssetType)type == AssetType.TextureTGA || @@ -246,7 +251,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction } } - //m_log.Debug("asset upload of " + assetID); AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); AssetXferUploader uploader = transactions.RequestXferUploader(transaction); diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs index f698ea13c7..fa92fe8b3a 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs @@ -154,7 +154,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction m_userTransactions.Manager.MyScene.AssetService.Store(m_asset); } - m_log.DebugFormat("[ASSET TRANSACTIONS]: Uploaded asset data for transaction {0}", TransactionID); + m_log.DebugFormat( + "[ASSET TRANSACTIONS]: Uploaded asset {0} for transaction {1}", m_asset.FullID, TransactionID); if (m_dumpAssetToFile) { diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs index 1add0ab1be..1903eb9887 100644 --- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs @@ -91,6 +91,8 @@ namespace OpenSim.Region.CoreModules.Asset /// public class CenomeMemoryAssetCache : IImprovedAssetCache, ISharedRegionModule { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// /// Cache's default maximal asset count. /// @@ -115,12 +117,7 @@ namespace OpenSim.Region.CoreModules.Asset /// Asset's default expiration time in the cache. /// public static readonly TimeSpan DefaultExpirationTime = TimeSpan.FromMinutes(30.0); - - /// - /// Log manager instance. - /// - private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + /// /// Cache object. /// @@ -170,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Asset { if (maximalSize <= 0 || maximalCount <= 0) { - //Log.Debug("[ASSET CACHE]: Cenome asset cache is not enabled."); + //m_log.Debug("[ASSET CACHE]: Cenome asset cache is not enabled."); m_enabled = false; return; } @@ -186,7 +183,7 @@ namespace OpenSim.Region.CoreModules.Asset CnmSynchronizedCache.Synchronized(new CnmMemoryCache( maximalSize, maximalCount, expirationTime)); m_enabled = true; - Log.DebugFormat( + m_log.DebugFormat( "[ASSET CACHE]: Cenome asset cache enabled (MaxSize = {0} bytes, MaxCount = {1}, ExpirationTime = {2})", maximalSize, maximalCount, @@ -205,6 +202,8 @@ namespace OpenSim.Region.CoreModules.Asset { if (asset != null) { +// m_log.DebugFormat("[CENOME ASSET CACHE]: Caching asset {0}", asset.ID); + long size = asset.Data != null ? asset.Data.Length : 1; m_cache.Set(asset.ID, asset, size); m_cachedCount++; @@ -255,7 +254,7 @@ namespace OpenSim.Region.CoreModules.Asset if (m_getCount == m_debugEpoch) { - Log.DebugFormat( + m_log.DebugFormat( "[ASSET CACHE]: Cached = {0}, Get = {1}, Hits = {2}%, Size = {3} bytes, Avg. A. Size = {4} bytes", m_cachedCount, m_getCount, @@ -267,6 +266,9 @@ namespace OpenSim.Region.CoreModules.Asset m_cachedCount = 0; } +// if (null == assetBase) +// m_log.DebugFormat("[CENOME ASSET CACHE]: Asset {0} not in cache", id); + return assetBase; } @@ -325,12 +327,11 @@ namespace OpenSim.Region.CoreModules.Asset return; string name = moduleConfig.GetString("AssetCaching"); - //Log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name); + //m_log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name); if (name != Name) - return; - - // This module is used + return; + long maxSize = DefaultMaxSize; int maxCount = DefaultMaxCount; TimeSpan expirationTime = DefaultExpirationTime; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index fd3aaf4fd1..2f21e6dfdd 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs @@ -38,12 +38,9 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset { - public class LocalAssetServicesConnector : - ISharedRegionModule, IAssetService + public class LocalAssetServicesConnector : ISharedRegionModule, IAssetService { - private static readonly ILog m_log = - LogManager.GetLogger( - MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IImprovedAssetCache m_Cache = null; @@ -72,7 +69,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset IConfig assetConfig = source.Configs["AssetService"]; if (assetConfig == null) { - m_log.Error("[ASSET CONNECTOR]: AssetService missing from OpenSim.ini"); + m_log.Error("[LOCAL ASSET SERVICES CONNECTOR]: AssetService missing from OpenSim.ini"); return; } @@ -81,22 +78,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset if (serviceDll == String.Empty) { - m_log.Error("[ASSET CONNECTOR]: No LocalServiceModule named in section AssetService"); + m_log.Error("[LOCAL ASSET SERVICES CONNECTOR]: No LocalServiceModule named in section AssetService"); return; } Object[] args = new Object[] { source }; - m_AssetService = - ServerUtils.LoadPlugin(serviceDll, - args); + m_AssetService = ServerUtils.LoadPlugin(serviceDll, args); if (m_AssetService == null) { - m_log.Error("[ASSET CONNECTOR]: Can't load asset service"); + m_log.Error("[LOCAL ASSET SERVICES CONNECTOR]: Can't load asset service"); return; } m_Enabled = true; - m_log.Info("[ASSET CONNECTOR]: Local asset connector enabled"); + m_log.Info("[LOCAL ASSET SERVICES CONNECTOR]: Local asset connector enabled"); } } } @@ -134,11 +129,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset m_Cache = null; } - m_log.InfoFormat("[ASSET CONNECTOR]: Enabled local assets for region {0}", scene.RegionInfo.RegionName); + m_log.InfoFormat("[LOCAL ASSET SERVICES CONNECTOR]: Enabled local assets for region {0}", scene.RegionInfo.RegionName); if (m_Cache != null) { - m_log.InfoFormat("[ASSET CONNECTOR]: Enabled asset caching for region {0}", scene.RegionInfo.RegionName); + m_log.InfoFormat("[LOCAL ASSET SERVICES CONNECTOR]: Enabled asset caching for region {0}", scene.RegionInfo.RegionName); } else { @@ -151,6 +146,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset public AssetBase Get(string id) { +// m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Synchronously requesting asset {0}", id); + AssetBase asset = null; if (m_Cache != null) asset = m_Cache.Get(id); @@ -160,7 +157,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset asset = m_AssetService.Get(id); if ((m_Cache != null) && (asset != null)) m_Cache.Cache(asset); + +// if (null == asset) +// m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not synchronously find asset with id {0}", id); } + return asset; } @@ -204,15 +205,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset public bool Get(string id, Object sender, AssetRetrieved handler) { - AssetBase asset = null; - +// m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Asynchronously requesting asset {0}", id); + if (m_Cache != null) - m_Cache.Get(id); - - if (asset != null) { - Util.FireAndForget(delegate { handler(id, sender, asset); }); - return true; + AssetBase asset = m_Cache.Get(id); + + if (asset != null) + { + Util.FireAndForget(delegate { handler(id, sender, asset); }); + return true; + } } return m_AssetService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) @@ -220,6 +223,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset if ((a != null) && (m_Cache != null)) m_Cache.Cache(a); +// if (null == a) +// m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not asynchronously find asset with id {0}", id); + Util.FireAndForget(delegate { handler(assetID, s, a); }); }); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 66d11dd819..3883dc6b41 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -73,7 +73,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory IConfig inventoryConfig = source.Configs["InventoryService"]; if (inventoryConfig == null) { - m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); + m_log.Error("[LOCAL INVENTORY SERVICES CONNECTOR]: InventoryService missing from OpenSim.ini"); return; } @@ -81,18 +81,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory if (serviceDll == String.Empty) { - m_log.Error("[INVENTORY CONNECTOR]: No LocalServiceModule named in section InventoryService"); + m_log.Error("[LOCAL INVENTORY SERVICES CONNECTOR]: No LocalServiceModule named in section InventoryService"); return; } Object[] args = new Object[] { source }; - m_log.DebugFormat("[INVENTORY CONNECTOR]: Service dll = {0}", serviceDll); + m_log.DebugFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Service dll = {0}", serviceDll); m_InventoryService = ServerUtils.LoadPlugin(serviceDll, args); if (m_InventoryService == null) { - m_log.Error("[INVENTORY CONNECTOR]: Can't load inventory service"); + m_log.Error("[LOCAL INVENTORY SERVICES CONNECTOR]: Can't load inventory service"); //return; throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); } @@ -111,7 +111,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory Init(source); m_Enabled = true; - m_log.Info("[INVENTORY CONNECTOR]: Local inventory connector enabled"); + m_log.Info("[LOCAL INVENTORY SERVICES CONNECTOR]: Local inventory connector enabled"); } } } @@ -138,7 +138,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } // m_log.DebugFormat( -// "[INVENTORY CONNECTOR]: Registering IInventoryService to scene {0}", scene.RegionInfo.RegionName); +// "[LOCAL INVENTORY SERVICES CONNECTOR]: Registering IInventoryService to scene {0}", scene.RegionInfo.RegionName); scene.RegisterModuleInterface(this); m_cache.AddRegion(scene); @@ -158,7 +158,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return; m_log.InfoFormat( - "[INVENTORY CONNECTOR]: Enabled local invnetory for region {0}", scene.RegionInfo.RegionName); + "[LOCAL INVENTORY SERVICES CONNECTOR]: Enabled local inventory for region {0}", scene.RegionInfo.RegionName); } #region IInventoryService @@ -213,7 +213,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return folders; } } - m_log.WarnFormat("[INVENTORY CONNECTOR]: System folders for {0} not found", userID); + m_log.WarnFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: System folders for {0} not found", userID); return new Dictionary(); } @@ -312,7 +312,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory public override InventoryItemBase GetItem(InventoryItemBase item) { - return m_InventoryService.GetItem(item); +// m_log.DebugFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Requesting inventory item {0}", item.ID); + + item = m_InventoryService.GetItem(item); + + if (null == item) + m_log.ErrorFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find item with id {0}"); + + return item; } public override InventoryFolderBase GetFolder(InventoryFolderBase folder) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ddebd0b4d4..2909311e07 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3120,7 +3120,6 @@ namespace OpenSim.Region.Framework.Scenes m_log.DebugFormat("[APPEARANCE]: Appearance not found in {0}, returning default", RegionInfo.RegionName); appearance = new AvatarAppearance(client.AgentId); } - } /// diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6b95624d76..9c7559b2ec 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2505,6 +2505,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void SendWearables() { + m_log.DebugFormat("[SCENE]: Received request for wearables of {0}", Name); + ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); } diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index df33db2695..a91b632baf 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs @@ -76,17 +76,19 @@ namespace OpenSim.Services.AssetService }); } - m_log.Info("[ASSET CONNECTOR]: Local asset service enabled"); + m_log.Info("[ASSET SERVICE]: Local asset service enabled"); } } public AssetBase Get(string id) - { - //m_log.DebugFormat("[ASSET SERVICE]: Get asset {0}", id); + { UUID assetID; if (!UUID.TryParse(id, out assetID)) + { + m_log.WarnFormat("[ASSET SERVICE]: Could not parse requested sset id {0}", id); return null; + } return m_Database.GetAsset(assetID); } diff --git a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs index 8e311d70d8..6d442b75a1 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs @@ -93,7 +93,7 @@ namespace OpenSim.Services.Connectors } public AssetBase Get(string id) - { + { string uri = m_ServerURI + "/assets/" + id; AssetBase asset = null; From aad95fcff5e03a48dbc1586b86d51b4b0ed88290 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 12 Feb 2010 22:45:59 +0000 Subject: [PATCH 04/10] minor: remove completely commented out and unused class --- .../AgentAssetTransactionsManager.cs | 226 ------------------ 1 file changed, 226 deletions(-) delete mode 100644 OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs deleted file mode 100644 index 9c646b65de..0000000000 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetTransactionsManager.cs +++ /dev/null @@ -1,226 +0,0 @@ -/* - * 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.Reflection; -//using log4net; - -namespace OpenSim.Region.CoreModules.Agent.AssetTransaction -{ - /* - public class AgentAssetTransactionsManager - { - //private static readonly ILog m_log - // = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - /// - /// Each agent has its own singleton collection of transactions - /// - private Dictionary AgentTransactions = - new Dictionary(); - - /// - /// Should we dump uploaded assets to the filesystem? - /// - private bool m_dumpAssetsToFile; - - public Scene MyScene; - - public AgentAssetTransactionsManager(Scene scene, bool dumpAssetsToFile) - { - MyScene = scene; - m_dumpAssetsToFile = dumpAssetsToFile; - } - - /// - /// Get the collection of asset transactions for the given user. If one does not already exist, it - /// is created. - /// - /// - /// - private AgentAssetTransactions GetUserTransactions(UUID userID) - { - lock (AgentTransactions) - { - if (!AgentTransactions.ContainsKey(userID)) - { - AgentAssetTransactions transactions = null; - //= new AgentAssetTransactions(userID, this, m_dumpAssetsToFile); - AgentTransactions.Add(userID, transactions); - } - - return AgentTransactions[userID]; - } - } - - /// - /// Remove the given agent asset transactions. This should be called when a client is departing - /// from a scene (and hence won't be making any more transactions here). - /// - /// - public void RemoveAgentAssetTransactions(UUID userID) - { - // m_log.DebugFormat("Removing agent asset transactions structure for agent {0}", userID); - - lock (AgentTransactions) - { - AgentTransactions.Remove(userID); - } - } - - /// - /// Create an inventory item from data that has been received through a transaction. - /// - /// This is called when new clothing or body parts are created. It may also be called in other - /// situations. - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public void HandleItemCreationFromTransaction(IClientAPI remoteClient, UUID transactionID, UUID folderID, - uint callbackID, string description, string name, sbyte invType, - sbyte type, byte wearableType, uint nextOwnerMask) - { -// m_log.DebugFormat( -// "[TRANSACTIONS MANAGER] Called HandleItemCreationFromTransaction with item {0}", name); - - AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); - - transactions.RequestCreateInventoryItem( - remoteClient, transactionID, folderID, callbackID, description, - name, invType, type, wearableType, nextOwnerMask); - } - - /// - /// Update an inventory item with data that has been received through a transaction. - /// - /// This is called when clothing or body parts are updated (for instance, with new textures or - /// colours). It may also be called in other situations. - /// - /// - /// - /// - public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, UUID transactionID, - InventoryItemBase item) - { -// m_log.DebugFormat( -// "[TRANSACTIONS MANAGER] Called HandleItemUpdateFromTransaction with item {0}", -// item.Name); - - AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); - - transactions.RequestUpdateInventoryItem(remoteClient, transactionID, item); - } - - /// - /// Update a task inventory item with data that has been received through a transaction. - /// - /// This is currently called when, for instance, a notecard in a prim is saved. The data is sent - /// up through a single AssetUploadRequest. A subsequent UpdateTaskInventory then references the transaction - /// and comes through this method. - /// - /// - /// - /// - public void HandleTaskItemUpdateFromTransaction( - IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item) - { -// m_log.DebugFormat( -// "[TRANSACTIONS MANAGER] Called HandleTaskItemUpdateFromTransaction with item {0}", -// item.Name); - - AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); - - transactions.RequestUpdateTaskInventoryItem(remoteClient, part, transactionID, item); - } - - /// - /// Request that a client (agent) begin an asset transfer. - /// - /// - /// - /// - /// - /// - /// - public void HandleUDPUploadRequest(IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type, - byte[] data, bool storeLocal, bool tempFile) - { - //m_log.Debug("HandleUDPUploadRequest - assetID: " + assetID.ToString() + " transaction: " + transaction.ToString() + " type: " + type.ToString() + " storelocal: " + storeLocal + " tempFile: " + tempFile); - if (((AssetType)type == AssetType.Texture || - (AssetType)type == AssetType.Sound || - (AssetType)type == AssetType.TextureTGA || - (AssetType)type == AssetType.Animation) && - tempFile == false) - { - Scene scene = (Scene)remoteClient.Scene; - IMoneyModule mm = scene.RequestModuleInterface(); - - if (mm != null) - { - if (!mm.UploadCovered(remoteClient)) - { - remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); - return; - } - } - } - - //m_log.Debug("asset upload of " + assetID); - AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); - - AssetXferUploader uploader = transactions.RequestXferUploader(transaction); - if (uploader != null) - { - uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile); - } - } - - /// - /// Handle asset transfer data packets received in response to the asset upload request in - /// HandleUDPUploadRequest() - /// - /// - /// - /// - /// - public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data) - { - //m_log.Debug("xferID: " + xferID + " packetID: " + packetID + " data!"); - AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); - - transactions.HandleXfer(xferID, packetID, data); - } - } - */ -} From 00800c59d35662d65aeb61a17de0d56fa6196509 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 12 Feb 2010 23:13:35 +0000 Subject: [PATCH 05/10] Apply last two patches from http://opensimulator.org/mantis/view.php?id=3522 These patch should allow people using systems that do not have their locale set to En_US or similar to use OpenSim without suffering effects such as being a million miles up in the air on login. The problem was caused by parsing strings without forcing that parse to be En_US (hence different decimal and digit group symbols were causing problems). Thanks very much to VikingErik for doing the legwork on this fix and phacelia for spotting it in the first place. --- .../Rest/Regions/GETHandler.cs | 5 +-- OpenSim/Client/Linden/LLProxyLoginModule.cs | 6 ++-- .../Communications/Services/LoginService.cs | 4 +-- OpenSim/Framework/Culture.cs | 2 +- .../External/RegionSettingsSerializer.cs | 24 ++++++------- .../Grid/UserServer.Modules/UserManager.cs | 24 ++++++------- OpenSim/Region/Application/OpenSim.cs | 6 ++-- .../ClientStack/LindenUDP/LLClientView.cs | 36 +++++++++---------- .../Communications/OGS1/OGS1UserDataPlugin.cs | 12 +++---- .../Framework/InterfaceCommander/Command.cs | 2 +- .../World/Estate/EstateManagementModule.cs | 4 +-- .../TreePopulator/TreePopulatorModule.cs | 6 ++-- .../Shared/Instance/ScriptSerializer.cs | 2 +- .../Region/ScriptEngine/Shared/LSL_Types.cs | 32 ++++++++--------- .../Handlers/Grid/HypergridServerConnector.cs | 6 ++-- 15 files changed, 86 insertions(+), 85 deletions(-) diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs index 9c90a7ef08..ed18207216 100644 --- a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs +++ b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs @@ -29,6 +29,7 @@ using System; using System.IO; using System.Xml.Serialization; using OpenMetaverse; +using OpenSim.Framework; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; @@ -156,8 +157,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions Vector3 min, max; try { - min = new Vector3((float)Double.Parse(subregion[0]), (float)Double.Parse(subregion[1]), (float)Double.Parse(subregion[2])); - max = new Vector3((float)Double.Parse(subregion[3]), (float)Double.Parse(subregion[4]), (float)Double.Parse(subregion[5])); + min = new Vector3((float)Double.Parse(subregion[0], Culture.NumberFormatInfo), (float)Double.Parse(subregion[1], Culture.NumberFormatInfo), (float)Double.Parse(subregion[2], Culture.NumberFormatInfo)); + max = new Vector3((float)Double.Parse(subregion[3], Culture.NumberFormatInfo), (float)Double.Parse(subregion[4], Culture.NumberFormatInfo), (float)Double.Parse(subregion[5], Culture.NumberFormatInfo)); } catch (Exception) { diff --git a/OpenSim/Client/Linden/LLProxyLoginModule.cs b/OpenSim/Client/Linden/LLProxyLoginModule.cs index 14ce682084..7c36a9ba84 100644 --- a/OpenSim/Client/Linden/LLProxyLoginModule.cs +++ b/OpenSim/Client/Linden/LLProxyLoginModule.cs @@ -218,9 +218,9 @@ namespace OpenSim.Client.Linden { //m_log.Debug("[CLIENT]: Main agent detected"); agentData.startpos = - new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"]), - (float)Convert.ToDecimal((string)requestData["startpos_y"]), - (float)Convert.ToDecimal((string)requestData["startpos_z"])); + new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)requestData["startpos_y"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)requestData["startpos_z"], Culture.NumberFormatInfo)); agentData.child = false; } diff --git a/OpenSim/Framework/Communications/Services/LoginService.cs b/OpenSim/Framework/Communications/Services/LoginService.cs index 57ca704e73..71b38edde8 100644 --- a/OpenSim/Framework/Communications/Services/LoginService.cs +++ b/OpenSim/Framework/Communications/Services/LoginService.cs @@ -1015,8 +1015,8 @@ namespace OpenSim.Framework.Communications.Services } else { - theUser.CurrentAgent.Position = new Vector3(float.Parse(uriMatch.Groups["x"].Value), - float.Parse(uriMatch.Groups["y"].Value), float.Parse(uriMatch.Groups["z"].Value)); + theUser.CurrentAgent.Position = new Vector3(float.Parse(uriMatch.Groups["x"].Value, Culture.NumberFormatInfo), + float.Parse(uriMatch.Groups["y"].Value, Culture.NumberFormatInfo), float.Parse(uriMatch.Groups["z"].Value, Culture.NumberFormatInfo)); } } response.LookAt = "[r0,r1,r0]"; diff --git a/OpenSim/Framework/Culture.cs b/OpenSim/Framework/Culture.cs index 2066794671..3d78fac2d4 100644 --- a/OpenSim/Framework/Culture.cs +++ b/OpenSim/Framework/Culture.cs @@ -33,7 +33,7 @@ namespace OpenSim.Framework { public class Culture { - private static readonly CultureInfo m_cultureInfo = new CultureInfo("en-US", true); + private static readonly CultureInfo m_cultureInfo = new CultureInfo("en-US", false); public static NumberFormatInfo NumberFormatInfo { diff --git a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs index b5901e1bf8..6ba4c5a55e 100644 --- a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs +++ b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs @@ -109,7 +109,7 @@ namespace OpenSim.Framework.Serialization.External settings.AgentLimit = int.Parse(xtr.ReadElementContentAsString()); break; case "ObjectBonus": - settings.ObjectBonus = double.Parse(xtr.ReadElementContentAsString()); + settings.ObjectBonus = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; } } @@ -134,28 +134,28 @@ namespace OpenSim.Framework.Serialization.External settings.TerrainTexture4 = UUID.Parse(xtr.ReadElementContentAsString()); break; case "ElevationLowSW": - settings.Elevation1SW = double.Parse(xtr.ReadElementContentAsString()); + settings.Elevation1SW = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; case "ElevationLowNW": - settings.Elevation1NW = double.Parse(xtr.ReadElementContentAsString()); + settings.Elevation1NW = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; case "ElevationLowSE": - settings.Elevation1SE = double.Parse(xtr.ReadElementContentAsString()); + settings.Elevation1SE = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; case "ElevationLowNE": - settings.Elevation1NE = double.Parse(xtr.ReadElementContentAsString()); + settings.Elevation1NE = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; case "ElevationHighSW": - settings.Elevation2SW = double.Parse(xtr.ReadElementContentAsString()); + settings.Elevation2SW = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; case "ElevationHighNW": - settings.Elevation2NW = double.Parse(xtr.ReadElementContentAsString()); + settings.Elevation2NW = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; case "ElevationHighSE": - settings.Elevation2SE = double.Parse(xtr.ReadElementContentAsString()); + settings.Elevation2SE = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; case "ElevationHighNE": - settings.Elevation2NE = double.Parse(xtr.ReadElementContentAsString()); + settings.Elevation2NE = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; } } @@ -168,13 +168,13 @@ namespace OpenSim.Framework.Serialization.External switch (xtr.Name) { case "WaterHeight": - settings.WaterHeight = double.Parse(xtr.ReadElementContentAsString()); + settings.WaterHeight = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; case "TerrainRaiseLimit": - settings.TerrainRaiseLimit = double.Parse(xtr.ReadElementContentAsString()); + settings.TerrainRaiseLimit = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; case "TerrainLowerLimit": - settings.TerrainLowerLimit = double.Parse(xtr.ReadElementContentAsString()); + settings.TerrainLowerLimit = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); break; case "UseEstateSun": settings.UseEstateSun = bool.Parse(xtr.ReadElementContentAsString()); diff --git a/OpenSim/Grid/UserServer.Modules/UserManager.cs b/OpenSim/Grid/UserServer.Modules/UserManager.cs index 36c6297440..a2032dcdcb 100644 --- a/OpenSim/Grid/UserServer.Modules/UserManager.cs +++ b/OpenSim/Grid/UserServer.Modules/UserManager.cs @@ -503,7 +503,7 @@ namespace OpenSim.Grid.UserServer.Modules { try { - userProfile.HomeLocationX = (float)Convert.ToDecimal((string)requestData["home_pos_x"]); + userProfile.HomeLocationX = (float)Convert.ToDecimal((string)requestData["home_pos_x"], Culture.NumberFormatInfo); } catch (InvalidCastException) { @@ -514,7 +514,7 @@ namespace OpenSim.Grid.UserServer.Modules { try { - userProfile.HomeLocationY = (float)Convert.ToDecimal((string)requestData["home_pos_y"]); + userProfile.HomeLocationY = (float)Convert.ToDecimal((string)requestData["home_pos_y"], Culture.NumberFormatInfo); } catch (InvalidCastException) { @@ -525,7 +525,7 @@ namespace OpenSim.Grid.UserServer.Modules { try { - userProfile.HomeLocationZ = (float)Convert.ToDecimal((string)requestData["home_pos_z"]); + userProfile.HomeLocationZ = (float)Convert.ToDecimal((string)requestData["home_pos_z"], Culture.NumberFormatInfo); } catch (InvalidCastException) { @@ -536,7 +536,7 @@ namespace OpenSim.Grid.UserServer.Modules { try { - userProfile.HomeLookAtX = (float)Convert.ToDecimal((string)requestData["home_look_x"]); + userProfile.HomeLookAtX = (float)Convert.ToDecimal((string)requestData["home_look_x"], Culture.NumberFormatInfo); } catch (InvalidCastException) { @@ -547,7 +547,7 @@ namespace OpenSim.Grid.UserServer.Modules { try { - userProfile.HomeLookAtY = (float)Convert.ToDecimal((string)requestData["home_look_y"]); + userProfile.HomeLookAtY = (float)Convert.ToDecimal((string)requestData["home_look_y"], Culture.NumberFormatInfo); } catch (InvalidCastException) { @@ -558,7 +558,7 @@ namespace OpenSim.Grid.UserServer.Modules { try { - userProfile.HomeLookAtZ = (float)Convert.ToDecimal((string)requestData["home_look_z"]); + userProfile.HomeLookAtZ = (float)Convert.ToDecimal((string)requestData["home_look_z"], Culture.NumberFormatInfo); } catch (InvalidCastException) { @@ -634,13 +634,13 @@ namespace OpenSim.Grid.UserServer.Modules UUID RegionID = new UUID((string)requestData["region_uuid"]); ulong regionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]); Vector3 position = new Vector3( - (float)Convert.ToDecimal((string)requestData["region_pos_x"]), - (float)Convert.ToDecimal((string)requestData["region_pos_y"]), - (float)Convert.ToDecimal((string)requestData["region_pos_z"])); + (float)Convert.ToDecimal((string)requestData["region_pos_x"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)requestData["region_pos_y"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)requestData["region_pos_z"], Culture.NumberFormatInfo)); Vector3 lookat = new Vector3( - (float)Convert.ToDecimal((string)requestData["lookat_x"]), - (float)Convert.ToDecimal((string)requestData["lookat_y"]), - (float)Convert.ToDecimal((string)requestData["lookat_z"])); + (float)Convert.ToDecimal((string)requestData["lookat_x"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)requestData["lookat_y"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)requestData["lookat_z"], Culture.NumberFormatInfo)); handlerLogOffUser = OnLogOffUser; if (handlerLogOffUser != null) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index eccd2765cc..a86a83146d 100755 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -1183,14 +1183,14 @@ namespace OpenSim } if (cmdparams.Length > 4) { - loadOffset.X = (float) Convert.ToDecimal(cmdparams[4]); + loadOffset.X = (float)Convert.ToDecimal(cmdparams[4], Culture.NumberFormatInfo); if (cmdparams.Length > 5) { - loadOffset.Y = (float) Convert.ToDecimal(cmdparams[5]); + loadOffset.Y = (float)Convert.ToDecimal(cmdparams[5], Culture.NumberFormatInfo); } if (cmdparams.Length > 6) { - loadOffset.Z = (float) Convert.ToDecimal(cmdparams[6]); + loadOffset.Z = (float)Convert.ToDecimal(cmdparams[6], Culture.NumberFormatInfo); } MainConsole.Instance.Output(String.Format("loadOffsets = <{0},{1},{2}>",loadOffset.X,loadOffset.Y,loadOffset.Z)); } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index e38232ca4a..e39323f549 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -8307,8 +8307,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter), convertParamStringToBool(messagePacket.ParamList[1].Parameter), convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter), - Convert.ToInt16(Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[4].Parameter))), - (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter)), + Convert.ToInt16(Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[4].Parameter), Culture.NumberFormatInfo)), + (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter), Culture.NumberFormatInfo), Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[6].Parameter)), convertParamStringToBool(messagePacket.ParamList[7].Parameter), convertParamStringToBool(messagePacket.ParamList[8].Parameter)); } @@ -8356,8 +8356,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (splitField.Length == 3) { Int16 corner = Convert.ToInt16(splitField[0]); - float lowValue = (float)Convert.ToDecimal(splitField[1]); - float highValue = (float)Convert.ToDecimal(splitField[2]); + float lowValue = (float)Convert.ToDecimal(splitField[1], Culture.NumberFormatInfo); + float highValue = (float)Convert.ToDecimal(splitField[2], Culture.NumberFormatInfo); OnSetEstateTerrainTextureHeights(this, corner, lowValue, highValue); } @@ -8380,19 +8380,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP { string tmp = Utils.BytesToString(messagePacket.ParamList[0].Parameter); if (!tmp.Contains(".")) tmp += ".00"; - float WaterHeight = (float)Convert.ToDecimal(tmp); + float WaterHeight = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo); tmp = Utils.BytesToString(messagePacket.ParamList[1].Parameter); if (!tmp.Contains(".")) tmp += ".00"; - float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp); + float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo); tmp = Utils.BytesToString(messagePacket.ParamList[2].Parameter); if (!tmp.Contains(".")) tmp += ".00"; - float TerrainLowerLimit = (float)Convert.ToDecimal(tmp); + float TerrainLowerLimit = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo); bool UseEstateSun = convertParamStringToBool(messagePacket.ParamList[3].Parameter); bool UseFixedSun = convertParamStringToBool(messagePacket.ParamList[4].Parameter); - float SunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter)); + float SunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter), Culture.NumberFormatInfo); bool UseGlobal = convertParamStringToBool(messagePacket.ParamList[6].Parameter); bool EstateFixedSun = convertParamStringToBool(messagePacket.ParamList[7].Parameter); - float EstateSunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[8].Parameter)); + float EstateSunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[8].Parameter), Culture.NumberFormatInfo); OnSetRegionTerrainSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseEstateSun, UseFixedSun, SunHour, UseGlobal, EstateFixedSun, EstateSunHour); @@ -13924,8 +13924,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter), convertParamStringToBool(messagePacket.ParamList[1].Parameter), convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter), - Convert.ToInt16(Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[4].Parameter))), - (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter)), + Convert.ToInt16(Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[4].Parameter), Culture.NumberFormatInfo)), + (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter), Culture.NumberFormatInfo), Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[6].Parameter)), convertParamStringToBool(messagePacket.ParamList[7].Parameter), convertParamStringToBool(messagePacket.ParamList[8].Parameter)); } @@ -13973,8 +13973,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (splitField.Length == 3) { Int16 corner = Convert.ToInt16(splitField[0]); - float lowValue = (float)Convert.ToDecimal(splitField[1]); - float highValue = (float)Convert.ToDecimal(splitField[2]); + float lowValue = (float)Convert.ToDecimal(splitField[1], Culture.NumberFormatInfo); + float highValue = (float)Convert.ToDecimal(splitField[2], Culture.NumberFormatInfo); OnSetEstateTerrainTextureHeights(this, corner, lowValue, highValue); } @@ -13997,19 +13997,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP { string tmp = Utils.BytesToString(messagePacket.ParamList[0].Parameter); if (!tmp.Contains(".")) tmp += ".00"; - float WaterHeight = (float)Convert.ToDecimal(tmp); + float WaterHeight = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo); tmp = Utils.BytesToString(messagePacket.ParamList[1].Parameter); if (!tmp.Contains(".")) tmp += ".00"; - float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp); + float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo); tmp = Utils.BytesToString(messagePacket.ParamList[2].Parameter); if (!tmp.Contains(".")) tmp += ".00"; - float TerrainLowerLimit = (float)Convert.ToDecimal(tmp); + float TerrainLowerLimit = (float)Convert.ToDecimal(tmp, Culture.NumberFormatInfo); bool UseEstateSun = convertParamStringToBool(messagePacket.ParamList[3].Parameter); bool UseFixedSun = convertParamStringToBool(messagePacket.ParamList[4].Parameter); - float SunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter)); + float SunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter), Culture.NumberFormatInfo); bool UseGlobal = convertParamStringToBool(messagePacket.ParamList[6].Parameter); bool EstateFixedSun = convertParamStringToBool(messagePacket.ParamList[7].Parameter); - float EstateSunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[8].Parameter)); + float EstateSunHour = (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[8].Parameter), Culture.NumberFormatInfo); OnSetRegionTerrainSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseEstateSun, UseFixedSun, SunHour, UseGlobal, EstateFixedSun, EstateSunHour); diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs b/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs index 776d5d14ce..cb1766a22c 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs @@ -673,13 +673,13 @@ namespace OpenSim.Region.Communications.OGS1 else userData.HomeRegionID = UUID.Zero; userData.HomeLocation = - new Vector3((float)Convert.ToDecimal((string)data["home_coordinates_x"]), - (float)Convert.ToDecimal((string)data["home_coordinates_y"]), - (float)Convert.ToDecimal((string)data["home_coordinates_z"])); + new Vector3((float)Convert.ToDecimal((string)data["home_coordinates_x"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)data["home_coordinates_y"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)data["home_coordinates_z"], Culture.NumberFormatInfo)); userData.HomeLookAt = - new Vector3((float)Convert.ToDecimal((string)data["home_look_x"]), - (float)Convert.ToDecimal((string)data["home_look_y"]), - (float)Convert.ToDecimal((string)data["home_look_z"])); + new Vector3((float)Convert.ToDecimal((string)data["home_look_x"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)data["home_look_y"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)data["home_look_z"], Culture.NumberFormatInfo)); if (data.Contains("user_flags")) userData.UserFlags = Convert.ToInt32((string)data["user_flags"]); if (data.Contains("god_level")) diff --git a/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs b/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs index 9fe669af1f..4004135dbe 100644 --- a/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs +++ b/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs @@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.Framework.InterfaceCommander m_args[i].ArgumentValue = Int32.Parse(arg.ToString()); break; case "Double": - m_args[i].ArgumentValue = Double.Parse(arg.ToString()); + m_args[i].ArgumentValue = Double.Parse(arg.ToString(), OpenSim.Framework.Culture.NumberFormatInfo); break; case "Boolean": m_args[i].ArgumentValue = Boolean.Parse(arg.ToString()); diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 695cced293..03da2690c4 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -974,8 +974,8 @@ namespace OpenSim.Region.CoreModules.World.Estate if (y == -1 || m_scene.RegionInfo.RegionLocY == y) { int corner = int.Parse(num); - float lowValue = float.Parse(min); - float highValue = float.Parse(max); + float lowValue = float.Parse(min, Culture.NumberFormatInfo); + float highValue = float.Parse(max, Culture.NumberFormatInfo); m_log.Debug("[ESTATEMODULE] Setting terrain heights " + m_scene.RegionInfo.RegionName + string.Format(" (C{0}, {1}-{2}", corner, lowValue, highValue)); diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs index e3fbb6ee09..c8e6e4b979 100644 --- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs +++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs @@ -104,9 +104,9 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator this.m_name = field[1].Trim(); this.m_frozen = (copsedef[0] == 'F'); this.m_tree_quantity = int.Parse(field[2]); - this.m_treeline_high = float.Parse(field[3]); - this.m_treeline_low = float.Parse(field[4]); - this.m_range = double.Parse(field[5]); + this.m_treeline_high = float.Parse(field[3], Culture.NumberFormatInfo); + this.m_treeline_low = float.Parse(field[4], Culture.NumberFormatInfo); + this.m_range = double.Parse(field[5], Culture.NumberFormatInfo); this.m_tree_type = (Tree) Enum.Parse(typeof(Tree),field[6]); this.m_seed_point = Vector3.Parse(field[7]); this.m_initial_scale = Vector3.Parse(field[8]); diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs index bf3d335b34..bcdc7bf5dd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs @@ -389,7 +389,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance break; case "MinEventDelay": double minEventDelay = 0.0; - double.TryParse(part.InnerText, out minEventDelay); + double.TryParse(part.InnerText, NumberStyles.Float, Culture.NumberFormatInfo, out minEventDelay); instance.MinEventDelay = minEventDelay; break; } diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index faf9c4041a..e87b1f4d90 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -72,9 +72,9 @@ namespace OpenSim.Region.ScriptEngine.Shared return; } bool res; - res = Double.TryParse(tmps[0], out x); - res = res & Double.TryParse(tmps[1], out y); - res = res & Double.TryParse(tmps[2], out z); + res = Double.TryParse(tmps[0], NumberStyles.Float, Culture.NumberFormatInfo, out x); + res = res & Double.TryParse(tmps[1], NumberStyles.Float, Culture.NumberFormatInfo, out y); + res = res & Double.TryParse(tmps[2], NumberStyles.Float, Culture.NumberFormatInfo, out z); } #endregion @@ -309,10 +309,10 @@ namespace OpenSim.Region.ScriptEngine.Shared return; } bool res; - res = Double.TryParse(tmps[0], NumberStyles.Float, Culture.FormatProvider, out x); - res = res & Double.TryParse(tmps[1], NumberStyles.Float, Culture.FormatProvider, out y); - res = res & Double.TryParse(tmps[2], NumberStyles.Float, Culture.FormatProvider, out z); - res = res & Double.TryParse(tmps[3], NumberStyles.Float, Culture.FormatProvider, out s); + res = Double.TryParse(tmps[0], NumberStyles.Float, Culture.NumberFormatInfo, out x); + res = res & Double.TryParse(tmps[1], NumberStyles.Float, Culture.NumberFormatInfo, out y); + res = res & Double.TryParse(tmps[2], NumberStyles.Float, Culture.NumberFormatInfo, out z); + res = res & Double.TryParse(tmps[3], NumberStyles.Float, Culture.NumberFormatInfo, out s); if (x == 0 && y == 0 && z == 0 && s == 0) s = 1; } @@ -1015,7 +1015,7 @@ namespace OpenSim.Region.ScriptEngine.Shared double entry; for (int i = 0; i < Data.Length; i++) { - if (double.TryParse(Data[i].ToString(), out entry)) + if (double.TryParse(Data[i].ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out entry)) { if (entry < minimum) minimum = entry; } @@ -1029,7 +1029,7 @@ namespace OpenSim.Region.ScriptEngine.Shared double entry; for (int i = 0; i < Data.Length; i++) { - if (double.TryParse(Data[i].ToString(), out entry)) + if (double.TryParse(Data[i].ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out entry)) { if (entry > maximum) maximum = entry; } @@ -1048,7 +1048,7 @@ namespace OpenSim.Region.ScriptEngine.Shared double entry; for (int i = 0; i < Data.Length; i++) { - if (double.TryParse(Data[i].ToString(), out entry)) + if (double.TryParse(Data[i].ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out entry)) { count++; } @@ -1062,7 +1062,7 @@ namespace OpenSim.Region.ScriptEngine.Shared double entry; for (int i = 0; i < src.Data.Length - 1; i++) { - if (double.TryParse(src.Data[i].ToString(), out entry)) + if (double.TryParse(src.Data[i].ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out entry)) { ret.Add(entry); } @@ -1076,7 +1076,7 @@ namespace OpenSim.Region.ScriptEngine.Shared double entry; for (int i = 0; i < Data.Length; i++) { - if (double.TryParse(Data[i].ToString(), out entry)) + if (double.TryParse(Data[i].ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out entry)) { sum = sum + entry; } @@ -1090,7 +1090,7 @@ namespace OpenSim.Region.ScriptEngine.Shared double entry; for (int i = 0; i < Data.Length; i++) { - if (double.TryParse(Data[i].ToString(), out entry)) + if (double.TryParse(Data[i].ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out entry)) { sum = sum + Math.Pow(entry, 2); } @@ -1213,11 +1213,11 @@ namespace OpenSim.Region.ScriptEngine.Shared { double a; double b; - if (!double.TryParse(x.ToString(), out a)) + if (!double.TryParse(x.ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out a)) { a = 0.0; } - if (!double.TryParse(y.ToString(), out b)) + if (!double.TryParse(y.ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out b)) { b = 0.0; } @@ -1857,7 +1857,7 @@ namespace OpenSim.Region.ScriptEngine.Shared else if (v.EndsWith(".")) v = v + "0"; - this.value = double.Parse(v, System.Globalization.NumberStyles.Float, Culture.FormatProvider); + this.value = double.Parse(v, System.Globalization.NumberStyles.Float, Culture.NumberFormatInfo); } #endregion diff --git a/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs index 115ac29a2d..7cc0dfacef 100644 --- a/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs +++ b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs @@ -132,9 +132,9 @@ namespace OpenSim.Server.Handlers.Grid userData.SurName = (string)requestData["lastname"]; userData.ID = new UUID((string)requestData["agent_id"]); UUID sessionID = new UUID((string)requestData["session_id"]); - userData.HomeLocation = new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"]), - (float)Convert.ToDecimal((string)requestData["startpos_y"]), - (float)Convert.ToDecimal((string)requestData["startpos_z"])); + userData.HomeLocation = new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)requestData["startpos_y"], Culture.NumberFormatInfo), + (float)Convert.ToDecimal((string)requestData["startpos_z"], Culture.NumberFormatInfo)); userData.UserServerURI = (string)requestData["userserver_id"]; userData.UserAssetURI = (string)requestData["assetserver_id"]; From b2656e62ba2c8a57859df96ab1f877910f271cff Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 12 Feb 2010 23:16:45 +0000 Subject: [PATCH 06/10] minor: update CONTRIBUTORS.txt --- CONTRIBUTORS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 08048f534f..13c05ef608 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -120,6 +120,7 @@ what it is today. * tglion * tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud) * tyre +* VikingErik * Vytek * webmage (IBM) * Xantor From fa6da2f6c666e786513e4c822a37d6755c9ff716 Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Sat, 13 Feb 2010 05:09:15 -0500 Subject: [PATCH 07/10] * This is an attempt to resolve mantis 4437 by using SqliteAdapter type statements instead of blanket SQL statements. The hope is that this makes SQLite work on Linux/Mono again. Re: http://opensimulator.org/mantis/view.php?id=4437 * Added a 'Create Update Statement' method that takes two fields for a primary key * Added an Update and Delete command for parcels and land access list table rows. --- OpenSim/Data/SQLite/SQLiteRegionData.cs | 115 +++++++++++++++++++++--- 1 file changed, 102 insertions(+), 13 deletions(-) diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index b68de1a87b..1285064ec0 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs @@ -617,18 +617,42 @@ namespace OpenSim.Data.SQLite { lock (ds) { - using (SqliteCommand cmd = new SqliteCommand("delete from land where UUID=:UUID", m_conn)) + // Can't use blanket SQL statements when using SqlAdapters unless you re-read the data into the adapter + // after you're done. + // replaced below code with the SqliteAdapter version. + //using (SqliteCommand cmd = new SqliteCommand("delete from land where UUID=:UUID", m_conn)) + //{ + // cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString())); + // cmd.ExecuteNonQuery(); + //} + + //using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:UUID", m_conn)) + //{ + // cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString())); + // cmd.ExecuteNonQuery(); + //} + + DataTable land = ds.Tables["land"]; + DataTable landaccesslist = ds.Tables["landaccesslist"]; + DataRow landRow = land.Rows.Find(globalID.ToString()); + if (landRow != null) { - cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString())); - cmd.ExecuteNonQuery(); + land.Rows.Remove(landRow); + } + List rowsToDelete = new List(); + foreach (DataRow rowToCheck in landaccesslist.Rows) + { + if (rowToCheck["LandUUID"].ToString() == globalID.ToString()) + rowsToDelete.Add(rowToCheck); + } + for (int iter = 0; iter < rowsToDelete.Count; iter++) + { + landaccesslist.Rows.Remove(rowsToDelete[iter]); } - using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:UUID", m_conn)) - { - cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString())); - cmd.ExecuteNonQuery(); - } + } + Commit(); } /// @@ -655,12 +679,27 @@ namespace OpenSim.Data.SQLite } // I know this caused someone issues before, but OpenSim is unusable if we leave this stuff around - using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:LandUUID", m_conn)) - { - cmd.Parameters.Add(new SqliteParameter(":LandUUID", parcel.LandData.GlobalID.ToString())); - cmd.ExecuteNonQuery(); - } + //using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:LandUUID", m_conn)) + //{ + // cmd.Parameters.Add(new SqliteParameter(":LandUUID", parcel.LandData.GlobalID.ToString())); + // cmd.ExecuteNonQuery(); +// } + + // This is the slower.. but more appropriate thing to do + + // We can't modify the table with direct queries before calling Commit() and re-filling them. + List rowsToDelete = new List(); + foreach (DataRow rowToCheck in landaccesslist.Rows) + { + if (rowToCheck["LandUUID"].ToString() == parcel.LandData.GlobalID.ToString()) + rowsToDelete.Add(rowToCheck); + } + for (int iter = 0; iter < rowsToDelete.Count; iter++) + { + landaccesslist.Rows.Remove(rowsToDelete[iter]); + } + rowsToDelete.Clear(); foreach (ParcelManager.ParcelAccessEntry entry in parcel.LandData.ParcelAccessList) { DataRow newAccessRow = landaccesslist.NewRow(); @@ -1813,6 +1852,7 @@ namespace OpenSim.Data.SQLite /// private void addPrim(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) { + DataTable prims = ds.Tables["prims"]; DataTable shapes = ds.Tables["primshapes"]; @@ -1961,6 +2001,40 @@ namespace OpenSim.Data.SQLite return cmd; } + /// + /// create an update command + /// + /// table name + /// + /// + /// the created command + private static SqliteCommand createUpdateCommand(string table, string pk1, string pk2, DataTable dt) + { + string sql = "update " + table + " set "; + string subsql = String.Empty; + foreach (DataColumn col in dt.Columns) + { + if (subsql.Length > 0) + { + // a map function would rock so much here + subsql += ", "; + } + subsql += col.ColumnName + "= :" + col.ColumnName; + } + sql += subsql; + sql += " where " + pk1 + " and " + pk2; + SqliteCommand cmd = new SqliteCommand(sql); + + // this provides the binding for all our parameters, so + // much less code than it used to be + + foreach (DataColumn col in dt.Columns) + { + cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); + } + return cmd; + } + /// /// /// @@ -2079,6 +2153,11 @@ namespace OpenSim.Data.SQLite da.UpdateCommand = createUpdateCommand("land", "UUID=:UUID", ds.Tables["land"]); da.UpdateCommand.Connection = conn; + + SqliteCommand delete = new SqliteCommand("delete from land where UUID=:UUID"); + delete.Parameters.Add(createSqliteParameter("UUID", typeof(String))); + da.DeleteCommand = delete; + da.DeleteCommand.Connection = conn; } /// @@ -2090,6 +2169,16 @@ namespace OpenSim.Data.SQLite { da.InsertCommand = createInsertCommand("landaccesslist", ds.Tables["landaccesslist"]); da.InsertCommand.Connection = conn; + + da.UpdateCommand = createUpdateCommand("landaccesslist", "LandUUID=:landUUID", "AccessUUID=:AccessUUID", ds.Tables["landaccesslist"]); + da.UpdateCommand.Connection = conn; + + SqliteCommand delete = new SqliteCommand("delete from landaccesslist where LandUUID= :LandUUID and AccessUUID= :AccessUUID"); + delete.Parameters.Add(createSqliteParameter("LandUUID", typeof(String))); + delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String))); + da.DeleteCommand = delete; + da.DeleteCommand.Connection = conn; + } private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn) From 45493171b01c1a623edc70fcb92c48e307c7f89f Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Sat, 13 Feb 2010 05:50:57 -0500 Subject: [PATCH 08/10] * SQLite match code casing with regionsettings table field casing (what's with the upper case S in Sandbox while the rest is lower case 0.o) * It's doubtful that this will have any effect on mantis http://opensimulator.org/mantis/view.php?id=4577 . Sqlite 3 is required, Sqlite 2 was reported. --- OpenSim/Data/SQLite/SQLiteRegionData.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index 1285064ec0..5a4ee2ab72 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs @@ -1750,7 +1750,7 @@ namespace OpenSim.Data.SQLite row["terrain_raise_limit"] = settings.TerrainRaiseLimit; row["terrain_lower_limit"] = settings.TerrainLowerLimit; row["use_estate_sun"] = settings.UseEstateSun; - row["sandbox"] = settings.Sandbox; + row["Sandbox"] = settings.Sandbox; // database uses upper case S for sandbox row["sunvectorx"] = settings.SunVector.X; row["sunvectory"] = settings.SunVector.Y; row["sunvectorz"] = settings.SunVector.Z; From 9821c4f566e11c75c8d87721777480c5b2e2bd4e Mon Sep 17 00:00:00 2001 From: Revolution Date: Sun, 14 Feb 2010 15:41:57 -0600 Subject: [PATCH 09/10] Revolution is on the roll again! :) Fixes: Undo, T-pose of others on login, modifiedBulletX works again, feet now stand on the ground instead of in the ground, adds checks to CombatModule. Adds: Redo, Land Undo, checks to agentUpdate (so one can not fall off of a region), more vehicle parts. Finishes almost all of LSL (1 function left, 2 events). Direct flames and kudos to Revolution, please Signed-off-by: Melanie --- .../Client/MXP/ClientStack/MXPClientView.cs | 2 + .../ClientStack/SirikataClientView.cs | 2 + .../VWoHTTP/ClientStack/VWHClientView.cs | 2 + OpenSim/Framework/AvatarAppearance.cs | 7 +- OpenSim/Framework/IClientAPI.cs | 8 +- OpenSim/Framework/LandData.cs | 26 ++ .../ClientStack/LindenUDP/LLClientView.cs | 56 ++- .../CoreModules/Avatar/Combat/CombatModule.cs | 14 +- .../CoreModules/World/Sound/SoundModule.cs | 14 +- .../World/Terrain/TerrainModule.cs | 41 ++ .../Examples/SimpleModule/MyNpcCharacter.cs | 2 + .../Framework/Interfaces/ISoundModule.cs | 4 +- .../Framework/Interfaces/ITerrainModule.cs | 2 + .../Scenes/Animation/ScenePresenceAnimator.cs | 13 +- OpenSim/Region/Framework/Scenes/Scene.cs | 47 +- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 9 + .../Framework/Scenes/SceneObjectGroup.cs | 139 ++++-- .../Framework/Scenes/SceneObjectPart.cs | 344 +++++++++++++-- .../Region/Framework/Scenes/ScenePresence.cs | 89 +++- OpenSim/Region/Framework/Scenes/UndoState.cs | 79 +++- .../Server/IRCClientView.cs | 2 + .../Scripting/Minimodule/SOPObject.cs | 2 +- .../Scripting/Minimodule/World.cs | 4 +- .../OptionalModules/World/NPC/NPCAvatar.cs | 2 + .../BasicPhysicsPlugin/BasicPhysicsActor.cs | 5 + .../BulletDotNETCharacter.cs | 5 + .../BulletDotNETPlugin/BulletDotNETPrim.cs | 5 + .../Physics/BulletXPlugin/BulletXPlugin.cs | 19 +- .../Region/Physics/Manager/PhysicsActor.cs | 6 + .../Physics/Manager/VehicleConstants.cs | 12 +- .../Region/Physics/OdePlugin/ODECharacter.cs | 5 + .../Region/Physics/OdePlugin/ODEDynamics.cs | 409 ++++++++++++++++-- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 5 + .../Region/Physics/POSPlugin/POSCharacter.cs | 2 + OpenSim/Region/Physics/POSPlugin/POSPrim.cs | 2 + .../Region/Physics/PhysXPlugin/PhysXPlugin.cs | 4 + .../Shared/Api/Implementation/LSL_Api.cs | 257 ++++++++--- .../Shared/Api/Runtime/LSL_Constants.cs | 8 + OpenSim/Tests/Common/Mock/TestClient.cs | 2 + 39 files changed, 1430 insertions(+), 226 deletions(-) diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index 94a81f09bb..d414f08d82 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs @@ -692,6 +692,8 @@ namespace OpenSim.Client.MXP.ClientStack public event UUIDNameRequest OnTeleportHomeRequest; public event ScriptAnswer OnScriptAnswer; public event AgentSit OnUndo; + public event AgentSit OnRedo; + public event LandUndo OnLandUndo; public event ForceReleaseControls OnForceReleaseControls; public event GodLandStatRequest OnLandStatRequest; public event DetailedEstateDataRequest OnDetailedEstateDataRequest; diff --git a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs index eac20bc6ce..d305ffea4d 100644 --- a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs +++ b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs @@ -338,6 +338,8 @@ namespace OpenSim.Client.Sirikata.ClientStack public event UUIDNameRequest OnTeleportHomeRequest; public event ScriptAnswer OnScriptAnswer; public event AgentSit OnUndo; + public event AgentSit OnRedo; + public event LandUndo OnLandUndo; public event ForceReleaseControls OnForceReleaseControls; public event GodLandStatRequest OnLandStatRequest; public event DetailedEstateDataRequest OnDetailedEstateDataRequest; diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs index 20122112b0..ef74677836 100644 --- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs +++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs @@ -343,6 +343,8 @@ namespace OpenSim.Client.VWoHTTP.ClientStack public event UUIDNameRequest OnTeleportHomeRequest = delegate { }; public event ScriptAnswer OnScriptAnswer = delegate { }; public event AgentSit OnUndo = delegate { }; + public event AgentSit OnRedo = delegate { }; + public event LandUndo OnLandUndo = delegate { }; public event ForceReleaseControls OnForceReleaseControls = delegate { }; public event GodLandStatRequest OnLandStatRequest = delegate { }; public event DetailedEstateDataRequest OnDetailedEstateDataRequest = delegate { }; diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index a3ea499357..b2c4d8ea83 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -390,11 +390,12 @@ namespace OpenSim.Framework + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; // Neck length - m_hipOffset = (0.615385f // Half of avatar + m_hipOffset = (((1.23077f // Half of avatar + + 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height + + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f // Leg length + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height - + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f // Leg length - - m_avatarHeight / 2) * 0.3f - 0.04f; + ) / 2) - m_avatarHeight / 2) * 0.31f - 0.0425f; diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 3f53258713..222bae0d52 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -152,6 +152,8 @@ namespace OpenSim.Framework public delegate void AgentSit(IClientAPI remoteClient, UUID agentID); + public delegate void LandUndo(IClientAPI remoteClient); + public delegate void AvatarPickerRequest(IClientAPI remoteClient, UUID agentdata, UUID queryID, string UserQuery); public delegate void GrabObject( @@ -419,9 +421,9 @@ namespace OpenSim.Framework public delegate void AcceptCallingCard(IClientAPI remoteClient, UUID transactionID, UUID folderID); public delegate void DeclineCallingCard(IClientAPI remoteClient, UUID transactionID); - + public delegate void SoundTrigger( - UUID soundId, UUID ownerid, UUID objid, UUID parentid, double Gain, Vector3 Position, UInt64 Handle); + UUID soundId, UUID ownerid, UUID objid, UUID parentid, double Gain, Vector3 Position, UInt64 Handle, float radius); public delegate void StartLure(byte lureType, string message, UUID targetID, IClientAPI client); public delegate void TeleportLureRequest(UUID lureID, uint teleportFlags, IClientAPI client); @@ -988,6 +990,8 @@ namespace OpenSim.Framework event ScriptAnswer OnScriptAnswer; event AgentSit OnUndo; + event AgentSit OnRedo; + event LandUndo OnLandUndo; event ForceReleaseControls OnForceReleaseControls; event GodLandStatRequest OnLandStatRequest; diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index 071a66758f..060e88696a 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -358,6 +358,32 @@ namespace OpenSim.Framework } } + private int[] _mediaSize = new int[2]; + public int[] MediaSize + { + get + { + return _mediaSize; + } + set + { + _mediaSize = value; + } + } + + private string _mediaType = ""; + public string MediaType + { + get + { + return _mediaType; + } + set + { + _mediaType = value; + } + } + /// /// URL to the shoutcast music stream to play on the parcel /// diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index e39323f549..9fe61a7f8c 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -233,6 +233,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event ObjectBuy OnObjectBuy; public event BuyObjectInventory OnBuyObjectInventory; public event AgentSit OnUndo; + public event AgentSit OnRedo; + public event LandUndo OnLandUndo; public event ForceReleaseControls OnForceReleaseControls; public event GodLandStatRequest OnLandStatRequest; public event RequestObjectPropertiesFamily OnObjectGroupRequest; @@ -4667,6 +4669,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.ObjectName, HandleObjectName, false); AddLocalPacketHandler(PacketType.ObjectPermissions, HandleObjectPermissions, false); AddLocalPacketHandler(PacketType.Undo, HandleUndo, false); + AddLocalPacketHandler(PacketType.UndoLand, HandleLandUndo, false); + AddLocalPacketHandler(PacketType.Redo, HandleRedo, false); AddLocalPacketHandler(PacketType.ObjectDuplicateOnRay, HandleObjectDuplicateOnRay); AddLocalPacketHandler(PacketType.RequestObjectPropertiesFamily, HandleRequestObjectPropertiesFamily, false); AddLocalPacketHandler(PacketType.ObjectIncludeInSearch, HandleObjectIncludeInSearch); @@ -5836,7 +5840,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerSoundTrigger(soundTriggerPacket.SoundData.SoundID, soundTriggerPacket.SoundData.OwnerID, soundTriggerPacket.SoundData.ObjectID, soundTriggerPacket.SoundData.ParentID, soundTriggerPacket.SoundData.Gain, soundTriggerPacket.SoundData.Position, - soundTriggerPacket.SoundData.Handle); + soundTriggerPacket.SoundData.Handle, 0); } return true; @@ -6734,6 +6738,56 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; } + private bool HandleLandUndo(IClientAPI sender, Packet Pack) + { + UndoLandPacket undolanditem = (UndoLandPacket)Pack; + + #region Packet Session and User Check + if (m_checkPackets) + { + if (undolanditem.AgentData.SessionID != SessionId || + undolanditem.AgentData.AgentID != AgentId) + return true; + } + #endregion + + LandUndo handlerOnUndo = OnLandUndo; + if (handlerOnUndo != null) + { + handlerOnUndo(this); + } + return true; + } + + private bool HandleRedo(IClientAPI sender, Packet Pack) + { + RedoPacket redoitem = (RedoPacket)Pack; + + #region Packet Session and User Check + if (m_checkPackets) + { + if (redoitem.AgentData.SessionID != SessionId || + redoitem.AgentData.AgentID != AgentId) + return true; + } + #endregion + + if (redoitem.ObjectData.Length > 0) + { + for (int i = 0; i < redoitem.ObjectData.Length; i++) + { + UUID objiD = redoitem.ObjectData[i].ObjectID; + AgentSit handlerOnRedo = OnRedo; + if (handlerOnRedo != null) + { + handlerOnRedo(this, objiD); + } + + } + } + return true; + } + private bool HandleObjectDuplicateOnRay(IClientAPI sender, Packet Pack) { ObjectDuplicateOnRayPacket dupeOnRay = (ObjectDuplicateOnRayPacket)Pack; diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index 61b6d65cc7..406999167f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs @@ -148,13 +148,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID) { ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); - if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) + try { - avatar.Invulnerable = false; + if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) + { + avatar.Invulnerable = false; + } + else + { + avatar.Invulnerable = true; + } } - else + catch (Exception ex) { - avatar.Invulnerable = true; } } } diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs index 37f1f2eb9f..1f5a4ffad4 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs @@ -60,7 +60,7 @@ namespace OpenSim.Region.CoreModules.World.Sound } public virtual void PlayAttachedSound( - UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags) + UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius) { foreach (ScenePresence p in m_scene.GetAvatars()) { @@ -69,14 +69,17 @@ namespace OpenSim.Region.CoreModules.World.Sound continue; // Scale by distance - gain = (float)((double)gain*((100.0 - dis) / 100.0)); + if (radius == 0) + gain = (float)((double)gain * ((100.0 - dis) / 100.0)); + else + gain = (float)((double)gain * ((radius - dis) / radius)); p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); } } public virtual void TriggerSound( - UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle) + UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius) { foreach (ScenePresence p in m_scene.GetAvatars()) { @@ -85,7 +88,10 @@ namespace OpenSim.Region.CoreModules.World.Sound continue; // Scale by distance - gain = (float)((double)gain*((100.0 - dis) / 100.0)); + if (radius == 0) + gain = (float)((double)gain * ((100.0 - dis) / 100.0)); + else + gain = (float)((double)gain * ((radius - dis) / radius)); p.ControllingClient.SendTriggeredSound( soundId, ownerID, objectID, parentID, handle, position, (float)gain); diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index a40828b080..1e7ea7bce6 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -84,6 +84,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain private ITerrainChannel m_revert; private Scene m_scene; private volatile bool m_tainted; + private readonly UndoStack m_undo = new UndoStack(5); #region ICommandableModule Members @@ -174,6 +175,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain #region ITerrainModule Members + public void UndoTerrain(ITerrainChannel channel) + { + m_channel = channel; + } + /// /// Loads a terrain file from disk and installs it in the scene. /// @@ -574,6 +580,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain { client.OnModifyTerrain += client_OnModifyTerrain; client.OnBakeTerrain += client_OnBakeTerrain; + client.OnLandUndo += client_OnLandUndo; } /// @@ -664,6 +671,19 @@ namespace OpenSim.Region.CoreModules.World.Terrain return changesLimited; } + private void client_OnLandUndo(IClientAPI client) + { + lock (m_undo) + { + if (m_undo.Count > 0) + { + LandUndoState goback = m_undo.Pop(); + if (goback != null) + goback.PlaybackState(); + } + } + } + /// /// Sends a copy of the current terrain to the scenes clients /// @@ -718,6 +738,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain } if (allowed) { + StoreUndoState(); m_painteffects[(StandardTerrainEffects) action].PaintEffect( m_channel, allowMask, west, south, height, size, seconds); @@ -758,6 +779,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain if (allowed) { + StoreUndoState(); m_floodeffects[(StandardTerrainEffects) action].FloodEffect( m_channel, fillArea, size); @@ -782,6 +804,25 @@ namespace OpenSim.Region.CoreModules.World.Terrain } } + private void StoreUndoState() + { + lock (m_undo) + { + if (m_undo.Count > 0) + { + LandUndoState last = m_undo.Peek(); + if (last != null) + { + if (last.Compare(m_channel)) + return; + } + } + + LandUndoState nUndo = new LandUndoState(this, m_channel); + m_undo.Push(nUndo); + } + } + #region Console Commands private void InterfaceLoadFile(Object[] args) diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 0bd1a26c41..ce9362f0b9 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -194,6 +194,8 @@ namespace OpenSim.Region.Examples.SimpleModule public event ObjectBuy OnObjectBuy; public event BuyObjectInventory OnBuyObjectInventory; public event AgentSit OnUndo; + public event AgentSit OnRedo; + public event LandUndo OnLandUndo; public event ForceReleaseControls OnForceReleaseControls; diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs index 379fabdf03..6117a80d9e 100644 --- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs @@ -32,9 +32,9 @@ namespace OpenSim.Region.Framework.Interfaces { public interface ISoundModule { - void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags); + void PlayAttachedSound(UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius); void TriggerSound( - UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle); + UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius); } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs index 7caac55e9e..5947afb927 100644 --- a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs @@ -62,5 +62,7 @@ namespace OpenSim.Region.Framework.Interfaces void SaveToStream(string filename, Stream stream); void InstallPlugin(string name, ITerrainEffect plug); + + void UndoTerrain(ITerrainChannel channel); } } diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index fd526eb214..712dcc70e8 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -418,15 +418,12 @@ namespace OpenSim.Region.Framework.Scenes.Animation { if (m_scenePresence.IsChildAgent) return; - - UUID[] animIDs; - int[] sequenceNums; - UUID[] objectIDs; - m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs); - - m_scenePresence.ControllingClient.SendAnimations( - animIDs, sequenceNums, m_scenePresence.ControllingClient.AgentId, objectIDs); + m_scenePresence.Scene.ForEachScenePresence( + delegate(ScenePresence SP) + { + SP.Animator.SendAnimPack(); + }); } /// diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2909311e07..c7fb32afb1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1976,6 +1976,23 @@ namespace OpenSim.Region.Framework.Scenes return; } + if (grp.RootPart.RETURN_AT_EDGE) + { + // We remove the object here + try + { + List objects = new List(); + objects.Add(grp); + SceneObjectGroup[] objectsArray = objects.ToArray(); + returnObjects(objectsArray, UUID.Zero); + } + catch (Exception) + { + m_log.Warn("[DATABASE]: exception when trying to return the prim that crossed the border."); + } + return; + } + int thisx = (int)RegionInfo.RegionLocX; int thisy = (int)RegionInfo.RegionLocY; Vector3 EastCross = new Vector3(0.1f,0,0); @@ -2044,19 +2061,25 @@ namespace OpenSim.Region.Framework.Scenes Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S); //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize) - if (crossedBordery.BorderLine.Z > 0) + try { - pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); - changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); - } - else - pos.Y = ((pos.Y + Constants.RegionSize)); + if (crossedBordery.BorderLine.Z > 0) + { + pos.Y = ((pos.Y + crossedBordery.BorderLine.Z)); + changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize); + } + else + pos.Y = ((pos.Y + Constants.RegionSize)); - newRegionHandle - = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize), - (uint)((thisy + changeY) * Constants.RegionSize)); - // x - 1 - // y + 1 + newRegionHandle + = Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize), + (uint)((thisy + changeY) * Constants.RegionSize)); + // x - 1 + // y + 1 + } + catch (Exception ex) + { + } } else { @@ -2684,6 +2707,7 @@ namespace OpenSim.Region.Framework.Scenes client.OnGrabUpdate += ProcessObjectGrabUpdate; client.OnDeGrabObject += ProcessObjectDeGrab; client.OnUndo += m_sceneGraph.HandleUndo; + client.OnRedo += m_sceneGraph.HandleRedo; client.OnObjectDescription += m_sceneGraph.PrimDescription; client.OnObjectDrop += m_sceneGraph.DropObject; client.OnObjectSaleInfo += ObjectSaleInfo; @@ -2838,6 +2862,7 @@ namespace OpenSim.Region.Framework.Scenes client.OnGrabObject -= ProcessObjectGrab; client.OnDeGrabObject -= ProcessObjectDeGrab; client.OnUndo -= m_sceneGraph.HandleUndo; + client.OnRedo -= m_sceneGraph.HandleRedo; client.OnObjectDescription -= m_sceneGraph.PrimDescription; client.OnObjectDrop -= m_sceneGraph.DropObject; client.OnObjectSaleInfo -= ObjectSaleInfo; diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 1ac061a1b2..2b131812cc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -452,6 +452,15 @@ namespace OpenSim.Region.Framework.Scenes part.Undo(); } } + protected internal void HandleRedo(IClientAPI remoteClient, UUID primId) + { + if (primId != UUID.Zero) + { + SceneObjectPart part = m_parentScene.GetSceneObjectPart(primId); + if (part != null) + part.Redo(); + } + } protected internal void HandleObjectGroupUpdate( IClientAPI remoteClient, UUID GroupID, uint objectLocalID, UUID Garbage) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index af466593bc..fe9dd9bed3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -298,7 +298,16 @@ namespace OpenSim.Region.Framework.Scenes { m_scene.CrossPrimGroupIntoNewRegion(val, this, true); } - + if (RootPart.GetStatusSandbox()) + { + if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10) + { + RootPart.ScriptSetPhysicsStatus(false); + Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"), + ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false); + return; + } + } lock (m_parts) { foreach (SceneObjectPart part in m_parts.Values) @@ -398,6 +407,34 @@ namespace OpenSim.Region.Framework.Scenes } } + private SceneObjectPart m_PlaySoundMasterPrim = null; + public SceneObjectPart PlaySoundMasterPrim + { + get { return m_PlaySoundMasterPrim; } + set { m_PlaySoundMasterPrim = value; } + } + + private List m_PlaySoundSlavePrims = new List(); + public List PlaySoundSlavePrims + { + get { return m_LoopSoundSlavePrims; } + set { m_LoopSoundSlavePrims = value; } + } + + private SceneObjectPart m_LoopSoundMasterPrim = null; + public SceneObjectPart LoopSoundMasterPrim + { + get { return m_LoopSoundMasterPrim; } + set { m_LoopSoundMasterPrim = value; } + } + + private List m_LoopSoundSlavePrims = new List(); + public List LoopSoundSlavePrims + { + get { return m_LoopSoundSlavePrims; } + set { m_LoopSoundSlavePrims = value; } + } + // The UUID for the Region this Object is in. public UUID RegionUUID { @@ -1779,32 +1816,6 @@ namespace OpenSim.Region.Framework.Scenes } } - public void rotLookAt(Quaternion target, float strength, float damping) - { - SceneObjectPart rootpart = m_rootPart; - if (rootpart != null) - { - if (IsAttachment) - { - /* - ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); - if (avatar != null) - { - Rotate the Av? - } */ - } - else - { - if (rootpart.PhysActor != null) - { - rootpart.PhysActor.APIDTarget = new Quaternion(target.X, target.Y, target.Z, target.W); - rootpart.PhysActor.APIDStrength = strength; - rootpart.PhysActor.APIDDamping = damping; - rootpart.PhysActor.APIDActive = true; - } - } - } - } public void stopLookAt() { SceneObjectPart rootpart = m_rootPart; @@ -1963,6 +1974,8 @@ namespace OpenSim.Region.Framework.Scenes foreach (SceneObjectPart part in m_parts.Values) { + if (!IsSelected) + part.UpdateLookAt(); part.SendScheduledUpdates(); } } @@ -2452,11 +2465,14 @@ namespace OpenSim.Region.Framework.Scenes { if (m_rootPart.PhysActor.IsPhysical) { - Vector3 llmoveforce = pos - AbsolutePosition; - Vector3 grabforce = llmoveforce; - grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass; - m_rootPart.PhysActor.AddForce(grabforce,true); - m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); + if (!m_rootPart.BlockGrab) + { + Vector3 llmoveforce = pos - AbsolutePosition; + Vector3 grabforce = llmoveforce; + grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass; + m_rootPart.PhysActor.AddForce(grabforce, true); + m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); + } } else { @@ -2812,6 +2828,7 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart part = GetChildPart(localID); if (part != null) { + part.IgnoreUndoUpdate = true; if (scale.X > m_scene.m_maxNonphys) scale.X = m_scene.m_maxNonphys; if (scale.Y > m_scene.m_maxNonphys) @@ -2839,6 +2856,7 @@ namespace OpenSim.Region.Framework.Scenes { if (obPart.UUID != m_rootPart.UUID) { + obPart.IgnoreUndoUpdate = true; Vector3 oldSize = new Vector3(obPart.Scale); float f = 1.0f; @@ -2898,6 +2916,8 @@ namespace OpenSim.Region.Framework.Scenes z *= a; } } + obPart.IgnoreUndoUpdate = false; + obPart.StoreUndoState(); } } } @@ -2913,6 +2933,7 @@ namespace OpenSim.Region.Framework.Scenes { foreach (SceneObjectPart obPart in m_parts.Values) { + obPart.IgnoreUndoUpdate = true; if (obPart.UUID != m_rootPart.UUID) { Vector3 currentpos = new Vector3(obPart.OffsetPosition); @@ -2926,6 +2947,8 @@ namespace OpenSim.Region.Framework.Scenes obPart.Resize(newSize); obPart.UpdateOffSet(currentpos); } + obPart.IgnoreUndoUpdate = false; + obPart.StoreUndoState(); } } @@ -2935,6 +2958,8 @@ namespace OpenSim.Region.Framework.Scenes m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); } + part.IgnoreUndoUpdate = false; + part.StoreUndoState(); HasGroupChanged = true; ScheduleGroupForTerseUpdate(); } @@ -2950,13 +2975,26 @@ namespace OpenSim.Region.Framework.Scenes /// public void UpdateGroupPosition(Vector3 pos) { + foreach (SceneObjectPart part in Children.Values) + { + part.StoreUndoState(); + } if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) { if (IsAttachment) { m_rootPart.AttachedPos = pos; } - + if (RootPart.GetStatusSandbox()) + { + if (Util.GetDistanceTo(RootPart.StatusSandboxPos, pos) > 10) + { + RootPart.ScriptSetPhysicsStatus(false); + pos = AbsolutePosition; + Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"), + ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false); + } + } AbsolutePosition = pos; HasGroupChanged = true; @@ -2975,7 +3013,10 @@ namespace OpenSim.Region.Framework.Scenes public void UpdateSinglePosition(Vector3 pos, uint localID) { SceneObjectPart part = GetChildPart(localID); - + foreach (SceneObjectPart parts in Children.Values) + { + parts.StoreUndoState(); + } if (part != null) { if (part.UUID == m_rootPart.UUID) @@ -2997,6 +3038,10 @@ namespace OpenSim.Region.Framework.Scenes /// private void UpdateRootPosition(Vector3 pos) { + foreach (SceneObjectPart part in Children.Values) + { + part.StoreUndoState(); + } Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); Vector3 oldPos = new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X, @@ -3040,6 +3085,10 @@ namespace OpenSim.Region.Framework.Scenes /// public void UpdateGroupRotationR(Quaternion rot) { + foreach (SceneObjectPart parts in Children.Values) + { + parts.StoreUndoState(); + } m_rootPart.UpdateRotation(rot); PhysicsActor actor = m_rootPart.PhysActor; @@ -3060,6 +3109,10 @@ namespace OpenSim.Region.Framework.Scenes /// public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot) { + foreach (SceneObjectPart parts in Children.Values) + { + parts.StoreUndoState(); + } m_rootPart.UpdateRotation(rot); PhysicsActor actor = m_rootPart.PhysActor; @@ -3083,6 +3136,10 @@ namespace OpenSim.Region.Framework.Scenes public void UpdateSingleRotation(Quaternion rot, uint localID) { SceneObjectPart part = GetChildPart(localID); + foreach (SceneObjectPart parts in Children.Values) + { + parts.StoreUndoState(); + } if (part != null) { if (part.UUID == m_rootPart.UUID) @@ -3113,8 +3170,11 @@ namespace OpenSim.Region.Framework.Scenes } else { + part.IgnoreUndoUpdate = true; part.UpdateRotation(rot); part.OffsetPosition = pos; + part.IgnoreUndoUpdate = false; + part.StoreUndoState(); } } } @@ -3128,6 +3188,7 @@ namespace OpenSim.Region.Framework.Scenes Quaternion axRot = rot; Quaternion oldParentRot = m_rootPart.RotationOffset; + m_rootPart.StoreUndoState(); m_rootPart.UpdateRotation(rot); if (m_rootPart.PhysActor != null) { @@ -3141,6 +3202,7 @@ namespace OpenSim.Region.Framework.Scenes { if (prim.UUID != m_rootPart.UUID) { + prim.IgnoreUndoUpdate = true; Vector3 axPos = prim.OffsetPosition; axPos *= oldParentRot; axPos *= Quaternion.Inverse(axRot); @@ -3153,7 +3215,14 @@ namespace OpenSim.Region.Framework.Scenes } } } - + foreach (SceneObjectPart childpart in Children.Values) + { + if (childpart != m_rootPart) + { + childpart.IgnoreUndoUpdate = false; + childpart.StoreUndoState(); + } + } m_rootPart.ScheduleTerseUpdate(); } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index dd797fcdae..d339208142 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -133,6 +133,18 @@ namespace OpenSim.Region.Framework.Scenes [XmlIgnore] public bool DIE_AT_EDGE; + [XmlIgnore] + public bool RETURN_AT_EDGE; + + [XmlIgnore] + public bool BlockGrab; + + [XmlIgnore] + public bool StatusSandbox; + + [XmlIgnore] + public Vector3 StatusSandboxPos; + // TODO: This needs to be persisted in next XML version update! [XmlIgnore] public readonly int[] PayPrice = {-2,-2,-2,-2,-2}; @@ -219,6 +231,15 @@ namespace OpenSim.Region.Framework.Scenes [XmlIgnore] public Quaternion SpinOldOrientation = Quaternion.Identity; + [XmlIgnore] + public Quaternion m_APIDTarget = Quaternion.Identity; + + [XmlIgnore] + public float m_APIDDamp = 0; + + [XmlIgnore] + public float m_APIDStrength = 0; + /// /// This part's inventory /// @@ -232,6 +253,9 @@ namespace OpenSim.Region.Framework.Scenes [XmlIgnore] public bool Undoing; + [XmlIgnore] + public bool IgnoreUndoUpdate = false; + [XmlIgnore] private PrimFlags LocalFlags; [XmlIgnore] @@ -253,6 +277,7 @@ namespace OpenSim.Region.Framework.Scenes private string m_text = String.Empty; private string m_touchName = String.Empty; private readonly UndoStack m_undo = new UndoStack(5); + private readonly UndoStack m_redo = new UndoStack(5); private UUID _creatorID; private bool m_passTouches; @@ -501,6 +526,27 @@ namespace OpenSim.Region.Framework.Scenes } } + [XmlIgnore] + public Quaternion APIDTarget + { + get { return m_APIDTarget; } + set { m_APIDTarget = value; } + } + + [XmlIgnore] + public float APIDDamp + { + get { return m_APIDDamp; } + set { m_APIDDamp = value; } + } + + [XmlIgnore] + public float APIDStrength + { + get { return m_APIDStrength; } + set { m_APIDStrength = value; } + } + public ulong RegionHandle { get { return m_regionHandle; } @@ -512,6 +558,33 @@ namespace OpenSim.Region.Framework.Scenes get { return m_scriptAccessPin; } set { m_scriptAccessPin = (int)value; } } + private SceneObjectPart m_PlaySoundMasterPrim = null; + public SceneObjectPart PlaySoundMasterPrim + { + get { return m_PlaySoundMasterPrim; } + set { m_PlaySoundMasterPrim = value; } + } + + private List m_PlaySoundSlavePrims = new List(); + public List PlaySoundSlavePrims + { + get { return m_LoopSoundSlavePrims; } + set { m_LoopSoundSlavePrims = value; } + } + + private SceneObjectPart m_LoopSoundMasterPrim = null; + public SceneObjectPart LoopSoundMasterPrim + { + get { return m_LoopSoundMasterPrim; } + set { m_LoopSoundMasterPrim = value; } + } + + private List m_LoopSoundSlavePrims = new List(); + public List LoopSoundSlavePrims + { + get { return m_LoopSoundSlavePrims; } + set { m_LoopSoundSlavePrims = value; } + } [XmlIgnore] public Byte[] TextureAnimation @@ -573,8 +646,6 @@ namespace OpenSim.Region.Framework.Scenes } set { - StoreUndoState(); - m_groupPosition = value; PhysicsActor actor = PhysActor; @@ -1401,6 +1472,10 @@ namespace OpenSim.Region.Framework.Scenes { m_undo.Clear(); } + lock (m_redo) + { + m_redo.Clear(); + } StoreUndoState(); } @@ -1711,6 +1786,66 @@ namespace OpenSim.Region.Framework.Scenes return m_parentGroup.RootPart.DIE_AT_EDGE; } + public bool GetReturnAtEdge() + { + if (m_parentGroup == null) + return false; + if (m_parentGroup.IsDeleted) + return false; + + return m_parentGroup.RootPart.RETURN_AT_EDGE; + } + + public void SetReturnAtEdge(bool p) + { + if (m_parentGroup == null) + return; + if (m_parentGroup.IsDeleted) + return; + + m_parentGroup.RootPart.RETURN_AT_EDGE = p; + } + + public bool GetBlockGrab() + { + if (m_parentGroup == null) + return false; + if (m_parentGroup.IsDeleted) + return false; + + return m_parentGroup.RootPart.BlockGrab; + } + + public void SetBlockGrab(bool p) + { + if (m_parentGroup == null) + return; + if (m_parentGroup.IsDeleted) + return; + + m_parentGroup.RootPart.BlockGrab = p; + } + + public void SetStatusSandbox(bool p) + { + if (m_parentGroup == null) + return; + if (m_parentGroup.IsDeleted) + return; + StatusSandboxPos = m_parentGroup.RootPart.AbsolutePosition; + m_parentGroup.RootPart.StatusSandbox = p; + } + + public bool GetStatusSandbox() + { + if (m_parentGroup == null) + return false; + if (m_parentGroup.IsDeleted) + return false; + + return m_parentGroup.RootPart.StatusSandbox; + } + public int GetAxisRotation(int axis) { //Cannot use ScriptBaseClass constants as no referance to it currently. @@ -1917,7 +2052,7 @@ namespace OpenSim.Region.Framework.Scenes // play the sound. if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f) { - SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0); + SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); } if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0) @@ -2491,9 +2626,8 @@ namespace OpenSim.Region.Framework.Scenes List avatarts = m_parentGroup.Scene.GetAvatars(); foreach (ScenePresence p in avatarts) { - // TODO: some filtering by distance of avatar - - p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); + if (!(Util.GetDistanceTo(p.AbsolutePosition, AbsolutePosition) >= 100)) + p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); } } @@ -2554,7 +2688,38 @@ namespace OpenSim.Region.Framework.Scenes public void RotLookAt(Quaternion target, float strength, float damping) { - m_parentGroup.rotLookAt(target, strength, damping); + rotLookAt(target, strength, damping); + } + + public void rotLookAt(Quaternion target, float strength, float damping) + { + if (IsAttachment) + { + /* + ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); + if (avatar != null) + { + Rotate the Av? + } */ + } + else + { + APIDDamp = damping; + APIDStrength = strength; + APIDTarget = target; + } + } + + public void startLookAt(Quaternion rot, float damp, float strength) + { + APIDDamp = damp; + APIDStrength = strength; + APIDTarget = rot; + } + + public void stopLookAt() + { + APIDTarget = Quaternion.Identity; } /// @@ -2814,7 +2979,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - public void SendSound(string sound, double volume, bool triggered, byte flags) + public void SendSound(string sound, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster) { if (volume > 1) volume = 1; @@ -2850,10 +3015,51 @@ namespace OpenSim.Region.Framework.Scenes ISoundModule soundModule = m_parentGroup.Scene.RequestModuleInterface(); if (soundModule != null) { - if (triggered) - soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle); + if (useMaster) + { + if (isMaster) + { + if (triggered) + soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); + else + soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); + ParentGroup.PlaySoundMasterPrim = this; + ownerID = this._ownerID; + objectID = this.UUID; + parentID = this.GetRootPartUUID(); + position = this.AbsolutePosition; // region local + regionHandle = this.ParentGroup.Scene.RegionInfo.RegionHandle; + if (triggered) + soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); + else + soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); + foreach (SceneObjectPart prim in ParentGroup.PlaySoundSlavePrims) + { + ownerID = prim._ownerID; + objectID = prim.UUID; + parentID = prim.GetRootPartUUID(); + position = prim.AbsolutePosition; // region local + regionHandle = prim.ParentGroup.Scene.RegionInfo.RegionHandle; + if (triggered) + soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); + else + soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); + } + ParentGroup.PlaySoundSlavePrims.Clear(); + ParentGroup.PlaySoundMasterPrim = null; + } + else + { + ParentGroup.PlaySoundSlavePrims.Add(this); + } + } else - soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags); + { + if (triggered) + soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); + else + soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); + } } } @@ -3156,6 +3362,14 @@ namespace OpenSim.Region.Framework.Scenes hasProfileCut = hasDimple; // is it the same thing? } + public void SetVehicleFlags(int param, bool remove) + { + if (PhysActor != null) + { + PhysActor.VehicleFlags(param, remove); + } + } + public void SetGroup(UUID groupID, IClientAPI client) { _groupID = groupID; @@ -3260,27 +3474,30 @@ namespace OpenSim.Region.Framework.Scenes { if (!Undoing) { - if (m_parentGroup != null) + if (!IgnoreUndoUpdate) { - lock (m_undo) + if (m_parentGroup != null) { - if (m_undo.Count > 0) + lock (m_undo) { - UndoState last = m_undo.Peek(); - if (last != null) + if (m_undo.Count > 0) { - if (last.Compare(this)) - return; + UndoState last = m_undo.Peek(); + if (last != null) + { + if (last.Compare(this)) + return; + } } + + if (m_parentGroup.GetSceneMaxUndo() > 0) + { + UndoState nUndo = new UndoState(this); + + m_undo.Push(nUndo); + } + } - - if (m_parentGroup.GetSceneMaxUndo() > 0) - { - UndoState nUndo = new UndoState(this); - - m_undo.Push(nUndo); - } - } } } @@ -3751,14 +3968,39 @@ namespace OpenSim.Region.Framework.Scenes lock (m_undo) { if (m_undo.Count > 0) + { + UndoState nUndo = null; + if (m_parentGroup.GetSceneMaxUndo() > 0) { - UndoState goback = m_undo.Pop(); - if (goback != null) - goback.PlaybackState(this); + nUndo = new UndoState(this); + } + UndoState goback = m_undo.Pop(); + if (goback != null) + { + goback.PlaybackState(this); + if (nUndo != null) + m_redo.Push(nUndo); + } } } } + public void Redo() + { + lock (m_redo) + { + if (m_parentGroup.GetSceneMaxUndo() > 0) + { + UndoState nUndo = new UndoState(this); + + m_undo.Push(nUndo); + } + UndoState gofwd = m_redo.Pop(); + if (gofwd != null) + gofwd.PlayfwdState(this); + } + } + public void UpdateExtraParam(ushort type, bool inUse, byte[] data) { m_shape.ReadInUpdateExtraParam(type, inUse, data); @@ -3802,6 +4044,18 @@ namespace OpenSim.Region.Framework.Scenes (pos.Z != OffsetPosition.Z)) { Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); + + if (ParentGroup.RootPart.GetStatusSandbox()) + { + if (Util.GetDistanceTo(ParentGroup.RootPart.StatusSandboxPos, newPos) > 10) + { + ParentGroup.RootPart.ScriptSetPhysicsStatus(false); + newPos = OffsetPosition; + ParentGroup.Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"), + ChatTypeEnum.DebugChannel, 0x7FFFFFFF, ParentGroup.RootPart.AbsolutePosition, Name, UUID, false); + } + } + OffsetPosition = newPos; ScheduleTerseUpdate(); } @@ -4094,7 +4348,6 @@ namespace OpenSim.Region.Framework.Scenes (rot.Z != RotationOffset.Z) || (rot.W != RotationOffset.W)) { - //StoreUndoState(); RotationOffset = rot; ParentGroup.HasGroupChanged = true; ScheduleTerseUpdate(); @@ -4396,5 +4649,36 @@ namespace OpenSim.Region.Framework.Scenes Inventory.ApplyNextOwnerPermissions(); } + public void UpdateLookAt() + { + try + { + if (APIDTarget != Quaternion.Identity) + { + if (Single.IsNaN(APIDTarget.W) == true) + { + APIDTarget = Quaternion.Identity; + return; + } + Quaternion rot = RotationOffset; + Quaternion dir = (rot - APIDTarget); + float speed = ((APIDStrength / APIDDamp) * (float)(Math.PI / 180.0f)); + if (dir.Z > speed) + { + rot.Z -= speed; + } + if (dir.Z < -speed) + { + rot.Z += speed; + } + rot.Normalize(); + UpdateRotation(rot); + } + } + catch (Exception ex) + { + m_log.Error("[Physics] " + ex); + } + } } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9c7559b2ec..675fb690fc 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -164,6 +164,8 @@ namespace OpenSim.Region.Framework.Scenes private Quaternion m_bodyRot= Quaternion.Identity; + private Quaternion m_bodyRotPrevious = Quaternion.Identity; + private const int LAND_VELOCITYMAG_MAX = 12; public bool IsRestrictedToRegion; @@ -508,6 +510,12 @@ namespace OpenSim.Region.Framework.Scenes set { m_bodyRot = value; } } + public Quaternion PreviousRotation + { + get { return m_bodyRotPrevious; } + set { m_bodyRotPrevious = value; } + } + /// /// If this is true, agent doesn't have a representation in this scene. /// this is an agent 'looking into' this scene from a nearby scene(region) @@ -824,6 +832,31 @@ namespace OpenSim.Region.Framework.Scenes if (pos.X < 0 || pos.Y < 0 || pos.Z < 0) { Vector3 emergencyPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128); + + if (pos.X < 0) + { + emergencyPos.X = (int)Constants.RegionSize + pos.X; + if (!(pos.Y < 0)) + emergencyPos.Y = pos.Y; + if (!(pos.Z < 0)) + emergencyPos.X = pos.X; + } + if (pos.Y < 0) + { + emergencyPos.Y = (int)Constants.RegionSize + pos.Y; + if (!(pos.X < 0)) + emergencyPos.X = pos.X; + if (!(pos.Z < 0)) + emergencyPos.Z = pos.Z; + } + if (pos.Z < 0) + { + if (!(pos.X < 0)) + emergencyPos.X = pos.X; + if (!(pos.Y < 0)) + emergencyPos.Y = pos.Y; + //Leave as 128 + } m_log.WarnFormat( "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", @@ -1193,6 +1226,14 @@ namespace OpenSim.Region.Framework.Scenes } else { + if (m_pos.X < 0) + m_pos.X = 128; + if (m_pos.Y < 0) + m_pos.Y = 128; + if (m_pos.X > Scene.WestBorders[0].BorderLine.X) + m_pos.X = 128; + if (m_pos.Y > Scene.NorthBorders[0].BorderLine.Y) + m_pos.Y = 128; m_LastFinitePos = m_pos; } @@ -2704,36 +2745,72 @@ namespace OpenSim.Region.Framework.Scenes { // Checks if where it's headed exists a region + bool needsTransit = false; if (m_scene.TestBorderCross(pos2, Cardinals.W)) { if (m_scene.TestBorderCross(pos2, Cardinals.S)) + { + needsTransit = true; neighbor = HaveNeighbor(Cardinals.SW, ref fix); + } else if (m_scene.TestBorderCross(pos2, Cardinals.N)) + { + needsTransit = true; neighbor = HaveNeighbor(Cardinals.NW, ref fix); + } else + { + needsTransit = true; neighbor = HaveNeighbor(Cardinals.W, ref fix); + } } else if (m_scene.TestBorderCross(pos2, Cardinals.E)) { if (m_scene.TestBorderCross(pos2, Cardinals.S)) + { + needsTransit = true; neighbor = HaveNeighbor(Cardinals.SE, ref fix); + } else if (m_scene.TestBorderCross(pos2, Cardinals.N)) + { + needsTransit = true; neighbor = HaveNeighbor(Cardinals.NE, ref fix); + } else + { + needsTransit = true; neighbor = HaveNeighbor(Cardinals.E, ref fix); + } } else if (m_scene.TestBorderCross(pos2, Cardinals.S)) + { + needsTransit = true; neighbor = HaveNeighbor(Cardinals.S, ref fix); + } else if (m_scene.TestBorderCross(pos2, Cardinals.N)) + { + needsTransit = true; neighbor = HaveNeighbor(Cardinals.N, ref fix); + } + - // Makes sure avatar does not end up outside region - if (neighbor < 0) - AbsolutePosition = new Vector3( - AbsolutePosition.X + 3*fix[0], - AbsolutePosition.Y + 3*fix[1], - AbsolutePosition.Z); + if (neighbor <= 0) + { + if (!needsTransit) + { + Vector3 pos = AbsolutePosition; + if (AbsolutePosition.X < 0) + pos.X += Velocity.Y; + else if (AbsolutePosition.X > Constants.RegionSize) + pos.X -= Velocity.Y; + if (AbsolutePosition.Y < 0) + pos.Y += Velocity.Y; + else if (AbsolutePosition.Y > Constants.RegionSize) + pos.Y -= Velocity.Y; + AbsolutePosition = pos; + } + } else if (neighbor > 0) CrossToNewRegion(); } diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs index 713ff69d32..55e407ec5f 100644 --- a/OpenSim/Region/Framework/Scenes/UndoState.cs +++ b/OpenSim/Region/Framework/Scenes/UndoState.cs @@ -26,6 +26,7 @@ */ using OpenMetaverse; +using OpenSim.Region.Framework.Interfaces; namespace OpenSim.Region.Framework.Scenes { @@ -35,29 +36,21 @@ namespace OpenSim.Region.Framework.Scenes public Vector3 Scale = Vector3.Zero; public Quaternion Rotation = Quaternion.Identity; - public UndoState(Vector3 pos, Quaternion rot, Vector3 scale) - { - Position = pos; - Rotation = rot; - Scale = scale; - } - public UndoState(SceneObjectPart part) { if (part != null) { if (part.ParentID == 0) { - Position = part.AbsolutePosition; + Position = part.ParentGroup.AbsolutePosition; Rotation = part.RotationOffset; - + Scale = part.Shape.Scale; } else { Position = part.OffsetPosition; Rotation = part.RotationOffset; Scale = part.Shape.Scale; - } } } @@ -68,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes { if (part.ParentID == 0) { - if (Position == part.AbsolutePosition && Rotation == part.RotationOffset) + if (Position == part.ParentGroup.AbsolutePosition && Rotation == part.ParentGroup.Rotation) return true; else return false; @@ -93,24 +86,78 @@ namespace OpenSim.Region.Framework.Scenes if (part.ParentID == 0) { - part.ParentGroup.AbsolutePosition = Position; - part.UpdateRotation(Rotation); + if (Position != Vector3.Zero) + part.ParentGroup.AbsolutePosition = Position; + part.RotationOffset = Rotation; + if (Scale != Vector3.Zero) + part.Resize(Scale); part.ParentGroup.ScheduleGroupForTerseUpdate(); } else { - part.OffsetPosition = Position; + if (Position != Vector3.Zero) + part.OffsetPosition = Position; part.UpdateRotation(Rotation); - part.Resize(Scale); + if (Scale != Vector3.Zero) + part.Resize(Scale); part.ScheduleTerseUpdate(); + } + part.Undoing = false; + + } + } + public void PlayfwdState(SceneObjectPart part) + { + if (part != null) + { + part.Undoing = true; + + if (part.ParentID == 0) + { + if (Position != Vector3.Zero) + part.ParentGroup.AbsolutePosition = Position; + if (Rotation != Quaternion.Identity) + part.UpdateRotation(Rotation); + if (Scale != Vector3.Zero) + part.Resize(Scale); + part.ParentGroup.ScheduleGroupForTerseUpdate(); + } + else + { + if (Position != Vector3.Zero) + part.OffsetPosition = Position; + if (Rotation != Quaternion.Identity) + part.UpdateRotation(Rotation); + if (Scale != Vector3.Zero) + part.Resize(Scale); part.ScheduleTerseUpdate(); } part.Undoing = false; } } + } + public class LandUndoState + { + public ITerrainModule m_terrainModule; + public ITerrainChannel m_terrainChannel; - public UndoState() + public LandUndoState(ITerrainModule terrainModule, ITerrainChannel terrainChannel) { + m_terrainModule = terrainModule; + m_terrainChannel = terrainChannel; + } + + public bool Compare(ITerrainChannel terrainChannel) + { + if (m_terrainChannel != terrainChannel) + return false; + else + return false; + } + + public void PlaybackState() + { + m_terrainModule.UndoTerrain(m_terrainChannel); } } } diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index b421623fb7..009dd37ad3 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -774,6 +774,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public event UUIDNameRequest OnTeleportHomeRequest; public event ScriptAnswer OnScriptAnswer; public event AgentSit OnUndo; + public event AgentSit OnRedo; + public event LandUndo OnLandUndo; public event ForceReleaseControls OnForceReleaseControls; public event GodLandStatRequest OnLandStatRequest; public event DetailedEstateDataRequest OnDetailedEstateDataRequest; diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs index 31f28e0355..5bfe4bedce 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs @@ -767,7 +767,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule if (!CanEdit()) return; - GetSOP().SendSound(asset.ToString(), volume, true, 0); + GetSOP().SendSound(asset.ToString(), volume, true, 0, 0, false, false); } #endregion diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs index c7cd37b2df..45bb005903 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs @@ -231,7 +231,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule if (soundModule != null) { soundModule.TriggerSound(audio, UUID.Zero, UUID.Zero, UUID.Zero, volume, position, - m_internalScene.RegionInfo.RegionHandle); + m_internalScene.RegionInfo.RegionHandle, 0); } } @@ -241,7 +241,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule if (soundModule != null) { soundModule.TriggerSound(audio, UUID.Zero, UUID.Zero, UUID.Zero, 1.0, position, - m_internalScene.RegionInfo.RegionHandle); + m_internalScene.RegionInfo.RegionHandle, 0); } } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 1d15552993..b331001a84 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -298,6 +298,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC public event ObjectBuy OnObjectBuy; public event BuyObjectInventory OnBuyObjectInventory; public event AgentSit OnUndo; + public event AgentSit OnRedo; + public event LandUndo OnLandUndo; public event ForceReleaseControls OnForceReleaseControls; public event GodLandStatRequest OnLandStatRequest; diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs index 31366db75b..5e2eeebc44 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs @@ -185,6 +185,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin } + public override void VehicleFlags(int param, bool remove) + { + + } + public override void SetVolumeDetect(int param) { diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs index 97eb6a2e5e..6a54705cb1 100644 --- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs +++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs @@ -362,6 +362,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin } + public override void VehicleFlags(int param, bool remove) + { + + } + public override void SetVolumeDetect(int param) { diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs index 9603ea4571..920ed96ee7 100644 --- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs +++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs @@ -397,6 +397,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin //TODO: } + public override void VehicleFlags(int param, bool remove) + { + + } + public override void SetVolumeDetect(int param) { //TODO: GhostObject diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index d5d146e11a..e2a6a2ed11 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs @@ -500,6 +500,18 @@ namespace OpenSim.Region.Physics.BulletXPlugin public BulletXScene(String sceneIdentifier) { //identifier = sceneIdentifier; + cDispatcher = new CollisionDispatcherLocal(this); + Vector3 worldMinDim = new Vector3((float)minXY, (float)minXY, (float)minZ); + Vector3 worldMaxDim = new Vector3((float)maxXY, (float)maxXY, (float)maxZ); + opCache = new AxisSweep3(worldMinDim, worldMaxDim, maxHandles); + sicSolver = new SequentialImpulseConstraintSolver(); + + lock (BulletXLock) + { + ddWorld = new DiscreteDynamicsWorld(cDispatcher, opCache, sicSolver); + ddWorld.Gravity = new Vector3(0, 0, -gravity); + } + //this._heightmap = new float[65536]; } public static float Gravity @@ -582,12 +594,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin pos.Y = position.Y; pos.Z = position.Z + 20; BulletXCharacter newAv = null; - newAv.Flying = isFlying; lock (BulletXLock) { newAv = new BulletXCharacter(avName, this, pos); _characters.Add(newAv.RigidBody, newAv); } + newAv.Flying = isFlying; return newAv; } @@ -983,6 +995,11 @@ namespace OpenSim.Region.Physics.BulletXPlugin public override void VehicleRotationParam(int param, OpenMetaverse.Quaternion rotation) { + } + + public override void VehicleFlags(int param, bool remove) + { + } public override void SetVolumeDetect(int param) diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 9c192ede80..880c3ea3cb 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs @@ -208,6 +208,7 @@ namespace OpenSim.Region.Physics.Manager public abstract void VehicleFloatParam(int param, float value); public abstract void VehicleVectorParam(int param, Vector3 value); public abstract void VehicleRotationParam(int param, Quaternion rotation); + public abstract void VehicleFlags(int param, bool remove); public abstract void SetVolumeDetect(int param); // Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more @@ -352,6 +353,11 @@ namespace OpenSim.Region.Physics.Manager } + public override void VehicleFlags(int param, bool remove) + { + + } + public override void SetVolumeDetect(int param) { diff --git a/OpenSim/Region/Physics/Manager/VehicleConstants.cs b/OpenSim/Region/Physics/Manager/VehicleConstants.cs index 532e55e5fc..f0775c1a8e 100644 --- a/OpenSim/Region/Physics/Manager/VehicleConstants.cs +++ b/OpenSim/Region/Physics/Manager/VehicleConstants.cs @@ -91,7 +91,9 @@ namespace OpenSim.Region.Physics.Manager BANKING_EFFICIENCY = 38, BANKING_MIX = 39, BANKING_TIMESCALE = 40, - REFERENCE_FRAME = 44 + REFERENCE_FRAME = 44, + BLOCK_EXIT = 45, + ROLL_FRAME = 46 } @@ -107,7 +109,13 @@ namespace OpenSim.Region.Physics.Manager LIMIT_MOTOR_UP = 64, MOUSELOOK_STEER = 128, MOUSELOOK_BANK = 256, - CAMERA_DECOUPLED = 512 + CAMERA_DECOUPLED = 512, + NO_X = 1024, + NO_Y = 2048, + NO_Z = 4096, + LOCK_HOVER_HEIGHT = 8192, + NO_DEFLECTION = 16392, + LOCK_ROTATION = 32784 } } diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 06ed8fb20d..a2229e8aa5 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -734,6 +734,11 @@ namespace OpenSim.Region.Physics.OdePlugin } + public override void VehicleFlags(int param, bool remove) + { + + } + public override void SetVolumeDetect(int param) { diff --git a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs index 008070b687..6ae0c8a53e 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs @@ -82,7 +82,9 @@ namespace OpenSim.Region.Physics.OdePlugin // HOVER_UP_ONLY // LIMIT_MOTOR_UP // LIMIT_ROLL_ONLY - + private VehicleFlag m_Hoverflags = (VehicleFlag)0; + private Vector3 m_BlockingEndPoint = Vector3.Zero; + private Quaternion m_RollreferenceFrame = Quaternion.Identity; // Linear properties private Vector3 m_linearMotorDirection = Vector3.Zero; // velocity requested by LSL, decayed by time private Vector3 m_linearMotorDirectionLASTSET = Vector3.Zero; // velocity requested by LSL @@ -91,6 +93,7 @@ namespace OpenSim.Region.Physics.OdePlugin private float m_linearMotorDecayTimescale = 0; private float m_linearMotorTimescale = 0; private Vector3 m_lastLinearVelocityVector = Vector3.Zero; + private d.Vector3 m_lastPositionVector = new d.Vector3(); // private bool m_LinearMotorSetLastFrame = false; // private Vector3 m_linearMotorOffset = Vector3.Zero; @@ -255,6 +258,9 @@ namespace OpenSim.Region.Physics.OdePlugin case Vehicle.LINEAR_MOTOR_OFFSET: // m_linearMotorOffset = new Vector3(pValue.X, pValue.Y, pValue.Z); break; + case Vehicle.BLOCK_EXIT: + m_BlockingEndPoint = new Vector3(pValue.X, pValue.Y, pValue.Z); + break; } }//end ProcessVectorVehicleParam @@ -265,15 +271,189 @@ namespace OpenSim.Region.Physics.OdePlugin case Vehicle.REFERENCE_FRAME: // m_referenceFrame = pValue; break; + case Vehicle.ROLL_FRAME: + m_RollreferenceFrame = pValue; + break; } }//end ProcessRotationVehicleParam + internal void ProcessVehicleFlags(int pParam, bool remove) + { + if (remove) + { + if (pParam == -1) + { + m_flags = (VehicleFlag)0; + m_Hoverflags = (VehicleFlag)0; + return; + } + if ((pParam & (int)VehicleFlag.HOVER_GLOBAL_HEIGHT) == (int)VehicleFlag.HOVER_GLOBAL_HEIGHT) + { + if ((m_Hoverflags & VehicleFlag.HOVER_GLOBAL_HEIGHT) != (VehicleFlag)0) + m_Hoverflags &= ~(VehicleFlag.HOVER_GLOBAL_HEIGHT); + } + if ((pParam & (int)VehicleFlag.HOVER_TERRAIN_ONLY) == (int)VehicleFlag.HOVER_TERRAIN_ONLY) + { + if ((m_Hoverflags & VehicleFlag.HOVER_TERRAIN_ONLY) != (VehicleFlag)0) + m_Hoverflags &= ~(VehicleFlag.HOVER_TERRAIN_ONLY); + } + if ((pParam & (int)VehicleFlag.HOVER_UP_ONLY) == (int)VehicleFlag.HOVER_UP_ONLY) + { + if ((m_Hoverflags & VehicleFlag.HOVER_UP_ONLY) != (VehicleFlag)0) + m_Hoverflags &= ~(VehicleFlag.HOVER_UP_ONLY); + } + if ((pParam & (int)VehicleFlag.HOVER_WATER_ONLY) == (int)VehicleFlag.HOVER_WATER_ONLY) + { + if ((m_Hoverflags & VehicleFlag.HOVER_WATER_ONLY) != (VehicleFlag)0) + m_Hoverflags &= ~(VehicleFlag.HOVER_WATER_ONLY); + } + if ((pParam & (int)VehicleFlag.LIMIT_MOTOR_UP) == (int)VehicleFlag.LIMIT_MOTOR_UP) + { + if ((m_flags & VehicleFlag.LIMIT_MOTOR_UP) != (VehicleFlag)0) + m_flags &= ~(VehicleFlag.LIMIT_MOTOR_UP); + } + if ((pParam & (int)VehicleFlag.LIMIT_ROLL_ONLY) == (int)VehicleFlag.LIMIT_ROLL_ONLY) + { + if ((m_flags & VehicleFlag.LIMIT_ROLL_ONLY) != (VehicleFlag)0) + m_flags &= ~(VehicleFlag.LIMIT_ROLL_ONLY); + } + if ((pParam & (int)VehicleFlag.MOUSELOOK_BANK) == (int)VehicleFlag.MOUSELOOK_BANK) + { + if ((m_flags & VehicleFlag.MOUSELOOK_BANK) != (VehicleFlag)0) + m_flags &= ~(VehicleFlag.MOUSELOOK_BANK); + } + if ((pParam & (int)VehicleFlag.MOUSELOOK_STEER) == (int)VehicleFlag.MOUSELOOK_STEER) + { + if ((m_flags & VehicleFlag.MOUSELOOK_STEER) != (VehicleFlag)0) + m_flags &= ~(VehicleFlag.MOUSELOOK_STEER); + } + if ((pParam & (int)VehicleFlag.NO_DEFLECTION_UP) == (int)VehicleFlag.NO_DEFLECTION_UP) + { + if ((m_flags & VehicleFlag.NO_DEFLECTION_UP) != (VehicleFlag)0) + m_flags &= ~(VehicleFlag.NO_DEFLECTION_UP); + } + if ((pParam & (int)VehicleFlag.CAMERA_DECOUPLED) == (int)VehicleFlag.CAMERA_DECOUPLED) + { + if ((m_flags & VehicleFlag.CAMERA_DECOUPLED) != (VehicleFlag)0) + m_flags &= ~(VehicleFlag.CAMERA_DECOUPLED); + } + if ((pParam & (int)VehicleFlag.NO_X) == (int)VehicleFlag.NO_X) + { + if ((m_flags & VehicleFlag.NO_X) != (VehicleFlag)0) + m_flags &= ~(VehicleFlag.NO_X); + } + if ((pParam & (int)VehicleFlag.NO_Y) == (int)VehicleFlag.NO_Y) + { + if ((m_flags & VehicleFlag.NO_Y) != (VehicleFlag)0) + m_flags &= ~(VehicleFlag.NO_Y); + } + if ((pParam & (int)VehicleFlag.NO_Z) == (int)VehicleFlag.NO_Z) + { + if ((m_flags & VehicleFlag.NO_Z) != (VehicleFlag)0) + m_flags &= ~(VehicleFlag.NO_Z); + } + if ((pParam & (int)VehicleFlag.LOCK_HOVER_HEIGHT) == (int)VehicleFlag.LOCK_HOVER_HEIGHT) + { + if ((m_Hoverflags & VehicleFlag.LOCK_HOVER_HEIGHT) != (VehicleFlag)0) + m_Hoverflags &= ~(VehicleFlag.LOCK_HOVER_HEIGHT); + } + if ((pParam & (int)VehicleFlag.NO_DEFLECTION) == (int)VehicleFlag.NO_DEFLECTION) + { + if ((m_flags & VehicleFlag.NO_DEFLECTION) != (VehicleFlag)0) + m_flags &= ~(VehicleFlag.NO_DEFLECTION); + } + if ((pParam & (int)VehicleFlag.LOCK_ROTATION) == (int)VehicleFlag.LOCK_ROTATION) + { + if ((m_flags & VehicleFlag.LOCK_ROTATION) != (VehicleFlag)0) + m_flags &= ~(VehicleFlag.LOCK_ROTATION); + } + } + else + { + if ((pParam & (int)VehicleFlag.HOVER_GLOBAL_HEIGHT) == (int)VehicleFlag.HOVER_GLOBAL_HEIGHT) + { + m_Hoverflags |= (VehicleFlag.HOVER_GLOBAL_HEIGHT | m_flags); + } + if ((pParam & (int)VehicleFlag.HOVER_TERRAIN_ONLY) == (int)VehicleFlag.HOVER_TERRAIN_ONLY) + { + m_Hoverflags |= (VehicleFlag.HOVER_TERRAIN_ONLY | m_flags); + } + if ((pParam & (int)VehicleFlag.HOVER_UP_ONLY) == (int)VehicleFlag.HOVER_UP_ONLY) + { + m_Hoverflags |= (VehicleFlag.HOVER_UP_ONLY | m_flags); + } + if ((pParam & (int)VehicleFlag.HOVER_WATER_ONLY) == (int)VehicleFlag.HOVER_WATER_ONLY) + { + m_Hoverflags |= (VehicleFlag.HOVER_WATER_ONLY | m_flags); + } + if ((pParam & (int)VehicleFlag.LIMIT_MOTOR_UP) == (int)VehicleFlag.LIMIT_MOTOR_UP) + { + m_flags |= (VehicleFlag.LIMIT_MOTOR_UP | m_flags); + } + if ((pParam & (int)VehicleFlag.MOUSELOOK_BANK) == (int)VehicleFlag.MOUSELOOK_BANK) + { + m_flags |= (VehicleFlag.MOUSELOOK_BANK | m_flags); + } + if ((pParam & (int)VehicleFlag.MOUSELOOK_STEER) == (int)VehicleFlag.MOUSELOOK_STEER) + { + m_flags |= (VehicleFlag.MOUSELOOK_STEER | m_flags); + } + if ((pParam & (int)VehicleFlag.NO_DEFLECTION_UP) == (int)VehicleFlag.NO_DEFLECTION_UP) + { + m_flags |= (VehicleFlag.NO_DEFLECTION_UP | m_flags); + } + if ((pParam & (int)VehicleFlag.CAMERA_DECOUPLED) == (int)VehicleFlag.CAMERA_DECOUPLED) + { + m_flags |= (VehicleFlag.CAMERA_DECOUPLED | m_flags); + } + if ((pParam & (int)VehicleFlag.NO_X) == (int)VehicleFlag.NO_X) + { + m_flags |= (VehicleFlag.NO_X); + } + if ((pParam & (int)VehicleFlag.NO_Y) == (int)VehicleFlag.NO_Y) + { + m_flags |= (VehicleFlag.NO_Y); + } + if ((pParam & (int)VehicleFlag.NO_Z) == (int)VehicleFlag.NO_Z) + { + m_flags |= (VehicleFlag.NO_Z); + } + if ((pParam & (int)VehicleFlag.LOCK_HOVER_HEIGHT) == (int)VehicleFlag.LOCK_HOVER_HEIGHT) + { + m_Hoverflags |= (VehicleFlag.LOCK_HOVER_HEIGHT); + } + if ((pParam & (int)VehicleFlag.NO_DEFLECTION) == (int)VehicleFlag.NO_DEFLECTION) + { + m_flags |= (VehicleFlag.NO_DEFLECTION); + } + if ((pParam & (int)VehicleFlag.LOCK_ROTATION) == (int)VehicleFlag.LOCK_ROTATION) + { + m_flags |= (VehicleFlag.LOCK_ROTATION); + } + } + }//end ProcessVehicleFlags + internal void ProcessTypeChange(Vehicle pType) { // Set Defaults For Type m_type = pType; switch (pType) { + case Vehicle.TYPE_NONE: + m_linearFrictionTimescale = new Vector3(0, 0, 0); + m_angularFrictionTimescale = new Vector3(0, 0, 0); + m_linearMotorDirection = Vector3.Zero; + m_linearMotorTimescale = 0; + m_linearMotorDecayTimescale = 0; + m_angularMotorDirection = Vector3.Zero; + m_angularMotorTimescale = 0; + m_angularMotorDecayTimescale = 0; + m_VhoverHeight = 0; + m_VhoverTimescale = 0; + m_VehicleBuoyancy = 0; + m_flags = (VehicleFlag)0; + break; + case Vehicle.TYPE_SLED: m_linearFrictionTimescale = new Vector3(30, 1, 1000); m_angularFrictionTimescale = new Vector3(1000, 1000, 1000); @@ -295,9 +475,9 @@ namespace OpenSim.Region.Physics.OdePlugin // m_bankingMix = 1; // m_bankingTimescale = 10; // m_referenceFrame = Quaternion.Identity; - m_flags &= - ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | - VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY); + m_Hoverflags &= + ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | + VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY); m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.LIMIT_MOTOR_UP); break; case Vehicle.TYPE_CAR: @@ -323,9 +503,10 @@ namespace OpenSim.Region.Physics.OdePlugin // m_bankingMix = 1; // m_bankingTimescale = 1; // m_referenceFrame = Quaternion.Identity; - m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT); - m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.HOVER_UP_ONLY | + m_Hoverflags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT); + m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.LIMIT_MOTOR_UP); + m_Hoverflags |= (VehicleFlag.HOVER_UP_ONLY); break; case Vehicle.TYPE_BOAT: m_linearFrictionTimescale = new Vector3(10, 3, 2); @@ -350,10 +531,12 @@ namespace OpenSim.Region.Physics.OdePlugin // m_bankingMix = 0.8f; // m_bankingTimescale = 1; // m_referenceFrame = Quaternion.Identity; - m_flags &= ~(VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.LIMIT_ROLL_ONLY | + m_Hoverflags &= ~(VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY); - m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.HOVER_WATER_ONLY | + m_flags &= ~(VehicleFlag.LIMIT_ROLL_ONLY); + m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_MOTOR_UP); + m_Hoverflags |= (VehicleFlag.HOVER_WATER_ONLY); break; case Vehicle.TYPE_AIRPLANE: m_linearFrictionTimescale = new Vector3(200, 10, 5); @@ -378,8 +561,9 @@ namespace OpenSim.Region.Physics.OdePlugin // m_bankingMix = 0.7f; // m_bankingTimescale = 2; // m_referenceFrame = Quaternion.Identity; - m_flags &= ~(VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | - VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY | VehicleFlag.LIMIT_MOTOR_UP); + m_Hoverflags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | + VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY); + m_flags &= ~(VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_MOTOR_UP); m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY); break; case Vehicle.TYPE_BALLOON: @@ -405,9 +589,11 @@ namespace OpenSim.Region.Physics.OdePlugin // m_bankingMix = 0.7f; // m_bankingTimescale = 5; // m_referenceFrame = Quaternion.Identity; - m_flags &= ~(VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | - VehicleFlag.HOVER_UP_ONLY | VehicleFlag.LIMIT_MOTOR_UP); - m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT); + m_Hoverflags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | + VehicleFlag.HOVER_UP_ONLY); + m_flags &= ~(VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_MOTOR_UP); + m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY); + m_Hoverflags |= (VehicleFlag.HOVER_GLOBAL_HEIGHT); break; } @@ -431,6 +617,7 @@ namespace OpenSim.Region.Physics.OdePlugin MoveLinear(pTimestep, pParentScene); MoveAngular(pTimestep); + LimitRotation(pTimestep); }// end Step private void MoveLinear(float pTimestep, OdeScene _pParentScene) @@ -477,61 +664,152 @@ namespace OpenSim.Region.Physics.OdePlugin // .Z velocity and gravity. Therefore only 0g will used script-requested // .Z velocity. >0g (m_VehicleBuoyancy < 1) will used modified gravity only. Vector3 grav = Vector3.Zero; - if (m_VehicleBuoyancy < 1.0f) + // There is some gravity, make a gravity force vector + // that is applied after object velocity. + d.Mass objMass; + d.BodyGetMass(Body, out objMass); + // m_VehicleBuoyancy: -1=2g; 0=1g; 1=0g; + grav.Z = _pParentScene.gravityz * objMass.mass * (1f - m_VehicleBuoyancy); + // Preserve the current Z velocity + d.Vector3 vel_now = d.BodyGetLinearVel(Body); + m_dir.Z = vel_now.Z; // Preserve the accumulated falling velocity + + d.Vector3 pos = d.BodyGetPosition(Body); + Vector3 accel = new Vector3(-(m_dir.X - m_lastLinearVelocityVector.X / 0.1f), -(m_dir.Y - m_lastLinearVelocityVector.Y / 0.1f), m_dir.Z - m_lastLinearVelocityVector.Z / 0.1f); + Vector3 posChange = new Vector3(); + posChange.X = pos.X - m_lastPositionVector.X; + posChange.Y = pos.Y - m_lastPositionVector.Y; + posChange.Z = pos.Z - m_lastPositionVector.Z; + double Zchange = Math.Abs(posChange.Z); + if (m_BlockingEndPoint != Vector3.Zero) { - // There is some gravity, make a gravity force vector - // that is applied after object velocity. - d.Mass objMass; - d.BodyGetMass(Body, out objMass); - // m_VehicleBuoyancy: -1=2g; 0=1g; 1=0g; - grav.Z = _pParentScene.gravityz * objMass.mass * (1f - m_VehicleBuoyancy); - // Preserve the current Z velocity - d.Vector3 vel_now = d.BodyGetLinearVel(Body); - m_dir.Z = vel_now.Z; // Preserve the accumulated falling velocity - } // else its 1.0, no gravity. + if (pos.X >= (m_BlockingEndPoint.X - (float)1)) + { + pos.X -= posChange.X + 1; + d.BodySetPosition(Body, pos.X, pos.Y, pos.Z); + } + if (pos.Y >= (m_BlockingEndPoint.Y - (float)1)) + { + pos.Y -= posChange.Y + 1; + d.BodySetPosition(Body, pos.X, pos.Y, pos.Z); + } + if (pos.Z >= (m_BlockingEndPoint.Z - (float)1)) + { + pos.Z -= posChange.Z + 1; + d.BodySetPosition(Body, pos.X, pos.Y, pos.Z); + } + if (pos.X <= 0) + { + pos.X += posChange.X + 1; + d.BodySetPosition(Body, pos.X, pos.Y, pos.Z); + } + if (pos.Y <= 0) + { + pos.Y += posChange.Y + 1; + d.BodySetPosition(Body, pos.X, pos.Y, pos.Z); + } + } + if (pos.Z < _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y)) + { + pos.Z = _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y) + 2; + d.BodySetPosition(Body, pos.X, pos.Y, pos.Z); + } // Check if hovering - if ((m_flags & (VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT)) != 0) + if ((m_Hoverflags & (VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT)) != 0) { // We should hover, get the target height - d.Vector3 pos = d.BodyGetPosition(Body); - if ((m_flags & VehicleFlag.HOVER_WATER_ONLY) == VehicleFlag.HOVER_WATER_ONLY) + if ((m_Hoverflags & VehicleFlag.HOVER_WATER_ONLY) != 0) { m_VhoverTargetHeight = _pParentScene.GetWaterLevel() + m_VhoverHeight; } - else if ((m_flags & VehicleFlag.HOVER_TERRAIN_ONLY) == VehicleFlag.HOVER_TERRAIN_ONLY) + if ((m_Hoverflags & VehicleFlag.HOVER_TERRAIN_ONLY) != 0) { m_VhoverTargetHeight = _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y) + m_VhoverHeight; } - else if ((m_flags & VehicleFlag.HOVER_GLOBAL_HEIGHT) == VehicleFlag.HOVER_GLOBAL_HEIGHT) + if ((m_Hoverflags & VehicleFlag.HOVER_GLOBAL_HEIGHT) != 0) { m_VhoverTargetHeight = m_VhoverHeight; } - if ((m_flags & VehicleFlag.HOVER_UP_ONLY) == VehicleFlag.HOVER_UP_ONLY) + if ((m_Hoverflags & VehicleFlag.HOVER_UP_ONLY) != 0) { // If body is aready heigher, use its height as target height if (pos.Z > m_VhoverTargetHeight) m_VhoverTargetHeight = pos.Z; } + if ((m_Hoverflags & VehicleFlag.LOCK_HOVER_HEIGHT) != 0) + { + if ((pos.Z - m_VhoverTargetHeight) > .2 || (pos.Z - m_VhoverTargetHeight) < -.2) + { + d.BodySetPosition(Body, pos.X, pos.Y, m_VhoverTargetHeight); + } + } + else + { + float herr0 = pos.Z - m_VhoverTargetHeight; + // Replace Vertical speed with correction figure if significant + if (Math.Abs(herr0) > 0.01f) + { + m_dir.Z = -((herr0 * pTimestep * 50.0f) / m_VhoverTimescale); + //KF: m_VhoverEfficiency is not yet implemented + } + else + { + m_dir.Z = 0f; + } + } // m_VhoverEfficiency = 0f; // 0=boucy, 1=Crit.damped // m_VhoverTimescale = 0f; // time to acheive height // pTimestep is time since last frame,in secs - float herr0 = pos.Z - m_VhoverTargetHeight; - // Replace Vertical speed with correction figure if significant - if (Math.Abs(herr0) > 0.01f) - { - d.Mass objMass; - d.BodyGetMass(Body, out objMass); - m_dir.Z = - ((herr0 * pTimestep * 50.0f) / m_VhoverTimescale); - //KF: m_VhoverEfficiency is not yet implemented - } - else - { - m_dir.Z = 0f; - } } + if ((m_flags & (VehicleFlag.LIMIT_MOTOR_UP)) != 0) + { + //Start Experimental Values + if (Zchange > .3) + { + grav.Z = (float)(grav.Z * 3); + } + if (Zchange > .15) + { + grav.Z = (float)(grav.Z * 2); + } + if (Zchange > .75) + { + grav.Z = (float)(grav.Z * 1.5); + } + if (Zchange > .05) + { + grav.Z = (float)(grav.Z * 1.25); + } + if (Zchange > .025) + { + grav.Z = (float)(grav.Z * 1.125); + } + float terraintemp = _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y); + float postemp = (pos.Z - terraintemp); + if (postemp > 2.5f) + { + grav.Z = (float)(grav.Z * 1.037125); + } + //End Experimental Values + } + if ((m_flags & (VehicleFlag.NO_X)) != 0) + { + m_dir.X = 0; + } + if ((m_flags & (VehicleFlag.NO_Y)) != 0) + { + m_dir.Y = 0; + } + if ((m_flags & (VehicleFlag.NO_Z)) != 0) + { + m_dir.Z = 0; + } + + m_lastPositionVector = d.BodyGetPosition(Body); + // Apply velocity d.BodySetLinearVel(Body, m_dir.X, m_dir.Y, m_dir.Z); // apply gravity force @@ -629,6 +907,12 @@ namespace OpenSim.Region.Physics.OdePlugin // Sum velocities m_lastAngularVelocity = m_angularMotorVelocity + vertattr; // + bank + deflection + + if ((m_flags & (VehicleFlag.NO_DEFLECTION_UP)) != 0) + { + m_lastAngularVelocity.X = 0; + m_lastAngularVelocity.Y = 0; + } if (!m_lastAngularVelocity.ApproxEquals(Vector3.Zero, 0.01f)) { @@ -647,5 +931,44 @@ namespace OpenSim.Region.Physics.OdePlugin d.BodySetAngularVel (Body, m_lastAngularVelocity.X, m_lastAngularVelocity.Y, m_lastAngularVelocity.Z); } //end MoveAngular + internal void LimitRotation(float timestep) + { + d.Quaternion rot = d.BodyGetQuaternion(Body); + Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); // rotq = rotation of object + d.Quaternion m_rot = new d.Quaternion(); + bool changed = false; + m_rot.X = rotq.X; + m_rot.Y = rotq.Y; + m_rot.Z = rotq.Z; + m_rot.W = rotq.W; + if (m_RollreferenceFrame != Quaternion.Identity) + { + if (rotq.X >= m_RollreferenceFrame.X) + { + m_rot.X = rotq.X - (m_RollreferenceFrame.X / 2); + } + if (rotq.Y >= m_RollreferenceFrame.Y) + { + m_rot.Y = rotq.Y - (m_RollreferenceFrame.Y / 2); + } + if (rotq.X <= -m_RollreferenceFrame.X) + { + m_rot.X = rotq.X + (m_RollreferenceFrame.X / 2); + } + if (rotq.Y <= -m_RollreferenceFrame.Y) + { + m_rot.Y = rotq.Y + (m_RollreferenceFrame.Y / 2); + } + changed = true; + } + if ((m_flags & VehicleFlag.LOCK_ROTATION) != 0) + { + m_rot.X = 0; + m_rot.Y = 0; + changed = true; + } + if (changed) + d.BodySetQuaternion(Body, ref m_rot); + } } } diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 44b2727afe..03736d157b 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -2355,6 +2355,11 @@ Console.WriteLine(" JointCreateFixed"); m_vehicle.ProcessRotationVehicleParam((Vehicle) param, rotation); } + public override void VehicleFlags(int param, bool remove) + { + m_vehicle.ProcessVehicleFlags(param, remove); + } + public override void SetVolumeDetect(int param) { lock (_parent_scene.OdeLock) diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs index 566b4e7313..a70179b729 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs @@ -182,6 +182,8 @@ namespace OpenSim.Region.Physics.POSPlugin } + public override void VehicleFlags(int param, bool remove) { } + public override void SetVolumeDetect(int param) { diff --git a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs index 7447f76e1d..91ec3df6f9 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs @@ -139,6 +139,8 @@ namespace OpenSim.Region.Physics.POSPlugin } + public override void VehicleFlags(int param, bool remove) { } + public override void SetVolumeDetect(int param) { diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs index 24eb6b1d20..dd2c68617b 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs @@ -371,6 +371,8 @@ namespace OpenSim.Region.Physics.PhysXPlugin } + public override void VehicleFlags(int param, bool remove) { } + public override void SetVolumeDetect(int param) { @@ -775,6 +777,8 @@ namespace OpenSim.Region.Physics.PhysXPlugin } + public override void VehicleFlags(int param, bool remove) { } + public override void SetVolumeDetect(int param) { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a1db77ee73..eab475416b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1181,7 +1181,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if ((status & ScriptBaseClass.STATUS_BLOCK_GRAB) == ScriptBaseClass.STATUS_BLOCK_GRAB) { - NotImplemented("llSetStatus - STATUS_BLOCK_GRAB"); + if (value != 0) + m_host.SetBlockGrab(true); + else + m_host.SetBlockGrab(false); } if ((status & ScriptBaseClass.STATUS_DIE_AT_EDGE) == ScriptBaseClass.STATUS_DIE_AT_EDGE) @@ -1194,12 +1197,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if ((status & ScriptBaseClass.STATUS_RETURN_AT_EDGE) == ScriptBaseClass.STATUS_RETURN_AT_EDGE) { - NotImplemented("llSetStatus - STATUS_RETURN_AT_EDGE"); + if (value != 0) + m_host.SetReturnAtEdge(true); + else + m_host.SetReturnAtEdge(false); } if ((status & ScriptBaseClass.STATUS_SANDBOX) == ScriptBaseClass.STATUS_SANDBOX) { - NotImplemented("llSetStatus - STATUS_SANDBOX"); + if (value != 0) + m_host.SetStatusSandbox(true); + else + m_host.SetStatusSandbox(false); } if (statusrotationaxis != 0) @@ -1236,8 +1245,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return 0; case ScriptBaseClass.STATUS_BLOCK_GRAB: - NotImplemented("llGetStatus - STATUS_BLOCK_GRAB"); - return 0; + if (m_host.GetBlockGrab()) + return 1; + else + return 0; case ScriptBaseClass.STATUS_DIE_AT_EDGE: if (m_host.GetDieAtEdge()) @@ -1246,24 +1257,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return 0; case ScriptBaseClass.STATUS_RETURN_AT_EDGE: - NotImplemented("llGetStatus - STATUS_RETURN_AT_EDGE"); - return 0; + if (m_host.GetReturnAtEdge()) + return 1; + else + return 0; case ScriptBaseClass.STATUS_ROTATE_X: - NotImplemented("llGetStatus - STATUS_ROTATE_X"); - return 0; + if (m_host.GetAxisRotation(2) == 2) + return 1; + else + return 0; case ScriptBaseClass.STATUS_ROTATE_Y: - NotImplemented("llGetStatus - STATUS_ROTATE_Y"); - return 0; + if (m_host.GetAxisRotation(4) == 4) + return 1; + else + return 0; case ScriptBaseClass.STATUS_ROTATE_Z: - NotImplemented("llGetStatus - STATUS_ROTATE_Z"); - return 0; + if (m_host.GetAxisRotation(8) == 8) + return 1; + else + return 0; case ScriptBaseClass.STATUS_SANDBOX: - NotImplemented("llGetStatus - STATUS_SANDBOX"); - return 0; + if (m_host.GetStatusSandbox()) + return 1; + else + return 0; } return 0; } @@ -2201,7 +2222,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); // send the sound, once, to all clients in range - m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0); + m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0, 0, false, false); } // Xantor 20080528 we should do this differently. @@ -2231,42 +2252,98 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llLoopSoundMaster(string sound, double volume) { m_host.AddScriptLPS(1); - NotImplemented("llLoopSoundMaster"); + m_host.ParentGroup.LoopSoundMasterPrim = m_host; + lock (m_host.ParentGroup.LoopSoundSlavePrims) + { + foreach (SceneObjectPart prim in m_host.ParentGroup.LoopSoundSlavePrims) + { + if (prim.Sound != UUID.Zero) + llStopSound(); + + prim.Sound = KeyOrName(sound); + prim.SoundGain = volume; + prim.SoundFlags = 1; // looping + prim.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable? + + prim.ScheduleFullUpdate(); + prim.SendFullUpdateToAllClients(); + } + } + if (m_host.Sound != UUID.Zero) + llStopSound(); + + m_host.Sound = KeyOrName(sound); + m_host.SoundGain = volume; + m_host.SoundFlags = 1; // looping + m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable? + + m_host.ScheduleFullUpdate(); + m_host.SendFullUpdateToAllClients(); } public void llLoopSoundSlave(string sound, double volume) { m_host.AddScriptLPS(1); - NotImplemented("llLoopSoundSlave"); + lock (m_host.ParentGroup.LoopSoundSlavePrims) + { + m_host.ParentGroup.LoopSoundSlavePrims.Add(m_host); + } } public void llPlaySoundSlave(string sound, double volume) { m_host.AddScriptLPS(1); - NotImplemented("llPlaySoundSlave"); + + // send the sound, once, to all clients in range + m_host.SendSound(KeyOrName(sound).ToString(), volume, false, 0, 0, true, false); } public void llTriggerSound(string sound, double volume) { m_host.AddScriptLPS(1); // send the sound, once, to all clients in range - m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0); + m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0, 0, false, false); } // Xantor 20080528: Clear prim data of sound instead public void llStopSound() { m_host.AddScriptLPS(1); - - m_host.Sound = UUID.Zero; - m_host.SoundGain = 0; - m_host.SoundFlags = 0; - m_host.SoundRadius = 0; - - m_host.ScheduleFullUpdate(); - m_host.SendFullUpdateToAllClients(); - - // m_host.SendSound(UUID.Zero.ToString(), 1.0, false, 2); + if (m_host.ParentGroup.LoopSoundSlavePrims.Contains(m_host)) + { + if (m_host.ParentGroup.LoopSoundMasterPrim == m_host) + { + foreach (SceneObjectPart part in m_host.ParentGroup.LoopSoundSlavePrims) + { + part.Sound = UUID.Zero; + part.SoundGain = 0; + part.SoundFlags = 0; + part.SoundRadius = 0; + part.ScheduleFullUpdate(); + part.SendFullUpdateToAllClients(); + } + m_host.ParentGroup.LoopSoundMasterPrim = null; + m_host.ParentGroup.LoopSoundSlavePrims.Clear(); + } + else + { + m_host.Sound = UUID.Zero; + m_host.SoundGain = 0; + m_host.SoundFlags = 0; + m_host.SoundRadius = 0; + m_host.ScheduleFullUpdate(); + m_host.SendFullUpdateToAllClients(); + } + } + else + { + m_host.Sound = UUID.Zero; + m_host.SoundGain = 0; + m_host.SoundFlags = 0; + m_host.SoundRadius = 0; + m_host.ScheduleFullUpdate(); + m_host.SendFullUpdateToAllClients(); + } } public void llPreloadSound(string sound) @@ -2660,8 +2737,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llLookAt(LSL_Vector target, double strength, double damping) { - // partial implementation, rotates objects correctly but does not apply strength or damping attributes - m_host.AddScriptLPS(1); // Determine where we are looking from LSL_Vector from = llGetPos(); @@ -2681,9 +2756,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // the angles of rotation in radians into rotation value LSL_Types.Quaternion rot = llEuler2Rot(angle); - + Quaternion rotation = new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s); + m_host.startLookAt(rotation, (float)damping, (float)strength); // Orient the object to the angle calculated - llSetRot(rot); + //llSetRot(rot); } public void llStopLookAt() @@ -3045,8 +3121,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llRotLookAt(LSL_Rotation target, double strength, double damping) { m_host.AddScriptLPS(1); -// NotImplemented("llRotLookAt"); - m_host.RotLookAt(Rot2Quaternion(target), (float)strength, (float)damping); + Quaternion rot = new Quaternion((float)target.x, (float)target.y, (float)target.z, (float)target.s); + m_host.RotLookAt(rot, (float)strength, (float)damping); } public LSL_Integer llStringLength(string str) @@ -3144,13 +3220,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llPointAt(LSL_Vector pos) { m_host.AddScriptLPS(1); - NotImplemented("llPointAt"); + ScenePresence Owner = World.GetScenePresence(m_host.UUID); + LSL_Rotation rot = llEuler2Rot(pos); + Owner.PreviousRotation = Owner.Rotation; + Owner.Rotation = (new Quaternion((float)rot.x,(float)rot.y,(float)rot.z,(float)rot.s)); } public void llStopPointAt() { m_host.AddScriptLPS(1); - NotImplemented("llStopPointAt"); + ScenePresence Owner = m_host.ParentGroup.Scene.GetScenePresence(m_host.OwnerID); + Owner.Rotation = Owner.PreviousRotation; } public void llTargetOmega(LSL_Vector axis, double spinrate, double gain) @@ -3946,8 +4026,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llCollisionSound(string impact_sound, double impact_volume) { m_host.AddScriptLPS(1); - //NotImplemented("llCollisionSound"); - // TODO: Parameter check logic required. UUID soundId = UUID.Zero; if (!UUID.TryParse(impact_sound, out soundId)) @@ -4535,8 +4613,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llGetCenterOfMass() { m_host.AddScriptLPS(1); - NotImplemented("llGetCenterOfMass"); - return new LSL_Vector(); + Vector3 center = m_host.GetGeometricCenter(); + return new LSL_Vector(center.X,center.Y,center.Z); } public LSL_List llListSort(LSL_List src, int stride, int ascending) @@ -5269,8 +5347,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api flags |= ScriptBaseClass.AGENT_SITTING; } - //NotImplemented("llGetAgentInfo"); - return flags; } @@ -5353,7 +5429,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_Vector bottom_south_west) { m_host.AddScriptLPS(1); - NotImplemented("llTriggerSoundLimited"); + float radius1 = (float)llVecDist(llGetPos(), top_north_east); + float radius2 = (float)llVecDist(llGetPos(), bottom_south_west); + float radius = Math.Abs(radius1 - radius2); + m_host.SendSound(KeyOrName(sound).ToString(), volume, true, 0, radius, false, false); } public void llEjectFromLand(string pest) @@ -5892,7 +5971,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llGroundRepel(double height, int water, double tau) { m_host.AddScriptLPS(1); - NotImplemented("llGroundRepel"); + if (m_host.PhysActor != null) + { + float ground = (float)llGround(new LSL_Types.Vector3(0, 0, 0)); + float waterLevel = (float)llWater(new LSL_Types.Vector3(0, 0, 0)); + PIDHoverType hoverType = PIDHoverType.Ground; + if (water != 0) + { + hoverType = PIDHoverType.GroundAndWater; + if (ground < waterLevel) + height += waterLevel; + else + height += ground; + } + else + { + height += ground; + } + + m_host.SetHoverHeight((float)height, hoverType, (float)tau); + } } protected UUID GetTaskInventoryItem(string name) @@ -6021,13 +6119,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llSetVehicleFlags(int flags) { m_host.AddScriptLPS(1); - NotImplemented("llSetVehicleFlags"); + if (m_host.ParentGroup != null) + { + if (!m_host.ParentGroup.IsDeleted) + { + m_host.ParentGroup.RootPart.SetVehicleFlags(flags, false); + } + } } public void llRemoveVehicleFlags(int flags) { m_host.AddScriptLPS(1); - NotImplemented("llRemoveVehicleFlags"); + if (m_host.ParentGroup != null) + { + if (!m_host.ParentGroup.IsDeleted) + { + m_host.ParentGroup.RootPart.SetVehicleFlags(flags, true); + } + } } public void llSitTarget(LSL_Vector offset, LSL_Rotation rot) @@ -7049,7 +7159,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llRemoteDataSetRegion() { m_host.AddScriptLPS(1); - NotImplemented("llRemoteDataSetRegion"); + Deprecated("llRemoteDataSetRegion"); } public LSL_Float llLog10(double val) @@ -8081,7 +8191,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llSetInventoryPermMask(string item, int mask, int value) { m_host.AddScriptLPS(1); - NotImplemented("llSetInventoryPermMask"); + if (m_ScriptEngine.Config.GetBoolean("AllowGodFunctions", false)) + { + if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) + { + lock (m_host.TaskInventory) + { + foreach (KeyValuePair inv in m_host.TaskInventory) + { + if (inv.Value.Name == item) + { + switch (mask) + { + case 0: + inv.Value.BasePermissions = (uint)value; + break; + case 1: + inv.Value.CurrentPermissions = (uint)value; + break; + case 2: + inv.Value.GroupPermissions = (uint)value; + break; + case 3: + inv.Value.EveryonePermissions = (uint)value; + break; + case 4: + inv.Value.NextPermissions = (uint)value; + break; + } + } + } + } + } + } } public LSL_String llGetInventoryCreator(string item) @@ -8515,6 +8657,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // we send to all landData.MediaID = new UUID(texture); landData.MediaAutoScale = autoAlign ? (byte)1 : (byte)0; + landData.MediaSize[0] = width; + landData.MediaSize[1] = height; + landData.MediaType = mediaType; // do that one last, it will cause a ParcelPropertiesUpdate landObject.SetMediaUrl(url); @@ -8574,11 +8719,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); LSL_List list = new LSL_List(); //TO DO: make the implementation for the missing commands - //PARCEL_MEDIA_COMMAND_TEXTURE key uuid Use this to get or set the parcel's media texture. - //PARCEL_MEDIA_COMMAND_URL string url Used to get or set the parcel's media url. - //PARCEL_MEDIA_COMMAND_TYPE string mime_type Use this to get or set the parcel media MIME type (e.g. "text/html"). (1.19.1 RC0 or later) - //PARCEL_MEDIA_COMMAND_SIZE integer x, integer y Use this to get or set the parcel media pixel resolution. (1.19.1 RC0 or later) - //PARCEL_MEDIA_COMMAND_DESC string desc Use this to get or set the parcel media description. (1.19.1 RC0 or later) //PARCEL_MEDIA_COMMAND_LOOP_SET float loop Use this to get or set the parcel's media loop duration. (1.19.1 RC0 or later) for (int i = 0; i < aList.Data.Length; i++) { @@ -8596,6 +8736,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ParcelMediaCommandEnum.Texture: list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaID.ToString())); break; + case ParcelMediaCommandEnum.Type: + list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaType)); + break; + case ParcelMediaCommandEnum.Size: + list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaSize[0])); + list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaSize[1])); + break; default: ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; NotImplemented("llParcelMediaQuery parameter do not supported yet: " + Enum.Parse(mediaCommandEnum.GetType() , aList.Data[i].ToString()).ToString()); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 13b855f3b7..7cf82b275e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -160,6 +160,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int VEHICLE_BANKING_MIX = 39; public const int VEHICLE_BANKING_TIMESCALE = 40; public const int VEHICLE_REFERENCE_FRAME = 44; + public const int VEHICLE_RANGE_BLOCK = 45; + public const int VEHICLE_ROLL_FRAME = 46; public const int VEHICLE_FLAG_NO_DEFLECTION_UP = 1; public const int VEHICLE_FLAG_LIMIT_ROLL_ONLY = 2; public const int VEHICLE_FLAG_HOVER_WATER_ONLY = 4; @@ -170,6 +172,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int VEHICLE_FLAG_MOUSELOOK_STEER = 128; public const int VEHICLE_FLAG_MOUSELOOK_BANK = 256; public const int VEHICLE_FLAG_CAMERA_DECOUPLED = 512; + public const int VEHICLE_FLAG_NO_X = 1024; + public const int VEHICLE_FLAG_NO_Y = 2048; + public const int VEHICLE_FLAG_NO_Z = 4096; + public const int VEHICLE_FLAG_LOCK_HOVER_HEIGHT = 8192; + public const int VEHICLE_FLAG_NO_DEFLECTION = 16392; + public const int VEHICLE_FLAG_LOCK_ROTATION = 32784; public const int INVENTORY_ALL = -1; public const int INVENTORY_NONE = -1; diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index b5eaf43950..7dab6a12c7 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -206,6 +206,8 @@ namespace OpenSim.Tests.Common.Mock public event ObjectBuy OnObjectBuy; public event BuyObjectInventory OnBuyObjectInventory; public event AgentSit OnUndo; + public event AgentSit OnRedo; + public event LandUndo OnLandUndo; public event ForceReleaseControls OnForceReleaseControls; From 2c0c21d0a5fd89120d8be47cd959acd96b286fe3 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 14 Feb 2010 23:58:54 +0000 Subject: [PATCH 10/10] Plug a small hole --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 7df3e50792..c6cee753cb 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -585,6 +585,9 @@ namespace OpenSim.Region.Framework.Scenes m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString()); return; } + + if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) + return; } AssetBase asset = AssetService.Get(item.AssetID.ToString());