* Spring cleaning on Region.Environment.

* Converted a large number of read-only fields to be actually, readonly.
* Reformatted code sections.
* Removed redundant code.
0.6.0-stable
Adam Frisby 2008-05-01 16:35:00 +00:00
parent 01f31fd933
commit 13526097f2
76 changed files with 4181 additions and 4314 deletions

View File

@ -32,13 +32,10 @@ namespace OpenSim.Region.Environment
/// <summary>
/// Bit Vector for Which Modules to send an instant message to from the Scene or an Associated Module
/// </summary>
// This prevents the Modules from sending Instant messages to other modules through the scene
// and then receiving the same messages
// This is mostly here because on LLSL and the SecondLife Client, IMs,Groups and friends are linked
// inseparably
[Flags]
public enum InstantMessageReceiver : uint
{
@ -51,4 +48,4 @@ namespace OpenSim.Region.Environment
/// <summary>The Groups Module</summary>
GroupsModule = 0x00000004
}
}
}

View File

@ -41,4 +41,4 @@ namespace OpenSim.Region.Environment.Interfaces
void RemoveAgentAssetTransactions(LLUUID userID);
}
}
}

View File

@ -30,9 +30,9 @@ using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Interfaces
{
public interface IAvatarFactory
public interface IAvatarFactory
{
bool TryGetAvatarAppearance(LLUUID avatarId, out AvatarAppearance appearance);
void UpdateDatabase(LLUUID userID, AvatarAppearance avatAppearance);
}
}
}

View File

@ -39,4 +39,4 @@ namespace OpenSim.Region.Environment.Interfaces
HttpRequestClass GetNextCompletedRequest();
void RemoveCompletedRequest(LLUUID id);
}
}
}

View File

@ -70,7 +70,8 @@ namespace OpenSim.Region.Environment.Interfaces
void handleSignificantClientMovement(IClientAPI remote_client);
void handleAnyClientMovement(ScenePresence avatar);
void handleParcelAccessRequest(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, int landLocalID, IClientAPI remote_client);
void handleParcelAccessUpdateRequest(LLUUID agentID, LLUUID sessionID, uint flags, int landLocalID, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client);
void handleParcelAccessUpdateRequest(LLUUID agentID, LLUUID sessionID, uint flags, int landLocalID, List<ParcelManager.ParcelAccessEntry> entries,
IClientAPI remote_client);
}
}
}

View File

@ -48,7 +48,7 @@ namespace OpenSim.Region.Environment.Interfaces
/// <param name="obj"></param>
/// <param name="regionUUID"></param>
void StoreObject(SceneObjectGroup obj, LLUUID regionUUID);
/// <summary>
/// Entirely removes the object, including inventory
/// </summary>
@ -56,7 +56,7 @@ namespace OpenSim.Region.Environment.Interfaces
/// <param name="regionUUID"></param>
/// <returns></returns>
void RemoveObject(LLUUID uuid, LLUUID regionUUID);
/// <summary>
/// Store a prim's inventory
/// </summary>
@ -74,4 +74,4 @@ namespace OpenSim.Region.Environment.Interfaces
void Shutdown();
}
}
}

View File

@ -32,10 +32,10 @@ namespace OpenSim.Region.Environment.Interfaces
{
public interface IRegionModule
{
string Name { get; }
bool IsSharedModule { get; }
void Initialise(Scene scene, IConfigSource source);
void PostInitialise();
void Close();
string Name { get; }
bool IsSharedModule { get; }
}
}
}

View File

@ -34,4 +34,4 @@ namespace OpenSim.Region.Environment.Interfaces
{
void SimChat(Object sender, ChatFromViewerArgs e);
}
}
}

View File

@ -43,4 +43,4 @@ namespace OpenSim.Region.Environment.Interfaces
uint PeekNextMessageLocalID();
LLUUID PeekNextMessageItemID();
}
}
}

View File

@ -45,4 +45,4 @@ namespace OpenSim.Region.Environment.Interfaces
void RemoveCompletedSRDRequest(LLUUID id);
void CancelSRDRequests(LLUUID itemID);
}
}
}

View File

@ -31,4 +31,4 @@ namespace OpenSim.Region.Environment.Interfaces
{
bool AddNewFile(string fileName, byte[] data);
}
}
}

View File

@ -47,12 +47,11 @@ namespace OpenSim.Region.Environment
public class ModuleLoader
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>();
private readonly IConfigSource m_config;
private readonly List<IRegionModule> m_loadedModules = new List<IRegionModule>();
private readonly Dictionary<string, IRegionModule> m_loadedSharedModules = new Dictionary<string, IRegionModule>();
private readonly IConfigSource m_config;
public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>();
public ModuleLoader(IConfigSource config)
{
@ -86,7 +85,8 @@ namespace OpenSim.Region.Environment
DynamicTextureModule dynamicModule = new DynamicTextureModule();
if (m_loadedSharedModules.ContainsKey(dynamicModule.Name))
{
m_log.ErrorFormat("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", dynamicModule.Name, "DynamicTextureModule");
m_log.ErrorFormat("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", dynamicModule.Name,
"DynamicTextureModule");
}
else
{
@ -123,15 +123,15 @@ namespace OpenSim.Region.Environment
m_loadedSharedModules.Add(loadMod.Name, loadMod);
}
// AvatarFactoryModule avatarFactory = new AvatarFactoryModule();
// if (m_loadedSharedModules.ContainsKey(avatarFactory.Name))
// {
// m_log.ErrorFormat("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", avatarFactory.Name, "AvarFactoryModule");
// }
// else
// {
// m_loadedSharedModules.Add(avatarFactory.Name, avatarFactory);
// }
// AvatarFactoryModule avatarFactory = new AvatarFactoryModule();
// if (m_loadedSharedModules.ContainsKey(avatarFactory.Name))
// {
// m_log.ErrorFormat("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", avatarFactory.Name, "AvarFactoryModule");
// }
// else
// {
// m_loadedSharedModules.Add(avatarFactory.Name, avatarFactory);
// }
XMLRPCModule xmlRpcMod = new XMLRPCModule();
if (m_loadedSharedModules.ContainsKey(xmlRpcMod.Name))
@ -149,13 +149,13 @@ namespace OpenSim.Region.Environment
AssetTransactionModule transactionsModule = new AssetTransactionModule();
if (m_loadedSharedModules.ContainsKey(transactionsModule.Name))
{
m_log.ErrorFormat("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", transactionsModule.Name, "TransactionModule");
m_log.ErrorFormat("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", transactionsModule.Name,
"TransactionModule");
}
else
{
m_loadedSharedModules.Add(transactionsModule.Name, transactionsModule);
}
}
public void InitialiseSharedModules(Scene scene)
@ -284,7 +284,7 @@ namespace OpenSim.Region.Environment
{
if (pluginType.GetInterface("IRegionModule") != null)
{
modules.Add((IRegionModule)Activator.CreateInstance(pluginType));
modules.Add((IRegionModule) Activator.CreateInstance(pluginType));
}
}
}
@ -320,8 +320,8 @@ namespace OpenSim.Region.Environment
public void UnloadModule(IRegionModule rm)
{
rm.Close();
m_loadedModules.Remove(rm);
}
}
}
}

View File

@ -40,15 +40,16 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetDownload
/// <summary>
/// Asset requests with data which are ready to be sent back to requesters. This includes textures.
/// </summary>
private List<AssetRequest> AssetRequests;
private readonly List<AssetRequest> AssetRequests;
private Scene m_scene;
private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
private readonly Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
///
/// Assets requests (for each user) which are waiting for asset server data. This includes texture requests
/// </summary>
private Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>> RequestedAssets;
private readonly Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>> RequestedAssets;
private Scene m_scene;
public AssetDownloadModule()
{
@ -205,22 +206,18 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetDownload
{
public AssetBase AssetInf;
public byte AssetRequestSource = 2;
public long DataPointer = 0;
public long DataPointer;
public int DiscardLevel = -1;
public AssetBase ImageInfo;
public bool IsTextureRequest;
public int NumPackets = 0;
public int PacketCounter = 0;
public byte[] Params = null;
public int NumPackets;
public int PacketCounter;
public byte[] Params;
public LLUUID RequestAssetID;
public IClientAPI RequestUser;
public LLUUID TransferRequestID;
//public bool AssetInCache;
//public int TimeRequested;
public AssetRequest()
{
}
}
#endregion

View File

@ -44,7 +44,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Fields
private bool m_dumpAssetsToFile;
private readonly bool m_dumpAssetsToFile;
public AgentAssetTransactionsManager Manager;
public LLUUID UserID;
public Dictionary<LLUUID, AssetXferUploader> XferUploaders = new Dictionary<LLUUID, AssetXferUploader>();
@ -141,23 +141,23 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
public class AssetXferUploader
{
// Fields
private readonly bool m_dumpAssetToFile;
private readonly AgentAssetTransactions m_userTransactions;
public bool AddToInventory;
public AssetBase Asset;
public LLUUID InventFolder = LLUUID.Zero;
private sbyte invType = 0;
private bool m_createItem = false;
private sbyte invType;
private bool m_createItem;
private string m_description = String.Empty;
private bool m_dumpAssetToFile;
private bool m_finished = false;
private bool m_finished;
private string m_name = String.Empty;
private bool m_storeLocal;
private AgentAssetTransactions m_userTransactions;
private uint nextPerm = 0;
private uint nextPerm;
private IClientAPI ourClient;
public LLUUID TransactionID = LLUUID.Zero;
private sbyte type = 0;
private sbyte type;
public bool UploadComplete;
private byte wearableType = 0;
private byte wearableType;
public ulong XferID;
public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile)
@ -390,7 +390,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
item.BasePermissions = 2147483647;
item.CurrentPermissions = 2147483647;
item.NextPermissions = nextPerm;
item.Flags = (uint) wearableType;
item.Flags = wearableType;
userInfo.AddItem(ourClient.AgentId, item);
ourClient.SendInventoryItemCreateUpdate(item);

View File

@ -40,16 +40,11 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
public class AssetTransactionModule : IRegionModule, IAgentAssetTransactions
{
private readonly Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
private bool m_dumpAssetsToFile = false;
private Scene m_scene = null;
private bool m_dumpAssetsToFile;
private Scene m_scene;
private AgentAssetTransactionsManager m_transactionManager;
public AssetTransactionModule()
{
// System.Console.WriteLine("creating AgentAssetTransactionModule");
}
#region IAgentAssetTransactions Members
public void HandleItemCreationFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
@ -145,13 +140,13 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
/// <summary>
/// Each agent has its own singleton collection of transactions
/// </summary>
private Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions =
private readonly Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions =
new Dictionary<LLUUID, AgentAssetTransactions>();
/// <summary>
/// Should we dump uploaded assets to the filesystem?
/// </summary>
private bool m_dumpAssetsToFile;
private readonly bool m_dumpAssetsToFile;
public Scene MyScene;

View File

@ -47,6 +47,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
private readonly BlockingQueue<ITextureSender> m_queueSenders
= new BlockingQueue<ITextureSender>();
private readonly List<Scene> m_scenes = new List<Scene>();
/// <summary>
/// Each user has their own texture download service.
/// </summary>
@ -54,14 +56,9 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
new Dictionary<LLUUID, UserTextureDownloadService>();
private Scene m_scene;
private List<Scene> m_scenes = new List<Scene>();
private Thread m_thread;
public TextureDownloadModule()
{
}
#region IRegionModule Members
public void Initialise(Scene scene, IConfigSource config)
@ -69,7 +66,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
if (m_scene == null)
{
//Console.WriteLine("Creating Texture download module");
m_thread = new Thread(new ThreadStart(ProcessTextureSenders));
m_thread = new Thread(ProcessTextureSenders);
m_thread.Name = "ProcessTextureSenderThread";
m_thread.IsBackground = true;
m_thread.Start();

View File

@ -40,13 +40,13 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
//private static readonly log4net.ILog m_log
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private bool m_cancel = false;
private readonly LLUUID m_textureId;
private bool m_cancel;
private IClientAPI m_client;
// See ITextureSender
private bool m_sending = false;
private LLUUID m_textureId;
private bool m_sending;
// See ITextureSender

View File

@ -43,12 +43,14 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
private static readonly ILog m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly IClientAPI RequestUser;
/// <summary>
/// Records the number of times texture send has been called.
/// </summary>
public int counter = 0;
public int counter;
public bool ImageLoaded = false;
public bool ImageLoaded;
/// <summary>
/// Holds the texture asset to send.
@ -57,27 +59,26 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
//public LLUUID assetID { get { return m_asset.FullID; } }
private bool m_cancel = false;
private bool m_cancel;
// See ITextureSender
private bool m_sending = false;
private bool m_sending;
/// <summary>
/// This is actually the number of extra packets required to send the texture data! We always assume
/// at least one is required.
/// </summary>
private int NumPackets = 0;
private int NumPackets;
/// <summary>
/// Holds the packet number to send next. In this case, each packet is 1000 bytes long and starts
/// at the 600th byte (0th indexed).
/// </summary>
private int PacketCounter = 0;
private int PacketCounter;
private int RequestedDiscardLevel = -1;
private IClientAPI RequestUser;
private uint StartPacketNumber = 0;
private uint StartPacketNumber;
public TextureSender(IClientAPI client, int discardLevel, uint packetNumber)
{
@ -190,7 +191,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
catch (ArgumentOutOfRangeException)
{
m_log.Error("[TEXTURE SENDER]: Unable to separate texture into multiple packets: Array bounds failure on asset:" +
m_asset.FullID.ToString());
m_asset.FullID);
return;
}
RequestUser.OutPacket(im, ThrottleOutPacketType.Texture);

View File

@ -41,10 +41,6 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer
public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>();
public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>();
public XferModule()
{
}
#region IRegionModule Members
public void Initialise(Scene scene, IConfigSource config)
@ -149,11 +145,11 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer
public IClientAPI Client;
private bool complete;
public byte[] Data = new byte[0];
public int DataPointer = 0;
public int DataPointer;
public string FileName = String.Empty;
public uint Packet = 0;
public uint Packet;
public uint Serial = 1;
public ulong XferID = 0;
public ulong XferID;
public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client)
{
@ -217,7 +213,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer
{
byte[] transferData = new byte[Data.Length - DataPointer];
Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer);
uint endPacket = Packet |= (uint) 0x80000000;
uint endPacket = Packet |= 0x80000000;
Client.SendXferPacket(XferID, endPacket, transferData);
Packet++;
DataPointer += (Data.Length - DataPointer);

View File

@ -44,15 +44,15 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
public class ChatModule : IRegionModule, ISimChat
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string m_defaultzone = null;
private readonly List<Scene> m_scenes = new List<Scene>();
private string m_defaultzone;
private IRCChatModule m_irc = null;
private Thread m_irc_connector = null;
private IRCChatModule m_irc;
private Thread m_irc_connector;
private string m_last_leaving_user = null;
private string m_last_new_user = null;
private string m_last_leaving_user;
private string m_last_new_user;
private int m_saydistance = 30;
private List<Scene> m_scenes = new List<Scene>();
private int m_shoutdistance = 100;
internal object m_syncInit = new object();
internal object m_syncLogout = new object();
@ -257,7 +257,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
}
catch (Exception ex)
{
m_log.Error("[IRC]: NewClient exception trap:" + ex.ToString());
m_log.Error("[IRC]: NewClient exception trap:" + ex);
}
}
@ -284,7 +284,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
}
catch (Exception ex)
{
m_log.Error("[IRC]: ClientLoggedOut exception trap:" + ex.ToString());
m_log.Error("[IRC]: ClientLoggedOut exception trap:" + ex);
}
}
}
@ -372,24 +372,24 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
#endregion
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Thread listener;
private string m_basenick = null;
private string m_channel = null;
private bool m_connected = false;
private bool m_enabled = false;
private List<Scene> m_last_scenes = null;
private string m_nick = null;
private uint m_port = 6668;
private string m_privmsgformat = "PRIVMSG {0} :<{1} in {2}>: {3}";
private readonly string m_basenick;
private readonly string m_channel;
private readonly bool m_enabled;
private readonly uint m_port = 6668;
private readonly string m_privmsgformat = "PRIVMSG {0} :<{1} in {2}>: {3}";
private readonly string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
private Thread listener;
private bool m_connected;
private List<Scene> m_last_scenes;
private string m_nick;
private StreamReader m_reader;
private List<Scene> m_scenes = null;
private string m_server = null;
private List<Scene> m_scenes;
private string m_server;
private NetworkStream m_stream;
internal object m_syncConnect = new object();
private TcpClient m_tcp;
private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
private StreamWriter m_writer;
private Thread pingSender;
@ -478,13 +478,13 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
m_reader = new StreamReader(m_stream);
m_writer = new StreamWriter(m_stream);
pingSender = new Thread(new ThreadStart(PingRun));
pingSender = new Thread(PingRun);
pingSender.Name = "PingSenderThread";
pingSender.IsBackground = true;
pingSender.Start();
ThreadTracker.Add(pingSender);
listener = new Thread(new ThreadStart(ListenerRun));
listener = new Thread(ListenerRun);
listener.Name = "IRCChatModuleListenerThread";
listener.IsBackground = true;
listener.Start();
@ -545,7 +545,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
}
catch (Exception ex)
{
m_log.Error("[IRC]: PrivMsg exception trap:" + ex.ToString());
m_log.Error("[IRC]: PrivMsg exception trap:" + ex);
}
}
@ -588,7 +588,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
{
try
{
if (m_connected == true)
if (m_connected)
{
m_writer.WriteLine("PING :" + m_server);
m_writer.Flush();
@ -602,7 +602,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
}
catch (Exception ex)
{
m_log.Error("[IRC]: PingRun exception trap:" + ex.ToString() + "\n" + ex.StackTrace);
m_log.Error("[IRC]: PingRun exception trap:" + ex + "\n" + ex.StackTrace);
}
}
}
@ -615,7 +615,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
{
try
{
while ((m_connected == true) && ((inputLine = m_reader.ReadLine()) != null))
while (m_connected && ((inputLine = m_reader.ReadLine()) != null))
{
// Console.WriteLine(inputLine);
if (inputLine.Contains(m_channel))
@ -659,7 +659,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
}
catch (Exception ex)
{
m_log.Error("[IRC]: ListenerRun exception trap:" + ex.ToString() + "\n" + ex.StackTrace);
m_log.Error("[IRC]: ListenerRun exception trap:" + ex + "\n" + ex.StackTrace);
}
}
}
@ -685,7 +685,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
}
catch (Exception ex) // IRC gate should not crash Sim
{
m_log.Error("[IRC]: BroadcastSim Exception Trap:" + ex.ToString() + "\n" + ex.StackTrace);
m_log.Error("[IRC]: BroadcastSim Exception Trap:" + ex + "\n" + ex.StackTrace);
}
}

View File

@ -65,55 +65,55 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
public class SampleMoneyModule : IMoneyModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly Dictionary<LLUUID, int> m_KnownClientFunds = new Dictionary<LLUUID, int>();
/// <summary>
/// Region UUIDS indexed by AgentID
/// </summary>
private readonly Dictionary<LLUUID, LLUUID> m_rootAgents = new Dictionary<LLUUID, LLUUID>();
/// <summary>
/// Scenes by Region Handle
/// </summary>
private readonly Dictionary<ulong, Scene> m_scenel = new Dictionary<ulong, Scene>();
/// <summary>
/// Where Stipends come from and Fees go to.
/// </summary>
private LLUUID EconomyBaseAccount = LLUUID.Zero;
private float EnergyEfficiency = 0f;
private bool gridmode = false;
private float EnergyEfficiency;
private bool gridmode;
private ObjectPaid handerOnObjectPaid;
private bool m_enabled = true;
private IConfigSource m_gConfig;
private bool m_keepMoneyAcrossLogins = true;
private Dictionary<LLUUID, int> m_KnownClientFunds = new Dictionary<LLUUID, int>();
private string m_LandAddress = String.Empty;
private int m_minFundsBeforeRefresh = 100;
private string m_MoneyAddress = String.Empty;
/// <summary>
/// Region UUIDS indexed by AgentID
/// </summary>
private Dictionary<LLUUID, LLUUID> m_rootAgents = new Dictionary<LLUUID, LLUUID>();
/// <summary>
/// Scenes by Region Handle
/// </summary>
private Dictionary<ulong, Scene> m_scenel = new Dictionary<ulong, Scene>();
private int m_stipend = 1000;
private int ObjectCapacity = 45000;
private int ObjectCount = 0;
private int PriceEnergyUnit = 0;
private int PriceGroupCreate = 0;
private int PriceObjectClaim = 0;
private float PriceObjectRent = 0f;
private float PriceObjectScaleFactor = 0f;
private int PriceParcelClaim = 0;
private float PriceParcelClaimFactor = 0f;
private int PriceParcelRent = 0;
private int PricePublicObjectDecay = 0;
private int PricePublicObjectDelete = 0;
private int PriceRentLight = 0;
private int PriceUpload = 0;
private int TeleportMinPrice = 0;
private int ObjectCount;
private int PriceEnergyUnit;
private int PriceGroupCreate;
private int PriceObjectClaim;
private float PriceObjectRent;
private float PriceObjectScaleFactor;
private int PriceParcelClaim;
private float PriceParcelClaimFactor;
private int PriceParcelRent;
private int PricePublicObjectDecay;
private int PricePublicObjectDelete;
private int PriceRentLight;
private int PriceUpload;
private int TeleportMinPrice;
private float TeleportPriceExponent = 0f;
private float TeleportPriceExponent;
private int UserLevelPaysFees = 2;
private Scene XMLRPCHandler;
@ -305,7 +305,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
Hashtable hbinfo =
GetBalanceForUserFromMoneyServer(client.AgentId, client.SecureSessionId, s.RegionInfo.originRegionID.ToString(),
s.RegionInfo.regionSecret);
if ((bool) hbinfo["success"] == true)
if ((bool) hbinfo["success"])
{
Helpers.TryParse((string) hbinfo["agentId"], out agentID);
try
@ -333,7 +333,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
else
{
m_log.WarnFormat("[MONEY]: Getting Money for user {0} failed with the following message:{1}", agentID,
(string) hbinfo["errorMessage"]);
hbinfo["errorMessage"]);
client.SendAlertMessage((string) hbinfo["errorMessage"]);
}
SendMoneyBalance(client, agentID, client.SessionId, LLUUID.Zero);
@ -660,7 +660,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
Hashtable hresult = genericCurrencyXMLRPCRequest(ht, "regionMoveMoney");
if ((bool) hresult["success"] == true)
if ((bool) hresult["success"])
{
int funds1 = 0;
int funds2 = 0;
@ -718,7 +718,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
Hashtable hbinfo =
GetBalanceForUserFromMoneyServer(aClient.AgentId, aClient.SecureSessionId, s.RegionInfo.originRegionID.ToString(),
s.RegionInfo.regionSecret);
if ((bool) hbinfo["success"] == true)
if ((bool) hbinfo["success"])
{
try
{
@ -743,7 +743,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
else
{
m_log.WarnFormat("[MONEY]: Getting Money for user {0} failed with the following message:{1}", agentId,
(string) hbinfo["errorMessage"]);
hbinfo["errorMessage"]);
aClient.SendAlertMessage((string) hbinfo["errorMessage"]);
}
}
@ -812,7 +812,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
string secret = (string) requestData["secret"];
Scene userScene = GetRandomScene();
if (userScene.RegionInfo.regionSecret.ToString() == secret)
if (userScene.RegionInfo.regionSecret == secret)
{
IClientAPI client = LocateClientObject(agentId);
@ -1238,7 +1238,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
{
lock (e)
{
if (e.economyValidated == true && e.transactionID == 0)
if (e.economyValidated && e.transactionID == 0)
{
e.transactionID = Util.UnixTimeSinceEpoch();
@ -1328,7 +1328,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
else
{
m_log.Warn("[MONEY]: Potential Fraud Warning, got money transfer request for avatar that isn't in this simulator - Details; Sender:" +
e.sender.ToString() + " Receiver: " + e.receiver.ToString() + " Amount: " + e.amount.ToString());
e.sender + " Receiver: " + e.receiver + " Amount: " + e.amount);
}
}
@ -1400,7 +1400,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
{
Hashtable hresult =
claim_user(avatar.UUID, avatar.ControllingClient.SecureSessionId, regionID, RegionItem.RegionInfo.regionSecret);
if ((bool) hresult["success"] == true)
if ((bool) hresult["success"])
{
int funds = 0;
try
@ -1432,7 +1432,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
if (RegionItem != null)
{
Hashtable hresult = claim_user(avatar.UUID, avatar.ControllingClient.SecureSessionId, regionID, RegionItem.RegionInfo.regionSecret);
if ((bool) hresult["success"] == true)
if ((bool) hresult["success"])
{
int funds = 0;
try
@ -1460,7 +1460,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
#endregion
}
public enum TransactionType : int
public enum TransactionType
{
SystemGenerated = 0,
RegionMoneyRequest = 1,

View File

@ -42,10 +42,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<LLUUID, List<FriendListItem>> FriendLists = new Dictionary<LLUUID, List<FriendListItem>>();
private Dictionary<LLUUID, LLUUID> m_pendingFriendRequests = new Dictionary<LLUUID, LLUUID>();
private Dictionary<LLUUID, ulong> m_rootAgents = new Dictionary<LLUUID, ulong>();
private List<Scene> m_scene = new List<Scene>();
private readonly Dictionary<LLUUID, List<FriendListItem>> FriendLists = new Dictionary<LLUUID, List<FriendListItem>>();
private readonly Dictionary<LLUUID, LLUUID> m_pendingFriendRequests = new Dictionary<LLUUID, LLUUID>();
private readonly Dictionary<LLUUID, ulong> m_rootAgents = new Dictionary<LLUUID, ulong>();
private readonly List<Scene> m_scene = new List<Scene>();
#region IRegionModule Members
@ -213,7 +213,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
List<LLUUID> updateUsers = new List<LLUUID>();
foreach (FriendListItem fli in lfli)
{
if (fli.onlinestatus == true)
if (fli.onlinestatus)
{
updateUsers.Add(fli.Friend);
}
@ -357,20 +357,20 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
// https://wiki.secondlife.com/wiki/ImprovedInstantMessage
// 38 == Offer friendship
if (dialog == (byte) 38)
if (dialog == 38)
{
LLUUID friendTransactionID = LLUUID.Random();
m_pendingFriendRequests.Add(friendTransactionID, fromAgentID);
m_log.Info("[FRIEND]: 38 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" +
m_log.Info("[FRIEND]: 38 - From:" + fromAgentID + " To: " + toAgentID + " Session:" + imSessionID + " Message:" +
message);
GridInstantMessage msg = new GridInstantMessage();
msg.fromAgentID = fromAgentID.UUID;
msg.fromAgentSession = fromAgentSession.UUID;
msg.toAgentID = toAgentID.UUID;
msg.imSessionID = friendTransactionID.UUID; // This is the item we're mucking with here
m_log.Info("[FRIEND]: Filling Session: " + msg.imSessionID.ToString());
m_log.Info("[FRIEND]: Filling Session: " + msg.imSessionID);
msg.timestamp = timestamp;
if (client != null)
{
@ -393,16 +393,16 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
}
// 39 == Accept Friendship
if (dialog == (byte) 39)
if (dialog == 39)
{
m_log.Info("[FRIEND]: 39 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" +
m_log.Info("[FRIEND]: 39 - From:" + fromAgentID + " To: " + toAgentID + " Session:" + imSessionID + " Message:" +
message);
}
// 40 == Decline Friendship
if (dialog == (byte) 40)
if (dialog == 40)
{
m_log.Info("[FRIEND]: 40 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" +
m_log.Info("[FRIEND]: 40 - From:" + fromAgentID + " To: " + toAgentID + " Session:" + imSessionID + " Message:" +
message);
}
}
@ -433,14 +433,14 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
msg.ParentEstateID = 0;
msg.timestamp = (uint) Util.UnixTimeSinceEpoch();
msg.RegionID = SceneAgentIn.RegionInfo.RegionID.UUID;
msg.dialog = (byte) 39; // Approved friend request
msg.dialog = 39; // Approved friend request
msg.Position = new sLLVector3();
msg.offline = (byte) 0;
msg.offline = 0;
msg.binaryBucket = new byte[0];
// We don't really care which scene we pipe it through, it goes to the shared IM Module and/or the database
SceneAgentIn.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule);
SceneAgentIn.StoreAddFriendship(m_pendingFriendRequests[transactionID], agentID, (uint) 1);
SceneAgentIn.StoreAddFriendship(m_pendingFriendRequests[transactionID], agentID, 1);
m_pendingFriendRequests.Remove(transactionID);
// TODO: Inform agent that the friend is online
@ -471,9 +471,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
msg.ParentEstateID = 0;
msg.timestamp = (uint) Util.UnixTimeSinceEpoch();
msg.RegionID = SceneAgentIn.RegionInfo.RegionID.UUID;
msg.dialog = (byte) 40; // Deny friend request
msg.dialog = 40; // Deny friend request
msg.Position = new sLLVector3();
msg.offline = (byte) 0;
msg.offline = 0;
msg.binaryBucket = new byte[0];
SceneAgentIn.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule);
m_pendingFriendRequests.Remove(transactionID);

View File

@ -41,10 +41,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<LLUUID, GroupList> m_grouplistmap = new Dictionary<LLUUID, GroupList>();
private Dictionary<LLUUID, GroupData> m_groupmap = new Dictionary<LLUUID, GroupData>();
private Dictionary<LLUUID, IClientAPI> m_iclientmap = new Dictionary<LLUUID, IClientAPI>();
private List<Scene> m_scene = new List<Scene>();
private readonly Dictionary<LLUUID, GroupList> m_grouplistmap = new Dictionary<LLUUID, GroupList>();
private readonly Dictionary<LLUUID, GroupData> m_groupmap = new Dictionary<LLUUID, GroupData>();
private readonly Dictionary<LLUUID, IClientAPI> m_iclientmap = new Dictionary<LLUUID, IClientAPI>();
private readonly List<Scene> m_scene = new List<Scene>();
#region IRegionModule Members
@ -214,7 +214,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups
}
else
{
m_log.Info("[GROUP]: Removing all reference to groups for " + agentID.ToString());
m_log.Info("[GROUP]: Removing all reference to groups for " + agentID);
}
m_iclientmap.Remove(agentID);
}

View File

@ -46,7 +46,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory
/// occurs in the initial offer message, not the accept message. So this dictionary links
/// IM Session Ids to ItemIds
/// </summary>
private IDictionary<LLUUID, LLUUID> m_pendingOffers = new Dictionary<LLUUID, LLUUID>();
private readonly IDictionary<LLUUID, LLUUID> m_pendingOffers = new Dictionary<LLUUID, LLUUID>();
private Scene m_scene;

View File

@ -41,10 +41,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Profiles
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_scene;
public AvatarProfilesModule()
{
}
#region IRegionModule Members
public void Initialise(Scene scene, IConfigSource config)
@ -104,7 +100,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Profiles
}
else
{
m_log.Debug("[AvatarProfilesModule]: Got null for profile for " + avatarID.ToString());
m_log.Debug("[AvatarProfilesModule]: Got null for profile for " + avatarID);
}
}

View File

@ -42,11 +42,11 @@ namespace OpenSim.Region.Environment.Modules.Framework
public class Command : ICommand
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private List<CommandArgument> m_args = new List<CommandArgument>();
private readonly List<CommandArgument> m_args = new List<CommandArgument>();
private Action<object[]> m_command;
private string m_help;
private string m_name;
private readonly Action<object[]> m_command;
private readonly string m_help;
private readonly string m_name;
public Command(string name, Action<Object[]> command, string help)
{
@ -164,9 +164,9 @@ namespace OpenSim.Region.Environment.Modules.Framework
/// </summary>
public class CommandArgument
{
private string m_help;
private string m_name;
private string m_type;
private readonly string m_help;
private readonly string m_name;
private readonly string m_type;
private Object m_val;
public CommandArgument(string name, string help, string type)
@ -204,8 +204,8 @@ namespace OpenSim.Region.Environment.Modules.Framework
public class Commander : ICommander
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<string, ICommand> m_commands = new Dictionary<string, ICommand>();
private string m_name;
private readonly Dictionary<string, ICommand> m_commands = new Dictionary<string, ICommand>();
private readonly string m_name;
public Commander(string name)
{
@ -235,11 +235,11 @@ namespace OpenSim.Region.Environment.Modules.Framework
}
classSrc = classSrc.Remove(classSrc.Length - 1); // Delete the last comma
classSrc += " )\n\t{\n";
classSrc += "\t\tObject[] args = new Object[" + com.Arguments.Count.ToString() + "];\n";
classSrc += "\t\tObject[] args = new Object[" + com.Arguments.Count + "];\n";
int i = 0;
foreach (KeyValuePair<string, string> arg in com.Arguments)
{
classSrc += "\t\targs[" + i.ToString() + "] = " + Util.Md5Hash(arg.Key) + " " + ";\n";
classSrc += "\t\targs[" + i + "] = " + Util.Md5Hash(arg.Key) + " " + ";\n";
i++;
}
classSrc += "\t\tGetCommander(\"" + m_name + "\").Run(\"" + com.Name + "\", args);\n";

View File

@ -34,7 +34,7 @@ namespace OpenSim.Region.Environment.Modules.Framework
{
public class CommanderTestModule : IRegionModule, ICommandableModule
{
private Commander m_commander = new Commander("CommanderTest");
private readonly Commander m_commander = new Commander("CommanderTest");
private Scene m_scene;
#region ICommandableModule Members

View File

@ -29,14 +29,14 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
#endregion
private readonly Dictionary<Type, Object> m_interfaces = new Dictionary<Type, object>();
private readonly Object m_lockObject = new object();
private readonly List<Location> m_myLocations = new List<Location>();
private readonly Dictionary<Location, string[]> m_neighbourInterfaces = new Dictionary<Location, string[]>();
private readonly Dictionary<Location, RemotingObject> m_neighbourRemote = new Dictionary<Location, RemotingObject>();
private IConfigSource m_config;
private bool m_enabled = false;
private bool m_enabled;
private Object m_lockObject = new object();
private RemotingObject m_myRemote;
private TcpChannel m_tcpChannel;
private int m_tcpPort = 10101;

View File

@ -40,12 +40,12 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
{
public class DynamicTextureModule : IRegionModule, IDynamicTextureManager
{
private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
private readonly Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
private Dictionary<string, IDynamicTextureRender> RenderPlugins =
private readonly Dictionary<string, IDynamicTextureRender> RenderPlugins =
new Dictionary<string, IDynamicTextureRender>();
private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>();
private readonly Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>();
#region IDynamicTextureManager Members
@ -176,14 +176,14 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
public class DynamicTextureUpdater
{
public bool BlendWithOldTexture = false;
public bool BlendWithOldTexture;
public string BodyData;
public string ContentType;
public byte FrontAlpha = 255;
public LLUUID LastAssetID;
public string Params;
public LLUUID PrimID;
public bool SetNewFrontAlpha = false;
public bool SetNewFrontAlpha;
public LLUUID SimUUID;
public LLUUID UpdaterID;
public int UpdateTimer;

View File

@ -84,7 +84,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
{
public class HttpRequestModule : IRegionModule, IHttpRequests
{
private object HttpListLock = new object();
private readonly object HttpListLock = new object();
private int httpTimeout = 30000;
private string m_name = "HttpScriptRequests";
@ -93,10 +93,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
private Scene m_scene;
private Queue<HttpRequestClass> rpcQueue = new Queue<HttpRequestClass>();
public HttpRequestModule()
{
}
#region IHttpRequests Members
public LLUUID MakeHttpRequest(string url, string parameters, string body)

View File

@ -120,9 +120,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
private void MakeHttpRequest(string url, LLUUID requestID)
{
WebRequest request = HttpWebRequest.Create(url);
WebRequest request = WebRequest.Create(url);
RequestState state = new RequestState((HttpWebRequest) request, requestID);
IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state);
IAsyncResult result = request.BeginGetResponse(HttpRequestReturn, state);
TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
state.TimeOfRequest = (int) t.TotalSeconds;
@ -131,7 +131,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
private void HttpRequestReturn(IAsyncResult result)
{
RequestState state = (RequestState) result.AsyncState;
WebRequest request = (WebRequest) state.Request;
WebRequest request = state.Request;
HttpWebResponse response = (HttpWebResponse) request.EndGetResponse(result);
if (response.StatusCode == HttpStatusCode.OK)
{
@ -175,9 +175,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
public class RequestState
{
public HttpWebRequest Request = null;
public HttpWebRequest Request;
public LLUUID RequestID = LLUUID.Zero;
public int TimeOfRequest = 0;
public int TimeOfRequest;
public RequestState(HttpWebRequest request, LLUUID requestID)
{

View File

@ -48,10 +48,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
private Scene m_scene;
private IDynamicTextureManager m_textureManager;
public VectorRenderModule()
{
}
#region IDynamicTextureRender Members
public string GetContentType()
@ -138,7 +134,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
catch (Exception e)
{
//Ckrinke: Add a WriteLine to remove the warning about 'e' defined but not used
Console.WriteLine("Problem with Draw. Please verify parameters." + e.ToString());
Console.WriteLine("Problem with Draw. Please verify parameters." + e);
}
if ((size < 128) || (size > 1024))
@ -260,7 +256,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
endPoint.X = (int) x;
endPoint.Y = (int) y;
Image image = ImageHttpRequest(nextLine);
graph.DrawImage(image, (float) startPoint.X, (float) startPoint.Y, x, y);
graph.DrawImage(image, startPoint.X, startPoint.Y, x, y);
startPoint.X += endPoint.X;
startPoint.Y += endPoint.Y;
}
@ -353,7 +349,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
private Bitmap ImageHttpRequest(string url)
{
WebRequest request = HttpWebRequest.Create(url);
WebRequest request = WebRequest.Create(url);
//Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used.
//Ckrinke Stream str = null;
HttpWebResponse response = (HttpWebResponse) (request).GetResponse();

View File

@ -75,10 +75,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
private Queue m_pendingQ;
private Scene m_scene;
public WorldCommModule()
{
}
#region IRegionModule Members
public void Initialise(Scene scene, IConfigSource config)
@ -324,8 +320,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
public class ListenerManager
{
//private Dictionary<int, ListenerInfo> m_listeners;
private readonly Hashtable m_listeners = Hashtable.Synchronized(new Hashtable());
private object ListenersLock = new object();
private Hashtable m_listeners = Hashtable.Synchronized(new Hashtable());
private int m_MaxListeners = 100;
public int AddListener(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg)
@ -485,6 +481,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
public class ListenerInfo
{
private readonly LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message
private bool m_active; // Listener is active or not
private int m_channel; // Channel
private int m_handle; // Assigned handle of this listener
@ -494,7 +491,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
private uint m_localID; // Local ID from script engine
private string m_message; // The message
private string m_name; // Object name to filter messages from
private LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message
public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message)
{

View File

@ -78,20 +78,20 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
public class XMLRPCModule : IRegionModule, IXMLRPC
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly List<Scene> m_scenes = new List<Scene>();
private readonly object XMLRPCListLock = new object();
private string m_name = "XMLRPCModule";
// <channel id, RPCChannelInfo>
private Dictionary<LLUUID, RPCChannelInfo> m_openChannels;
private Dictionary<LLUUID, SendRemoteDataRequest> m_pendingSRDResponses;
private int m_remoteDataPort = 0;
private int m_remoteDataPort;
private Dictionary<LLUUID, RPCRequestInfo> m_rpcPending;
private Dictionary<LLUUID, RPCRequestInfo> m_rpcPendingResponses;
private List<Scene> m_scenes = new List<Scene>();
private int RemoteReplyScriptTimeout = 9000;
private int RemoteReplyScriptWait = 300;
private object XMLRPCListLock = new object();
#region IRegionModule Members
@ -428,15 +428,15 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
public class RPCRequestInfo
{
private LLUUID m_ChannelKey;
private string m_IntVal;
private LLUUID m_ItemID;
private uint m_localID;
private LLUUID m_MessageID;
private readonly LLUUID m_ChannelKey;
private readonly string m_IntVal;
private readonly LLUUID m_ItemID;
private readonly uint m_localID;
private readonly LLUUID m_MessageID;
private readonly string m_StrVal;
private bool m_processed;
private int m_respInt;
private string m_respStr;
private string m_StrVal;
public RPCRequestInfo(uint localID, LLUUID itemID, LLUUID channelKey, string strVal, string intVal)
{
@ -514,9 +514,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
public class RPCChannelInfo
{
private LLUUID m_ChannelKey;
private LLUUID m_itemID;
private uint m_localID;
private readonly LLUUID m_ChannelKey;
private readonly LLUUID m_itemID;
private readonly uint m_localID;
public RPCChannelInfo(uint localID, LLUUID itemID, LLUUID channelID)
{

View File

@ -44,8 +44,8 @@ namespace OpenSim.Region.Environment.Modules.World.Land
//Land types set with flags in ParcelOverlay.
//Only one of these can be used.
public const float BAN_LINE_SAFETY_HIEGHT = 100;
public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = (byte) 128; //Equals 10000000
public const byte LAND_FLAG_PROPERTY_BORDER_WEST = (byte) 64; //Equals 01000000
public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = 128; //Equals 10000000
public const byte LAND_FLAG_PROPERTY_BORDER_WEST = 64; //Equals 01000000
//RequestResults (I think these are right, they seem to work):
public const int LAND_RESULT_MULTIPLE = 1; // The request they made contained more than a single peice of land
@ -55,26 +55,26 @@ namespace OpenSim.Region.Environment.Modules.World.Land
public const int LAND_SELECT_OBJECTS_GROUP = 4;
public const int LAND_SELECT_OBJECTS_OTHER = 8;
public const int LAND_SELECT_OBJECTS_OWNER = 2;
public const byte LAND_TYPE_IS_BEING_AUCTIONED = (byte) 5; //Equals 00000101
public const byte LAND_TYPE_IS_FOR_SALE = (byte) 4; //Equals 00000100
public const byte LAND_TYPE_OWNED_BY_GROUP = (byte) 2; //Equals 00000010
public const byte LAND_TYPE_OWNED_BY_OTHER = (byte) 1; //Equals 00000001
public const byte LAND_TYPE_OWNED_BY_REQUESTER = (byte) 3; //Equals 00000011
public const byte LAND_TYPE_PUBLIC = (byte) 0; //Equals 00000000
public const byte LAND_TYPE_IS_BEING_AUCTIONED = 5; //Equals 00000101
public const byte LAND_TYPE_IS_FOR_SALE = 4; //Equals 00000100
public const byte LAND_TYPE_OWNED_BY_GROUP = 2; //Equals 00000010
public const byte LAND_TYPE_OWNED_BY_OTHER = 1; //Equals 00000001
public const byte LAND_TYPE_OWNED_BY_REQUESTER = 3; //Equals 00000011
public const byte LAND_TYPE_PUBLIC = 0; //Equals 00000000
//These are other constants. Yay!
public const int START_LAND_LOCAL_ID = 1;
#endregion
private int[,] landIDList = new int[64,64];
private Dictionary<int, ILandObject> landList = new Dictionary<int, ILandObject>();
private readonly int[,] landIDList = new int[64,64];
private readonly Dictionary<int, ILandObject> landList = new Dictionary<int, ILandObject>();
private readonly Scene m_scene;
private bool landPrimCountTainted = false;
private bool landPrimCountTainted;
private int lastLandLocalID = START_LAND_LOCAL_ID - 1;
private bool m_allowedForcefulBans = true;
private Scene m_scene;
public LandChannel(Scene scene)
{
@ -192,7 +192,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
{
lastLandLocalID++;
new_land.landData.localID = lastLandLocalID;
landList.Add(lastLandLocalID, (LandObject) new_land.Copy());
landList.Add(lastLandLocalID, new_land.Copy());
bool[,] landBitmap = new_land.getLandBitmap();
@ -532,7 +532,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
{
for (x = 0; x < 64; x++)
{
byte tempByte = (byte) 0; //This represents the byte for the current 4x4
byte tempByte = 0; //This represents the byte for the current 4x4
ILandObject currentParcelBlock = null;
try
@ -611,7 +611,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
packet = (ParcelOverlayPacket) PacketPool.Instance.GetPacket(PacketType.ParcelOverlay);
packet.ParcelData.Data = byteArray;
packet.ParcelData.SequenceID = sequenceID;
remote_client.OutPacket((Packet) packet, ThrottleOutPacketType.Task);
remote_client.OutPacket(packet, ThrottleOutPacketType.Task);
sequenceID++;
byteArray = new byte[LAND_BLOCKS_PER_PACKET];
}

View File

@ -45,14 +45,14 @@ namespace OpenSim.Region.Environment.Modules.World.Land
m_scene.EventManager.OnParcelPrimCountAdd += landChannel.addPrimToLandPrimCounts;
m_scene.EventManager.OnParcelPrimCountUpdate += landChannel.updateLandPrimCounts;
m_scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(landChannel.handleAvatarChangingParcel);
m_scene.EventManager.OnClientMovement += new EventManager.ClientMovement(landChannel.handleAnyClientMovement);
m_scene.EventManager.OnAvatarEnteringNewParcel += landChannel.handleAvatarChangingParcel;
m_scene.EventManager.OnClientMovement += landChannel.handleAnyClientMovement;
m_scene.EventManager.OnValidateLandBuy += landChannel.handleLandValidationRequest;
m_scene.EventManager.OnLandBuy += landChannel.handleLandBuyRequest;
lock (m_scene)
{
m_scene.LandChannel = (ILandChannel) landChannel;
m_scene.LandChannel = landChannel;
}
}

View File

@ -73,6 +73,8 @@ namespace OpenSim.Region.Environment.Modules.World.Land
get { return m_scene.RegionInfo.RegionID; }
}
#endregion
#region Constructors
public LandObject(LLUUID owner_id, bool is_group_owned, Scene scene)
@ -98,7 +100,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
{
if (x >= 0 && y >= 0 && x <= Constants.RegionSize && x <= Constants.RegionSize)
{
return (landBitmap[x / 4, y / 4] == true);
return landBitmap[x / 4, y / 4];
}
else
{
@ -148,7 +150,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
updatePacket.ParcelData.GroupID = landData.groupID;
updatePacket.ParcelData.GroupPrims = landData.groupPrims;
updatePacket.ParcelData.IsGroupOwned = landData.isGroupOwned;
updatePacket.ParcelData.LandingType = (byte) landData.landingType;
updatePacket.ParcelData.LandingType = landData.landingType;
updatePacket.ParcelData.LocalID = landData.localID;
if (landData.area > 0)
{
@ -212,7 +214,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
landData.selectedPrims;
updatePacket.ParcelData.UserLocation = landData.userLocation;
updatePacket.ParcelData.UserLookAt = landData.userLookAt;
remote_client.OutPacket((Packet) updatePacket, ThrottleOutPacketType.Task);
remote_client.OutPacket(updatePacket, ThrottleOutPacketType.Task);
}
public void updateLandProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client)
@ -355,7 +357,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
{
ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock();
listBlock.Flags = (uint) 0;
listBlock.Flags = 0;
listBlock.ID = entry.AgentID;
listBlock.Time = 0;
@ -367,7 +369,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
{
ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock();
listBlock.Flags = (uint) 0;
listBlock.Flags = 0;
listBlock.ID = LLUUID.Zero;
listBlock.Time = 0;
@ -390,7 +392,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
replyPacket.Data.SequenceID = 0;
replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Access);
remote_client.OutPacket((Packet) replyPacket, ThrottleOutPacketType.Task);
remote_client.OutPacket(replyPacket, ThrottleOutPacketType.Task);
}
if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both)
@ -402,7 +404,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
replyPacket.Data.SequenceID = 0;
replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Ban);
remote_client.OutPacket((Packet) replyPacket, ThrottleOutPacketType.Task);
remote_client.OutPacket(replyPacket, ThrottleOutPacketType.Task);
}
}
@ -482,7 +484,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
{
for (y = 0; y < 64; y++)
{
if (landBitmap[x, y] == true)
if (landBitmap[x, y])
{
if (min_x > x) min_x = x;
if (min_y > y) min_y = y;
@ -499,7 +501,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
if (ty > 255)
ty = 255;
landData.AABBMin =
new LLVector3((float) (min_x * 4), (float) (min_y * 4),
new LLVector3((min_x * 4), (min_y * 4),
(float) m_scene.Heightmap[tx, ty]);
tx = max_x * 4;
@ -509,7 +511,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
if (ty > 255)
ty = 255;
landData.AABBMax =
new LLVector3((float) (max_x * 4), (float) (max_y * 4),
new LLVector3((max_x * 4), (max_y * 4),
(float) m_scene.Heightmap[tx, ty]);
landData.area = tempArea;
}
@ -657,7 +659,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
if (i % 8 == 0)
{
tempConvertArr[byteNum] = tempByte;
tempByte = (byte) 0;
tempByte = 0;
i = 0;
byteNum++;
}
@ -677,7 +679,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
tempByte = landData.landBitmapByteArray[i];
for (bitNum = 0; bitNum < 8; bitNum++)
{
bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1);
bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & 1);
tempConvertMap[x, y] = bit;
x++;
if (x > 63)
@ -751,7 +753,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
resultLocalIDs.RemoveAt(0);
}
pack.Data = data;
remote_client.OutPacket((Packet) pack, ThrottleOutPacketType.Task);
remote_client.OutPacket(pack, ThrottleOutPacketType.Task);
}
}
@ -922,7 +924,5 @@ namespace OpenSim.Region.Environment.Modules.World.Land
#endregion
#endregion
#endregion
}
}

View File

@ -37,10 +37,10 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
{
public class SerialiserModule : IRegionModule, IRegionSerialiser
{
private Commander m_commander = new Commander("Export");
private List<Scene> m_regions = new List<Scene>();
private readonly Commander m_commander = new Commander("Export");
private readonly List<Scene> m_regions = new List<Scene>();
private readonly List<IFileSerialiser> m_serialisers = new List<IFileSerialiser>();
private string m_savedir = "exports" + "/";
private List<IFileSerialiser> m_serialisers = new List<IFileSerialiser>();
#region IRegionModule Members
@ -105,8 +105,8 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
TextWriter regionInfoWriter = new StreamWriter(saveDir + "README.TXT");
regionInfoWriter.WriteLine("Region Name: " + scene.RegionInfo.RegionName);
regionInfoWriter.WriteLine("Region ID: " + scene.RegionInfo.RegionID.ToString());
regionInfoWriter.WriteLine("Backup Time: UTC " + DateTime.UtcNow.ToString());
regionInfoWriter.WriteLine("Region ID: " + scene.RegionInfo.RegionID);
regionInfoWriter.WriteLine("Backup Time: UTC " + DateTime.UtcNow);
regionInfoWriter.WriteLine("Serialise Version: 0.1");
regionInfoWriter.Close();
@ -141,7 +141,7 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
{
if (region.RegionInfo.RegionName == (string) args[0])
{
List<string> results = SerialiseRegion(region, m_savedir + region.RegionInfo.RegionID.ToString() + "/");
List<string> results = SerialiseRegion(region, m_savedir + region.RegionInfo.RegionID + "/");
}
}
}
@ -150,7 +150,7 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
{
foreach (Scene region in m_regions)
{
List<string> results = SerialiseRegion(region, m_savedir + region.RegionInfo.RegionID.ToString() + "/");
List<string> results = SerialiseRegion(region, m_savedir + region.RegionInfo.RegionID + "/");
}
}

View File

@ -127,7 +127,7 @@ namespace OpenSim.Region.Environment.Modules.World.Sun
{
long m_addticks = (DateTime.Now.Ticks - m_start) * m_dilation;
DateTime dt = new DateTime(m_start + m_addticks);
return (double) dt.Hour + ((double) dt.Minute / 60.0);
return dt.Hour + (dt.Minute / 60.0);
}
private LLVector3 SunPos(double hour)

View File

@ -78,7 +78,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.Effects
{
for (y = 0; y < map.Height; y++)
{
if (cliffMask[x, y] == true)
if (cliffMask[x, y])
eroder.PaintEffect(map, x, y, 4, 0.1);
}
}

View File

@ -47,7 +47,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
{
for (x = 0; x < retval.Width; x++)
{
retval[x, y] = (double) bs.ReadByte() * ((double) bs.ReadByte() / 127.0);
retval[x, y] = bs.ReadByte() * (bs.ReadByte() / 127.0);
bs.ReadBytes(11); // Advance the stream to next bytes.
}
}
@ -76,7 +76,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
{
for (j = 0; j < 256; j++)
{
lookupHeightTable[i + (j * 256)] = ((double) i * ((double) j / 127.0));
lookupHeightTable[i + (j * 256)] = (i * (j / 127.0));
}
}

View File

@ -50,14 +50,14 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
BinaryReader bs = new BinaryReader(s);
bool eof = false;
if (ASCIIEncoding.ASCII.GetString(bs.ReadBytes(16)) == "TERRAGENTERRAIN ")
if (Encoding.ASCII.GetString(bs.ReadBytes(16)) == "TERRAGENTERRAIN ")
{
// Terragen file
while (eof == false)
{
int w = 256;
int h = 256;
string tmp = ASCIIEncoding.ASCII.GetString(bs.ReadBytes(4));
string tmp = Encoding.ASCII.GetString(bs.ReadBytes(4));
switch (tmp)
{
case "SIZE":
@ -84,7 +84,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
{
for (y = 0; y < h; y++)
{
retval[x, y] = (double) baseHeight + (double) bs.ReadInt16() * (double) heightScale / 65536.0;
retval[x, y] = baseHeight + bs.ReadInt16() * (double) heightScale / 65536.0;
}
}
break;

View File

@ -31,7 +31,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
{
public class FlattenSphere : ITerrainPaintableEffect
{
#region ITerrainPaintableEffect Members
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)

View File

@ -57,7 +57,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
z *= z;
z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry));
double noise = TerrainUtil.PerlinNoise2D((double) x / (double) Constants.RegionSize, (double) y / (double) Constants.RegionSize, 8, 1.0);
double noise = TerrainUtil.PerlinNoise2D(x / (double) Constants.RegionSize, y / (double) Constants.RegionSize, 8, 1.0);
if (z > 0.0)
map[x, y] += noise * z * duration;

View File

@ -32,7 +32,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
{
public class RevertSphere : ITerrainPaintableEffect
{
private ITerrainChannel m_revertmap;
private readonly ITerrainChannel m_revertmap;
public RevertSphere(ITerrainChannel revertmap)
{

View File

@ -31,7 +31,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
{
public class TerrainException : Exception
{
public TerrainException() : base()
public TerrainException()
{
}

View File

@ -83,7 +83,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
private Dictionary<string, ITerrainEffect> m_plugineffects;
private ITerrainChannel m_revert;
private Scene m_scene;
private bool m_tainted = false;
private bool m_tainted;
#region ICommandableModule Members
@ -223,6 +223,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
}
}
#endregion
#region Plugin Loading Methods
private void LoadPlugins()
@ -276,8 +278,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
#endregion
#endregion
/// <summary>
/// Installs into terrain module the standard suite of brushes
/// </summary>

View File

@ -66,10 +66,10 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
m_trees = new List<LLUUID>();
m_scene = scene;
m_scene.EventManager.OnPluginConsole += new EventManager.OnPluginConsoleDelegate(EventManager_OnPluginConsole);
m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
Timer CalculateTrees = new Timer(m_tree_updates);
CalculateTrees.Elapsed += new ElapsedEventHandler(CalculateTrees_Elapsed);
CalculateTrees.Elapsed += CalculateTrees_Elapsed;
CalculateTrees.Start();
m_log.Debug("[TREES]: Initialised tree module");
}

View File

@ -33,27 +33,21 @@ namespace OpenSim.Region.Environment
{
public class PermissionManager
{
protected Scene m_scene;
// These are here for testing. They will be taken out
//private uint PERM_ALL = (uint)2147483647;
private uint PERM_COPY = (uint)32768;
//private uint PERM_MODIFY = (uint)16384;
private uint PERM_MOVE = (uint)524288;
//private uint PERM_TRANS = (uint)8192;
private uint PERM_LOCKED = (uint)540672;
// Bypasses the permissions engine (always returns OK)
// disable in any production environment
// TODO: Change this to false when permissions are a desired default
// TODO: Move to configuration option.
private bool m_bypassPermissions = true;
protected Scene m_scene;
// These are here for testing. They will be taken out
//private uint PERM_ALL = (uint)2147483647;
private uint PERM_COPY = 32768;
//private uint PERM_MODIFY = (uint)16384;
//private uint PERM_TRANS = (uint)8192;
private uint PERM_LOCKED = 540672;
private uint PERM_MOVE = 524288;
public bool BypassPermissions
{
get { return m_bypassPermissions; }
set { m_bypassPermissions = value; }
}
public PermissionManager()
{
@ -64,6 +58,12 @@ namespace OpenSim.Region.Environment
m_scene = scene;
}
public bool BypassPermissions
{
get { return m_bypassPermissions; }
set { m_bypassPermissions = value; }
}
public void Initialise(Scene scene)
{
m_scene = scene;
@ -129,8 +129,8 @@ namespace OpenSim.Region.Environment
ILandObject land = m_scene.LandChannel.getLandObject(position.X, position.Y);
if (land == null) return false;
if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.CreateObjects)) ==
(int)Parcel.ParcelFlags.CreateObjects)
if ((land.landData.landFlags & ((int) Parcel.ParcelFlags.CreateObjects)) ==
(int) Parcel.ParcelFlags.CreateObjects)
permission = true;
//TODO: check for group rights
@ -168,8 +168,6 @@ namespace OpenSim.Region.Environment
/// <returns>Has permission?</returns>
public virtual bool CanObjectEntry(LLUUID user, LLVector3 oldPos, LLVector3 newPos)
{
if ((newPos.X > 257f || newPos.X < -1f || newPos.Y > 257f || newPos.Y < -1f))
{
return true;
@ -193,7 +191,7 @@ namespace OpenSim.Region.Environment
return true;
}
if ((land2.landData.landFlags & ((int)Parcel.ParcelFlags.AllowAllObjectEntry)) != 0)
if ((land2.landData.landFlags & ((int) Parcel.ParcelFlags.AllowAllObjectEntry)) != 0)
{
return true;
}
@ -210,355 +208,6 @@ namespace OpenSim.Region.Environment
return false;
}
#region Object Permissions
public virtual uint GenerateClientFlags(LLUUID user, LLUUID objID)
{
// Here's the way this works,
// ObjectFlags and Permission flags are two different enumerations
// ObjectFlags, however, tells the client to change what it will allow the user to do.
// So, that means that all of the permissions type ObjectFlags are /temporary/ and only
// supposed to be set when customizing the objectflags for the client.
// These temporary objectflags get computed and added in this function based on the
// Permission mask that's appropriate!
// Outside of this method, they should never be added to objectflags!
// -teravus
SceneObjectPart task=m_scene.GetSceneObjectPart(objID);
// this shouldn't ever happen.. return no permissions/objectflags.
if (task == null)
return (uint)0;
uint objflags = task.GetEffectiveObjectFlags();
LLUUID objectOwner = task.OwnerID;
// Remove any of the objectFlags that are temporary. These will get added back if appropriate
// in the next bit of code
objflags &= (uint)
~(LLObject.ObjectFlags.ObjectCopy | // Tells client you can copy the object
LLObject.ObjectFlags.ObjectModify | // tells client you can modify the object
LLObject.ObjectFlags.ObjectMove | // tells client that you can move the object (only, no mod)
LLObject.ObjectFlags.ObjectTransfer | // tells the client that you can /take/ the object if you don't own it
LLObject.ObjectFlags.ObjectYouOwner | // Tells client that you're the owner of the object
LLObject.ObjectFlags.ObjectYouOfficer // Tells client that you've got group object editing permission. Used when ObjectGroupOwned is set
);
// Creating the three ObjectFlags options for this method to choose from.
// Customize the OwnerMask
uint objectOwnerMask = ApplyObjectModifyMasks(task.OwnerMask, objflags);
objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectYouOwner;
// Customize the GroupMask
uint objectGroupMask = ApplyObjectModifyMasks(task.GroupMask, objflags);
// Customize the EveryoneMask
uint objectEveryoneMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
// Hack to allow collaboration until Groups and Group Permissions are implemented
if ((objectEveryoneMask & (uint)LLObject.ObjectFlags.ObjectMove) != 0)
objectEveryoneMask |= (uint)LLObject.ObjectFlags.ObjectModify;
if (m_bypassPermissions)
return objectOwnerMask;
// Object owners should be able to edit their own content
if (user == objectOwner)
{
return objectOwnerMask;
}
// Users should be able to edit what is over their land.
ILandObject parcel = m_scene.LandChannel.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
if (parcel != null && parcel.landData.ownerID == user)
return objectOwnerMask;
// Admin objects should not be editable by the above
if (IsAdministrator(objectOwner))
return objectEveryoneMask;
// Estate users should be able to edit anything in the sim
if (IsEstateManager(user))
return objectOwnerMask;
// Admin should be able to edit anything in the sim (including admin objects)
if (IsAdministrator(user))
return objectOwnerMask;
return objectEveryoneMask;
}
private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask)
{
// We are adding the temporary objectflags to the object's objectflags based on the
// permission flag given. These change the F flags on the client.
if ((setPermissionMask & (uint)PermissionMask.Copy) != 0)
{
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectCopy;
}
if ((setPermissionMask & (uint)PermissionMask.Move) != 0)
{
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectMove;
}
if ((setPermissionMask & (uint)PermissionMask.Modify) != 0)
{
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectModify;
}
if ((setPermissionMask & (uint)PermissionMask.Transfer) != 0)
{
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectTransfer;
}
return objectFlagsMask;
}
protected virtual bool GenericObjectPermission(LLUUID currentUser, LLUUID objId)
{
// Default: deny
bool permission = false;
bool locked = false;
if (!m_scene.Entities.ContainsKey(objId))
{
return false;
}
// If it's not an object, we cant edit it.
if ((!(m_scene.Entities[objId] is SceneObjectGroup)))
{
return false;
}
SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[objId];
LLUUID objectOwner = group.OwnerID;
locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0);
// People shouldn't be able to do anything with locked objects, except the Administrator
// The 'set permissions' runs through a different permission check, so when an object owner
// sets an object locked, the only thing that they can do is unlock it.
//
// Nobody but the object owner can set permissions on an object
//
if (locked && (!IsAdministrator(currentUser)))
{
return false;
}
// Object owners should be able to edit their own content
if (currentUser == objectOwner)
{
permission = true;
}
// Users should be able to edit what is over their land.
ILandObject parcel = m_scene.LandChannel.getLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y);
if ((parcel != null) && (parcel.landData.ownerID == currentUser))
{
permission = true;
}
// Estate users should be able to edit anything in the sim
if (IsEstateManager(currentUser))
{
permission = true;
}
// Admin objects should not be editable by the above
if (IsAdministrator(objectOwner))
{
permission = false;
}
// Admin should be able to edit anything in the sim (including admin objects)
if (IsAdministrator(currentUser))
{
permission = true;
}
return permission;
}
/// <summary>
/// Permissions check - can user delete an object?
/// </summary>
/// <param name="user">User attempting the delete</param>
/// <param name="obj">Target object</param>
/// <returns>Has permission?</returns>
public virtual bool CanDeRezObject(LLUUID user, LLUUID obj)
{
return GenericObjectPermission(user, obj);
}
public virtual bool CanEditObject(LLUUID user, LLUUID obj)
{
return GenericObjectPermission(user, obj);
}
public virtual bool CanEditObjectPosition(LLUUID user, LLUUID obj)
{
bool permission = GenericObjectPermission(user, obj);
if (!permission)
{
if (!m_scene.Entities.ContainsKey(obj))
{
return false;
}
// The client
// may request to edit linked parts, and therefore, it needs
// to also check for SceneObjectPart
// If it's not an object, we cant edit it.
if ((!(m_scene.Entities[obj] is SceneObjectGroup)))
{
return false;
}
SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[obj];
LLUUID taskOwner = null;
// Added this because at this point in time it wouldn't be wise for
// the administrator object permissions to take effect.
LLUUID objectOwner = task.OwnerID;
// Anyone can move
if ((task.RootPart.EveryoneMask & PERM_MOVE) != 0)
permission = true;
// Locked
if ((task.RootPart.OwnerMask & PERM_LOCKED) == 0)
permission = false;
}
else
{
bool locked = false;
if (!m_scene.Entities.ContainsKey(obj))
{
return false;
}
// If it's not an object, we cant edit it.
if ((!(m_scene.Entities[obj] is SceneObjectGroup)))
{
return false;
}
SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[obj];
LLUUID objectOwner = group.OwnerID;
locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0);
// This is an exception to the generic object permission.
// Administrators who lock their objects should not be able to move them,
// however generic object permission should return true.
// This keeps locked objects from being affected by random click + drag actions by accident
// and allows the administrator to grab or delete a locked object.
// Administrators and estate managers are still able to click+grab locked objects not
// owned by them in the scene
// This is by design.
if (locked && (user == objectOwner))
return false;
}
return permission;
}
public virtual bool CanCopyObject(LLUUID user, LLUUID obj)
{
bool permission = GenericObjectPermission(user, obj);
if (!permission)
{
if (!m_scene.Entities.ContainsKey(obj))
{
return false;
}
// If it's not an object, we cant edit it.
if (!(m_scene.Entities[obj] is SceneObjectGroup))
{
return false;
}
SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[obj];
LLUUID taskOwner = null;
// Added this because at this point in time it wouldn't be wise for
// the administrator object permissions to take effect.
LLUUID objectOwner = task.OwnerID;
if ((task.RootPart.EveryoneMask & PERM_COPY) != 0)
permission = true;
}
return permission;
}
public virtual bool CanReturnObject(LLUUID user, LLUUID obj)
{
return GenericObjectPermission(user, obj);
}
#endregion
#region Communication Permissions
public virtual bool GenericCommunicationPermission(LLUUID user, LLUUID target)
{
bool permission = false;
string reason = "Only registered users may communicate with another account.";
if (IsGridUser(user))
permission = true;
if (!IsGridUser(user))
{
permission = false;
reason = "The person that you are messaging is not a registered user.";
}
if (IsAdministrator(user))
permission = true;
if (IsEstateManager(user))
permission = true;
if (!permission)
SendPermissionError(user, reason);
return permission;
}
public virtual bool CanInstantMessage(LLUUID user, LLUUID target)
{
return GenericCommunicationPermission(user, target);
}
public virtual bool CanInventoryTransfer(LLUUID user, LLUUID target)
{
return GenericCommunicationPermission(user, target);
}
#endregion
public virtual bool CanEditScript(LLUUID user, LLUUID script)
{
return IsAdministrator(user);
@ -690,5 +339,351 @@ namespace OpenSim.Region.Environment
}
#endregion
#region Object Permissions
public virtual uint GenerateClientFlags(LLUUID user, LLUUID objID)
{
// Here's the way this works,
// ObjectFlags and Permission flags are two different enumerations
// ObjectFlags, however, tells the client to change what it will allow the user to do.
// So, that means that all of the permissions type ObjectFlags are /temporary/ and only
// supposed to be set when customizing the objectflags for the client.
// These temporary objectflags get computed and added in this function based on the
// Permission mask that's appropriate!
// Outside of this method, they should never be added to objectflags!
// -teravus
SceneObjectPart task = m_scene.GetSceneObjectPart(objID);
// this shouldn't ever happen.. return no permissions/objectflags.
if (task == null)
return 0;
uint objflags = task.GetEffectiveObjectFlags();
LLUUID objectOwner = task.OwnerID;
// Remove any of the objectFlags that are temporary. These will get added back if appropriate
// in the next bit of code
objflags &= (uint)
~(LLObject.ObjectFlags.ObjectCopy | // Tells client you can copy the object
LLObject.ObjectFlags.ObjectModify | // tells client you can modify the object
LLObject.ObjectFlags.ObjectMove | // tells client that you can move the object (only, no mod)
LLObject.ObjectFlags.ObjectTransfer | // tells the client that you can /take/ the object if you don't own it
LLObject.ObjectFlags.ObjectYouOwner | // Tells client that you're the owner of the object
LLObject.ObjectFlags.ObjectYouOfficer
// Tells client that you've got group object editing permission. Used when ObjectGroupOwned is set
);
// Creating the three ObjectFlags options for this method to choose from.
// Customize the OwnerMask
uint objectOwnerMask = ApplyObjectModifyMasks(task.OwnerMask, objflags);
objectOwnerMask |= (uint) LLObject.ObjectFlags.ObjectYouOwner;
// Customize the GroupMask
uint objectGroupMask = ApplyObjectModifyMasks(task.GroupMask, objflags);
// Customize the EveryoneMask
uint objectEveryoneMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
// Hack to allow collaboration until Groups and Group Permissions are implemented
if ((objectEveryoneMask & (uint) LLObject.ObjectFlags.ObjectMove) != 0)
objectEveryoneMask |= (uint) LLObject.ObjectFlags.ObjectModify;
if (m_bypassPermissions)
return objectOwnerMask;
// Object owners should be able to edit their own content
if (user == objectOwner)
{
return objectOwnerMask;
}
// Users should be able to edit what is over their land.
ILandObject parcel = m_scene.LandChannel.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
if (parcel != null && parcel.landData.ownerID == user)
return objectOwnerMask;
// Admin objects should not be editable by the above
if (IsAdministrator(objectOwner))
return objectEveryoneMask;
// Estate users should be able to edit anything in the sim
if (IsEstateManager(user))
return objectOwnerMask;
// Admin should be able to edit anything in the sim (including admin objects)
if (IsAdministrator(user))
return objectOwnerMask;
return objectEveryoneMask;
}
private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask)
{
// We are adding the temporary objectflags to the object's objectflags based on the
// permission flag given. These change the F flags on the client.
if ((setPermissionMask & (uint) PermissionMask.Copy) != 0)
{
objectFlagsMask |= (uint) LLObject.ObjectFlags.ObjectCopy;
}
if ((setPermissionMask & (uint) PermissionMask.Move) != 0)
{
objectFlagsMask |= (uint) LLObject.ObjectFlags.ObjectMove;
}
if ((setPermissionMask & (uint) PermissionMask.Modify) != 0)
{
objectFlagsMask |= (uint) LLObject.ObjectFlags.ObjectModify;
}
if ((setPermissionMask & (uint) PermissionMask.Transfer) != 0)
{
objectFlagsMask |= (uint) LLObject.ObjectFlags.ObjectTransfer;
}
return objectFlagsMask;
}
protected virtual bool GenericObjectPermission(LLUUID currentUser, LLUUID objId)
{
// Default: deny
bool permission = false;
bool locked = false;
if (!m_scene.Entities.ContainsKey(objId))
{
return false;
}
// If it's not an object, we cant edit it.
if ((!(m_scene.Entities[objId] is SceneObjectGroup)))
{
return false;
}
SceneObjectGroup group = (SceneObjectGroup) m_scene.Entities[objId];
LLUUID objectOwner = group.OwnerID;
locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0);
// People shouldn't be able to do anything with locked objects, except the Administrator
// The 'set permissions' runs through a different permission check, so when an object owner
// sets an object locked, the only thing that they can do is unlock it.
//
// Nobody but the object owner can set permissions on an object
//
if (locked && (!IsAdministrator(currentUser)))
{
return false;
}
// Object owners should be able to edit their own content
if (currentUser == objectOwner)
{
permission = true;
}
// Users should be able to edit what is over their land.
ILandObject parcel = m_scene.LandChannel.getLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y);
if ((parcel != null) && (parcel.landData.ownerID == currentUser))
{
permission = true;
}
// Estate users should be able to edit anything in the sim
if (IsEstateManager(currentUser))
{
permission = true;
}
// Admin objects should not be editable by the above
if (IsAdministrator(objectOwner))
{
permission = false;
}
// Admin should be able to edit anything in the sim (including admin objects)
if (IsAdministrator(currentUser))
{
permission = true;
}
return permission;
}
/// <summary>
/// Permissions check - can user delete an object?
/// </summary>
/// <param name="user">User attempting the delete</param>
/// <param name="obj">Target object</param>
/// <returns>Has permission?</returns>
public virtual bool CanDeRezObject(LLUUID user, LLUUID obj)
{
return GenericObjectPermission(user, obj);
}
public virtual bool CanEditObject(LLUUID user, LLUUID obj)
{
return GenericObjectPermission(user, obj);
}
public virtual bool CanEditObjectPosition(LLUUID user, LLUUID obj)
{
bool permission = GenericObjectPermission(user, obj);
if (!permission)
{
if (!m_scene.Entities.ContainsKey(obj))
{
return false;
}
// The client
// may request to edit linked parts, and therefore, it needs
// to also check for SceneObjectPart
// If it's not an object, we cant edit it.
if ((!(m_scene.Entities[obj] is SceneObjectGroup)))
{
return false;
}
SceneObjectGroup task = (SceneObjectGroup) m_scene.Entities[obj];
LLUUID taskOwner = null;
// Added this because at this point in time it wouldn't be wise for
// the administrator object permissions to take effect.
LLUUID objectOwner = task.OwnerID;
// Anyone can move
if ((task.RootPart.EveryoneMask & PERM_MOVE) != 0)
permission = true;
// Locked
if ((task.RootPart.OwnerMask & PERM_LOCKED) == 0)
permission = false;
}
else
{
bool locked = false;
if (!m_scene.Entities.ContainsKey(obj))
{
return false;
}
// If it's not an object, we cant edit it.
if ((!(m_scene.Entities[obj] is SceneObjectGroup)))
{
return false;
}
SceneObjectGroup group = (SceneObjectGroup) m_scene.Entities[obj];
LLUUID objectOwner = group.OwnerID;
locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0);
// This is an exception to the generic object permission.
// Administrators who lock their objects should not be able to move them,
// however generic object permission should return true.
// This keeps locked objects from being affected by random click + drag actions by accident
// and allows the administrator to grab or delete a locked object.
// Administrators and estate managers are still able to click+grab locked objects not
// owned by them in the scene
// This is by design.
if (locked && (user == objectOwner))
return false;
}
return permission;
}
public virtual bool CanCopyObject(LLUUID user, LLUUID obj)
{
bool permission = GenericObjectPermission(user, obj);
if (!permission)
{
if (!m_scene.Entities.ContainsKey(obj))
{
return false;
}
// If it's not an object, we cant edit it.
if (!(m_scene.Entities[obj] is SceneObjectGroup))
{
return false;
}
SceneObjectGroup task = (SceneObjectGroup) m_scene.Entities[obj];
LLUUID taskOwner = null;
// Added this because at this point in time it wouldn't be wise for
// the administrator object permissions to take effect.
LLUUID objectOwner = task.OwnerID;
if ((task.RootPart.EveryoneMask & PERM_COPY) != 0)
permission = true;
}
return permission;
}
public virtual bool CanReturnObject(LLUUID user, LLUUID obj)
{
return GenericObjectPermission(user, obj);
}
#endregion
#region Communication Permissions
public virtual bool GenericCommunicationPermission(LLUUID user, LLUUID target)
{
bool permission = false;
string reason = "Only registered users may communicate with another account.";
if (IsGridUser(user))
permission = true;
if (!IsGridUser(user))
{
permission = false;
reason = "The person that you are messaging is not a registered user.";
}
if (IsAdministrator(user))
permission = true;
if (IsEstateManager(user))
permission = true;
if (!permission)
SendPermissionError(user, reason);
return permission;
}
public virtual bool CanInstantMessage(LLUUID user, LLUUID target)
{
return GenericCommunicationPermission(user, target);
}
public virtual bool CanInventoryTransfer(LLUUID user, LLUUID target)
{
return GenericCommunicationPermission(user, target);
}
#endregion
}
}
}

View File

@ -46,8 +46,8 @@ namespace OpenSim.Region.Environment.Scenes
{
if (nod.Attributes["name"] != null)
{
string name = (string)nod.Attributes["name"].Value;
LLUUID id = (LLUUID)nod.InnerText;
string name = nod.Attributes["name"].Value;
LLUUID id = (LLUUID) nod.InnerText;
AnimsLLUUID.Add(name, id);
AnimsNames.Add(id, name);
@ -56,4 +56,4 @@ namespace OpenSim.Region.Environment.Scenes
}
}
}
}
}

View File

@ -37,52 +37,13 @@ namespace OpenSim.Region.Environment.Scenes
[Serializable]
public class AvatarAppearance : ISerializable
{
protected float m_avatarHeight;
protected LLUUID m_scenePresenceID;
public LLUUID ScenePresenceID
{
get { return m_scenePresenceID; }
set { m_scenePresenceID = value; }
}
protected int m_wearablesSerial = 1;
public int WearablesSerial
{
get { return m_wearablesSerial; }
set { m_wearablesSerial = value; }
}
protected LLObject.TextureEntry m_textureEntry;
protected byte[] m_visualParams;
public byte[] VisualParams
{
get { return m_visualParams; }
set { m_visualParams = value; }
}
protected AvatarWearable[] m_wearables;
public AvatarWearable[] Wearables
{
get { return m_wearables; }
set { m_wearables = value; }
}
protected LLObject.TextureEntry m_textureEntry;
public LLObject.TextureEntry TextureEntry
{
get { return m_textureEntry; }
set { m_textureEntry = value; }
}
protected float m_avatarHeight = 0;
public float AvatarHeight
{
get { return m_avatarHeight; }
set { m_avatarHeight = value; }
}
protected int m_wearablesSerial = 1;
public AvatarAppearance()
{
@ -97,6 +58,86 @@ namespace OpenSim.Region.Environment.Scenes
m_textureEntry = GetDefaultTextureEntry();
}
protected AvatarAppearance(SerializationInfo info, StreamingContext context)
{
//System.Console.WriteLine("AvatarAppearance Deserialize BGN");
if (info == null)
{
throw new ArgumentNullException("info");
}
m_scenePresenceID = new LLUUID((Guid) info.GetValue("m_scenePresenceID", typeof (Guid)));
m_wearablesSerial = (int) info.GetValue("m_wearablesSerial", typeof (int));
m_visualParams = (byte[]) info.GetValue("m_visualParams", typeof (byte[]));
m_wearables = (AvatarWearable[]) info.GetValue("m_wearables", typeof (AvatarWearable[]));
byte[] m_textureEntry_work = (byte[]) info.GetValue("m_textureEntry", typeof (byte[]));
m_textureEntry = new LLObject.TextureEntry(m_textureEntry_work, 0, m_textureEntry_work.Length);
m_avatarHeight = (float) info.GetValue("m_avatarHeight", typeof (float));
//System.Console.WriteLine("AvatarAppearance Deserialize END");
}
public LLUUID ScenePresenceID
{
get { return m_scenePresenceID; }
set { m_scenePresenceID = value; }
}
public int WearablesSerial
{
get { return m_wearablesSerial; }
set { m_wearablesSerial = value; }
}
public byte[] VisualParams
{
get { return m_visualParams; }
set { m_visualParams = value; }
}
public AvatarWearable[] Wearables
{
get { return m_wearables; }
set { m_wearables = value; }
}
public LLObject.TextureEntry TextureEntry
{
get { return m_textureEntry; }
set { m_textureEntry = value; }
}
public float AvatarHeight
{
get { return m_avatarHeight; }
set { m_avatarHeight = value; }
}
#region ISerializable Members
[SecurityPermission(SecurityAction.LinkDemand,
Flags = SecurityPermissionFlag.SerializationFormatter)]
public virtual void GetObjectData(
SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}
info.AddValue("m_scenePresenceID", m_scenePresenceID.UUID);
info.AddValue("m_wearablesSerial", m_wearablesSerial);
info.AddValue("m_visualParams", m_visualParams);
info.AddValue("m_wearables", m_wearables);
info.AddValue("m_textureEntry", m_textureEntry.ToBytes());
info.AddValue("m_avatarHeight", m_avatarHeight);
}
#endregion
/// <summary>
///
/// </summary>
@ -115,8 +156,8 @@ namespace OpenSim.Region.Environment.Scenes
// Teravus : Nifty AV Height Getting Maaaaagical formula. Oh how we love turning 0-255 into meters.
// (float)m_visualParams[25] = Height
// (float)m_visualParams[125] = LegLength
m_avatarHeight = (1.50856f + (((float) m_visualParams[25]/255.0f)*(2.525506f - 1.50856f)))
+ (((float) m_visualParams[125]/255.0f)/1.5f);
m_avatarHeight = (1.50856f + ((m_visualParams[25] / 255.0f) * (2.525506f - 1.50856f)))
+ ((m_visualParams[125] / 255.0f) / 1.5f);
}
/// <summary>
@ -152,45 +193,5 @@ namespace OpenSim.Region.Environment.Scenes
textu.CreateFace(6).TextureID = new LLUUID("00000000-0000-1111-9999-000000000011");
return textu;
}
protected AvatarAppearance(SerializationInfo info, StreamingContext context)
{
//System.Console.WriteLine("AvatarAppearance Deserialize BGN");
if (info == null)
{
throw new ArgumentNullException("info");
}
m_scenePresenceID = new LLUUID((Guid)info.GetValue("m_scenePresenceID", typeof(Guid)));
m_wearablesSerial = (int)info.GetValue("m_wearablesSerial", typeof(int));
m_visualParams = (byte[])info.GetValue("m_visualParams", typeof(byte[]));
m_wearables = (AvatarWearable[])info.GetValue("m_wearables", typeof(AvatarWearable[]));
byte[] m_textureEntry_work = (byte[])info.GetValue("m_textureEntry", typeof(byte[]));
m_textureEntry = new LLObject.TextureEntry(m_textureEntry_work, 0, m_textureEntry_work.Length);
m_avatarHeight = (float)info.GetValue("m_avatarHeight", typeof(float));
//System.Console.WriteLine("AvatarAppearance Deserialize END");
}
[SecurityPermission(SecurityAction.LinkDemand,
Flags = SecurityPermissionFlag.SerializationFormatter)]
public virtual void GetObjectData(
SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}
info.AddValue("m_scenePresenceID", m_scenePresenceID.UUID);
info.AddValue("m_wearablesSerial", m_wearablesSerial);
info.AddValue("m_visualParams", m_visualParams);
info.AddValue("m_wearables", m_wearables);
info.AddValue("m_textureEntry", m_textureEntry.ToBytes());
info.AddValue("m_avatarHeight", m_avatarHeight);
}
}
}
}

View File

@ -36,70 +36,15 @@ namespace OpenSim.Region.Environment.Scenes
[Serializable]
public abstract class EntityBase : ISerializable
{
protected uint m_localId;
protected string m_name;
protected LLVector3 m_pos;
protected Quaternion m_rotation = new Quaternion(0, 0, 1, 0);
protected LLVector3 m_rotationalvelocity;
protected Scene m_scene;
public Scene Scene
{
get { return m_scene; }
}
protected LLUUID m_uuid;
public virtual LLUUID UUID
{
get { return m_uuid; }
set { m_uuid = value; }
}
protected string m_name;
/// <summary>
///
/// </summary>
public virtual string Name
{
get { return m_name; }
set { m_name = value; }
}
protected LLVector3 m_pos;
/// <summary>
///
/// </summary>
public virtual LLVector3 AbsolutePosition
{
get { return m_pos; }
set { m_pos = value; }
}
protected LLVector3 m_velocity;
protected LLVector3 m_rotationalvelocity;
/// <summary>
///
/// </summary>
public virtual LLVector3 Velocity
{
get { return m_velocity; }
set { m_velocity = value; }
}
protected Quaternion m_rotation = new Quaternion(0, 0, 1, 0);
public virtual Quaternion Rotation
{
get { return m_rotation; }
set { m_rotation = value; }
}
protected uint m_localId;
public virtual uint LocalId
{
get { return m_localId; }
set { m_localId = value; }
}
/// <summary>
/// Creates a new Entity (should not occur on it's own)
@ -115,28 +60,6 @@ namespace OpenSim.Region.Environment.Scenes
m_rotationalvelocity = new LLVector3(0, 0, 0);
}
/// <summary>
///
/// </summary>
public abstract void UpdateMovement();
/// <summary>
/// Performs any updates that need to be done at each frame.
/// </summary>
public abstract void Update();
/// <summary>
/// Copies the entity
/// </summary>
/// <returns></returns>
public virtual EntityBase Copy()
{
return (EntityBase) MemberwiseClone();
}
public abstract void SetText(string text, Vector3 color, double alpha);
protected EntityBase(SerializationInfo info, StreamingContext context)
{
//System.Console.WriteLine("EntityBase Deserialize BGN");
@ -146,43 +69,95 @@ namespace OpenSim.Region.Environment.Scenes
throw new ArgumentNullException("info");
}
m_uuid = new LLUUID((Guid)info.GetValue("m_uuid", typeof(Guid)));
m_name = (string)info.GetValue("m_name", typeof(string));
m_uuid = new LLUUID((Guid) info.GetValue("m_uuid", typeof (Guid)));
m_name = (string) info.GetValue("m_name", typeof (string));
m_pos
= new LLVector3(
(float)info.GetValue("m_pos.X", typeof(float)),
(float)info.GetValue("m_pos.Y", typeof(float)),
(float)info.GetValue("m_pos.Z", typeof(float)));
(float) info.GetValue("m_pos.X", typeof (float)),
(float) info.GetValue("m_pos.Y", typeof (float)),
(float) info.GetValue("m_pos.Z", typeof (float)));
m_velocity
= new LLVector3(
(float)info.GetValue("m_velocity.X", typeof(float)),
(float)info.GetValue("m_velocity.Y", typeof(float)),
(float)info.GetValue("m_velocity.Z", typeof(float)));
(float) info.GetValue("m_velocity.X", typeof (float)),
(float) info.GetValue("m_velocity.Y", typeof (float)),
(float) info.GetValue("m_velocity.Z", typeof (float)));
m_rotationalvelocity
= new LLVector3(
(float)info.GetValue("m_rotationalvelocity.X", typeof(float)),
(float)info.GetValue("m_rotationalvelocity.Y", typeof(float)),
(float)info.GetValue("m_rotationalvelocity.Z", typeof(float)));
(float) info.GetValue("m_rotationalvelocity.X", typeof (float)),
(float) info.GetValue("m_rotationalvelocity.Y", typeof (float)),
(float) info.GetValue("m_rotationalvelocity.Z", typeof (float)));
m_rotation
= new Quaternion(
(float)info.GetValue("m_rotation.w", typeof(float)),
(float)info.GetValue("m_rotation.x", typeof(float)),
(float)info.GetValue("m_rotation.y", typeof(float)),
(float)info.GetValue("m_rotation.z", typeof(float)));
(float) info.GetValue("m_rotation.w", typeof (float)),
(float) info.GetValue("m_rotation.x", typeof (float)),
(float) info.GetValue("m_rotation.y", typeof (float)),
(float) info.GetValue("m_rotation.z", typeof (float)));
m_localId = (uint)info.GetValue("m_localId", typeof(uint));
m_localId = (uint) info.GetValue("m_localId", typeof (uint));
//System.Console.WriteLine("EntityBase Deserialize END");
}
public Scene Scene
{
get { return m_scene; }
}
public virtual LLUUID UUID
{
get { return m_uuid; }
set { m_uuid = value; }
}
/// <summary>
///
/// </summary>
public virtual string Name
{
get { return m_name; }
set { m_name = value; }
}
/// <summary>
///
/// </summary>
public virtual LLVector3 AbsolutePosition
{
get { return m_pos; }
set { m_pos = value; }
}
/// <summary>
///
/// </summary>
public virtual LLVector3 Velocity
{
get { return m_velocity; }
set { m_velocity = value; }
}
public virtual Quaternion Rotation
{
get { return m_rotation; }
set { m_rotation = value; }
}
public virtual uint LocalId
{
get { return m_localId; }
set { m_localId = value; }
}
#region ISerializable Members
[SecurityPermission(SecurityAction.LinkDemand,
Flags = SecurityPermissionFlag.SerializationFormatter)]
public virtual void GetObjectData(
SerializationInfo info, StreamingContext context)
SerializationInfo info, StreamingContext context)
{
if (info == null)
{
@ -215,18 +190,42 @@ namespace OpenSim.Region.Environment.Scenes
info.AddValue("m_localId", m_localId);
}
#endregion
/// <summary>
///
/// </summary>
public abstract void UpdateMovement();
/// <summary>
/// Performs any updates that need to be done at each frame.
/// </summary>
public abstract void Update();
/// <summary>
/// Copies the entity
/// </summary>
/// <returns></returns>
public virtual EntityBase Copy()
{
return (EntityBase) MemberwiseClone();
}
public abstract void SetText(string text, Vector3 color, double alpha);
}
//Nested Classes
public class EntityIntersection
{
public Vector3 AAfaceNormal = new Vector3(0, 0, 0);
public float distance;
public int face = -1;
public bool HitTF;
public Vector3 ipoint = new Vector3(0, 0, 0);
public Vector3 normal = new Vector3(0, 0, 0);
public Vector3 AAfaceNormal = new Vector3(0, 0, 0);
public int face = -1;
public bool HitTF = false;
public SceneObjectPart obj;
public float distance = 0;
public EntityIntersection()
{
@ -239,4 +238,4 @@ namespace OpenSim.Region.Environment.Scenes
HitTF = _HitTF;
}
}
}
}

View File

@ -34,4 +34,4 @@ namespace OpenSim.Region.Environment.Scenes
{
void processMovement(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation);
}
}
}

View File

@ -46,36 +46,33 @@ namespace OpenSim.Region.Environment.Scenes
#region Events
private PhysicsCrash handlerPhysicsCrash;
public event PhysicsCrash UnRecoverableError;
private PhysicsCrash handlerPhysicsCrash = null;
#endregion
#region Fields
public Dictionary<LLUUID, ScenePresence> ScenePresences;
// SceneObjects is not currently populated or used.
//public Dictionary<LLUUID, SceneObjectGroup> SceneObjects;
public PhysicsScene _PhyScene;
public Dictionary<LLUUID, EntityBase> Entities;
public Dictionary<LLUUID, ScenePresence> RestorePresences;
public BasicQuadTreeNode QuadTree;
protected RegionInfo m_regInfo;
protected int m_activeScripts;
protected int m_numChildAgents;
protected int m_numPrim;
protected int m_numRootAgents;
protected Scene m_parentScene;
protected PermissionManager PermissionsMngr;
protected List<EntityBase> m_updateList = new List<EntityBase>();
protected int m_numRootAgents = 0;
protected int m_numPrim = 0;
protected int m_numChildAgents = 0;
protected int m_physicalPrim = 0;
protected int m_physicalPrim;
protected RegionInfo m_regInfo;
protected int m_activeScripts = 0;
protected int m_scriptLPS = 0;
protected int m_scriptLPS;
internal object m_syncRoot = new object();
public PhysicsScene _PhyScene;
protected List<EntityBase> m_updateList = new List<EntityBase>();
protected PermissionManager PermissionsMngr;
public BasicQuadTreeNode QuadTree;
public Dictionary<LLUUID, ScenePresence> RestorePresences;
public Dictionary<LLUUID, ScenePresence> ScenePresences;
#endregion
@ -84,7 +81,7 @@ namespace OpenSim.Region.Environment.Scenes
m_parentScene = parent;
m_regInfo = regInfo;
PermissionsMngr = permissionsMngr;
QuadTree = new BasicQuadTreeNode(null, "/0/", 0, 0, (short)Constants.RegionSize, (short)Constants.RegionSize);
QuadTree = new BasicQuadTreeNode(null, "/0/", 0, 0, (short) Constants.RegionSize, (short) Constants.RegionSize);
QuadTree.Subdivide();
QuadTree.Subdivide();
}
@ -162,7 +159,7 @@ namespace OpenSim.Region.Environment.Scenes
{
lock (m_syncRoot)
{
return _PhyScene.Simulate((float)elapsed);
return _PhyScene.Simulate((float) elapsed);
}
}
@ -187,7 +184,6 @@ namespace OpenSim.Region.Environment.Scenes
foreach (SceneObjectPart part in sceneObject.Children.Values)
{
part.LocalId = m_parentScene.PrimIDAllocate();
}
sceneObject.UpdateParentIDs();
AddEntity(sceneObject);
@ -233,7 +229,7 @@ namespace OpenSim.Region.Environment.Scenes
for (int i = 0; i < m_updateList.Count; i++)
{
EntityBase entity = m_updateList[i];
// Don't abort the whole update if one entity happens to give us an exception.
try
{
@ -249,7 +245,7 @@ namespace OpenSim.Region.Environment.Scenes
}
catch (Exception e)
{
m_log.ErrorFormat("[INNER SCENE]: Failed to update {0}, - {1}", entity.Name, e);//entity.m_uuid
m_log.ErrorFormat("[INNER SCENE]: Failed to update {0}, - {1}", entity.Name, e); //entity.m_uuid
}
}
m_updateList.Clear();
@ -284,15 +280,16 @@ namespace OpenSim.Region.Environment.Scenes
{
if (obj is SceneObjectGroup)
{
if (((SceneObjectGroup)obj).LocalId == localID)
if ((obj).LocalId == localID)
{
m_parentScene.RemoveEntity((SceneObjectGroup)obj);
m_parentScene.RemoveEntity((SceneObjectGroup) obj);
m_numPrim--;
return;
}
}
}
}
public void DetachObject(uint objectLocalID, IClientAPI remoteClient)
{
List<EntityBase> EntityList = GetEntities();
@ -301,29 +298,25 @@ namespace OpenSim.Region.Environment.Scenes
{
if (obj is SceneObjectGroup)
{
if (((SceneObjectGroup)obj).LocalId == objectLocalID)
if ((obj).LocalId == objectLocalID)
{
SceneObjectGroup group = (SceneObjectGroup)obj;
SceneObjectGroup group = (SceneObjectGroup) obj;
//group.DetachToGround();
DetachSingleAttachmentToInv(group.GetFromAssetID(),remoteClient);
DetachSingleAttachmentToInv(group.GetFromAssetID(), remoteClient);
}
}
}
}
public void HandleUndo(IClientAPI remoteClient, LLUUID primId)
{
if (primId != LLUUID.Zero)
{
SceneObjectPart part = m_parentScene.GetSceneObjectPart(primId);
SceneObjectPart part = m_parentScene.GetSceneObjectPart(primId);
if (part != null)
part.Undo();
}
}
/// <summary>
@ -338,27 +331,29 @@ namespace OpenSim.Region.Environment.Scenes
// Calls attach with a Zero position
AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, LLVector3.Zero);
}
public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt,uint ItemFlags, uint NextOwnerMask)
public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt, uint ItemFlags, uint NextOwnerMask)
{
SceneObjectGroup objatt = m_parentScene.RezObject(remoteClient, itemID, LLVector3.Zero, LLVector3.Zero, LLUUID.Zero, (byte)1, true,
(uint)(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer),
(uint)(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer),
(uint)(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer),
ItemFlags, false, false, remoteClient.AgentId, true);
SceneObjectGroup objatt = m_parentScene.RezObject(remoteClient, itemID, LLVector3.Zero, LLVector3.Zero, LLUUID.Zero, 1, true,
(uint)
(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer),
(uint)
(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer),
(uint)
(PermissionMask.Copy | PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer),
ItemFlags, false, false, remoteClient.AgentId, true);
if (objatt != null)
{
AttachObject(remoteClient,objatt.LocalId,AttachmentPt,new LLQuaternion(0,0,0,1),objatt.AbsolutePosition);
AttachObject(remoteClient, objatt.LocalId, AttachmentPt, new LLQuaternion(0, 0, 0, 1), objatt.AbsolutePosition);
objatt.ScheduleGroupForFullUpdate();
}
}
// What makes this method odd and unique is it tries to detach using an LLUUID.... Yay for standards.
// To LocalId or LLUUID, *THAT* is the question. How now Brown LLUUID??
public void DetachSingleAttachmentToInv(LLUUID itemID, IClientAPI remoteClient)
{
if (itemID == LLUUID.Zero) // If this happened, someone made a mistake....
return;
@ -368,17 +363,16 @@ namespace OpenSim.Region.Environment.Scenes
{
if (obj is SceneObjectGroup)
{
if (((SceneObjectGroup)obj).GetFromAssetID() == itemID)
if (((SceneObjectGroup) obj).GetFromAssetID() == itemID)
{
SceneObjectGroup group = (SceneObjectGroup)obj;
SceneObjectGroup group = (SceneObjectGroup) obj;
group.DetachToInventoryPrep();
m_log.Debug("[DETACH]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString());
m_parentScene.updateKnownAsset(remoteClient, group, group.GetFromAssetID(),group.OwnerID);
m_log.Debug("[DETACH]: Saving attachpoint: " + ((uint) group.GetAttachmentPoint()));
m_parentScene.updateKnownAsset(remoteClient, group, group.GetFromAssetID(), group.OwnerID);
m_parentScene.DeleteSceneObjectGroup(group);
}
}
}
}
public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot, LLVector3 attachPos)
@ -388,39 +382,34 @@ namespace OpenSim.Region.Environment.Scenes
{
if (obj is SceneObjectGroup)
{
if (((SceneObjectGroup)obj).LocalId == objectLocalID)
if ((obj).LocalId == objectLocalID)
{
SceneObjectGroup group = (SceneObjectGroup)obj;
SceneObjectGroup group = (SceneObjectGroup) obj;
// If the attachment point isn't the same as the one previously used
// set it's offset position = 0 so that it appears on the attachment point
// and not in a weird location somewhere unknown.
if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint())
if (AttachmentPt != 0 && AttachmentPt != group.GetAttachmentPoint())
{
attachPos = LLVector3.Zero;
}
// AttachmentPt 0 means the client chose to 'wear' the attachment.
if (AttachmentPt == 0)
{
// Check object for stored attachment point
AttachmentPt = (uint)group.GetAttachmentPoint();
AttachmentPt = group.GetAttachmentPoint();
}
// if we still didn't find a suitable attachment point.......
if (AttachmentPt == 0)
{
// Stick it on left hand with Zero Offset from the attachment point.
AttachmentPt = (uint)AttachmentPoint.LeftHand;
AttachmentPt = (uint) AttachmentPoint.LeftHand;
attachPos = LLVector3.Zero;
}
m_log.Debug("[ATTACH]: Using attachpoint: " + AttachmentPt.ToString());
m_log.Debug("[ATTACH]: Using attachpoint: " + AttachmentPt);
// Saves and gets assetID
if (group.GetFromAssetID() == LLUUID.Zero)
@ -431,16 +420,14 @@ namespace OpenSim.Region.Environment.Scenes
group.SetFromAssetID(newAssetID);
}
group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos);
}
}
}
}
// Use the above method.
public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot,
bool deadMethod)
public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot,
bool deadMethod)
{
Console.WriteLine("Attaching object " + objectLocalID + " to " + AttachmentPt);
SceneObjectPart p = GetSceneObjectPart(objectLocalID);
@ -489,14 +476,14 @@ namespace OpenSim.Region.Environment.Scenes
objupdate.ObjectData[0].ParentID = 0;
objupdate.ObjectData[0].OwnerID = LLUUID.Zero;
objupdate.ObjectData[0].Scale = new LLVector3(1, 1, 1);
objupdate.ObjectData[0].PCode = (byte)PCode.Avatar;
objupdate.ObjectData[0].PCode = (byte) PCode.Avatar;
objupdate.ObjectData[0].TextureEntry = ScenePresence.DefaultTexture;
objupdate.ObjectData[0].ID = av.LocalId;
objupdate.ObjectData[0].FullID = remoteClient.AgentId;
objupdate.ObjectData[0].ParentID = 0;
objupdate.ObjectData[0].NameValue =
Helpers.StringToField("FirstName STRING RW SV " + av.Firstname + "\nLastName STRING RW SV " + av.Lastname);
Helpers.StringToField("FirstName STRING RW SV " + av.Firstname + "\nLastName STRING RW SV " + av.Lastname);
LLVector3 pos2 = av.AbsolutePosition;
// new LLVector3((float) Pos.X, (float) Pos.Y, (float) Pos.Z);
byte[] pb = pos2.GetBytes();
@ -529,7 +516,7 @@ namespace OpenSim.Region.Environment.Scenes
objupdate.ObjectData[1].TextureEntry = primData.TextureEntry;
objupdate.ObjectData[1].PCode = primData.PCode;
objupdate.ObjectData[1].State = (byte)(((byte)AttachmentPt) << 4);
objupdate.ObjectData[1].State = (byte) (((byte) AttachmentPt) << 4);
objupdate.ObjectData[1].PathBegin = primData.PathBegin;
objupdate.ObjectData[1].PathEnd = primData.PathEnd;
objupdate.ObjectData[1].PathScaleX = primData.PathScaleX;
@ -566,8 +553,8 @@ namespace OpenSim.Region.Environment.Scenes
//objupdate.ObjectData[1].ClickAction = clickAction;
objupdate.ObjectData[1].Radius = 20;
objupdate.ObjectData[1].NameValue =
Helpers.StringToField("AttachItemID STRING RW SV " + p.UUID);
LLVector3 pos = new LLVector3((float)0.0, (float)0.0, (float)0.0);
Helpers.StringToField("AttachItemID STRING RW SV " + p.UUID);
LLVector3 pos = new LLVector3((float) 0.0, (float) 0.0, (float) 0.0);
pb = pos.GetBytes();
Array.Copy(pb, 0, objupdate.ObjectData[1].ObjectData, 0, pb.Length);
@ -738,6 +725,7 @@ namespace OpenSim.Region.Environment.Scenes
m_scriptLPS = 0;
return returnval;
}
#endregion
#region Get Methods
@ -765,7 +753,7 @@ namespace OpenSim.Region.Environment.Scenes
return result;
}
/// <summary>
/// Get the controlling client for the given avatar, if there is one.
///
@ -779,12 +767,12 @@ namespace OpenSim.Region.Environment.Scenes
public IClientAPI GetControllingClient(LLUUID agentId)
{
ScenePresence presence = GetScenePresence(agentId);
if (presence != null)
{
return presence.ControllingClient;
}
return null;
}
@ -819,7 +807,7 @@ namespace OpenSim.Region.Environment.Scenes
{
return ScenePresences[agentID];
}
return null;
}
@ -831,8 +819,8 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
if (((SceneObjectGroup)ent).HasChildPrim(localID))
return (SceneObjectGroup)ent;
if (((SceneObjectGroup) ent).HasChildPrim(localID))
return (SceneObjectGroup) ent;
}
}
return null;
@ -846,8 +834,8 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
if (((SceneObjectGroup)ent).HasChildPrim(fullID))
return (SceneObjectGroup)ent;
if (((SceneObjectGroup) ent).HasChildPrim(fullID))
return (SceneObjectGroup) ent;
}
}
return null;
@ -862,7 +850,7 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
SceneObjectGroup reportingG = (SceneObjectGroup)ent;
SceneObjectGroup reportingG = (SceneObjectGroup) ent;
EntityIntersection result = reportingG.TestIntersection(hray, frontFacesOnly, faceCenters);
if (result.HitTF)
{
@ -902,13 +890,13 @@ namespace OpenSim.Region.Environment.Scenes
{
if (!presence.IsChildAgent)
{
avatar = presence;
avatar = presence;
return true;
}
else
{
m_log.WarnFormat(
"[INNER SCENE]: Requested avatar {0} could not be found in scene {1} since it is only registered as a child agent!",
"[INNER SCENE]: Requested avatar {0} could not be found in scene {1} since it is only registered as a child agent!",
avatarId, m_parentScene.RegionInfo.RegionName);
}
}
@ -987,8 +975,8 @@ namespace OpenSim.Region.Environment.Scenes
if (presence.IsChildAgent && m_parentScene.m_seeIntoRegionFromNeighbor)
{
LLVector3 oLoc = ((SceneObjectGroup)ent).AbsolutePosition;
float distResult = (float)Util.GetDistanceTo(presence.AbsolutePosition, oLoc);
LLVector3 oLoc = (ent).AbsolutePosition;
float distResult = (float) Util.GetDistanceTo(presence.AbsolutePosition, oLoc);
//m_log.Info("[DISTANCE]: " + distResult.ToString());
@ -996,13 +984,13 @@ namespace OpenSim.Region.Environment.Scenes
{
// Send Only if we don't already know about it.
// KnownPrim also makes the prim known when called.
if (!presence.KnownPrim(((SceneObjectGroup)ent).UUID))
((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence);
if (!presence.KnownPrim((ent).UUID))
((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence);
}
}
else
{
((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence);
((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence);
}
}
}
@ -1037,6 +1025,7 @@ namespace OpenSim.Region.Environment.Scenes
}
}
}
public void UpdatePrimGroupScale(uint localID, LLVector3 scale, IClientAPI remoteClient)
{
SceneObjectGroup group = GetGroupByPrim(localID);
@ -1151,13 +1140,12 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null)
{
LLVector3 oldPos = group.AbsolutePosition;
if (group.RootPart.m_IsAttachment)
{
group.UpdateGroupPosition(pos);
}
else
else
{
if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment)
{
@ -1203,7 +1191,7 @@ namespace OpenSim.Region.Environment.Scenes
{
if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID))
{
group.UpdatePrimFlags(localID, (ushort)packet.Type, true, packet.ToBytes());
group.UpdatePrimFlags(localID, (ushort) packet.Type, true, packet.ToBytes());
}
}
}
@ -1213,7 +1201,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectGroup group = GetGroupByPrim(objectID);
if (group != null)
{
if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID))// && PermissionsMngr.)
if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) // && PermissionsMngr.)
{
group.GrabMovement(offset, pos, remoteClient);
}
@ -1304,9 +1292,9 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
if (((SceneObjectGroup)ent).LocalId == parentPrim)
if ((ent).LocalId == parentPrim)
{
parenPrim = (SceneObjectGroup)ent;
parenPrim = (SceneObjectGroup) ent;
break;
}
}
@ -1321,9 +1309,9 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
if (((SceneObjectGroup)ent).LocalId == childPrims[i])
if ((ent).LocalId == childPrims[i])
{
children.Add((SceneObjectGroup)ent);
children.Add((SceneObjectGroup) ent);
}
}
}
@ -1334,7 +1322,7 @@ namespace OpenSim.Region.Environment.Scenes
{
parenPrim.LinkToGroup(sceneObj);
}
// We need to explicitly resend the newly link prim's object properties since no other actions
// occur on link to invoke this elsewhere (such as object selection)
parenPrim.GetProperties(client);
@ -1360,19 +1348,16 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
SceneObjectGroup obj = (SceneObjectGroup)ent;
SceneObjectGroup obj = (SceneObjectGroup) ent;
sceneObjects.Add(obj.LocalId, obj);
}
}
// Find the root prim among the prim ids we've been given
for (int i = 0; i < primIds.Count; i++)
{
if (sceneObjects.ContainsKey(primIds[i]))
{
parenPrim = sceneObjects[primIds[i]];
primIds.RemoveAt(i);
break;
@ -1402,14 +1387,13 @@ namespace OpenSim.Region.Environment.Scenes
grp.DelinkFromGroup(primIds[i]);
delinkedSomething = true;
}
}
}
if (!delinkedSomething)
{
m_log.InfoFormat("[SCENE]: " +
"DelinkObjects(): Could not find a root prim out of {0} as given to a delink request!",
primIds);
"DelinkObjects(): Could not find a root prim out of {0} as given to a delink request!",
primIds);
}
}
}
@ -1425,7 +1409,7 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
foreach (KeyValuePair<LLUUID, SceneObjectPart> subent in ((SceneObjectGroup)ent).Children)
foreach (KeyValuePair<LLUUID, SceneObjectPart> subent in ((SceneObjectGroup) ent).Children)
{
if (subent.Value.LocalId == localID)
{
@ -1435,7 +1419,7 @@ namespace OpenSim.Region.Environment.Scenes
}
}
}
//Protip: In my day, we didn't call them searchable objects, we called them limited point-to-point joints
//aka ObjectFlags.JointWheel = IncludeInSearch
@ -1467,7 +1451,7 @@ namespace OpenSim.Region.Environment.Scenes
public void DuplicateObject(uint originalPrim, LLVector3 offset, uint flags, LLUUID AgentID, LLUUID GroupID)
{
m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID);
List<EntityBase> EntityList = GetEntities();
SceneObjectGroup originPrim = null;
@ -1475,9 +1459,9 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
if (((SceneObjectGroup)ent).LocalId == originalPrim)
if ((ent).LocalId == originalPrim)
{
originPrim = (SceneObjectGroup)ent;
originPrim = (SceneObjectGroup) ent;
break;
}
}
@ -1526,4 +1510,4 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
}
}
}

View File

@ -40,7 +40,7 @@ namespace OpenSim.Region.Environment.Scenes
{
public partial class Scene
{
private static readonly ILog m_log
private static readonly ILog m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
@ -49,11 +49,11 @@ namespace OpenSim.Region.Environment.Scenes
public void StartScripts()
{
m_log.Info("[PRIM INVENTORY]: Starting scripts in scene");
foreach (SceneObjectGroup group in Entities.Values)
{
group.StartScripts();
}
}
}
/// <summary>
@ -64,9 +64,9 @@ namespace OpenSim.Region.Environment.Scenes
/// in which the item is to be placed.</param>
public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
{
CachedUserInfo userInfo
CachedUserInfo userInfo
= CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
userInfo.AddItem(remoteClient.AgentId, item);
@ -88,9 +88,9 @@ namespace OpenSim.Region.Environment.Scenes
m_log.ErrorFormat(
"[AGENT INVENTORY]: Agent {0} {1} was not found for add of item {2} {3}",
remoteClient.Name, remoteClient.AgentId, item.Name, item.ID);
return;
}
}
}
/// <summary>
@ -190,7 +190,7 @@ namespace OpenSim.Region.Environment.Scenes
{
// Retrieve group
SceneObjectPart part = GetSceneObjectPart(primId);
SceneObjectGroup group = part.ParentGroup;
SceneObjectGroup group = part.ParentGroup;
if (null == group)
{
m_log.ErrorFormat(
@ -200,30 +200,30 @@ namespace OpenSim.Region.Environment.Scenes
return;
}
// Retrieve item
TaskInventoryItem item = group.GetInventoryItem(part.LocalId, itemId);
if (null == item)
{
return;
}
// Create new asset
// XXX Hardcoding the numbers is a temporary measure - need an enumeration for this
// There may well be one in libsecondlife
AssetBase asset = CreateAsset(item.Name, item.Description, 10, 10, data);
AssetCache.AddAsset(asset);
// Update item with new asset
item.AssetID = asset.FullID;
group.UpdateInventoryItem(item);
group.GetProperties(remoteClient);
// Trigger rerunning of script (use TriggerRezScript event, see RezScript)
if (isScriptRunning)
{
group.StopScript(part.LocalId, item.ItemID);
group.StartScript(part.LocalId, item.ItemID);
group.StartScript(part.LocalId, item.ItemID);
}
}
@ -272,7 +272,7 @@ namespace OpenSim.Region.Environment.Scenes
if (userInfo != null && userInfo.RootFolder != null)
{
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
if (item != null)
{
if (LLUUID.Zero == transactionID)
@ -298,11 +298,11 @@ namespace OpenSim.Region.Environment.Scenes
}
else
{
IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
IAgentAssetTransactions agentTransactions = RequestModuleInterface<IAgentAssetTransactions>();
if (agentTransactions != null)
{
agentTransactions.HandleItemUpdateFromTransaction(
remoteClient, transactionID, item);
remoteClient, transactionID, item);
}
}
}
@ -318,7 +318,7 @@ namespace OpenSim.Region.Environment.Scenes
"[AGENT INVENTORY]: Agent ID " + remoteClient.AgentId + " not found for an inventory item update.");
}
}
/// <summary>
/// Give an inventory item from one avatar to another
/// </summary>
@ -328,13 +328,13 @@ namespace OpenSim.Region.Environment.Scenes
public void GiveInventoryItem(IClientAPI recipientClient, LLUUID senderId, LLUUID itemId)
{
// Retrieve the item from the sender
CachedUserInfo senderUserInfo = CommsManager.UserProfileCacheService.GetUserDetails(senderId);
CachedUserInfo senderUserInfo = CommsManager.UserProfileCacheService.GetUserDetails(senderId);
if (senderUserInfo == null)
{
m_log.ErrorFormat(
"[AGENT INVENTORY]: Failed to find sending user {0} for item {1}", senderId, itemId);
"[AGENT INVENTORY]: Failed to find sending user {0} for item {1}", senderId, itemId);
return;
}
@ -342,11 +342,11 @@ namespace OpenSim.Region.Environment.Scenes
{
InventoryItemBase item = senderUserInfo.RootFolder.HasItem(itemId);
if (item != null)
{
{
// TODO get recipient's root folder
CachedUserInfo recipientUserInfo
= CommsManager.UserProfileCacheService.GetUserDetails(recipientClient.AgentId);
CachedUserInfo recipientUserInfo
= CommsManager.UserProfileCacheService.GetUserDetails(recipientClient.AgentId);
if (recipientUserInfo != null)
{
// Insert a copy of the item into the recipient
@ -373,15 +373,15 @@ namespace OpenSim.Region.Environment.Scenes
itemCopy.SaleType = item.SaleType;
recipientUserInfo.AddItem(recipientClient.AgentId, itemCopy);
// Let the recipient client know about this new item
recipientClient.SendBulkUpdateInventory(itemCopy);
recipientClient.SendBulkUpdateInventory(itemCopy);
}
else
{
m_log.ErrorFormat(
"[AGENT INVENTORY]: Could not find userinfo for recipient user {0}, {1} of item {2}, {3} from {4}",
recipientClient.Name, recipientClient.AgentId, item.Name,
"[AGENT INVENTORY]: Could not find userinfo for recipient user {0}, {1} of item {2}, {3} from {4}",
recipientClient.Name, recipientClient.AgentId, item.Name,
item.ID, senderId);
}
}
@ -389,15 +389,15 @@ namespace OpenSim.Region.Environment.Scenes
{
m_log.ErrorFormat(
"[AGENT INVENTORY]: Failed to find item {0} to give to {1}", itemId, senderId);
return;
}
}
else
{
m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemId.ToString() + ", no root folder");
m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemId + ", no root folder");
return;
}
}
}
public void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID,
@ -406,14 +406,14 @@ namespace OpenSim.Region.Environment.Scenes
m_log.DebugFormat(
"[AGENT INVENTORY]: CopyInventoryItem received by {0} with oldAgentID {1}, oldItemID {2}, new FolderID {3}, newName {4}",
remoteClient.AgentId, oldAgentID, oldItemID, newFolderID, newName);
InventoryItemBase item = CommsManager.UserProfileCacheService.libraryRoot.HasItem(oldItemID);
if (item == null)
{
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(oldAgentID);
if (userInfo == null)
{
m_log.Error("[AGENT INVENTORY]: Failed to find user " + oldAgentID.ToString());
m_log.Error("[AGENT INVENTORY]: Failed to find user " + oldAgentID);
return;
}
@ -422,20 +422,20 @@ namespace OpenSim.Region.Environment.Scenes
item = userInfo.RootFolder.HasItem(oldItemID);
if (item == null)
{
m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString());
m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID);
return;
}
}
else
{
m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString());
m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID);
return;
}
}
AssetBase asset
AssetBase asset
= AssetCache.GetAsset(
item.AssetID, (item.AssetType == (int)AssetType.Texture ? true : false));
item.AssetID, (item.AssetType == (int) AssetType.Texture ? true : false));
if (asset != null)
{
@ -447,7 +447,7 @@ namespace OpenSim.Region.Environment.Scenes
{
m_log.ErrorFormat(
"[AGENT INVENTORY]: Could not copy item {0} since asset {1} could not be found",
item.Name, item.AssetID);
item.Name, item.AssetID);
}
}
@ -472,7 +472,7 @@ namespace OpenSim.Region.Environment.Scenes
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo == null)
{
m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString());
m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId);
return;
}
@ -493,13 +493,13 @@ namespace OpenSim.Region.Environment.Scenes
}
else
{
m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID.ToString());
m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID);
return;
}
}
else
{
m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID.ToString() + ", no root folder");
m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID + ", no root folder");
return;
}
}
@ -515,9 +515,9 @@ namespace OpenSim.Region.Environment.Scenes
private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID,
AssetBase asset, uint nextOwnerMask)
{
CachedUserInfo userInfo
CachedUserInfo userInfo
= CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
InventoryItemBase item = new InventoryItemBase();
@ -539,8 +539,8 @@ namespace OpenSim.Region.Environment.Scenes
else
{
m_log.WarnFormat(
"No user details associated with client {0} uuid {1} in CreateNewInventoryItem!",
remoteClient.Name, remoteClient.AgentId);
"No user details associated with client {0} uuid {1} in CreateNewInventoryItem!",
remoteClient.Name, remoteClient.AgentId);
}
}
@ -564,25 +564,25 @@ namespace OpenSim.Region.Environment.Scenes
byte wearableType, uint nextOwnerMask)
{
// m_log.DebugFormat("[AGENT INVENTORY]: Received request to create inventory item {0} in folder {1}", name, folderID);
if (transactionID == LLUUID.Zero)
{
CachedUserInfo userInfo
CachedUserInfo userInfo
= CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
ScenePresence presence;
TryGetAvatar(remoteClient.AgentId, out presence);
byte[] data = null;
if(invType == 3 && presence != null) // libsecondlife.asset.assettype.landmark = 3 - needs to be turned into an enum
if (invType == 3 && presence != null) // libsecondlife.asset.assettype.landmark = 3 - needs to be turned into an enum
{
LLVector3 pos=presence.AbsolutePosition;
string strdata=String.Format("Landmark version 2\nregion_id {0}\nlocal_pos {1} {2} {3}\nregion_handle {4}\n",
presence.Scene.RegionInfo.RegionID,
pos.X, pos.Y, pos.Z,
presence.RegionHandle);
data=Encoding.ASCII.GetBytes(strdata);
LLVector3 pos = presence.AbsolutePosition;
string strdata = String.Format("Landmark version 2\nregion_id {0}\nlocal_pos {1} {2} {3}\nregion_handle {4}\n",
presence.Scene.RegionInfo.RegionID,
pos.X, pos.Y, pos.Z,
presence.RegionHandle);
data = Encoding.ASCII.GetBytes(strdata);
}
AssetBase asset = CreateAsset(name, description, invType, assetType, data);
@ -593,21 +593,19 @@ namespace OpenSim.Region.Environment.Scenes
else
{
m_log.ErrorFormat(
"userInfo for agent uuid {0} unexpectedly null in CreateNewInventoryItem",
"userInfo for agent uuid {0} unexpectedly null in CreateNewInventoryItem",
remoteClient.AgentId);
}
}
else
{
IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
IAgentAssetTransactions agentTransactions = RequestModuleInterface<IAgentAssetTransactions>();
if (agentTransactions != null)
{
agentTransactions.HandleItemCreationFromTransaction(
remoteClient, transactionID, folderID, callbackID, description,
name, invType, assetType, wearableType, nextOwnerMask);
remoteClient, transactionID, folderID, callbackID, description,
name, invType, assetType, wearableType, nextOwnerMask);
}
}
}
@ -617,7 +615,7 @@ namespace OpenSim.Region.Environment.Scenes
= CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo == null)
{
m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString());
m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId);
return;
}
@ -641,7 +639,7 @@ namespace OpenSim.Region.Environment.Scenes
= CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo == null)
{
m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString());
m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId);
return;
}
@ -677,7 +675,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="remoteClient"></param>
/// <param name="primLocalID"></param>
public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID)
{
{
SceneObjectGroup group = GetGroupByPrim(primLocalID);
if (group != null)
{
@ -725,7 +723,7 @@ namespace OpenSim.Region.Environment.Scenes
localID);
}
}
/// <summary>
/// Move the given item in the given prim to a folder in the client's inventory
/// </summary>
@ -736,43 +734,43 @@ namespace OpenSim.Region.Environment.Scenes
public void MoveTaskInventoryItem(IClientAPI remoteClient, LLUUID folderId, uint primLocalId, LLUUID itemId)
{
SceneObjectGroup group = GetGroupByPrim(primLocalId);
if (null == group)
{
m_log.WarnFormat(
"[PRIM INVENTORY]: " +
"Move of inventory item {0} from prim with local id {1} failed because the prim could not be found",
itemId, primLocalId);
return;
}
}
TaskInventoryItem taskItem = group.GetInventoryItem(primLocalId, itemId);
if (null == taskItem)
{
// Console already notified of error in GetInventoryItem
return;
}
// bool permission;
// permission = PermissionsMngr.CanCopyObject(remoteClient.AgentId,
// ((SceneObjectGroup) selectedEnt).UUID);
// Pending resolving upstream problems with permissions, we just won't allow anybody who is not the owner
// to copy
if (remoteClient.AgentId != taskItem.OwnerID)
{
m_log.InfoFormat(
"[PRIM INVENTORY]: Attempt made by {0} {1} to copy inventory item {2} {3} in prim {4} {5},"
+ " but temporarily not allowed pending upstream bugfixes/feature implementation",
+ " but temporarily not allowed pending upstream bugfixes/feature implementation",
remoteClient.Name, remoteClient.AgentId, taskItem.Name, taskItem.ItemID, group.Name, group.UUID);
return;
}
InventoryItemBase agentItem = new InventoryItemBase();
agentItem.ID = LLUUID.Random();
agentItem.Creator = taskItem.CreatorID;
agentItem.Owner = remoteClient.AgentId;
@ -783,8 +781,9 @@ namespace OpenSim.Region.Environment.Scenes
agentItem.InvType = taskItem.InvType;
agentItem.Folder = folderId;
agentItem.EveryOnePermissions = taskItem.EveryoneMask;
if (remoteClient.AgentId != taskItem.OwnerID) {
if (remoteClient.AgentId != taskItem.OwnerID)
{
agentItem.BasePermissions = taskItem.NextOwnerMask;
agentItem.CurrentPermissions = taskItem.NextOwnerMask;
agentItem.NextPermissions = taskItem.NextOwnerMask;
@ -793,9 +792,9 @@ namespace OpenSim.Region.Environment.Scenes
{
agentItem.BasePermissions = taskItem.BaseMask;
agentItem.CurrentPermissions = taskItem.OwnerMask;
agentItem.NextPermissions = taskItem.NextOwnerMask;
agentItem.NextPermissions = taskItem.NextOwnerMask;
}
AddInventoryItem(remoteClient, agentItem);
}
@ -834,7 +833,7 @@ namespace OpenSim.Region.Environment.Scenes
{
group.AddInventoryItem(remoteClient, primLocalID, item, copyID);
m_log.InfoFormat(
"[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}",
"[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}",
item.Name, primLocalID, remoteClient.Name);
group.GetProperties(remoteClient);
}
@ -865,22 +864,22 @@ namespace OpenSim.Region.Environment.Scenes
public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID)
{
LLUUID copyID = LLUUID.Random();
if (itemID != LLUUID.Zero)
{
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo != null && userInfo.RootFolder != null)
{
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
// Try library
// XXX clumsy, possibly should be one call
if (null == item)
{
item = CommsManager.UserProfileCacheService.libraryRoot.HasItem(itemID);
}
if (item != null)
{
SceneObjectGroup group = GetGroupByPrim(localID);
@ -889,10 +888,10 @@ namespace OpenSim.Region.Environment.Scenes
group.AddInventoryItem(remoteClient, localID, item, copyID);
group.StartScript(localID, copyID);
group.GetProperties(remoteClient);
// m_log.InfoFormat("[PRIMINVENTORY]: " +
// "Rezzed script {0} into prim local ID {1} for user {2}",
// item.inventoryName, localID, remoteClient.Name);
// m_log.InfoFormat("[PRIMINVENTORY]: " +
// "Rezzed script {0} into prim local ID {1} for user {2}",
// item.inventoryName, localID, remoteClient.Name);
}
else
{
@ -911,7 +910,7 @@ namespace OpenSim.Region.Environment.Scenes
}
}
}
else // If the itemID is zero then the script has been rezzed directly in an object's inventory
else // If the itemID is zero then the script has been rezzed directly in an object's inventory
{
// not yet implemented
// TODO Need to get more details from original RezScript packet
@ -927,7 +926,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="packet"></param>
/// <param name="simClient"></param>
public virtual void DeRezObject(Packet packet, IClientAPI remoteClient)
{
{
DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet;
if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
@ -937,11 +936,11 @@ namespace OpenSim.Region.Environment.Scenes
else
{
foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData)
{
{
// m_log.DebugFormat(
// "[AGENT INVENTORY]: Received request to derez {0} into folder {1}",
// Data.ObjectLocalID, DeRezPacket.AgentBlock.DestinationID);
EntityBase selectedEnt = null;
//m_log.Info("[CLIENT]: LocalID:" + Data.ObjectLocalID.ToString());
@ -959,14 +958,16 @@ namespace OpenSim.Region.Environment.Scenes
{
bool permission;
if (DeRezPacket.AgentBlock.Destination == 1)
{ // Take Copy
permission = PermissionsMngr.CanCopyObject(remoteClient.AgentId,
((SceneObjectGroup) selectedEnt).UUID);
{
// Take Copy
permission = PermissionsMngr.CanCopyObject(remoteClient.AgentId,
(selectedEnt).UUID);
}
else
{ // Take
permission = PermissionsMngr.CanDeRezObject(remoteClient.AgentId,
((SceneObjectGroup) selectedEnt).UUID);
{
// Take
permission = PermissionsMngr.CanDeRezObject(remoteClient.AgentId,
(selectedEnt).UUID);
}
if (permission)
@ -997,7 +998,8 @@ namespace OpenSim.Region.Environment.Scenes
item.InvType = asset.InvType;
item.Folder = DeRezPacket.AgentBlock.DestinationID;
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
if (remoteClient.AgentId != objectGroup.RootPart.OwnerID) {
if (remoteClient.AgentId != objectGroup.RootPart.OwnerID)
{
item.BasePermissions = objectGroup.RootPart.NextOwnerMask;
item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask;
item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
@ -1025,6 +1027,7 @@ namespace OpenSim.Region.Environment.Scenes
}
}
}
public void updateKnownAsset(IClientAPI remoteClient, SceneObjectGroup grp, LLUUID assetID, LLUUID agentID)
{
SceneObjectGroup objectGroup = grp;
@ -1044,7 +1047,6 @@ namespace OpenSim.Region.Environment.Scenes
// search through folders to find the asset.
while (searchfolders.Count > 0)
{
InventoryFolderImpl fld = searchfolders.Dequeue();
lock (fld)
{
@ -1069,8 +1071,8 @@ namespace OpenSim.Region.Environment.Scenes
AssetBase asset = CreateAsset(
objectGroup.GetPartName(objectGroup.LocalId),
objectGroup.GetPartDescription(objectGroup.LocalId),
(sbyte)InventoryType.Object,
(sbyte)AssetType.Object,
(sbyte) InventoryType.Object,
(sbyte) AssetType.Object,
Helpers.StringToField(sceneObjectXml));
AssetCache.AddAsset(asset);
@ -1086,7 +1088,7 @@ namespace OpenSim.Region.Environment.Scenes
// Sticking it in root folder for now.. objects folder later?
item.Folder = foundFolder;// DeRezPacket.AgentBlock.DestinationID;
item.Folder = foundFolder; // DeRezPacket.AgentBlock.DestinationID;
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
if (agentID != objectGroup.RootPart.OwnerID)
{
@ -1108,10 +1110,10 @@ namespace OpenSim.Region.Environment.Scenes
{
remoteClient.SendInventoryItemCreateUpdate(item);
}
}
}
}
public LLUUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, LLUUID AgentId)
{
SceneObjectGroup objectGroup = grp;
@ -1126,8 +1128,8 @@ namespace OpenSim.Region.Environment.Scenes
AssetBase asset = CreateAsset(
objectGroup.GetPartName(objectGroup.LocalId),
objectGroup.GetPartDescription(objectGroup.LocalId),
(sbyte)InventoryType.Object,
(sbyte)AssetType.Object,
(sbyte) InventoryType.Object,
(sbyte) AssetType.Object,
Helpers.StringToField(sceneObjectXml));
AssetCache.AddAsset(asset);
@ -1140,10 +1142,10 @@ namespace OpenSim.Region.Environment.Scenes
item.Name = asset.Name;
item.AssetType = asset.Type;
item.InvType = asset.InvType;
// Sticking it in root folder for now.. objects folder later?
item.Folder = userInfo.RootFolder.ID;// DeRezPacket.AgentBlock.DestinationID;
item.Folder = userInfo.RootFolder.ID; // DeRezPacket.AgentBlock.DestinationID;
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
if (remoteClient.AgentId != objectGroup.RootPart.OwnerID)
{
@ -1165,7 +1167,6 @@ namespace OpenSim.Region.Environment.Scenes
return LLUUID.Zero;
}
return LLUUID.Zero;
}
/// <summary>
@ -1187,64 +1188,63 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="RemoveItem"></param>
/// <param name="fromTaskID"></param>
public virtual void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 RayEnd, LLVector3 RayStart,
LLUUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
uint EveryoneMask, uint GroupMask, uint NextOwnerMask, uint ItemFlags,
bool RezSelected, bool RemoveItem, LLUUID fromTaskID)
LLUUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
uint EveryoneMask, uint GroupMask, uint NextOwnerMask, uint ItemFlags,
bool RezSelected, bool RemoveItem, LLUUID fromTaskID)
{
SceneObjectGroup sog = RezObject(remoteClient, itemID, RayEnd, RayStart,
RayTargetID, BypassRayCast, RayEndIsIntersection,
EveryoneMask, GroupMask, NextOwnerMask, ItemFlags,
RezSelected, RemoveItem, fromTaskID, false);
RayTargetID, BypassRayCast, RayEndIsIntersection,
EveryoneMask, GroupMask, NextOwnerMask, ItemFlags,
RezSelected, RemoveItem, fromTaskID, false);
}
/// <summary>
/// Returns SceneObjectGroup or null from asset request.
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="itemID"></param>
/// <param name="RayEnd"></param>
/// <param name="RayStart"></param>
/// <param name="RayTargetID"></param>
/// <param name="BypassRayCast"></param>
/// <param name="RayEndIsIntersection"></param>
/// <param name="EveryoneMask"></param>
/// <param name="GroupMask"></param>
/// <param name="NextOwnerMask"></param>
/// <param name="ItemFlags"></param>
/// <param name="RezSelected"></param>
/// <param name="RemoveItem"></param>
/// <param name="fromTaskID"></param>
/// <param name="difference"></param>
/// <returns></returns>
/// <summary>
/// Returns SceneObjectGroup or null from asset request.
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="itemID"></param>
/// <param name="RayEnd"></param>
/// <param name="RayStart"></param>
/// <param name="RayTargetID"></param>
/// <param name="BypassRayCast"></param>
/// <param name="RayEndIsIntersection"></param>
/// <param name="EveryoneMask"></param>
/// <param name="GroupMask"></param>
/// <param name="NextOwnerMask"></param>
/// <param name="ItemFlags"></param>
/// <param name="RezSelected"></param>
/// <param name="RemoveItem"></param>
/// <param name="fromTaskID"></param>
/// <param name="difference"></param>
/// <returns></returns>
public virtual SceneObjectGroup RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 RayEnd, LLVector3 RayStart,
LLUUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
uint EveryoneMask, uint GroupMask, uint NextOwnerMask, uint ItemFlags,
bool RezSelected, bool RemoveItem, LLUUID fromTaskID, bool attachment)
LLUUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
uint EveryoneMask, uint GroupMask, uint NextOwnerMask, uint ItemFlags,
bool RezSelected, bool RemoveItem, LLUUID fromTaskID, bool attachment)
{
// Work out position details
byte bRayEndIsIntersection = (byte)0;
byte bRayEndIsIntersection = 0;
if (RayEndIsIntersection)
{
bRayEndIsIntersection = (byte)1;
bRayEndIsIntersection = 1;
}
else
{
bRayEndIsIntersection = (byte)0;
bRayEndIsIntersection = 0;
}
LLVector3 scale = new LLVector3(0.5f, 0.5f, 0.5f);
LLVector3 pos = GetNewRezLocation(
RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1),
BypassRayCast, bRayEndIsIntersection,true,scale, false);
RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1),
BypassRayCast, bRayEndIsIntersection, true, scale, false);
if (!PermissionsMngr.CanRezObject(remoteClient.AgentId, pos) && !attachment)
{
return null;
return null;
}
// Rez object
@ -1260,7 +1260,7 @@ namespace OpenSim.Region.Environment.Scenes
if (rezAsset != null)
{
string xmlData = Helpers.FieldToUTF8String(rezAsset.Data);
string xmlData = Helpers.FieldToUTF8String(rezAsset.Data);
SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData);
group.ResetIDs();
AddEntity(group);
@ -1270,8 +1270,8 @@ namespace OpenSim.Region.Environment.Scenes
if (!attachment)
{
pos = GetNewRezLocation(
RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1),
BypassRayCast, bRayEndIsIntersection, true, group.GroupScale(), false);
RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1),
BypassRayCast, bRayEndIsIntersection, true, group.GroupScale(), false);
group.AbsolutePosition = pos;
}
else
@ -1280,7 +1280,7 @@ namespace OpenSim.Region.Environment.Scenes
}
SceneObjectPart rootPart = group.GetChildPart(group.UUID);
// Since renaming the item in the inventory does not affect the name stored
// in the serialization, transfer the correct name from the inventory to the
// object itself before we rez.
@ -1301,22 +1301,22 @@ namespace OpenSim.Region.Environment.Scenes
part.ChangeInventoryOwner(item.Owner);
}
}
rootPart.TrimPermissions();
if (!attachment)
{
if (group.RootPart.Shape.PCode == (byte)PCode.Prim)
if (group.RootPart.Shape.PCode == (byte) PCode.Prim)
{
group.ClearPartAttachmentData();
}
group.ApplyPhysics(m_physicalPrim);
}
group.StartScripts();
if (!attachment)
rootPart.ScheduleFullUpdate();
@ -1327,7 +1327,5 @@ namespace OpenSim.Region.Environment.Scenes
}
return null;
}
}
}
}

View File

@ -78,11 +78,12 @@ namespace OpenSim.Region.Environment.Scenes
foreach (EntityBase ent in EntitieList)
{
if (ent is SceneObjectGroup)
{
if (((SceneObjectGroup) ent).LocalId == primLocalID)
{
if ((ent).LocalId == primLocalID)
{
// A prim is only tainted if it's allowed to be edited by the person clicking it.
if (m_permissionManager.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || m_permissionManager.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID))
if (m_permissionManager.CanEditObjectPosition(remoteClient.AgentId, (ent).UUID) ||
m_permissionManager.CanEditObject(remoteClient.AgentId, (ent).UUID))
{
((SceneObjectGroup) ent).GetProperties(remoteClient);
((SceneObjectGroup) ent).IsSelected = true;
@ -107,9 +108,10 @@ namespace OpenSim.Region.Environment.Scenes
{
if (ent is SceneObjectGroup)
{
if (((SceneObjectGroup) ent).LocalId == primLocalID)
if ((ent).LocalId == primLocalID)
{
if (m_permissionManager.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || m_permissionManager.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID))
if (m_permissionManager.CanEditObjectPosition(remoteClient.AgentId, (ent).UUID) ||
m_permissionManager.CanEditObject(remoteClient.AgentId, (ent).UUID))
{
((SceneObjectGroup) ent).IsSelected = false;
LandChannel.setPrimsTainted();
@ -129,21 +131,20 @@ namespace OpenSim.Region.Environment.Scenes
}
public virtual void ProcessParcelBuy(LLUUID agentId, LLUUID groupId, bool final, bool groupOwned,
bool removeContribution, int parcelLocalID, int parcelArea, int parcelPrice, bool authenticated)
bool removeContribution, int parcelLocalID, int parcelArea, int parcelPrice, bool authenticated)
{
EventManager.LandBuyArgs args = new EventManager.LandBuyArgs(
agentId, groupId, final, groupOwned, removeContribution, parcelLocalID, parcelArea, parcelPrice, authenticated);
agentId, groupId, final, groupOwned, removeContribution, parcelLocalID, parcelArea, parcelPrice, authenticated);
// First, allow all validators a stab at it
m_eventManager.TriggerValidateLandBuy(this, args);
m_eventManager.TriggerValidateLandBuy(this, args);
// Then, check validation and transfer
m_eventManager.TriggerLandBuy(this, args);
m_eventManager.TriggerLandBuy(this, args);
}
public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
{
List<EntityBase> EntitieList = GetEntities();
foreach (EntityBase ent in EntitieList)
@ -178,7 +179,6 @@ namespace OpenSim.Region.Environment.Scenes
public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient)
{
List<EntityBase> EntitieList = GetEntities();
foreach (EntityBase ent in EntitieList)
@ -190,7 +190,7 @@ namespace OpenSim.Region.Environment.Scenes
// Is this prim part of the group
if (obj.HasChildPrim(localID))
{
SceneObjectPart part=obj.GetChildPart(localID);
SceneObjectPart part = obj.GetChildPart(localID);
if (part != null)
{
// If the touched prim handles touches, deliver it
@ -233,8 +233,8 @@ namespace OpenSim.Region.Environment.Scenes
LLUUID translatedIDtem = item.AvatarID;
searchData[i] = new AvatarPickerReplyPacket.DataBlock();
searchData[i].AvatarID = translatedIDtem;
searchData[i].FirstName = Helpers.StringToField((string) item.firstName);
searchData[i].LastName = Helpers.StringToField((string) item.lastName);
searchData[i].FirstName = Helpers.StringToField(item.firstName);
searchData[i].LastName = Helpers.StringToField(item.lastName);
i++;
}
if (AvatarResponses.Count == 0)
@ -245,4 +245,4 @@ namespace OpenSim.Region.Environment.Scenes
client.SendAvatarPickerReply(replyPacket);
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -40,6 +40,11 @@ namespace OpenSim.Region.Environment.Scenes
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// XXX These two methods are very temporary
/// </summary>
protected Dictionary<LLUUID, string> capsPaths = new Dictionary<LLUUID, string>();
#region Events
public event restart OnRestart;
@ -50,41 +55,38 @@ namespace OpenSim.Region.Environment.Scenes
private readonly ClientManager m_clientManager = new ClientManager();
public ClientManager ClientManager
{
get { return m_clientManager; }
}
protected ulong m_regionHandle;
protected string m_regionName;
protected RegionInfo m_regInfo;
//public TerrainEngine Terrain;
public ITerrainChannel Heightmap;
public ILandChannel LandChannel;
private AssetCache m_assetCache;
protected string m_datastore;
protected EventManager m_eventManager;
private uint m_nextLocalId = 8880000;
protected RegionInfo m_regInfo;
protected ulong m_regionHandle;
protected string m_regionName;
protected RegionStatus m_regStatus;
public EventManager EventManager
{
get { return m_eventManager; }
}
protected string m_datastore;
private uint m_nextLocalId = 8880000;
private AssetCache m_assetCache;
public AssetCache AssetCache
{
get { return m_assetCache; }
set { m_assetCache = value; }
}
protected RegionStatus m_regStatus;
public ClientManager ClientManager
{
get { return m_clientManager; }
}
public RegionStatus Region_Status
{
@ -141,6 +143,8 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
#region IScene Members
/// <summary>
///
/// </summary>
@ -155,6 +159,18 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_nextLocalId++; }
}
public string GetCapsPath(LLUUID agentId)
{
if (capsPaths.ContainsKey(agentId))
{
return capsPaths[agentId];
}
return null;
}
#endregion
#region admin stuff
/// <summary>
@ -173,6 +189,7 @@ namespace OpenSim.Region.Environment.Scenes
{
return false;
}
public abstract bool OtherRegionUp(RegionInfo thisRegion);
public virtual string GetSimulatorVersion()
@ -195,24 +212,10 @@ namespace OpenSim.Region.Environment.Scenes
}
catch (Exception e)
{
m_log.Error("[SCENE]: SceneBase.cs: Close() - Failed with exception " + e.ToString());
m_log.Error("[SCENE]: SceneBase.cs: Close() - Failed with exception " + e);
}
}
#endregion
/// <summary>
/// XXX These two methods are very temporary
/// </summary>
protected Dictionary<LLUUID, string> capsPaths = new Dictionary<LLUUID, string>();
public string GetCapsPath(LLUUID agentId)
{
if (capsPaths.ContainsKey(agentId))
{
return capsPaths[agentId];
}
return null;
}
}
}
}

View File

@ -43,13 +43,47 @@ namespace OpenSim.Region.Environment.Scenes
public class SceneCommunicationService //one instance per region
{
#region Delegates
public delegate void InformNeighbourThatRegionUpDelegate(RegionInfo region, ulong regionhandle);
public delegate void SendChildAgentDataUpdateDelegate(ChildAgentDataUpdate cAgentData, ScenePresence presence);
public delegate void SendCloseChildAgentDelegate(LLUUID agentID, List<ulong> regionlst);
#endregion
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public string _debugRegionName = String.Empty;
private AgentCrossing handlerAvatarCrossingIntoRegion; // OnAvatarCrossingIntoRegion;
private ChildAgentUpdate handlerChildAgentUpdate; // OnChildAgentUpdate;
private CloseAgentConnection handlerCloseAgentConnection; // OnCloseAgentConnection;
private ExpectPrimDelegate handlerExpectPrim; // OnExpectPrim;
private ExpectUserDelegate handlerExpectUser; // OnExpectUser;
private PrimCrossing handlerPrimCrossingIntoRegion; // OnPrimCrossingIntoRegion;
private RegionUp handlerRegionUp; // OnRegionUp;
private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar; // OnRemoveKnownRegionFromAvatar;
public KillObjectDelegate KillObject;
protected CommunicationsManager m_commsProvider;
protected RegionInfo m_regionInfo;
protected RegionCommsListener regionCommsHost;
public SceneCommunicationService(CommunicationsManager commsMan)
{
m_commsProvider = commsMan;
m_commsProvider.GridService.gdebugRegionName = _debugRegionName;
m_commsProvider.InterRegion.rdebugRegionName = _debugRegionName;
}
public string debugRegionName
{
get { return _debugRegionName; }
set { _debugRegionName = value; }
}
public event AgentCrossing OnAvatarCrossingIntoRegion;
public event ExpectUserDelegate OnExpectUser;
public event ExpectPrimDelegate OnExpectPrim;
@ -59,31 +93,6 @@ namespace OpenSim.Region.Environment.Scenes
public event ChildAgentUpdate OnChildAgentUpdate;
public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar;
private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion;
private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser;
private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim;
private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection;
private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
private RegionUp handlerRegionUp = null; // OnRegionUp;
private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate;
private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar = null; // OnRemoveKnownRegionFromAvatar;
public KillObjectDelegate KillObject;
public string _debugRegionName = String.Empty;
public string debugRegionName
{
get { return _debugRegionName; }
set { _debugRegionName = value; }
}
public SceneCommunicationService(CommunicationsManager commsMan)
{
m_commsProvider = commsMan;
m_commsProvider.GridService.gdebugRegionName = _debugRegionName;
m_commsProvider.InterRegion.rdebugRegionName = _debugRegionName;
}
public void RegisterRegion(RegionInfo regionInfos)
{
m_regionInfo = regionInfos;
@ -99,7 +108,7 @@ namespace OpenSim.Region.Environment.Scenes
regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing;
regionCommsHost.OnCloseAgentConnection += CloseConnection;
regionCommsHost.OnRegionUp += newRegionUp;
regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate;
regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate;
}
else
{
@ -122,218 +131,6 @@ namespace OpenSim.Region.Environment.Scenes
}
}
#region CommsManager Event handlers
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agent"></param>
///
protected void NewUserConnection(ulong regionHandle, AgentCircuitData agent)
{
handlerExpectUser = OnExpectUser;
if (handlerExpectUser != null)
{
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: OnExpectUser Fired for User:" + agent.firstname + " " + agent.lastname);
handlerExpectUser(regionHandle, agent);
}
}
protected bool newRegionUp(RegionInfo region)
{
handlerRegionUp = OnRegionUp;
if (handlerRegionUp != null)
{
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: newRegionUp Fired for User:" + region.RegionName);
handlerRegionUp(region);
}
return true;
}
protected bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{
handlerChildAgentUpdate = OnChildAgentUpdate;
if (handlerChildAgentUpdate != null)
handlerChildAgentUpdate(regionHandle, cAgentData);
return true;
}
protected void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
{
handlerAvatarCrossingIntoRegion = OnAvatarCrossingIntoRegion;
if (handlerAvatarCrossingIntoRegion != null)
{
handlerAvatarCrossingIntoRegion(regionHandle, agentID, position, isFlying);
}
}
protected bool IncomingPrimCrossing(ulong regionHandle, LLUUID primID, String objXMLData, int XMLMethod)
{
handlerExpectPrim = OnExpectPrim;
if (handlerExpectPrim != null)
{
return handlerExpectPrim(regionHandle, primID, objXMLData, XMLMethod);
}
else
{
return false;
}
}
protected void PrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical)
{
handlerPrimCrossingIntoRegion = OnPrimCrossingIntoRegion;
if (handlerPrimCrossingIntoRegion != null)
{
handlerPrimCrossingIntoRegion(regionHandle, primID, position, isPhysical);
}
}
protected bool CloseConnection(ulong regionHandle, LLUUID agentID)
{
m_log.Info("[INTERREGION]: Incoming Agent Close Request for agent: " + agentID.ToString());
handlerCloseAgentConnection = OnCloseAgentConnection;
if (handlerCloseAgentConnection != null)
{
return handlerCloseAgentConnection(regionHandle, agentID);
}
return false;
}
#endregion
#region Inform Client of Neighbours
private delegate void InformClientOfNeighbourDelegate(
ScenePresence avatar, AgentCircuitData a, ulong regionHandle, IPEndPoint endPoint);
private void InformClientOfNeighbourCompleted(IAsyncResult iar)
{
InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate) iar.AsyncState;
icon.EndInvoke(iar);
}
/// <summary>
/// Async compnent for informing client of which neighbours exists
/// </summary>
/// <remarks>
/// This needs to run asynchronesously, as a network timeout may block the thread for a long while
/// </remarks>
/// <param name="remoteClient"></param>
/// <param name="a"></param>
/// <param name="regionHandle"></param>
/// <param name="endPoint"></param>
private void InformClientOfNeighbourAsync(ScenePresence avatar, AgentCircuitData a, ulong regionHandle,
IPEndPoint endPoint)
{
m_log.Info("[INTERGRID]: Starting to inform client about neighbours");
bool regionAccepted = m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, a);
if (regionAccepted)
{
avatar.ControllingClient.InformClientOfNeighbour(regionHandle, endPoint);
avatar.AddNeighbourRegion(regionHandle);
m_log.Info("[INTERGRID]: Completed inform client about neighbours");
}
}
public void RequestNeighbors(RegionInfo region)
{
List<SimpleRegionInfo> neighbours =
m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
//IPEndPoint blah = new IPEndPoint();
//blah.Address = region.RemotingAddress;
//blah.Port = region.RemotingPort;
}
/// <summary>
/// This informs all neighboring regions about agent "avatar".
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
/// </summary>
public void EnableNeighbourChildAgents(ScenePresence avatar, List<RegionInfo> lstneighbours)
{
List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
//m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
for (int i = 0; i < lstneighbours.Count; i++)
{
// We don't want to keep sending to regions that consistently fail on comms.
if (!(lstneighbours[i].commFailTF))
{
neighbours.Add(new SimpleRegionInfo(lstneighbours[i]));
}
}
// we're going to be using the above code once neighbour cache is correct. Currently it doesn't appear to be
// So we're temporarily going back to the old method of grabbing it from the Grid Server Every time :/
neighbours =
m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
if (neighbours != null)
{
for (int i = 0; i < neighbours.Count; i++)
{
AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo();
agent.BaseFolder = LLUUID.Zero;
agent.InventoryFolder = LLUUID.Zero;
agent.startpos = new LLVector3(128, 128, 70);
agent.child = true;
InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
try
{
d.BeginInvoke(avatar, agent, neighbours[i].RegionHandle, neighbours[i].ExternalEndPoint,
InformClientOfNeighbourCompleted,
d);
}
catch (Exception e)
{
m_log.ErrorFormat(
"[REGIONINFO]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}",
neighbours[i].ExternalHostName,
neighbours[i].RegionHandle,
neighbours[i].RegionLocX,
neighbours[i].RegionLocY,
e);
// FIXME: Okay, even though we've failed, we're still going to throw the exception on,
// since I don't know what will happen if we just let the client continue
// XXX: Well, decided to swallow the exception instead for now. Let us see how that goes.
// throw e;
}
}
}
}
/// <summary>
/// This informs a single neighboring region about agent "avatar".
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
/// </summary>
public void InformNeighborChildAgent(ScenePresence avatar, RegionInfo region, List<RegionInfo> neighbours)
{
AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo();
agent.BaseFolder = LLUUID.Zero;
agent.InventoryFolder = LLUUID.Zero;
agent.startpos = new LLVector3(128, 128, 70);
agent.child = true;
InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
d.BeginInvoke(avatar, agent, region.RegionHandle, region.ExternalEndPoint,
InformClientOfNeighbourCompleted,
d);
}
#endregion
public delegate void InformNeighbourThatRegionUpDelegate(RegionInfo region, ulong regionhandle);
private void InformNeighborsThatRegionisUpCompleted(IAsyncResult iar)
{
InformNeighbourThatRegionUpDelegate icon = (InformNeighbourThatRegionUpDelegate) iar.AsyncState;
@ -390,8 +187,6 @@ namespace OpenSim.Region.Environment.Scenes
//bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region));
}
public delegate void SendChildAgentDataUpdateDelegate(ChildAgentDataUpdate cAgentData, ScenePresence presence);
/// <summary>
/// This informs all neighboring regions about the settings of it's child agent.
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
@ -422,7 +217,6 @@ namespace OpenSim.Region.Environment.Scenes
{
// We're ignoring a collection was modified error because this data gets old and outdated fast.
}
}
private void SendChildAgentDataUpdateCompleted(IAsyncResult iar)
@ -435,20 +229,17 @@ namespace OpenSim.Region.Environment.Scenes
{
// This assumes that we know what our neighbors are.
SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync;
d.BeginInvoke(cAgentData,presence,
d.BeginInvoke(cAgentData, presence,
SendChildAgentDataUpdateCompleted,
d);
}
public delegate void SendCloseChildAgentDelegate( LLUUID agentID, List<ulong> regionlst);
/// <summary>
/// This Closes child agents on neighboring regions
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
/// </summary>
private void SendCloseChildAgentAsync(LLUUID agentID, List<ulong> regionlst)
{
foreach (ulong regionHandle in regionlst)
{
bool regionAccepted = m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID);
@ -456,14 +247,11 @@ namespace OpenSim.Region.Environment.Scenes
if (regionAccepted)
{
m_log.Info("[INTERGRID]: Completed sending agent Close agent Request to neighbor");
}
else
{
m_log.Info("[INTERGRID]: Failed sending agent Close agent Request to neighbor");
}
}
// We remove the list of known regions from the agent's known region list through an event
// to scene, because, if an agent logged of, it's likely that there will be no scene presence
@ -477,7 +265,7 @@ namespace OpenSim.Region.Environment.Scenes
private void SendCloseChildAgentCompleted(IAsyncResult iar)
{
SendCloseChildAgentDelegate icon = (SendCloseChildAgentDelegate)iar.AsyncState;
SendCloseChildAgentDelegate icon = (SendCloseChildAgentDelegate) iar.AsyncState;
icon.EndInvoke(iar);
}
@ -556,28 +344,28 @@ namespace OpenSim.Region.Environment.Scenes
// assume local regions are always up
destRegionUp = true;
}
if(destRegionUp)
if (destRegionUp)
{
avatar.Close();
// Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport
// failure at this point (unlike a border crossing failure). So perhaps this can never fail
// once we reach here...
avatar.Scene.RemoveCapsHandler(avatar.UUID);
m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, agent);
m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId,
position, false);
position, false);
AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo();
// TODO Should construct this behind a method
string capsPath =
"http://" + reg.ExternalHostName + ":" + reg.HttpPort
+ "/CAPS/" + circuitdata.CapsPath + "0000/";
string capsPath =
"http://" + reg.ExternalHostName + ":" + reg.HttpPort
+ "/CAPS/" + circuitdata.CapsPath + "0000/";
m_log.DebugFormat(
"[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID);
"[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID);
avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4),
capsPath);
avatar.MakeChildAgent();
@ -587,13 +375,13 @@ namespace OpenSim.Region.Environment.Scenes
{
KillObject(avatar.LocalId);
}
uint newRegionX = (uint)(regionHandle >> 40);
uint newRegionY = (((uint)(regionHandle)) >> 8);
uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40);
uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8);
if (Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3)
uint newRegionX = (uint) (regionHandle >> 40);
uint newRegionY = (((uint) (regionHandle)) >> 8);
uint oldRegionX = (uint) (m_regionInfo.RegionHandle >> 40);
uint oldRegionY = (((uint) (m_regionInfo.RegionHandle)) >> 8);
if (Util.fast_distance2d((int) (newRegionX - oldRegionX), (int) (newRegionY - oldRegionY)) > 3)
{
SendCloseChildAgentConnections(avatar.UUID,avatar.GetKnownRegionList());
SendCloseChildAgentConnections(avatar.UUID, avatar.GetKnownRegionList());
}
}
else
@ -628,7 +416,7 @@ namespace OpenSim.Region.Environment.Scenes
public void LogOffUser(LLUUID userid, LLUUID regionid, ulong regionhandle, float posx, float posy, float posz)
{
m_commsProvider.LogOffUser(userid, regionid, regionhandle, posx, posy, posz);
m_commsProvider.LogOffUser(userid, regionid, regionhandle, posx, posy, posz);
}
public void ClearUserAgent(LLUUID avatarID)
@ -656,7 +444,7 @@ namespace OpenSim.Region.Environment.Scenes
return m_commsProvider.GetUserFriendList(friendlistowner);
}
public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
{
return m_commsProvider.GridService.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
}
@ -665,5 +453,213 @@ namespace OpenSim.Region.Environment.Scenes
{
return m_commsProvider.GenerateAgentPickerRequestResponse(queryID, query);
}
#region CommsManager Event handlers
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agent"></param>
///
protected void NewUserConnection(ulong regionHandle, AgentCircuitData agent)
{
handlerExpectUser = OnExpectUser;
if (handlerExpectUser != null)
{
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: OnExpectUser Fired for User:" + agent.firstname + " " + agent.lastname);
handlerExpectUser(regionHandle, agent);
}
}
protected bool newRegionUp(RegionInfo region)
{
handlerRegionUp = OnRegionUp;
if (handlerRegionUp != null)
{
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: newRegionUp Fired for User:" + region.RegionName);
handlerRegionUp(region);
}
return true;
}
protected bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{
handlerChildAgentUpdate = OnChildAgentUpdate;
if (handlerChildAgentUpdate != null)
handlerChildAgentUpdate(regionHandle, cAgentData);
return true;
}
protected void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
{
handlerAvatarCrossingIntoRegion = OnAvatarCrossingIntoRegion;
if (handlerAvatarCrossingIntoRegion != null)
{
handlerAvatarCrossingIntoRegion(regionHandle, agentID, position, isFlying);
}
}
protected bool IncomingPrimCrossing(ulong regionHandle, LLUUID primID, String objXMLData, int XMLMethod)
{
handlerExpectPrim = OnExpectPrim;
if (handlerExpectPrim != null)
{
return handlerExpectPrim(regionHandle, primID, objXMLData, XMLMethod);
}
else
{
return false;
}
}
protected void PrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical)
{
handlerPrimCrossingIntoRegion = OnPrimCrossingIntoRegion;
if (handlerPrimCrossingIntoRegion != null)
{
handlerPrimCrossingIntoRegion(regionHandle, primID, position, isPhysical);
}
}
protected bool CloseConnection(ulong regionHandle, LLUUID agentID)
{
m_log.Info("[INTERREGION]: Incoming Agent Close Request for agent: " + agentID);
handlerCloseAgentConnection = OnCloseAgentConnection;
if (handlerCloseAgentConnection != null)
{
return handlerCloseAgentConnection(regionHandle, agentID);
}
return false;
}
#endregion
#region Inform Client of Neighbours
private void InformClientOfNeighbourCompleted(IAsyncResult iar)
{
InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate) iar.AsyncState;
icon.EndInvoke(iar);
}
/// <summary>
/// Async compnent for informing client of which neighbours exists
/// </summary>
/// <remarks>
/// This needs to run asynchronesously, as a network timeout may block the thread for a long while
/// </remarks>
/// <param name="remoteClient"></param>
/// <param name="a"></param>
/// <param name="regionHandle"></param>
/// <param name="endPoint"></param>
private void InformClientOfNeighbourAsync(ScenePresence avatar, AgentCircuitData a, ulong regionHandle,
IPEndPoint endPoint)
{
m_log.Info("[INTERGRID]: Starting to inform client about neighbours");
bool regionAccepted = m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, a);
if (regionAccepted)
{
avatar.ControllingClient.InformClientOfNeighbour(regionHandle, endPoint);
avatar.AddNeighbourRegion(regionHandle);
m_log.Info("[INTERGRID]: Completed inform client about neighbours");
}
}
public void RequestNeighbors(RegionInfo region)
{
List<SimpleRegionInfo> neighbours =
m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
//IPEndPoint blah = new IPEndPoint();
//blah.Address = region.RemotingAddress;
//blah.Port = region.RemotingPort;
}
/// <summary>
/// This informs all neighboring regions about agent "avatar".
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
/// </summary>
public void EnableNeighbourChildAgents(ScenePresence avatar, List<RegionInfo> lstneighbours)
{
List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
//m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
for (int i = 0; i < lstneighbours.Count; i++)
{
// We don't want to keep sending to regions that consistently fail on comms.
if (!(lstneighbours[i].commFailTF))
{
neighbours.Add(new SimpleRegionInfo(lstneighbours[i]));
}
}
// we're going to be using the above code once neighbour cache is correct. Currently it doesn't appear to be
// So we're temporarily going back to the old method of grabbing it from the Grid Server Every time :/
neighbours =
m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
if (neighbours != null)
{
for (int i = 0; i < neighbours.Count; i++)
{
AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo();
agent.BaseFolder = LLUUID.Zero;
agent.InventoryFolder = LLUUID.Zero;
agent.startpos = new LLVector3(128, 128, 70);
agent.child = true;
InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
try
{
d.BeginInvoke(avatar, agent, neighbours[i].RegionHandle, neighbours[i].ExternalEndPoint,
InformClientOfNeighbourCompleted,
d);
}
catch (Exception e)
{
m_log.ErrorFormat(
"[REGIONINFO]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}",
neighbours[i].ExternalHostName,
neighbours[i].RegionHandle,
neighbours[i].RegionLocX,
neighbours[i].RegionLocY,
e);
// FIXME: Okay, even though we've failed, we're still going to throw the exception on,
// since I don't know what will happen if we just let the client continue
// XXX: Well, decided to swallow the exception instead for now. Let us see how that goes.
// throw e;
}
}
}
}
/// <summary>
/// This informs a single neighboring region about agent "avatar".
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
/// </summary>
public void InformNeighborChildAgent(ScenePresence avatar, RegionInfo region, List<RegionInfo> neighbours)
{
AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo();
agent.BaseFolder = LLUUID.Zero;
agent.InventoryFolder = LLUUID.Zero;
agent.startpos = new LLVector3(128, 128, 70);
agent.child = true;
InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
d.BeginInvoke(avatar, agent, region.RegionHandle, region.ExternalEndPoint,
InformClientOfNeighbourCompleted,
d);
}
private delegate void InformClientOfNeighbourDelegate(
ScenePresence avatar, AgentCircuitData a, ulong regionHandle, IPEndPoint endPoint);
#endregion
}
}
}

View File

@ -38,118 +38,59 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
public class EventManager
{
public delegate void OnFrameDelegate();
public event OnFrameDelegate OnFrame;
public delegate void ClientMovement(ScenePresence client);
public event ClientMovement OnClientMovement;
public delegate void OnTerrainTickDelegate();
public event OnTerrainTickDelegate OnTerrainTick;
public delegate void OnBackupDelegate(IRegionDataStore datastore);
public event OnBackupDelegate OnBackup;
public delegate void OnNewClientDelegate(IClientAPI client);
public event OnNewClientDelegate OnNewClient;
public delegate void OnNewPresenceDelegate(ScenePresence presence);
public event OnNewPresenceDelegate OnNewPresence;
public delegate void OnRemovePresenceDelegate(LLUUID agentId);
public event OnRemovePresenceDelegate OnRemovePresence;
public delegate void OnParcelPrimCountUpdateDelegate();
public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate;
public delegate void OnParcelPrimCountAddDelegate(SceneObjectGroup obj);
public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd;
public delegate void OnPluginConsoleDelegate(string[] args);
public event OnPluginConsoleDelegate OnPluginConsole;
public delegate void OnShutdownDelegate();
public event OnShutdownDelegate OnShutdown;
public delegate void ObjectGrabDelegate(uint localID, LLVector3 offsetPos, IClientAPI remoteClient);
public delegate void ObjectDeGrabDelegate(uint localID, IClientAPI remoteClient);
public delegate void OnPermissionErrorDelegate(LLUUID user, string reason);
public event ObjectGrabDelegate OnObjectGrab;
public event ObjectDeGrabDelegate OnObjectDeGrab;
public event OnPermissionErrorDelegate OnPermissionError;
public delegate void NewRezScript(uint localID, LLUUID itemID, string script);
public event NewRezScript OnRezScript;
public delegate void RemoveScript(uint localID, LLUUID itemID);
public event RemoveScript OnRemoveScript;
public delegate bool SceneGroupMoved(LLUUID groupID, LLVector3 delta);
public event SceneGroupMoved OnSceneGroupMove;
public delegate void SceneGroupGrabed(LLUUID groupID, LLVector3 offset, LLUUID userID);
public event SceneGroupGrabed OnSceneGroupGrab;
public delegate void LandObjectAdded(ILandObject newParcel);
public event LandObjectAdded OnLandObjectAdded;
public delegate void LandObjectRemoved(LLUUID globalID);
public event LandObjectRemoved OnLandObjectRemoved;
#region Delegates
public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, LLUUID regionID);
public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel;
public delegate void ClientClosed(LLUUID clientID);
public delegate void ClientMovement(ScenePresence client);
/// <summary>
/// DeregisterCapsEvent is called by Scene when the caps
/// handler for an agent are removed.
/// </summary>
public delegate void DeregisterCapsEvent(LLUUID agentID, Caps caps);
public delegate void LandBuy(Object sender, LandBuyArgs e);
public delegate void LandObjectAdded(ILandObject newParcel);
public delegate void LandObjectRemoved(LLUUID globalID);
public delegate void MoneyTransferEvent(Object sender, MoneyTransferArgs e);
public delegate void NewGridInstantMessage(GridInstantMessage message);
public event NewGridInstantMessage OnGridInstantMessageToIMModule;
public event NewGridInstantMessage OnGridInstantMessageToFriendsModule;
public event NewGridInstantMessage OnGridInstantMessageToGroupsModule;
public delegate void ClientClosed(LLUUID clientID);
public event ClientClosed OnClientClosed;
public delegate void ScriptChangedEvent(uint localID, uint change);
public event ScriptChangedEvent OnScriptChangedEvent;
public delegate void ScriptAtTargetEvent(uint localID, uint handle, LLVector3 targetpos, LLVector3 atpos);
public event ScriptAtTargetEvent OnScriptAtTargetEvent;
public delegate void ScriptNotAtTargetEvent(uint localID);
public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent;
public event OnNewPresenceDelegate OnMakeChildAgent;
public delegate void NewInventoryItemUploadComplete(LLUUID avatarID, LLUUID assetID, string name, int userlevel);
public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete;
public delegate void NewRezScript(uint localID, LLUUID itemID, string script);
public delegate void ObjectDeGrabDelegate(uint localID, IClientAPI remoteClient);
public delegate void ObjectGrabDelegate(uint localID, LLVector3 offsetPos, IClientAPI remoteClient);
public delegate void OnBackupDelegate(IRegionDataStore datastore);
public delegate void OnFrameDelegate();
public delegate void OnNewClientDelegate(IClientAPI client);
public delegate void OnNewPresenceDelegate(ScenePresence presence);
public delegate void OnParcelPrimCountAddDelegate(SceneObjectGroup obj);
public delegate void OnParcelPrimCountUpdateDelegate();
public delegate void OnPermissionErrorDelegate(LLUUID user, string reason);
public delegate void OnPluginConsoleDelegate(string[] args);
public delegate void OnRemovePresenceDelegate(LLUUID agentId);
public delegate void OnShutdownDelegate();
public delegate void OnTerrainTickDelegate();
/// <summary>
/// RegisterCapsEvent is called by Scene after the Caps object
@ -157,117 +98,126 @@ namespace OpenSim.Region.Environment.Scenes
/// client and provides region modules to add their caps.
/// </summary>
public delegate void RegisterCapsEvent(LLUUID agentID, Caps caps);
public delegate void RemoveScript(uint localID, LLUUID itemID);
public delegate void SceneGroupGrabed(LLUUID groupID, LLVector3 offset, LLUUID userID);
public delegate bool SceneGroupMoved(LLUUID groupID, LLVector3 delta);
public delegate void ScriptAtTargetEvent(uint localID, uint handle, LLVector3 targetpos, LLVector3 atpos);
public delegate void ScriptChangedEvent(uint localID, uint change);
public delegate void ScriptNotAtTargetEvent(uint localID);
#endregion
private AvatarEnteringNewParcel handlerAvatarEnteringNewParcel; //OnAvatarEnteringNewParcel;
private OnBackupDelegate handlerBackup; //OnBackup;
private ClientClosed handlerClientClosed; //OnClientClosed;
private ClientMovement handlerClientMovement; //OnClientMovement;
private DeregisterCapsEvent handlerDeregisterCaps; // OnDeregisterCaps;
private OnFrameDelegate handlerFrame; //OnFrame;
private NewGridInstantMessage handlerGridInstantMessageToFriends; //OnGridInstantMessageToFriendsModule;
private NewGridInstantMessage handlerGridInstantMessageToIM; //OnGridInstantMessageToIMModule;
private LandBuy handlerLandBuy;
private LandObjectAdded handlerLandObjectAdded; //OnLandObjectAdded;
private LandObjectRemoved handlerLandObjectRemoved; //OnLandObjectRemoved;
private OnNewPresenceDelegate handlerMakeChildAgent; //OnMakeChildAgent;
private MoneyTransferEvent handlerMoneyTransfer; //OnMoneyTransfer;
private OnNewClientDelegate handlerNewClient; //OnNewClient;
private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete;
private OnNewPresenceDelegate handlerNewPresence; //OnNewPresence;
private ObjectDeGrabDelegate handlerObjectDeGrab; //OnObjectDeGrab;
private ObjectGrabDelegate handlerObjectGrab; //OnObjectGrab;
private OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd; //OnParcelPrimCountAdd;
private OnParcelPrimCountUpdateDelegate handlerParcelPrimCountUpdate; //OnParcelPrimCountUpdate;
private OnPermissionErrorDelegate handlerPermissionError; //OnPermissionError;
private OnPluginConsoleDelegate handlerPluginConsole; //OnPluginConsole;
private RegisterCapsEvent handlerRegisterCaps; // OnRegisterCaps;
private OnRemovePresenceDelegate handlerRemovePresence; //OnRemovePresence;
private RemoveScript handlerRemoveScript; //OnRemoveScript;
private NewRezScript handlerRezScript; //OnRezScript;
private SceneGroupGrabed handlerSceneGroupGrab; //OnSceneGroupGrab;
private SceneGroupMoved handlerSceneGroupMove; //OnSceneGroupMove;
private ScriptAtTargetEvent handlerScriptAtTargetEvent;
private ScriptChangedEvent handlerScriptChangedEvent; //OnScriptChangedEvent;
private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent;
private OnShutdownDelegate handlerShutdown; //OnShutdown;
private OnTerrainTickDelegate handlerTerrainTick; // OnTerainTick;
private LandBuy handlerValidateLandBuy;
public event OnFrameDelegate OnFrame;
public event ClientMovement OnClientMovement;
public event OnTerrainTickDelegate OnTerrainTick;
public event OnBackupDelegate OnBackup;
public event OnNewClientDelegate OnNewClient;
public event OnNewPresenceDelegate OnNewPresence;
public event OnRemovePresenceDelegate OnRemovePresence;
public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate;
public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd;
public event OnPluginConsoleDelegate OnPluginConsole;
public event OnShutdownDelegate OnShutdown;
public event ObjectGrabDelegate OnObjectGrab;
public event ObjectDeGrabDelegate OnObjectDeGrab;
public event OnPermissionErrorDelegate OnPermissionError;
public event NewRezScript OnRezScript;
public event RemoveScript OnRemoveScript;
public event SceneGroupMoved OnSceneGroupMove;
public event SceneGroupGrabed OnSceneGroupGrab;
public event LandObjectAdded OnLandObjectAdded;
public event LandObjectRemoved OnLandObjectRemoved;
public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel;
public event NewGridInstantMessage OnGridInstantMessageToIMModule;
public event NewGridInstantMessage OnGridInstantMessageToFriendsModule;
public event NewGridInstantMessage OnGridInstantMessageToGroupsModule;
public event ClientClosed OnClientClosed;
public event ScriptChangedEvent OnScriptChangedEvent;
public event ScriptAtTargetEvent OnScriptAtTargetEvent;
public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent;
public event OnNewPresenceDelegate OnMakeChildAgent;
public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete;
public event RegisterCapsEvent OnRegisterCaps;
/// <summary>
/// DeregisterCapsEvent is called by Scene when the caps
/// handler for an agent are removed.
/// </summary>
public delegate void DeregisterCapsEvent(LLUUID agentID, Caps caps);
public event DeregisterCapsEvent OnDeregisterCaps;
public class MoneyTransferArgs : EventArgs
{
public LLUUID sender;
public LLUUID receiver;
// Always false. The SL protocol sucks.
public bool authenticated = false;
public int amount;
public int transactiontype;
public string description;
public MoneyTransferArgs(LLUUID asender, LLUUID areceiver, int aamount, int atransactiontype, string adescription) {
sender = asender;
receiver = areceiver;
amount = aamount;
transactiontype = atransactiontype;
description = adescription;
}
}
public class LandBuyArgs : EventArgs
{
public LLUUID agentId = LLUUID.Zero;
public LLUUID groupId = LLUUID.Zero;
public LLUUID parcelOwnerID = LLUUID.Zero;
public bool final = false;
public bool groupOwned = false;
public bool removeContribution = false;
public int parcelLocalID = 0;
public int parcelArea = 0;
public int parcelPrice = 0;
public bool authenticated = false;
public bool landValidated = false;
public bool economyValidated = false;
public int transactionID = 0;
public int amountDebited = 0;
public LandBuyArgs(LLUUID pagentId, LLUUID pgroupId, bool pfinal, bool pgroupOwned,
bool premoveContribution, int pparcelLocalID, int pparcelArea, int pparcelPrice,
bool pauthenticated)
{
agentId = pagentId;
groupId = pgroupId;
final = pfinal;
groupOwned = pgroupOwned;
removeContribution = premoveContribution;
parcelLocalID = pparcelLocalID;
parcelArea = pparcelArea;
parcelPrice = pparcelPrice;
authenticated = pauthenticated;
}
}
public delegate void MoneyTransferEvent(Object sender, MoneyTransferArgs e);
public delegate void LandBuy(Object sender, LandBuyArgs e);
public event MoneyTransferEvent OnMoneyTransfer;
public event LandBuy OnLandBuy;
public event LandBuy OnValidateLandBuy;
/* Designated Event Deletage Instances */
private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent;
private ScriptAtTargetEvent handlerScriptAtTargetEvent = null;
private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null;
private ClientMovement handlerClientMovement = null; //OnClientMovement;
private OnPermissionErrorDelegate handlerPermissionError = null; //OnPermissionError;
private OnPluginConsoleDelegate handlerPluginConsole = null; //OnPluginConsole;
private OnFrameDelegate handlerFrame = null; //OnFrame;
private OnNewClientDelegate handlerNewClient = null; //OnNewClient;
private OnNewPresenceDelegate handlerNewPresence = null; //OnNewPresence;
private OnRemovePresenceDelegate handlerRemovePresence = null; //OnRemovePresence;
private OnBackupDelegate handlerBackup = null; //OnBackup;
private OnParcelPrimCountUpdateDelegate handlerParcelPrimCountUpdate = null; //OnParcelPrimCountUpdate;
private MoneyTransferEvent handlerMoneyTransfer = null; //OnMoneyTransfer;
private OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = null; //OnParcelPrimCountAdd;
private OnShutdownDelegate handlerShutdown = null; //OnShutdown;
private ObjectGrabDelegate handlerObjectGrab = null; //OnObjectGrab;
private ObjectDeGrabDelegate handlerObjectDeGrab = null; //OnObjectDeGrab;
private NewRezScript handlerRezScript = null; //OnRezScript;
private RemoveScript handlerRemoveScript = null; //OnRemoveScript;
private SceneGroupMoved handlerSceneGroupMove = null; //OnSceneGroupMove;
private SceneGroupGrabed handlerSceneGroupGrab = null; //OnSceneGroupGrab;
private LandObjectAdded handlerLandObjectAdded = null; //OnLandObjectAdded;
private LandObjectRemoved handlerLandObjectRemoved = null; //OnLandObjectRemoved;
private AvatarEnteringNewParcel handlerAvatarEnteringNewParcel = null; //OnAvatarEnteringNewParcel;
private NewGridInstantMessage handlerGridInstantMessageToIM = null; //OnGridInstantMessageToIMModule;
private NewGridInstantMessage handlerGridInstantMessageToFriends = null; //OnGridInstantMessageToFriendsModule;
private ClientClosed handlerClientClosed = null; //OnClientClosed;
private OnNewPresenceDelegate handlerMakeChildAgent = null; //OnMakeChildAgent;
private OnTerrainTickDelegate handlerTerrainTick = null; // OnTerainTick;
private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps;
private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps;
private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null;
private LandBuy handlerLandBuy = null;
private LandBuy handlerValidateLandBuy = null;
public void TriggerOnScriptChangedEvent(uint localID, uint change)
{
handlerScriptChangedEvent = OnScriptChangedEvent;
@ -343,7 +293,7 @@ namespace OpenSim.Region.Environment.Scenes
if (handlerParcelPrimCountUpdate != null)
{
handlerParcelPrimCountUpdate();
}
}
}
public void TriggerMoneyTransfer(Object sender, MoneyTransferArgs e)
@ -492,7 +442,6 @@ namespace OpenSim.Region.Environment.Scenes
{
handlerGridInstantMessageToFriends(message);
}
}
}
@ -514,7 +463,7 @@ namespace OpenSim.Region.Environment.Scenes
}
}
public void TriggerOnRegisterCaps(LLUUID agentID, Caps caps)
public void TriggerOnRegisterCaps(LLUUID agentID, Caps caps)
{
handlerRegisterCaps = OnRegisterCaps;
if (handlerRegisterCaps != null)
@ -523,7 +472,7 @@ namespace OpenSim.Region.Environment.Scenes
}
}
public void TriggerOnDeregisterCaps(LLUUID agentID, Caps caps)
public void TriggerOnDeregisterCaps(LLUUID agentID, Caps caps)
{
handlerDeregisterCaps = OnDeregisterCaps;
if (handlerDeregisterCaps != null)
@ -540,7 +489,8 @@ namespace OpenSim.Region.Environment.Scenes
handlerNewInventoryItemUpdateComplete(agentID, AssetID, AssetName, userlevel);
}
}
public void TriggerLandBuy (Object sender, LandBuyArgs e)
public void TriggerLandBuy(Object sender, LandBuyArgs e)
{
handlerLandBuy = OnLandBuy;
if (handlerLandBuy != null)
@ -548,6 +498,7 @@ namespace OpenSim.Region.Environment.Scenes
handlerLandBuy(sender, e);
}
}
public void TriggerValidateLandBuy(Object sender, LandBuyArgs e)
{
handlerValidateLandBuy = OnValidateLandBuy;
@ -556,7 +507,7 @@ namespace OpenSim.Region.Environment.Scenes
handlerValidateLandBuy(sender, e);
}
}
public void TriggerAtTargetEvent(uint localID, uint handle, LLVector3 targetpos, LLVector3 currentpos)
{
handlerScriptAtTargetEvent = OnScriptAtTargetEvent;
@ -574,5 +525,67 @@ namespace OpenSim.Region.Environment.Scenes
handlerScriptNotAtTargetEvent(localID);
}
}
#region Nested type: LandBuyArgs
public class LandBuyArgs : EventArgs
{
public LLUUID agentId = LLUUID.Zero;
public int amountDebited;
public bool authenticated;
public bool economyValidated;
public bool final;
public LLUUID groupId = LLUUID.Zero;
public bool groupOwned;
public bool landValidated;
public int parcelArea;
public int parcelLocalID;
public LLUUID parcelOwnerID = LLUUID.Zero;
public int parcelPrice;
public bool removeContribution;
public int transactionID;
public LandBuyArgs(LLUUID pagentId, LLUUID pgroupId, bool pfinal, bool pgroupOwned,
bool premoveContribution, int pparcelLocalID, int pparcelArea, int pparcelPrice,
bool pauthenticated)
{
agentId = pagentId;
groupId = pgroupId;
final = pfinal;
groupOwned = pgroupOwned;
removeContribution = premoveContribution;
parcelLocalID = pparcelLocalID;
parcelArea = pparcelArea;
parcelPrice = pparcelPrice;
authenticated = pauthenticated;
}
}
#endregion
#region Nested type: MoneyTransferArgs
public class MoneyTransferArgs : EventArgs
{
public int amount;
public bool authenticated;
public string description;
public LLUUID receiver;
public LLUUID sender;
public int transactiontype;
public MoneyTransferArgs(LLUUID asender, LLUUID areceiver, int aamount, int atransactiontype, string adescription)
{
sender = asender;
receiver = areceiver;
amount = aamount;
transactiontype = atransactiontype;
description = adescription;
}
}
#endregion
}
}
}

View File

@ -41,10 +41,13 @@ namespace OpenSim.Region.Environment.Scenes
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public event RestartSim OnRestartSim;
private readonly List<Scene> m_localScenes;
private Scene m_currentScene = null;
private Scene m_currentScene;
public SceneManager()
{
m_localScenes = new List<Scene>();
}
public List<Scene> Scenes
{
@ -71,10 +74,7 @@ namespace OpenSim.Region.Environment.Scenes
}
}
public SceneManager()
{
m_localScenes = new List<Scene>();
}
public event RestartSim OnRestartSim;
public void Close()
{
@ -180,7 +180,7 @@ namespace OpenSim.Region.Environment.Scenes
[Obsolete("TODO: Remove this warning by 0.7")]
public bool RunTerrainCmdOnCurrentScene(string[] cmdparams, ref string result)
{
m_log.Warn("DEPRECIATED: The terrain engine has been replaced with a new terrain plugin module. Please type 'plugin terrain help' for new commands.");
m_log.Warn("DEPRECIATED: The terrain engine has been replaced with a new terrain plugin module. Please type 'plugin terrain help' for new commands.");
return false;
}
@ -252,8 +252,8 @@ namespace OpenSim.Region.Environment.Scenes
public bool TrySetCurrentScene(LLUUID regionID)
{
Console.WriteLine("Searching for Region: '{0}'", regionID.ToString());
Console.WriteLine("Searching for Region: '{0}'", regionID);
foreach (Scene scene in m_localScenes)
{
if (scene.RegionInfo.RegionID == regionID)
@ -262,7 +262,7 @@ namespace OpenSim.Region.Environment.Scenes
return true;
}
}
return false;
}
@ -313,7 +313,7 @@ namespace OpenSim.Region.Environment.Scenes
{
foreach (Scene mscene in m_localScenes)
{
if((mscene.RegionInfo.InternalEndPoint.Equals(ipEndPoint.Address)) &&
if ((mscene.RegionInfo.InternalEndPoint.Equals(ipEndPoint.Address)) &&
(mscene.RegionInfo.InternalEndPoint.Port == ipEndPoint.Port))
{
scene = mscene;
@ -327,22 +327,22 @@ namespace OpenSim.Region.Environment.Scenes
public void SetDebugPacketOnCurrentScene(int newDebug)
{
ForEachCurrentScene(delegate(Scene scene)
{
List<ScenePresence> scenePresences = scene.GetScenePresences();
foreach (ScenePresence scenePresence in scenePresences)
{
if (!scenePresence.IsChildAgent)
{
m_log.ErrorFormat("Packet debug for {0} {1} set to {2}",
scenePresence.Firstname,
scenePresence.Lastname,
newDebug);
List<ScenePresence> scenePresences = scene.GetScenePresences();
scenePresence.ControllingClient.SetDebug(newDebug);
foreach (ScenePresence scenePresence in scenePresences)
{
if (!scenePresence.IsChildAgent)
{
m_log.ErrorFormat("Packet debug for {0} {1} set to {2}",
scenePresence.Firstname,
scenePresence.Lastname,
newDebug);
scenePresence.ControllingClient.SetDebug(newDebug);
}
}
}
});
});
}
public List<ScenePresence> GetCurrentSceneAvatars()
@ -350,17 +350,17 @@ namespace OpenSim.Region.Environment.Scenes
List<ScenePresence> avatars = new List<ScenePresence>();
ForEachCurrentScene(delegate(Scene scene)
{
List<ScenePresence> scenePresences = scene.GetScenePresences();
{
List<ScenePresence> scenePresences = scene.GetScenePresences();
foreach (ScenePresence scenePresence in scenePresences)
{
if (!scenePresence.IsChildAgent)
{
avatars.Add(scenePresence);
}
}
});
foreach (ScenePresence scenePresence in scenePresences)
{
if (!scenePresence.IsChildAgent)
{
avatars.Add(scenePresence);
}
}
});
return avatars;
}
@ -381,11 +381,11 @@ namespace OpenSim.Region.Environment.Scenes
public void SetCurrentSceneTimePhase(int timePhase)
{
ForEachCurrentScene(delegate(Scene scene)
{
scene.SetTimePhase(
timePhase)
;
});
{
scene.SetTimePhase(
timePhase)
;
});
}
public void ForceCurrentSceneClientUpdate()
@ -453,4 +453,4 @@ namespace OpenSim.Region.Environment.Scenes
m_localScenes.ForEach(action);
}
}
}
}

View File

@ -49,7 +49,6 @@ namespace OpenSim.Region.Environment.Scenes
if (part != null)
{
part.StartScript(itemID);
}
else
{
@ -57,9 +56,9 @@ namespace OpenSim.Region.Environment.Scenes
"[PRIMINVENTORY]: " +
"Couldn't find part {0} in object group {1}, {2} to start script with ID {3}",
localID, Name, UUID, itemID);
}
}
}
// /// Start a given script.
// /// </summary>
// /// <param name="localID">
@ -80,7 +79,7 @@ namespace OpenSim.Region.Environment.Scenes
// localID, Name, UUID, itemID);
// }
// }
/// <summary>
/// Start the scripts contained in all the prims in this group.
/// </summary>
@ -106,7 +105,7 @@ namespace OpenSim.Region.Environment.Scenes
}
}
}
/// Start a given script.
/// </summary>
/// <param name="localID">
@ -126,9 +125,9 @@ namespace OpenSim.Region.Environment.Scenes
"[PRIMINVENTORY]: " +
"Couldn't find part {0} in object group {1}, {2} to stop script with ID {3}",
partID, Name, UUID, itemID);
}
}
}
}
/// <summary>
///
/// </summary>
@ -171,7 +170,7 @@ namespace OpenSim.Region.Environment.Scenes
localID, Name, UUID);
}
}
/// <summary>
/// Add an inventory item to a prim in this group.
/// </summary>
@ -180,7 +179,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="item"></param>
/// <param name="copyItemID">The item UUID that should be used by the new item.</param>
/// <returns></returns>
public bool AddInventoryItem(IClientAPI remoteClient, uint localID,
public bool AddInventoryItem(IClientAPI remoteClient, uint localID,
InventoryItemBase item, LLUUID copyItemID)
{
LLUUID newItemId = (copyItemID != LLUUID.Zero) ? copyItemID : item.ID;
@ -189,8 +188,8 @@ namespace OpenSim.Region.Environment.Scenes
if (part != null)
{
TaskInventoryItem taskItem = new TaskInventoryItem();
taskItem.ItemID = newItemId;
taskItem.ItemID = newItemId;
taskItem.AssetID = item.AssetID;
taskItem.Name = item.Name;
taskItem.Description = item.Description;
@ -198,15 +197,15 @@ namespace OpenSim.Region.Environment.Scenes
taskItem.CreatorID = item.Creator;
taskItem.Type = item.AssetType;
taskItem.InvType = item.InvType;
taskItem.BaseMask = item.BasePermissions;
taskItem.OwnerMask = item.CurrentPermissions;
// FIXME: ignoring group permissions for now as they aren't stored in item
taskItem.EveryoneMask = item.EveryOnePermissions;
taskItem.NextOwnerMask = item.NextPermissions;
part.AddInventoryItem(taskItem);
return true;
}
else
@ -219,7 +218,7 @@ namespace OpenSim.Region.Environment.Scenes
return false;
}
/// <summary>
/// Returns an existing inventory item. Returns the original, so any changes will be live.
/// </summary>
@ -239,11 +238,11 @@ namespace OpenSim.Region.Environment.Scenes
"[PRIMINVENTORY]: " +
"Couldn't find prim local ID {0} in prim {1}, {2} to get inventory item ID {3}",
primID, part.Name, part.UUID, itemID);
}
}
return null;
}
}
/// <summary>
/// Update an existing inventory item.
/// </summary>
@ -255,8 +254,8 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectPart part = GetChildPart(item.ParentPartID);
if (part != null)
{
part.UpdateInventoryItem(item);
part.UpdateInventoryItem(item);
return true;
}
else
@ -265,22 +264,22 @@ namespace OpenSim.Region.Environment.Scenes
"[PRIMINVENTORY]: " +
"Couldn't find prim ID {0} to update item {1}, {2}",
item.ParentPartID, item.Name, item.ItemID);
}
}
return false;
}
}
public int RemoveInventoryItem(uint localID, LLUUID itemID)
{
SceneObjectPart part = GetChildPart(localID);
if (part != null)
{
{
int type = part.RemoveInventoryItem(itemID);
return type;
}
return -1;
}
}
}
}
}

View File

@ -72,7 +72,7 @@ namespace OpenSim.Region.Environment.Scenes
object_rez = 4194304
}
struct scriptPosTarget
internal struct scriptPosTarget
{
public LLVector3 targetPos;
public float tolerance;
@ -82,14 +82,14 @@ namespace OpenSim.Region.Environment.Scenes
public partial class SceneObjectGroup : EntityBase
{
private PrimCountTaintedDelegate handlerPrimCountTainted = null;
private readonly Dictionary<uint, scriptPosTarget> m_targets = new Dictionary<uint, scriptPosTarget>();
private PrimCountTaintedDelegate handlerPrimCountTainted;
/// <summary>
/// Signal whether the non-inventory attributes of any prims in the group have changed
/// since the group's last persistent backup
/// </summary>
public bool HasGroupChanged = false;
public bool HasGroupChanged;
private LLVector3 lastPhysGroupPos;
@ -104,11 +104,8 @@ namespace OpenSim.Region.Environment.Scenes
protected SceneObjectPart m_rootPart;
private Dictionary<LLUUID, scriptEvents> m_scriptEvents = new Dictionary<LLUUID, scriptEvents>();
private Dictionary<uint, scriptPosTarget> m_targets = new Dictionary<uint, scriptPosTarget>();
private bool m_scriptListens_atTarget = false;
private bool m_scriptListens_notAtTarget = false;
private bool m_scriptListens_atTarget;
private bool m_scriptListens_notAtTarget;
#region Properties
@ -119,7 +116,7 @@ namespace OpenSim.Region.Environment.Scenes
/// think really there should be a list (or whatever) in each scenepresence
/// saying what prim(s) that user has selected.
/// </summary>
protected bool m_isSelected = false;
protected bool m_isSelected;
/// <summary>
///
@ -186,7 +183,6 @@ namespace OpenSim.Region.Environment.Scenes
string.Format("[SCENE OBJECT GROUP]: Object {0} has no root part.", m_uuid));
}
return m_rootPart.GroupPosition;
}
@ -206,7 +202,7 @@ namespace OpenSim.Region.Environment.Scenes
part.GroupPosition = val;
}
}
//if (m_rootPart.PhysActor != null)
//{
//m_rootPart.PhysActor.Position =
@ -216,7 +212,7 @@ namespace OpenSim.Region.Environment.Scenes
//}
}
}
public override uint LocalId
{
get
@ -515,10 +511,11 @@ namespace OpenSim.Region.Environment.Scenes
m_scene.EventManager.OnBackup += ProcessBackup;
}
}
public LLVector3 GroupScale()
{
LLVector3 minScale = new LLVector3(Constants.RegionSize,Constants.RegionSize,Constants.RegionSize);
LLVector3 maxScale = new LLVector3(0f,0f,0f);
LLVector3 minScale = new LLVector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize);
LLVector3 maxScale = new LLVector3(0f, 0f, 0f);
LLVector3 finalScale = new LLVector3(0.5f, 0.5f, 0.5f);
lock (m_parts)
@ -541,8 +538,8 @@ namespace OpenSim.Region.Environment.Scenes
finalScale.Y = (minScale.Y > maxScale.Y) ? minScale.Y : maxScale.Y;
finalScale.Z = (minScale.Z > maxScale.Z) ? minScale.Z : maxScale.Z;
return finalScale;
}
public EntityIntersection TestIntersection(Ray hRay, bool frontFacesOnly, bool faceCenters)
{
// We got a request from the inner_scene to raytrace along the Ray hRay
@ -565,7 +562,7 @@ namespace OpenSim.Region.Environment.Scenes
// Telling the prim to raytrace.
//EntityIntersection inter = part.TestIntersection(hRay, parentrotation);
EntityIntersection inter = part.TestIntersectionOBB(hRay, parentrotation,frontFacesOnly, faceCenters);
EntityIntersection inter = part.TestIntersectionOBB(hRay, parentrotation, frontFacesOnly, faceCenters);
// This may need to be updated to the maximum draw distance possible..
// We might (and probably will) be checking for prim creation from other sims
@ -684,12 +681,11 @@ namespace OpenSim.Region.Environment.Scenes
DetachFromBackup(this);
m_rootPart.m_attachedAvatar = agentID;
if (m_rootPart.PhysActor != null)
{
m_scene.PhysicsScene.RemovePrim(m_rootPart.PhysActor);
m_rootPart.PhysActor = null;
}
AbsolutePosition = AttachOffset;
@ -709,27 +705,28 @@ namespace OpenSim.Region.Environment.Scenes
m_rootPart.ScheduleFullUpdate();
}
}
public byte GetAttachmentPoint()
{
if (m_rootPart != null)
{
return m_rootPart.Shape.State;
}
return (byte)0;
return 0;
}
public void ClearPartAttachmentData()
{
foreach (SceneObjectPart part in m_parts.Values)
{
part.SetAttachmentPoint((Byte)0);
part.SetAttachmentPoint(0);
}
}
public void DetachToGround()
{
ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.m_attachedAvatar);
LLVector3 detachedpos = new LLVector3(127f,127f,127f);
LLVector3 detachedpos = new LLVector3(127f, 127f, 127f);
if (avatar != null)
{
detachedpos = avatar.AbsolutePosition;
@ -738,14 +735,14 @@ namespace OpenSim.Region.Environment.Scenes
AbsolutePosition = detachedpos;
m_rootPart.m_attachedAvatar = LLUUID.Zero;
m_rootPart.SetParentLocalId(0);
m_rootPart.SetAttachmentPoint((byte)0);
m_rootPart.SetAttachmentPoint(0);
m_rootPart.m_IsAttachment = false;
m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim);
AttachToBackup();
m_rootPart.ScheduleFullUpdate();
m_rootPart.ClearUndoState();
}
public void DetachToInventoryPrep()
{
ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.m_attachedAvatar);
@ -755,7 +752,7 @@ namespace OpenSim.Region.Environment.Scenes
//detachedpos = avatar.AbsolutePosition;
avatar.RemoveAttachment(this);
}
m_rootPart.m_attachedAvatar = LLUUID.Zero;
m_rootPart.SetParentLocalId(0);
//m_rootPart.SetAttachmentPoint((byte)0);
@ -764,8 +761,8 @@ namespace OpenSim.Region.Environment.Scenes
//m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim);
//AttachToBackup();
//m_rootPart.ScheduleFullUpdate();
}
/// <summary>
///
/// </summary>
@ -826,7 +823,6 @@ namespace OpenSim.Region.Environment.Scenes
try
{
m_parts.Add(part.UUID, part);
}
catch (Exception e)
{
@ -847,7 +843,6 @@ namespace OpenSim.Region.Environment.Scenes
if (part.UUID != m_rootPart.UUID)
{
part.ParentID = m_rootPart.LocalId;
}
}
}
@ -860,10 +855,10 @@ namespace OpenSim.Region.Environment.Scenes
foreach (SceneObjectPart part in m_parts.Values)
{
part.UUID = LLUUID.Random();
}
}
}
// helper provided for parts.
public int GetSceneMaxUndo()
{
@ -871,6 +866,7 @@ namespace OpenSim.Region.Environment.Scenes
return m_scene.MaxUndoCount;
return 5;
}
public void ResetChildPrimPhysicsPositions()
{
AbsolutePosition = AbsolutePosition;
@ -897,7 +893,6 @@ namespace OpenSim.Region.Environment.Scenes
{
SceneObjectPart part = GetChildPart(localId);
OnGrabPart(part, offsetPos, remoteClient);
}
}
@ -905,7 +900,6 @@ namespace OpenSim.Region.Environment.Scenes
{
part.StoreUndoState();
part.OnGrab(offsetPos, remoteClient);
}
public virtual void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient)
@ -969,19 +963,19 @@ namespace OpenSim.Region.Environment.Scenes
public void aggregateScriptEvents()
{
uint objectflagupdate=(uint)RootPart.GetEffectiveObjectFlags();
uint objectflagupdate = RootPart.GetEffectiveObjectFlags();
scriptEvents aggregateScriptEvents=0;
scriptEvents aggregateScriptEvents = 0;
lock (m_parts)
{
foreach (SceneObjectPart part in m_parts.Values)
{
if(part == null)
continue;
if(part != RootPart)
part.ObjectFlags = objectflagupdate;
aggregateScriptEvents |= part.m_aggregateScriptEvents;
if (part == null)
continue;
if (part != RootPart)
part.ObjectFlags = objectflagupdate;
aggregateScriptEvents |= part.m_aggregateScriptEvents;
}
}
@ -1065,6 +1059,139 @@ namespace OpenSim.Region.Environment.Scenes
}
}
internal void SetAxisRotation(int axis, int rotate10)
{
bool setX = false;
bool setY = false;
bool setZ = false;
int xaxis = 2;
int yaxis = 4;
int zaxis = 8;
if (m_rootPart != null)
{
setX = ((axis & xaxis) != 0) ? true : false;
setY = ((axis & yaxis) != 0) ? true : false;
setZ = ((axis & zaxis) != 0) ? true : false;
float setval = (rotate10 > 0) ? 1f : 0f;
if (setX)
m_rootPart.m_rotationAxis.X = setval;
if (setY)
m_rootPart.m_rotationAxis.Y = setval;
if (setZ)
m_rootPart.m_rotationAxis.Z = setval;
if (setX || setY || setZ)
{
m_rootPart.SetPhysicsAxisRotation();
}
}
}
public int registerTargetWaypoint(LLVector3 target, float tolerance)
{
scriptPosTarget waypoint = new scriptPosTarget();
waypoint.targetPos = target;
waypoint.tolerance = tolerance;
uint handle = m_scene.PrimIDAllocate();
lock (m_targets)
{
m_targets.Add(handle, waypoint);
}
return (int) handle;
}
public void unregisterTargetWaypoint(int handle)
{
lock (m_targets)
{
if (m_targets.ContainsKey((uint) handle))
m_targets.Remove((uint) handle);
}
}
private void checkAtTargets()
{
if (m_scriptListens_atTarget || m_scriptListens_notAtTarget)
{
if (m_targets.Count > 0)
{
bool at_target = false;
//LLVector3 targetPos;
//uint targetHandle;
Dictionary<uint, scriptPosTarget> atTargets = new Dictionary<uint, scriptPosTarget>();
lock (m_targets)
{
foreach (uint idx in m_targets.Keys)
{
scriptPosTarget target = m_targets[idx];
if (Util.GetDistanceTo(target.targetPos, m_rootPart.GroupPosition) <= target.tolerance)
{
// trigger at_target
if (m_scriptListens_atTarget)
{
// Reusing att.tolerance to hold the index of the target in the targets dictionary
// to avoid deadlocking the sim.
at_target = true;
scriptPosTarget att = new scriptPosTarget();
att.targetPos = target.targetPos;
att.tolerance = idx;
atTargets.Add(idx, att);
}
}
}
}
if (atTargets.Count > 0)
{
uint[] localids = new uint[0];
lock (m_parts)
{
localids = new uint[m_parts.Count];
int cntr = 0;
foreach (SceneObjectPart part in m_parts.Values)
{
localids[cntr] = part.LocalId;
cntr++;
}
}
for (int ctr = 0; ctr < localids.Length; ctr++)
{
foreach (uint target in atTargets.Keys)
{
scriptPosTarget att = atTargets[target];
// Reusing att.tolerance to hold the index of the target in the targets dictionary
// to avoid deadlocking the sim.
m_scene.TriggerAtTargetEvent(localids[ctr], (uint) att.tolerance, att.targetPos, m_rootPart.GroupPosition);
}
}
return;
}
if (m_scriptListens_notAtTarget && !at_target)
{
//trigger not_at_target
uint[] localids = new uint[0];
lock (m_parts)
{
localids = new uint[m_parts.Count];
int cntr = 0;
foreach (SceneObjectPart part in m_parts.Values)
{
localids[cntr] = part.LocalId;
cntr++;
}
}
for (int ctr = 0; ctr < localids.Length; ctr++)
{
m_scene.TriggerNotAtTargetEvent(localids[ctr]);
}
}
}
}
}
#region Events
/// <summary>
@ -1362,9 +1489,8 @@ namespace OpenSim.Region.Environment.Scenes
{
m_parts.Add(newPart.UUID, newPart);
}
SetPartAsNonRoot(newPart);
}
/// <summary>
@ -1434,32 +1560,30 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
public override void Update()
{
lock (m_parts)
{
//if (m_rootPart.m_IsAttachment)
//{
//foreach (SceneObjectPart part in m_parts.Values)
//{
//part.SendScheduledUpdates();
//}
//return;
//foreach (SceneObjectPart part in m_parts.Values)
//{
//part.SendScheduledUpdates();
//}
//return;
//}
if (Util.GetDistanceTo(lastPhysGroupPos, AbsolutePosition) > 0.02)
{
m_rootPart.UpdateFlag = 1;
lastPhysGroupPos = AbsolutePosition;
}
//foreach (SceneObjectPart part in m_parts.Values)
//{
//if (part.UpdateFlag == 0) part.UpdateFlag = 1;
//}
//foreach (SceneObjectPart part in m_parts.Values)
//{
//if (part.UpdateFlag == 0) part.UpdateFlag = 1;
//}
checkAtTargets();
checkAtTargets();
if ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1)
|| (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1)
@ -1763,7 +1887,7 @@ namespace OpenSim.Region.Environment.Scenes
public void DelinkFromGroup(uint partID)
{
SceneObjectPart linkPart = GetChildPart(partID);
if (null != linkPart)
{
linkPart.ClearUndoState();
@ -1948,10 +2072,10 @@ namespace OpenSim.Region.Environment.Scenes
proper.ObjectData[0].FromTaskID = LLUUID.Zero;
proper.ObjectData[0].GroupID = LLUUID.Zero;
proper.ObjectData[0].InventorySerial = (short) m_rootPart.InventorySerial;
proper.ObjectData[0].LastOwnerID = m_rootPart.LastOwnerID;
// proper.ObjectData[0].LastOwnerID = LLUUID.Zero;
proper.ObjectData[0].ObjectID = UUID;
proper.ObjectData[0].OwnerID = m_rootPart.OwnerID;
proper.ObjectData[0].TouchName = Helpers.StringToField(m_rootPart.TouchName);
@ -2391,140 +2515,5 @@ namespace OpenSim.Region.Environment.Scenes
}
#endregion
internal void SetAxisRotation(int axis, int rotate10)
{
bool setX = false;
bool setY = false;
bool setZ = false;
int xaxis = 2;
int yaxis = 4;
int zaxis = 8;
if (m_rootPart != null)
{
setX = ((axis & xaxis) != 0) ? true : false;
setY = ((axis & yaxis) != 0) ? true : false;
setZ = ((axis & zaxis) != 0) ? true : false;
float setval = (rotate10 > 0) ? 1f : 0f;
if (setX)
m_rootPart.m_rotationAxis.X = setval;
if (setY)
m_rootPart.m_rotationAxis.Y = setval;
if (setZ)
m_rootPart.m_rotationAxis.Z = setval;
if (setX || setY || setZ)
{
m_rootPart.SetPhysicsAxisRotation();
}
}
}
public int registerTargetWaypoint(LLVector3 target, float tolerance)
{
scriptPosTarget waypoint = new scriptPosTarget();
waypoint.targetPos = target;
waypoint.tolerance = tolerance;
uint handle = m_scene.PrimIDAllocate();
lock (m_targets)
{
m_targets.Add(handle, waypoint);
}
return (int)handle;
}
public void unregisterTargetWaypoint(int handle)
{
lock (m_targets)
{
if (m_targets.ContainsKey((uint)handle))
m_targets.Remove((uint)handle);
}
}
private void checkAtTargets()
{
if (m_scriptListens_atTarget || m_scriptListens_notAtTarget)
{
if (m_targets.Count > 0)
{
bool at_target = false;
//LLVector3 targetPos;
//uint targetHandle;
Dictionary<uint, scriptPosTarget> atTargets = new Dictionary<uint, scriptPosTarget>();
lock (m_targets)
{
foreach (uint idx in m_targets.Keys)
{
scriptPosTarget target = m_targets[idx];
if (Util.GetDistanceTo(target.targetPos, m_rootPart.GroupPosition) <= target.tolerance)
{
// trigger at_target
if (m_scriptListens_atTarget)
{
// Reusing att.tolerance to hold the index of the target in the targets dictionary
// to avoid deadlocking the sim.
at_target = true;
scriptPosTarget att = new scriptPosTarget();
att.targetPos = target.targetPos;
att.tolerance = (float)idx;
atTargets.Add(idx, att);
}
}
}
}
if (atTargets.Count > 0)
{
uint[] localids = new uint[0];
lock (m_parts)
{
localids = new uint[m_parts.Count];
int cntr = 0;
foreach (SceneObjectPart part in m_parts.Values)
{
localids[cntr] = part.LocalId;
cntr++;
}
}
for (int ctr = 0; ctr < localids.Length; ctr++)
{
foreach (uint target in atTargets.Keys)
{
scriptPosTarget att = atTargets[target];
// Reusing att.tolerance to hold the index of the target in the targets dictionary
// to avoid deadlocking the sim.
m_scene.TriggerAtTargetEvent(localids[ctr], (uint)att.tolerance, att.targetPos, m_rootPart.GroupPosition);
}
}
return;
}
if (m_scriptListens_notAtTarget && !at_target)
{
//trigger not_at_target
uint[] localids = new uint[0];
lock (m_parts)
{
localids = new uint[m_parts.Count];
int cntr = 0;
foreach (SceneObjectPart part in m_parts.Values)
{
localids[cntr] = part.LocalId;
cntr++;
}
}
for (int ctr = 0; ctr < localids.Length; ctr++)
{
m_scene.TriggerNotAtTargetEvent(localids[ctr]);
}
}
}
}
}
}
}
}

View File

@ -41,13 +41,29 @@ namespace OpenSim.Region.Environment.Scenes
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string m_inventoryFileName = String.Empty;
private readonly string m_inventoryFileName = String.Empty;
/// <summary>
/// Tracks whether inventory has changed since the last persistent backup
/// </summary>
private bool HasInventoryChanged;
/// <summary>
/// The inventory folder for this prim
/// </summary>
private LLUUID m_folderID = LLUUID.Zero;
/// <summary>
/// Serial count for inventory file , used to tell if inventory has changed
/// no need for this to be part of Database backup
/// </summary>
protected uint m_inventorySerial;
/// <summary>
/// Holds in memory prim inventory
/// </summary>
protected TaskInventoryDictionary m_taskInventory = new TaskInventoryDictionary();
/// <summary>
/// Exposing this is not particularly good, but it's one of the least evils at the moment to see
/// folder id from prim inventory item data, since it's not (yet) actually stored with the prim.
@ -58,34 +74,18 @@ namespace OpenSim.Region.Environment.Scenes
set { m_folderID = value; }
}
/// <summary>
/// Serial count for inventory file , used to tell if inventory has changed
/// no need for this to be part of Database backup
/// </summary>
protected uint m_inventorySerial = 0;
public uint InventorySerial
{
get { return m_inventorySerial; }
set { m_inventorySerial = value; }
}
/// <summary>
/// Holds in memory prim inventory
/// </summary>
protected TaskInventoryDictionary m_taskInventory = new TaskInventoryDictionary();
public TaskInventoryDictionary TaskInventory
{
get { return m_taskInventory; }
set { m_taskInventory = value; }
}
/// <summary>
/// Tracks whether inventory has changed since the last persistent backup
/// </summary>
private bool HasInventoryChanged;
/// <summary>
/// Reset LLUUIDs for all the items in the prim's inventory. This involves either generating
/// new ones or setting existing UUIDs to the correct parent UUIDs.
@ -96,14 +96,14 @@ namespace OpenSim.Region.Environment.Scenes
public void ResetInventoryIDs()
{
lock (TaskInventory)
{
{
if (0 == TaskInventory.Count)
{
return;
return;
}
HasInventoryChanged = true;
HasInventoryChanged = true;
IList<TaskInventoryItem> items = new List<TaskInventoryItem>(TaskInventory.Values);
TaskInventory.Clear();
@ -132,9 +132,9 @@ namespace OpenSim.Region.Environment.Scenes
if (ownerId != item.OwnerID)
{
item.LastOwnerID = item.OwnerID;
item.OwnerID = ownerId;
item.BaseMask = item.NextOwnerMask & (uint)PermissionMask.All;
item.OwnerMask = item.NextOwnerMask & (uint)PermissionMask.All;
item.OwnerID = ownerId;
item.BaseMask = item.NextOwnerMask & (uint) PermissionMask.All;
item.OwnerMask = item.NextOwnerMask & (uint) PermissionMask.All;
}
}
}
@ -194,22 +194,22 @@ namespace OpenSim.Region.Environment.Scenes
AssetCache cache = m_parentGroup.Scene.AssetCache;
cache.GetAsset(item.AssetID, delegate(LLUUID assetID, AssetBase asset)
{
if (null == asset)
{
m_log.ErrorFormat(
"[PRIMINVENTORY]: " +
"Couldn't start script {0}, {1} since asset ID {2} could not be found",
item.Name, item.ItemID, item.AssetID);
}
else
{
string script = Helpers.FieldToUTF8String(asset.Data);
m_parentGroup.Scene.EventManager.TriggerRezScript(LocalId,item.ItemID,script);
m_parentGroup.AddActiveScriptCount(1);
ScheduleFullUpdate();
}
}, false);
{
if (null == asset)
{
m_log.ErrorFormat(
"[PRIMINVENTORY]: " +
"Couldn't start script {0}, {1} since asset ID {2} could not be found",
item.Name, item.ItemID, item.AssetID);
}
else
{
string script = Helpers.FieldToUTF8String(asset.Data);
m_parentGroup.Scene.EventManager.TriggerRezScript(LocalId, item.ItemID, script);
m_parentGroup.AddActiveScriptCount(1);
ScheduleFullUpdate();
}
}, false);
}
}
@ -226,7 +226,6 @@ namespace OpenSim.Region.Environment.Scenes
if (m_taskInventory.ContainsKey(itemId))
{
StartScript(m_taskInventory[itemId]);
}
else
{
@ -263,7 +262,7 @@ namespace OpenSim.Region.Environment.Scenes
{
foreach (TaskInventoryItem item in m_taskInventory.Values)
{
if(item.Name == name)
if (item.Name == name)
return true;
}
return false;
@ -271,14 +270,14 @@ namespace OpenSim.Region.Environment.Scenes
private string FindAvailableInventoryName(string name)
{
if(!InventoryContainsName(name))
if (!InventoryContainsName(name))
return name;
int suffix=1;
while(suffix < 256)
int suffix = 1;
while (suffix < 256)
{
string tryName=String.Format("{0} {1}", name, suffix);
if(!InventoryContainsName(tryName))
string tryName = String.Format("{0} {1}", name, suffix);
if (!InventoryContainsName(tryName))
return tryName;
suffix++;
}
@ -295,11 +294,11 @@ namespace OpenSim.Region.Environment.Scenes
item.CreationDate = 1000;
item.ParentPartID = UUID;
string name=FindAvailableInventoryName(item.Name);
if(name == String.Empty)
string name = FindAvailableInventoryName(item.Name);
if (name == String.Empty)
return;
item.Name=name;
item.Name = name;
lock (m_taskInventory)
{
@ -347,7 +346,7 @@ namespace OpenSim.Region.Environment.Scenes
// m_log.DebugFormat(
// "[PRIM INVENTORY]: Retrieved task inventory item {0}, {1} from prim {2}, {3}",
// m_taskInventory[itemID].Name, itemID, Name, UUID);
return m_taskInventory[itemID];
}
else
@ -428,7 +427,6 @@ namespace OpenSim.Region.Environment.Scenes
scriptcount++;
}
}
}
if (scriptcount <= 0)
{
@ -457,14 +455,14 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="client"></param>
/// <param name="localID"></param>
public bool GetInventoryFileName(IClientAPI client, uint localID)
{
{
// m_log.DebugFormat(
// "[PRIM INVENTORY]: Received request from client {0} for inventory file name of {1}, {2}",
// client.AgentId, Name, UUID);
if (m_inventorySerial > 0)
{
client.SendTaskInventory(m_uuid, (short)m_inventorySerial,
client.SendTaskInventory(m_uuid, (short) m_inventorySerial,
Helpers.StringToField(m_inventoryFileName));
return true;
}
@ -480,9 +478,9 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
/// <param name="xferManager"></param>
public void RequestInventoryFile(IXfer xferManager)
{
{
byte[] fileData = new byte[0];
// Confusingly, the folder item has to be the object id, while the 'parent id' has to be zero. This matches
// what appears to happen in the Second Life protocol. If this isn't the case. then various functionality
// isn't available (such as drag from prim inventory to agent inventory)
@ -493,53 +491,53 @@ namespace OpenSim.Region.Environment.Scenes
foreach (TaskInventoryItem item in m_taskInventory.Values)
{
invString.AddItemStart();
invString.AddNameValueLine("item_id", item.ItemID.ToString());
invString.AddNameValueLine("item_id", item.ItemID.ToString());
invString.AddNameValueLine("parent_id", m_folderID.ToString());
invString.AddPermissionsStart();
// FIXME: Temporary until permissions are properly sorted.
invString.AddNameValueLine("base_mask", "7fffffff");
invString.AddNameValueLine("owner_mask", "7fffffff");
invString.AddNameValueLine("group_mask", "7fffffff");
invString.AddNameValueLine("everyone_mask", "7fffffff");
invString.AddNameValueLine("next_owner_mask", "7fffffff");
// invString.AddNameValueLine("group_mask", "00000000");
// invString.AddNameValueLine("everyone_mask", "00000000");
// invString.AddNameValueLine("next_owner_mask", "00086000");
// invString.AddNameValueLine("base_mask", Helpers.UIntToHexString(item.BaseMask));
// invString.AddNameValueLine("owner_mask", Helpers.UIntToHexString(item.OwnerMask));
// invString.AddNameValueLine("group_mask", Helpers.UIntToHexString(item.GroupMask));
// invString.AddNameValueLine("everyone_mask", Helpers.UIntToHexString(item.EveryoneMask));
// invString.AddNameValueLine("next_owner_mask", Helpers.UIntToHexString(item.NextOwnerMask));
invString.AddNameValueLine("creator_id", item.CreatorID.ToString());
invString.AddNameValueLine("owner_id", item.OwnerID.ToString());
invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString());
// invString.AddNameValueLine("last_owner_id", item.OwnerID.ToString());
invString.AddNameValueLine("group_id", item.GroupID.ToString());
invString.AddSectionEnd();
invString.AddNameValueLine("asset_id", item.AssetID.ToString());
invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]);
invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]);
invString.AddNameValueLine("flags", "00000000");
invString.AddSaleStart();
invString.AddNameValueLine("sale_type", "not");
invString.AddNameValueLine("sale_price", "0");
invString.AddSectionEnd();
invString.AddNameValueLine("name", item.Name + "|");
invString.AddNameValueLine("desc", item.Description + "|");
invString.AddNameValueLine("creation_date", item.CreationDate.ToString());
// invString.AddNameValueLine("creation_date", "1209151453");
invString.AddSectionEnd();
}
}
@ -571,6 +569,8 @@ namespace OpenSim.Region.Environment.Scenes
}
}
#region Nested type: InventoryStringBuilder
public class InventoryStringBuilder
{
public string BuildString = String.Empty;
@ -596,13 +596,13 @@ namespace OpenSim.Region.Environment.Scenes
BuildString += "\tpermissions 0\n";
AddSectionStart();
}
public void AddSaleStart()
{
BuildString += "\tsale_info\t0\n";
AddSectionStart();
}
}
protected void AddSectionStart()
{
BuildString += "\t{\n";
@ -629,5 +629,7 @@ namespace OpenSim.Region.Environment.Scenes
{
}
}
#endregion
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -39,8 +39,8 @@ namespace OpenSim.Region.Environment.Scenes
public class SceneXmlLoader // can move to a module?
{
protected InnerScene m_innerScene;
protected RegionInfo m_regInfo;
protected Scene m_parentScene;
protected RegionInfo m_regInfo;
public SceneXmlLoader(Scene parentScene, InnerScene innerScene, RegionInfo regionInfo)
{
@ -136,14 +136,13 @@ namespace OpenSim.Region.Environment.Scenes
returnstring += grp.ToXmlString2();
returnstring += "</scene>\n";
return returnstring;
}
public void LoadGroupFromXml2String(string xmlString)
{
XmlDocument doc = new XmlDocument();
XmlNode rootNode;
XmlTextReader reader = new XmlTextReader(new StringReader(xmlString));
reader.WhitespaceHandling = WhitespaceHandling.None;
doc.Load(reader);
@ -153,7 +152,6 @@ namespace OpenSim.Region.Environment.Scenes
{
CreatePrimFromXml(aPrimNode.OuterXml);
}
}
public void LoadPrimsFromXml2(string fileName)
@ -206,7 +204,7 @@ namespace OpenSim.Region.Environment.Scenes
rootPart.PhysActor.LocalID = rootPart.LocalId;
rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
}
rootPart.Velocity = receivedVelocity;
rootPart.Velocity = receivedVelocity;
}
obj.ScheduleGroupForFullUpdate();
@ -234,4 +232,4 @@ namespace OpenSim.Region.Environment.Scenes
file.Close();
}
}
}
}

View File

@ -44,4 +44,4 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
string TouchName { get; set; }
void SetText(string text, Vector3 color, double alpha);
}
}
}

View File

@ -33,7 +33,9 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
{
public class NullScriptHost : IScriptHost
{
private LLVector3 m_pos = new LLVector3(128, 128, 30);
private readonly LLVector3 m_pos = new LLVector3(128, 128, 30);
#region IScriptHost Members
public string Name
{
@ -83,5 +85,7 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
{
Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text);
}
#endregion
}
}
}

View File

@ -35,4 +35,4 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
void Shutdown();
// void StartScript(string ScriptID, IScriptHost ObjectID);
}
}
}

View File

@ -51,7 +51,7 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
{
m_log.Error("[ScriptEngine]: " +
"Error loading assembly \"" + EngineName + "\": " + e.Message + ", " +
e.StackTrace.ToString());
e.StackTrace);
}
return ret;
}
@ -116,4 +116,4 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
return ret;
}
}
}
}

View File

@ -34,105 +34,68 @@ namespace OpenSim.Region.Environment.Scenes
{
public class SimStatsReporter
{
#region Delegates
public delegate void SendStatResult(SimStatsPacket pack);
public event SendStatResult OnSendStatsResult;
#endregion
private SendStatResult handlerSendStatResult = null;
private readonly Timer m_report = new Timer();
private readonly SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
private readonly RegionInfo ReportingRegion;
private readonly SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[21];
private readonly SimStatsPacket statpack = (SimStatsPacket) PacketPool.Instance.GetPacket(PacketType.SimStats);
private enum Stats : uint
{
TimeDilation = 0,
SimFPS = 1,
PhysicsFPS = 2,
AgentUpdates = 3,
FrameMS = 4,
NetMS = 5,
OtherMS = 6,
PhysicsMS = 7,
AgentMS = 8,
ImageMS = 9,
ScriptMS = 10,
TotalPrim = 11,
ActivePrim = 12,
Agents = 13,
ChildAgents = 14,
ActiveScripts = 15,
ScriptLinesPerSecond = 16,
InPacketsPerSecond = 17,
OutPacketsPerSecond = 18,
PendingDownloads = 19,
PendingUploads = 20,
UnAckedBytes = 24,
private SendStatResult handlerSendStatResult;
private int m_activePrim;
private int m_activeScripts;
private int m_agentMS;
// Havok4 related... May or may not be in upcoming LLclients
// (kelly added them sometime late in January 2008)
NumRCCSLODReduced = 25,
NumRCCSFixed = 26
}
private int m_agentUpdates;
private int m_childAgents;
private int m_fps;
// Sending a stats update every 3 seconds
private int statsUpdatesEveryMS = 3000;
private float statsUpdateFactor = 0;
private float m_timeDilation = 0;
private int m_fps = 0;
private float m_pfps = 0;
private int m_agentUpdates = 0;
private int m_frameMS = 0;
private int m_netMS = 0;
private int m_agentMS = 0;
private int m_physicsMS = 0;
private int m_imageMS = 0;
private int m_otherMS = 0;
//Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed.
//Ckrinke private int m_scriptMS = 0;
private int m_rootAgents = 0;
private int m_childAgents = 0;
private int m_numPrim = 0;
private int m_inPacketsPerSecond = 0;
private int m_outPacketsPerSecond = 0;
private int m_activePrim = 0;
private int m_unAckedBytes = 0;
private int m_pendingDownloads = 0;
private int m_pendingUploads = 0;
private int m_activeScripts = 0;
private int m_scriptLinesPerSecond = 0;
private int m_frameMS;
private int m_imageMS;
private int m_inPacketsPerSecond;
private int m_netMS;
private int m_numPrim;
private int m_otherMS;
private int m_outPacketsPerSecond;
private int m_pendingDownloads;
private int m_pendingUploads;
private float m_pfps;
private int m_physicsMS;
private int m_rootAgents;
private int m_scriptLinesPerSecond;
private float m_timeDilation;
private int m_unAckedBytes;
private int objectCapacity = 45000;
SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[21];
SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
SimStatsPacket statpack = (SimStatsPacket)PacketPool.Instance.GetPacket(PacketType.SimStats);
private RegionInfo ReportingRegion;
private Timer m_report = new Timer();
private float statsUpdateFactor;
private int statsUpdatesEveryMS = 3000;
public SimStatsReporter(RegionInfo regionData)
{
statsUpdateFactor = (float)(statsUpdatesEveryMS / 1000);
statsUpdateFactor = (statsUpdatesEveryMS / 1000);
ReportingRegion = regionData;
for (int i = 0; i<21;i++)
for (int i = 0; i < 21; i++)
{
sb[i] = new SimStatsPacket.StatBlock();
}
m_report.AutoReset = true;
m_report.Interval = statsUpdatesEveryMS;
m_report.Elapsed += new ElapsedEventHandler(statsHeartBeat);
m_report.Elapsed += statsHeartBeat;
m_report.Enabled = true;
}
public event SendStatResult OnSendStatsResult;
public void SetUpdateMS(int ms)
{
statsUpdatesEveryMS = ms;
statsUpdateFactor = (float)(statsUpdatesEveryMS / 1000);
statsUpdateFactor = (statsUpdatesEveryMS / 1000);
m_report.Interval = statsUpdatesEveryMS;
}
@ -143,8 +106,8 @@ namespace OpenSim.Region.Environment.Scenes
lock (m_report)
{
// Packet is already initialized and ready for data insert
statpack.Region = rb;
statpack.Region.RegionX = ReportingRegion.RegionLocX;
statpack.Region.RegionY = ReportingRegion.RegionLocY;
@ -154,102 +117,102 @@ namespace OpenSim.Region.Environment.Scenes
}
catch (Exception)
{
statpack.Region.RegionFlags = (uint) 0;
statpack.Region.RegionFlags = 0;
}
statpack.Region.ObjectCapacity = (uint) objectCapacity;
#region various statistic googly moogly
#region various statistic googly moogly
// Our FPS is actually 10fps, so multiplying by 5 to get the amount that people expect there
// 0-50 is pretty close to 0-45
float simfps = (int) ((m_fps * 5));
float simfps = ((m_fps * 5));
//if (simfps > 45)
//simfps = simfps - (simfps - 45);
//if (simfps < 0)
//simfps = 0;
//
float physfps = ((m_pfps / 1000));
//if (physfps > 600)
//physfps = physfps - (physfps - 600);
if (physfps < 0)
physfps = 0;
#endregion
#endregion
//Our time dilation is 0.91 when we're running a full speed,
// therefore to make sure we get an appropriate range,
// we have to factor in our error. (0.10f * statsUpdateFactor)
// multiplies the fix for the error times the amount of times it'll occur a second
// / 10 divides the value by the number of times the sim heartbeat runs (10fps)
// Then we divide the whole amount by the amount of seconds pass in between stats updates.
sb[0].StatID = (uint) Stats.TimeDilation;
sb[0].StatValue = m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor));
sb[0].StatValue = m_timeDilation; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor));
sb[1].StatID = (uint) Stats.SimFPS;
sb[1].StatValue = simfps/statsUpdateFactor;
sb[1].StatValue = simfps / statsUpdateFactor;
sb[2].StatID = (uint) Stats.PhysicsFPS;
sb[2].StatValue = physfps / statsUpdateFactor;
sb[3].StatID = (uint) Stats.AgentUpdates;
sb[3].StatValue = (m_agentUpdates / statsUpdateFactor);
sb[4].StatID = (uint) Stats.Agents;
sb[4].StatValue = m_rootAgents;
sb[5].StatID = (uint) Stats.ChildAgents;
sb[5].StatValue = m_childAgents;
sb[6].StatID = (uint) Stats.TotalPrim;
sb[6].StatValue = m_numPrim;
sb[7].StatID = (uint) Stats.ActivePrim;
sb[7].StatValue = m_activePrim;
sb[8].StatID = (uint)Stats.FrameMS;
sb[8].StatID = (uint) Stats.FrameMS;
sb[8].StatValue = m_frameMS / statsUpdateFactor;
sb[9].StatID = (uint)Stats.NetMS;
sb[9].StatID = (uint) Stats.NetMS;
sb[9].StatValue = m_netMS / statsUpdateFactor;
sb[10].StatID = (uint)Stats.PhysicsMS;
sb[10].StatID = (uint) Stats.PhysicsMS;
sb[10].StatValue = m_physicsMS / statsUpdateFactor;
sb[11].StatID = (uint)Stats.ImageMS ;
sb[11].StatID = (uint) Stats.ImageMS;
sb[11].StatValue = m_imageMS / statsUpdateFactor;
sb[12].StatID = (uint)Stats.OtherMS;
sb[12].StatID = (uint) Stats.OtherMS;
sb[12].StatValue = m_otherMS / statsUpdateFactor;
sb[13].StatID = (uint)Stats.InPacketsPerSecond;
sb[13].StatID = (uint) Stats.InPacketsPerSecond;
sb[13].StatValue = (m_inPacketsPerSecond);
sb[14].StatID = (uint)Stats.OutPacketsPerSecond;
sb[14].StatID = (uint) Stats.OutPacketsPerSecond;
sb[14].StatValue = (m_outPacketsPerSecond / statsUpdateFactor);
sb[15].StatID = (uint)Stats.UnAckedBytes;
sb[15].StatID = (uint) Stats.UnAckedBytes;
sb[15].StatValue = m_unAckedBytes;
sb[16].StatID = (uint)Stats.AgentMS;
sb[16].StatID = (uint) Stats.AgentMS;
sb[16].StatValue = m_agentMS / statsUpdateFactor;
sb[17].StatID = (uint)Stats.PendingDownloads;
sb[17].StatID = (uint) Stats.PendingDownloads;
sb[17].StatValue = m_pendingDownloads;
sb[18].StatID = (uint)Stats.PendingUploads;
sb[18].StatID = (uint) Stats.PendingUploads;
sb[18].StatValue = m_pendingUploads;
sb[19].StatID = (uint)Stats.ActiveScripts;
sb[19].StatID = (uint) Stats.ActiveScripts;
sb[19].StatValue = m_activeScripts;
sb[20].StatID = (uint)Stats.ScriptLinesPerSecond;
sb[20].StatID = (uint) Stats.ScriptLinesPerSecond;
sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor;
statpack.Stat = sb;
handlerSendStatResult = OnSendStatsResult;
@ -260,7 +223,7 @@ namespace OpenSim.Region.Environment.Scenes
resetvalues();
}
}
private void resetvalues()
{
m_timeDilation = 0;
@ -284,6 +247,7 @@ namespace OpenSim.Region.Environment.Scenes
}
# region methods called from Scene
// The majority of these functions are additive
// so that you can easily change the amount of
// seconds in between sim stats updates
@ -292,10 +256,10 @@ namespace OpenSim.Region.Environment.Scenes
{
//float tdsetting = td;
//if (tdsetting > 1.0f)
//tdsetting = (tdsetting - (tdsetting - 0.91f));
//tdsetting = (tdsetting - (tdsetting - 0.91f));
//if (tdsetting < 0)
//tdsetting = 0.0f;
//tdsetting = 0.0f;
m_timeDilation = td;
}
@ -353,30 +317,35 @@ namespace OpenSim.Region.Environment.Scenes
{
m_frameMS += ms;
}
public void addNetMS(int ms)
{
m_netMS += ms;
}
public void addAgentMS(int ms)
{
m_agentMS += ms;
}
public void addPhysicsMS(int ms)
{
m_physicsMS += ms;
}
public void addImageMS(int ms)
{
m_imageMS += ms;
}
public void addOtherMS(int ms)
{
m_otherMS += ms;
}
// private static readonly log4net.ILog m_log
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public void addPendingDownload(int count)
{
m_pendingDownloads += count;
@ -399,5 +368,40 @@ namespace OpenSim.Region.Environment.Scenes
}
#endregion
#region Nested type: Stats
private enum Stats : uint
{
TimeDilation = 0,
SimFPS = 1,
PhysicsFPS = 2,
AgentUpdates = 3,
FrameMS = 4,
NetMS = 5,
OtherMS = 6,
PhysicsMS = 7,
AgentMS = 8,
ImageMS = 9,
ScriptMS = 10,
TotalPrim = 11,
ActivePrim = 12,
Agents = 13,
ChildAgents = 14,
ActiveScripts = 15,
ScriptLinesPerSecond = 16,
InPacketsPerSecond = 17,
OutPacketsPerSecond = 18,
PendingDownloads = 19,
PendingUploads = 20,
UnAckedBytes = 24,
// Havok4 related... May or may not be in upcoming LLclients
// (kelly added them sometime late in January 2008)
NumRCCSLODReduced = 25,
NumRCCSFixed = 26
}
#endregion
}
}
}

View File

@ -32,8 +32,8 @@ namespace OpenSim.Region.Environment.Scenes
public class UndoState
{
public LLVector3 Position = LLVector3.Zero;
public LLVector3 Scale = LLVector3.Zero;
public LLQuaternion Rotation = LLQuaternion.Identity;
public LLVector3 Scale = LLVector3.Zero;
public UndoState(LLVector3 pos, LLQuaternion rot, LLVector3 scale)
{
@ -41,7 +41,7 @@ namespace OpenSim.Region.Environment.Scenes
Rotation = rot;
Scale = scale;
}
public UndoState(SceneObjectPart part)
{
if (part != null)
@ -50,18 +50,20 @@ namespace OpenSim.Region.Environment.Scenes
{
Position = part.AbsolutePosition;
Rotation = part.RotationOffset;
}
else
{
Position = part.GroupPosition;
Rotation = part.RotationOffset;
Scale = part.Shape.Scale;
}
}
}
public UndoState()
{
}
public bool Compare(SceneObjectPart part)
{
if (part != null)
@ -79,7 +81,6 @@ namespace OpenSim.Region.Environment.Scenes
return true;
else
return false;
}
}
return false;
@ -90,7 +91,7 @@ namespace OpenSim.Region.Environment.Scenes
if (part != null)
{
part.m_undoing = true;
if (part.ParentID == 0)
{
part.ParentGroup.AbsolutePosition = Position;
@ -105,12 +106,7 @@ namespace OpenSim.Region.Environment.Scenes
part.ScheduleTerseUpdate();
}
part.m_undoing = false;
}
}
public UndoState()
{
}
}
}
}

View File

@ -36,12 +36,7 @@ namespace OpenSim.Region.Environment
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IRegionDataStore m_dataStore;
public IRegionDataStore DataStore
{
get { return m_dataStore; }
}
private readonly IRegionDataStore m_dataStore;
public StorageManager(IRegionDataStore storage)
{
@ -74,5 +69,10 @@ namespace OpenSim.Region.Environment
//TODO: Add checking and warning to make sure it initialised.
}
public IRegionDataStore DataStore
{
get { return m_dataStore; }
}
}
}
}

View File

@ -33,16 +33,15 @@ namespace OpenSim.Region.Environment.Types
{
public class BasicQuadTreeNode
{
private List<SceneObjectGroup> m_objects = new List<SceneObjectGroup>();
private BasicQuadTreeNode[] m_childNodes = null;
private BasicQuadTreeNode m_parent = null;
private short m_leftX;
private short m_leftY;
private short m_width;
private short m_height;
private readonly short m_height;
private readonly short m_leftX;
private readonly short m_leftY;
private readonly List<SceneObjectGroup> m_objects = new List<SceneObjectGroup>();
private readonly BasicQuadTreeNode m_parent;
//private int m_quadNumber;
private string m_quadID;
private readonly string m_quadID;
private readonly short m_width;
private BasicQuadTreeNode[] m_childNodes;
public BasicQuadTreeNode(BasicQuadTreeNode parent, string quadID, short leftX, short leftY, short width,
short height)
@ -67,9 +66,9 @@ namespace OpenSim.Region.Environment.Types
}
else
{
if (obj.AbsolutePosition.X < (m_leftX + (m_width/2)))
if (obj.AbsolutePosition.X < (m_leftX + (m_width / 2)))
{
if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2)))
if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2)))
{
m_childNodes[0].AddObject(obj);
}
@ -80,7 +79,7 @@ namespace OpenSim.Region.Environment.Types
}
else
{
if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2)))
if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2)))
{
m_childNodes[1].AddObject(obj);
}
@ -98,17 +97,17 @@ namespace OpenSim.Region.Environment.Types
{
m_childNodes = new BasicQuadTreeNode[4];
m_childNodes[0] =
new BasicQuadTreeNode(this, m_quadID + "1/", m_leftX, m_leftY, (short) (m_width/2),
(short) (m_height/2));
new BasicQuadTreeNode(this, m_quadID + "1/", m_leftX, m_leftY, (short) (m_width / 2),
(short) (m_height / 2));
m_childNodes[1] =
new BasicQuadTreeNode(this, m_quadID + "2/", (short) (m_leftX + (m_width/2)), m_leftY,
(short) (m_width/2), (short) (m_height/2));
new BasicQuadTreeNode(this, m_quadID + "2/", (short) (m_leftX + (m_width / 2)), m_leftY,
(short) (m_width / 2), (short) (m_height / 2));
m_childNodes[2] =
new BasicQuadTreeNode(this, m_quadID + "3/", m_leftX, (short) (m_leftY + (m_height/2)),
(short) (m_width/2), (short) (m_height/2));
new BasicQuadTreeNode(this, m_quadID + "3/", m_leftX, (short) (m_leftY + (m_height / 2)),
(short) (m_width / 2), (short) (m_height / 2));
m_childNodes[3] =
new BasicQuadTreeNode(this, m_quadID + "4/", (short) (m_leftX + (m_width/2)),
(short) (m_height + (m_height/2)), (short) (m_width/2), (short) (m_height/2));
new BasicQuadTreeNode(this, m_quadID + "4/", (short) (m_leftX + (m_width / 2)),
(short) (m_height + (m_height / 2)), (short) (m_width / 2), (short) (m_height / 2));
}
else
{
@ -127,9 +126,9 @@ namespace OpenSim.Region.Environment.Types
}
else
{
if (x < m_leftX + (m_width/2))
if (x < m_leftX + (m_width / 2))
{
if (y < m_leftY + (m_height/2))
if (y < m_leftY + (m_height / 2))
{
return m_childNodes[0].GetObjectsFrom(x, y);
}
@ -140,7 +139,7 @@ namespace OpenSim.Region.Environment.Types
}
else
{
if (y < m_leftY + (m_height/2))
if (y < m_leftY + (m_height / 2))
{
return m_childNodes[1].GetObjectsFrom(x, y);
}
@ -181,9 +180,9 @@ namespace OpenSim.Region.Environment.Types
}
else
{
if (x < m_leftX + (m_width/2))
if (x < m_leftX + (m_width / 2))
{
if (y < m_leftY + (m_height/2))
if (y < m_leftY + (m_height / 2))
{
return m_childNodes[0].GetNodeID(x, y);
}
@ -194,7 +193,7 @@ namespace OpenSim.Region.Environment.Types
}
else
{
if (y < m_leftY + (m_height/2))
if (y < m_leftY + (m_height / 2))
{
return m_childNodes[1].GetNodeID(x, y);
}
@ -266,4 +265,4 @@ namespace OpenSim.Region.Environment.Types
return retVal;
}
}
}
}

View File

@ -34,19 +34,13 @@ using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Types
{
[Serializable]
public class UpdateQueue : ISerializable
[Serializable]
public class UpdateQueue : ISerializable
{
private Queue<SceneObjectPart> m_queue;
private readonly List<LLUUID> m_ids;
private readonly Queue<SceneObjectPart> m_queue;
private List<LLUUID> m_ids;
private object m_syncObject = new object();
public int Count
{
get { return m_queue.Count; }
}
private readonly object m_syncObject = new object();
public UpdateQueue()
{
@ -54,6 +48,56 @@ namespace OpenSim.Region.Environment.Types
m_ids = new List<LLUUID>();
}
protected UpdateQueue(SerializationInfo info, StreamingContext context)
{
//System.Console.WriteLine("UpdateQueue Deserialize BGN");
if (info == null)
{
throw new ArgumentNullException("info");
}
m_queue = (Queue<SceneObjectPart>) info.GetValue("m_queue", typeof (Queue<SceneObjectPart>));
List<Guid> ids_work = (List<Guid>) info.GetValue("m_ids", typeof (List<Guid>));
foreach (Guid guid in ids_work)
{
m_ids.Add(new LLUUID(guid));
}
//System.Console.WriteLine("UpdateQueue Deserialize END");
}
public int Count
{
get { return m_queue.Count; }
}
#region ISerializable Members
[SecurityPermission(SecurityAction.LinkDemand,
Flags = SecurityPermissionFlag.SerializationFormatter)]
public virtual void GetObjectData(
SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}
List<Guid> ids_work = new List<Guid>();
foreach (LLUUID uuid in m_ids)
{
ids_work.Add(uuid.UUID);
}
info.AddValue("m_queue", m_queue);
info.AddValue("m_ids", ids_work);
}
#endregion
public void Clear()
{
lock (m_syncObject)
@ -89,46 +133,5 @@ namespace OpenSim.Region.Environment.Types
return part;
}
protected UpdateQueue(SerializationInfo info, StreamingContext context)
{
//System.Console.WriteLine("UpdateQueue Deserialize BGN");
if (info == null)
{
throw new ArgumentNullException("info");
}
m_queue = (Queue<SceneObjectPart>)info.GetValue("m_queue", typeof(Queue<SceneObjectPart>));
List<Guid> ids_work = (List<Guid>)info.GetValue("m_ids", typeof(List<Guid>));
foreach (Guid guid in ids_work)
{
m_ids.Add(new LLUUID(guid));
}
//System.Console.WriteLine("UpdateQueue Deserialize END");
}
[SecurityPermission(SecurityAction.LinkDemand,
Flags = SecurityPermissionFlag.SerializationFormatter)]
public virtual void GetObjectData(
SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}
List<Guid> ids_work = new List<Guid>();
foreach (LLUUID uuid in m_ids)
{
ids_work.Add(uuid.UUID);
}
info.AddValue("m_queue", m_queue);
info.AddValue("m_ids", ids_work);
}
}
}
}