Merge branch 'master' into presence-refactor

This commit is contained in:
Melanie
2010-02-15 00:20:48 +00:00
60 changed files with 1674 additions and 586 deletions

View File

@@ -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);
/// <summary>
/// Each agent has its own singleton collection of transactions
/// </summary>
private Dictionary<UUID, AgentAssetTransactions> AgentTransactions =
new Dictionary<UUID, AgentAssetTransactions>();
/// <summary>
/// Should we dump uploaded assets to the filesystem?
/// </summary>
private bool m_dumpAssetsToFile;
public Scene MyScene;
public AgentAssetTransactionsManager(Scene scene, bool dumpAssetsToFile)
{
MyScene = scene;
m_dumpAssetsToFile = dumpAssetsToFile;
}
/// <summary>
/// Get the collection of asset transactions for the given user. If one does not already exist, it
/// is created.
/// </summary>
/// <param name="userID"></param>
/// <returns></returns>
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];
}
}
/// <summary>
/// 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).
/// </summary>
/// <param name="userID"></param>
public void RemoveAgentAssetTransactions(UUID userID)
{
// m_log.DebugFormat("Removing agent asset transactions structure for agent {0}", userID);
lock (AgentTransactions)
{
AgentTransactions.Remove(userID);
}
}
/// <summary>
/// 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.
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="transactionID"></param>
/// <param name="folderID"></param>
/// <param name="callbackID"></param>
/// <param name="description"></param>
/// <param name="name"></param>
/// <param name="invType"></param>
/// <param name="type"></param>
/// <param name="wearableType"></param>
/// <param name="nextOwnerMask"></param>
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);
}
/// <summary>
/// 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.
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="transactionID"></param>
/// <param name="item"></param>
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);
}
/// <summary>
/// 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.
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="transactionID"></param>
/// <param name="item"></param>
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);
}
/// <summary>
/// Request that a client (agent) begin an asset transfer.
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="assetID"></param>
/// <param name="transaction"></param>
/// <param name="type"></param>
/// <param name="data"></param></param>
/// <param name="tempFile"></param>
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<IMoneyModule>();
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);
}
}
/// <summary>
/// Handle asset transfer data packets received in response to the asset upload request in
/// HandleUDPUploadRequest()
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="xferID"></param>
/// <param name="packetID"></param>
/// <param name="data"></param>
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);
}
}
*/
}

View File

@@ -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<UUID, Scene> RegisteredScenes = new Dictionary<UUID, Scene>();
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);

View File

@@ -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)
{

View File

@@ -91,6 +91,8 @@ namespace OpenSim.Region.CoreModules.Asset
/// </example>
public class CenomeMemoryAssetCache : IImprovedAssetCache, ISharedRegionModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// Cache's default maximal asset count.
/// </summary>
@@ -115,12 +117,7 @@ namespace OpenSim.Region.CoreModules.Asset
/// Asset's default expiration time in the cache.
/// </summary>
public static readonly TimeSpan DefaultExpirationTime = TimeSpan.FromMinutes(30.0);
/// <summary>
/// Log manager instance.
/// </summary>
private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// Cache object.
/// </summary>
@@ -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<string, AssetBase>.Synchronized(new CnmMemoryCache<string, AssetBase>(
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;

View File

@@ -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;
}
}
}

View File

@@ -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());

View File

@@ -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<IAssetService>(serviceDll,
args);
m_AssetService = ServerUtils.LoadPlugin<IAssetService>(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); });
});
}

View File

@@ -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<IInventoryService>(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");
}
}
}
@@ -135,7 +135,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<IInventoryService>(this);
m_cache.AddRegion(scene);
@@ -155,7 +155,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
@@ -210,7 +210,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<AssetType, InventoryFolderBase>();
}
@@ -309,7 +309,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)

View File

@@ -955,8 +955,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));

View File

@@ -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);

View File

@@ -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<LandUndoState> m_undo = new UndoStack<LandUndoState>(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;
}
/// <summary>
/// Loads a terrain file from disk and installs it in the scene.
/// </summary>
@@ -574,6 +580,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
{
client.OnModifyTerrain += client_OnModifyTerrain;
client.OnBakeTerrain += client_OnBakeTerrain;
client.OnLandUndo += client_OnLandUndo;
}
/// <summary>
@@ -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();
}
}
}
/// <summary>
/// Sends a copy of the current terrain to the scenes clients
/// </summary>
@@ -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)