From 101369e25ad4e72233e4855be4b82d1647233a6c Mon Sep 17 00:00:00 2001
From: lbsa71
Date: Thu, 20 Sep 2007 23:28:08 +0000
Subject: * Some more presence refactoring
---
.../Region/Environment/Scenes/Scene.Inventory.cs | 825 +++++++++++----------
.../Environment/Scenes/Scene.PacketHandlers.cs | 8 +-
OpenSim/Region/Environment/Scenes/Scene.cs | 99 ++-
.../Region/Environment/Scenes/SceneObjectGroup.cs | 2 +-
OpenSim/Region/Environment/Scenes/ScenePresence.cs | 4 +-
5 files changed, 469 insertions(+), 469 deletions(-)
(limited to 'OpenSim/Region/Environment')
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 048d2b4..a6e47f3 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -8,428 +8,433 @@ using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities;
using OpenSim.Region.Physics.Manager;
-namespace OpenSim.Region.Environment.Scenes
-{
- public partial class Scene
- {
- //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete
- // or at least some of they can be moved somewhere else
-
- public void AddInventoryItem(LLUUID userID, InventoryItemBase item)
- {
- if (Avatars.ContainsKey(userID))
- {
- AddInventoryItem(Avatars[userID].ControllingClient, item);
- }
- }
-
- public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
- {
- CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
- if (userInfo != null)
- {
- userInfo.AddItem(remoteClient.AgentId, item);
- remoteClient.SendInventoryItemUpdate(item);
- }
- }
-
- public LLUUID CapsUpdateInventoryItemAsset(LLUUID userID, LLUUID itemID, byte[] data)
- {
- if (Avatars.ContainsKey(userID))
- {
- return CapsUpdateInventoryItemAsset(Avatars[userID].ControllingClient, itemID, data);
- }
- return LLUUID.Zero;
- }
-
- public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data)
- {
- CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
- if (userInfo != null)
- {
- if (userInfo.RootFolder != null)
- {
- InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
- if (item != null)
- {
- AssetBase asset;
- asset = new AssetBase();
- asset.FullID = LLUUID.Random();
- asset.Type = (sbyte) item.assetType;
- asset.InvType = (sbyte) item.invType;
- asset.Name = item.inventoryName;
- asset.Data = data;
- commsManager.AssetCache.AddAsset(asset);
-
- item.assetID = asset.FullID;
- userInfo.UpdateItem(remoteClient.AgentId, item);
-
- // remoteClient.SendInventoryItemUpdate(item);
- if (item.invType == 7)
- {
- //do we want to know about updated note cards?
- }
- else if (item.invType == 10)
- {
- // do we want to know about updated scripts
- }
-
- return (asset.FullID);
- }
- }
- }
- return LLUUID.Zero;
- }
-
+namespace OpenSim.Region.Environment.Scenes
+{
+ public partial class Scene
+ {
+ //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete
+ // or at least some of they can be moved somewhere else
+
+ public void AddInventoryItem(LLUUID avatarId, InventoryItemBase item)
+ {
+ ScenePresence avatar;
+
+ if ( TryGetAvatar( avatarId, out avatar ))
+ {
+ AddInventoryItem(avatar.ControllingClient, item);
+ }
+ }
+
+ public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
+ {
+ CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
+ if (userInfo != null)
+ {
+ userInfo.AddItem(remoteClient.AgentId, item);
+ remoteClient.SendInventoryItemUpdate(item);
+ }
+ }
+
+ public LLUUID CapsUpdateInventoryItemAsset(LLUUID avatarId, LLUUID itemID, byte[] data)
+ {
+ ScenePresence avatar;
+
+ if (TryGetAvatar(avatarId, out avatar))
+ {
+ return CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data);
+ }
+
+ return LLUUID.Zero;
+ }
+
+ public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data)
+ {
+ CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
+ if (userInfo != null)
+ {
+ if (userInfo.RootFolder != null)
+ {
+ InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
+ if (item != null)
+ {
+ AssetBase asset;
+ asset = new AssetBase();
+ asset.FullID = LLUUID.Random();
+ asset.Type = (sbyte) item.assetType;
+ asset.InvType = (sbyte) item.invType;
+ asset.Name = item.inventoryName;
+ asset.Data = data;
+ commsManager.AssetCache.AddAsset(asset);
+
+ item.assetID = asset.FullID;
+ userInfo.UpdateItem(remoteClient.AgentId, item);
+
+ // remoteClient.SendInventoryItemUpdate(item);
+ if (item.invType == 7)
+ {
+ //do we want to know about updated note cards?
+ }
+ else if (item.invType == 10)
+ {
+ // do we want to know about updated scripts
+ }
+
+ return (asset.FullID);
+ }
+ }
+ }
+ return LLUUID.Zero;
+ }
+
public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID,
- LLUUID itemID)
- {
- CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
- if (userInfo != null)
- {
- if (userInfo.RootFolder != null)
- {
- InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
- if (item != null)
- {
+ LLUUID itemID)
+ {
+ CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
+ if (userInfo != null)
+ {
+ if (userInfo.RootFolder != null)
+ {
+ InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
+ if (item != null)
+ {
AgentAssetTransactions transactions =
- commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId);
- if (transactions != null)
- {
- AssetBase asset = null;
- bool addToCache = false;
-
- asset = commsManager.AssetCache.GetAsset(assetID);
- if (asset == null)
- {
- asset = transactions.GetTransactionAsset(transactionID);
- addToCache = true;
- }
-
- if (asset != null)
- {
- if (asset.FullID == assetID)
- {
- asset.Name = item.inventoryName;
- asset.Description = item.inventoryDescription;
- asset.InvType = (sbyte) item.invType;
- asset.Type = (sbyte) item.assetType;
- item.assetID = asset.FullID;
-
- if (addToCache)
- {
- commsManager.AssetCache.AddAsset(asset);
- }
-
- userInfo.UpdateItem(remoteClient.AgentId, item);
- }
- }
- }
- }
- }
- }
- }
-
- ///
- /// temporary method to test out creating new inventory items
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
+ commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId);
+ if (transactions != null)
+ {
+ AssetBase asset = null;
+ bool addToCache = false;
+
+ asset = commsManager.AssetCache.GetAsset(assetID);
+ if (asset == null)
+ {
+ asset = transactions.GetTransactionAsset(transactionID);
+ addToCache = true;
+ }
+
+ if (asset != null)
+ {
+ if (asset.FullID == assetID)
+ {
+ asset.Name = item.inventoryName;
+ asset.Description = item.inventoryDescription;
+ asset.InvType = (sbyte) item.invType;
+ asset.Type = (sbyte) item.assetType;
+ item.assetID = asset.FullID;
+
+ if (addToCache)
+ {
+ commsManager.AssetCache.AddAsset(asset);
+ }
+
+ userInfo.UpdateItem(remoteClient.AgentId, item);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ ///
+ /// temporary method to test out creating new inventory items
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID,
uint callbackID, string description, string name, sbyte invType, sbyte type,
- byte wearableType, uint nextOwnerMask)
- {
- if (transActionID == LLUUID.Zero)
- {
- CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
- if (userInfo != null)
- {
- AssetBase asset = new AssetBase();
- asset.Name = name;
- asset.Description = description;
- asset.InvType = invType;
- asset.Type = type;
- asset.FullID = LLUUID.Random();
- asset.Data = new byte[1];
- commsManager.AssetCache.AddAsset(asset);
-
- InventoryItemBase item = new InventoryItemBase();
- item.avatarID = remoteClient.AgentId;
- item.creatorsID = remoteClient.AgentId;
- item.inventoryID = LLUUID.Random();
- item.assetID = asset.FullID;
- item.inventoryDescription = description;
- item.inventoryName = name;
- item.assetType = invType;
- item.invType = invType;
- item.parentFolderID = folderID;
- item.inventoryCurrentPermissions = 2147483647;
- item.inventoryNextPermissions = nextOwnerMask;
-
- userInfo.AddItem(remoteClient.AgentId, item);
- remoteClient.SendInventoryItemUpdate(item);
- }
- }
- else
- {
+ byte wearableType, uint nextOwnerMask)
+ {
+ if (transActionID == LLUUID.Zero)
+ {
+ CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
+ if (userInfo != null)
+ {
+ AssetBase asset = new AssetBase();
+ asset.Name = name;
+ asset.Description = description;
+ asset.InvType = invType;
+ asset.Type = type;
+ asset.FullID = LLUUID.Random();
+ asset.Data = new byte[1];
+ commsManager.AssetCache.AddAsset(asset);
+
+ InventoryItemBase item = new InventoryItemBase();
+ item.avatarID = remoteClient.AgentId;
+ item.creatorsID = remoteClient.AgentId;
+ item.inventoryID = LLUUID.Random();
+ item.assetID = asset.FullID;
+ item.inventoryDescription = description;
+ item.inventoryName = name;
+ item.assetType = invType;
+ item.invType = invType;
+ item.parentFolderID = folderID;
+ item.inventoryCurrentPermissions = 2147483647;
+ item.inventoryNextPermissions = nextOwnerMask;
+
+ userInfo.AddItem(remoteClient.AgentId, item);
+ remoteClient.SendInventoryItemUpdate(item);
+ }
+ }
+ else
+ {
commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID,
callbackID, description, name, invType,
- type, wearableType, nextOwnerMask);
- //System.Console.WriteLine("request to create inventory item from transaction " + transActionID);
- }
- }
-
- ///
- ///
- ///
- ///
- ///
- public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID)
- {
- bool hasPrim = false;
- foreach (EntityBase ent in Entities.Values)
- {
- if (ent is SceneObjectGroup)
- {
- hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
- if (hasPrim != false)
- {
- bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID);
- if (fileChange)
- {
- if (XferManager != null)
- {
- ((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager);
- }
- }
- break;
- }
- }
- }
- }
-
- public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID)
- {
- bool hasPrim = false;
- foreach (EntityBase ent in Entities.Values)
- {
- if (ent is SceneObjectGroup)
- {
- hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
- if (hasPrim != false)
- {
- int type = ((SceneObjectGroup) ent).RemoveInventoryItem(remoteClient, localID, itemID);
- ((SceneObjectGroup) ent).GetProperites(remoteClient);
- if (type == 10)
- {
- EventManager.TriggerRemoveScript(localID, itemID);
- }
- }
- }
- }
- }
-
- public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID)
- {
- CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
- LLUUID copyID = LLUUID.Random();
- if (userInfo != null)
- {
- if (userInfo.RootFolder != null)
- {
- InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
- if (item != null)
- {
- bool isTexture = false;
- bool rezzed = false;
- if (item.invType == 0)
- {
- isTexture = true;
- }
- AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture);
- if (rezAsset != null)
- {
- string script = Util.FieldToString(rezAsset.Data);
- //Console.WriteLine("rez script "+script);
- EventManager.TriggerRezScript(localID, copyID, script);
- rezzed = true;
- }
- else
- {
- //lets try once more incase the asset cache is being slow getting the asset from server
- rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture);
- if (rezAsset != null)
- {
- string script = Util.FieldToString(rezAsset.Data);
- // Console.WriteLine("rez script " + script);
- EventManager.TriggerRezScript(localID, copyID, script);
- rezzed = true;
- }
- }
-
- if (rezzed)
- {
- bool hasPrim = false;
- foreach (EntityBase ent in Entities.Values)
- {
- if (ent is SceneObjectGroup)
- {
- hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
- if (hasPrim != false)
+ type, wearableType, nextOwnerMask);
+ //System.Console.WriteLine("request to create inventory item from transaction " + transActionID);
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID)
+ {
+ bool hasPrim = false;
+ foreach (EntityBase ent in Entities.Values)
+ {
+ if (ent is SceneObjectGroup)
+ {
+ hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
+ if (hasPrim != false)
+ {
+ bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID);
+ if (fileChange)
+ {
+ if (XferManager != null)
+ {
+ ((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager);
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID)
+ {
+ bool hasPrim = false;
+ foreach (EntityBase ent in Entities.Values)
+ {
+ if (ent is SceneObjectGroup)
+ {
+ hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
+ if (hasPrim != false)
+ {
+ int type = ((SceneObjectGroup) ent).RemoveInventoryItem(remoteClient, localID, itemID);
+ ((SceneObjectGroup) ent).GetProperites(remoteClient);
+ if (type == 10)
+ {
+ EventManager.TriggerRemoveScript(localID, itemID);
+ }
+ }
+ }
+ }
+ }
+
+ public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID)
+ {
+ CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
+ LLUUID copyID = LLUUID.Random();
+ if (userInfo != null)
+ {
+ if (userInfo.RootFolder != null)
+ {
+ InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
+ if (item != null)
+ {
+ bool isTexture = false;
+ bool rezzed = false;
+ if (item.invType == 0)
+ {
+ isTexture = true;
+ }
+ AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture);
+ if (rezAsset != null)
+ {
+ string script = Util.FieldToString(rezAsset.Data);
+ //Console.WriteLine("rez script "+script);
+ EventManager.TriggerRezScript(localID, copyID, script);
+ rezzed = true;
+ }
+ else
+ {
+ //lets try once more incase the asset cache is being slow getting the asset from server
+ rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture);
+ if (rezAsset != null)
+ {
+ string script = Util.FieldToString(rezAsset.Data);
+ // Console.WriteLine("rez script " + script);
+ EventManager.TriggerRezScript(localID, copyID, script);
+ rezzed = true;
+ }
+ }
+
+ if (rezzed)
+ {
+ bool hasPrim = false;
+ foreach (EntityBase ent in Entities.Values)
+ {
+ if (ent is SceneObjectGroup)
+ {
+ hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
+ if (hasPrim != false)
{
bool added =
((SceneObjectGroup) ent).AddInventoryItem(remoteClient, localID, item,
- copyID);
- ((SceneObjectGroup) ent).GetProperites(remoteClient);
- }
- }
- }
- }
- }
- }
- }
- }
-
- ///
- ///
- ///
- ///
- ///
- public void DeRezObject(Packet packet, IClientAPI remoteClient)
- {
- DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet;
-
- if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
- {
- //currently following code not used (or don't know of any case of destination being zero
- }
- else
- {
- foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData)
- {
- EntityBase selectedEnt = null;
- //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
- foreach (EntityBase ent in Entities.Values)
- {
- if (ent.LocalId == Data.ObjectLocalID)
- {
- selectedEnt = ent;
- break;
- }
- }
- if (selectedEnt != null)
- {
- if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID))
- {
- string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString();
- CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
- if (userInfo != null)
- {
- AssetBase asset = new AssetBase();
- asset.Name = ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId);
+ copyID);
+ ((SceneObjectGroup) ent).GetProperites(remoteClient);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void DeRezObject(Packet packet, IClientAPI remoteClient)
+ {
+ DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet;
+
+ if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
+ {
+ //currently following code not used (or don't know of any case of destination being zero
+ }
+ else
+ {
+ foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData)
+ {
+ EntityBase selectedEnt = null;
+ //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
+ foreach (EntityBase ent in Entities.Values)
+ {
+ if (ent.LocalId == Data.ObjectLocalID)
+ {
+ selectedEnt = ent;
+ break;
+ }
+ }
+ if (selectedEnt != null)
+ {
+ if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID))
+ {
+ string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString();
+ CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
+ if (userInfo != null)
+ {
+ AssetBase asset = new AssetBase();
+ asset.Name = ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId);
asset.Description =
- ((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId);
- asset.InvType = 6;
- asset.Type = 6;
- asset.FullID = LLUUID.Random();
- asset.Data = Helpers.StringToField(sceneObjectXml);
- commsManager.AssetCache.AddAsset(asset);
-
-
- InventoryItemBase item = new InventoryItemBase();
- item.avatarID = remoteClient.AgentId;
- item.creatorsID = remoteClient.AgentId;
- item.inventoryID = LLUUID.Random();
- item.assetID = asset.FullID;
- item.inventoryDescription = asset.Description;
- item.inventoryName = asset.Name;
- item.assetType = asset.Type;
- item.invType = asset.InvType;
- item.parentFolderID = DeRezPacket.AgentBlock.DestinationID;
- item.inventoryCurrentPermissions = 2147483647;
- item.inventoryNextPermissions = 2147483647;
-
- userInfo.AddItem(remoteClient.AgentId, item);
- remoteClient.SendInventoryItemUpdate(item);
- }
-
+ ((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId);
+ asset.InvType = 6;
+ asset.Type = 6;
+ asset.FullID = LLUUID.Random();
+ asset.Data = Helpers.StringToField(sceneObjectXml);
+ commsManager.AssetCache.AddAsset(asset);
+
+
+ InventoryItemBase item = new InventoryItemBase();
+ item.avatarID = remoteClient.AgentId;
+ item.creatorsID = remoteClient.AgentId;
+ item.inventoryID = LLUUID.Random();
+ item.assetID = asset.FullID;
+ item.inventoryDescription = asset.Description;
+ item.inventoryName = asset.Name;
+ item.assetType = asset.Type;
+ item.invType = asset.InvType;
+ item.parentFolderID = DeRezPacket.AgentBlock.DestinationID;
+ item.inventoryCurrentPermissions = 2147483647;
+ item.inventoryNextPermissions = 2147483647;
+
+ userInfo.AddItem(remoteClient.AgentId, item);
+ remoteClient.SendInventoryItemUpdate(item);
+ }
+
SceneObjectPart rootPart =
- ((SceneObjectGroup) selectedEnt).GetChildPart(((SceneObjectGroup) selectedEnt).UUID);
- if (rootPart.PhysActor != null)
- {
- phyScene.RemovePrim(rootPart.PhysActor);
- rootPart.PhysActor = null;
- }
-
+ ((SceneObjectGroup) selectedEnt).GetChildPart(((SceneObjectGroup) selectedEnt).UUID);
+ if (rootPart.PhysActor != null)
+ {
+ phyScene.RemovePrim(rootPart.PhysActor);
+ rootPart.PhysActor = null;
+ }
+
storageManager.DataStore.RemoveObject(((SceneObjectGroup) selectedEnt).UUID,
- m_regInfo.SimUUID);
- ((SceneObjectGroup) selectedEnt).DeleteGroup();
-
- lock (Entities)
- {
- Entities.Remove(((SceneObjectGroup) selectedEnt).UUID);
- }
- ((SceneObjectGroup) selectedEnt).DeleteParts();
- }
- }
- }
- }
- }
-
- public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos)
- {
- CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
- if (userInfo != null)
- {
- if (userInfo.RootFolder != null)
- {
- InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
- if (item != null)
- {
- AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
- if (rezAsset != null)
- {
- AddRezObject(Util.FieldToString(rezAsset.Data), pos);
- userInfo.DeleteItem(remoteClient.AgentId, item);
- remoteClient.SendRemoveInventoryItem(itemID);
- }
- else
- {
- //lets try once more incase the asset cache is being slow getting the asset from server
- rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
- if (rezAsset != null)
- {
- AddRezObject(Util.FieldToString(rezAsset.Data), pos);
- userInfo.DeleteItem(remoteClient.AgentId, item);
- remoteClient.SendRemoveInventoryItem(itemID);
- }
- }
- }
- }
- }
- }
-
- private void AddRezObject(string xmlData, LLVector3 pos)
- {
- SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData);
- AddEntity(group);
- group.AbsolutePosition = pos;
- SceneObjectPart rootPart = group.GetChildPart(group.UUID);
- if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
- rootPart.PhysActor = phyScene.AddPrim(
+ m_regInfo.SimUUID);
+ ((SceneObjectGroup) selectedEnt).DeleteGroup();
+
+ lock (Entities)
+ {
+ Entities.Remove(((SceneObjectGroup) selectedEnt).UUID);
+ }
+ ((SceneObjectGroup) selectedEnt).DeleteParts();
+ }
+ }
+ }
+ }
+ }
+
+ public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos)
+ {
+ CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
+ if (userInfo != null)
+ {
+ if (userInfo.RootFolder != null)
+ {
+ InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
+ if (item != null)
+ {
+ AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
+ if (rezAsset != null)
+ {
+ AddRezObject(Util.FieldToString(rezAsset.Data), pos);
+ userInfo.DeleteItem(remoteClient.AgentId, item);
+ remoteClient.SendRemoveInventoryItem(itemID);
+ }
+ else
+ {
+ //lets try once more incase the asset cache is being slow getting the asset from server
+ rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
+ if (rezAsset != null)
+ {
+ AddRezObject(Util.FieldToString(rezAsset.Data), pos);
+ userInfo.DeleteItem(remoteClient.AgentId, item);
+ remoteClient.SendRemoveInventoryItem(itemID);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void AddRezObject(string xmlData, LLVector3 pos)
+ {
+ SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData);
+ AddEntity(group);
+ group.AbsolutePosition = pos;
+ SceneObjectPart rootPart = group.GetChildPart(group.UUID);
+ if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
+ rootPart.PhysActor = phyScene.AddPrim(
new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
- rootPart.AbsolutePosition.Z),
- new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
- new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
- rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
- }
+ rootPart.AbsolutePosition.Z),
+ new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
+ new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
+ rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
+ }
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index c63424a..91b9634 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -69,13 +69,13 @@ namespace OpenSim.Region.Environment.Scenes
public void InstantMessage(LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID,
uint timestamp, string fromAgentName, string message, byte dialog)
{
- if (Avatars.ContainsKey(toAgentID))
+ if (m_scenePresences.ContainsKey(toAgentID))
{
- if (Avatars.ContainsKey(fromAgentID))
+ if (m_scenePresences.ContainsKey(fromAgentID))
{
// Local sim message
- ScenePresence fromAvatar = Avatars[fromAgentID];
- ScenePresence toAvatar = Avatars[toAgentID];
+ ScenePresence fromAvatar = m_scenePresences[fromAgentID];
+ ScenePresence toAvatar = m_scenePresences[toAgentID];
string fromName = fromAvatar.Firstname + " " + fromAvatar.Lastname;
toAvatar.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, toAgentID,
imSessionID, fromName, dialog, timestamp);
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index bdb8957..e683bce 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -52,23 +52,20 @@ using Timer = System.Timers.Timer;
namespace OpenSim.Region.Environment.Scenes
{
- public delegate bool FilterAvatarList(ScenePresence avatar);
-
- public delegate void ForEachScenePresenceDelegate(ScenePresence presence);
-
public partial class Scene : SceneBase
{
+ public delegate bool FilterAvatarList(ScenePresence avatar);
+
protected Timer m_heartbeatTimer = new Timer();
- protected Dictionary Avatars;
- protected Dictionary Prims;
- public PhysicsScene phyScene;
+ protected Dictionary m_scenePresences;
+ protected Dictionary m_sceneObjects;
/// publicized so it can be accessed from SceneObjectGroup.
protected float timeStep = 0.1f;
private Random Rand = new Random();
private uint _primCount = 702000;
- private Mutex _primAllocateMutex = new Mutex(false);
+ private readonly Mutex _primAllocateMutex = new Mutex(false);
private int storageCount;
private int terrainCheckCount;
private int landPrimCheckCount;
@@ -78,7 +75,7 @@ namespace OpenSim.Region.Environment.Scenes
public BasicQuadTreeNode QuadTree;
- private Mutex updateLock;
+ private readonly Mutex updateLock;
protected ModuleLoader m_moduleLoader;
protected StorageManager storageManager;
@@ -108,30 +105,28 @@ namespace OpenSim.Region.Environment.Scenes
get { return authenticateHandler; }
}
- ///
- ///
- ///
- public PhysicsScene PhysScene
- {
- set { phyScene = value; }
- get { return (phyScene); }
- }
-
- private LandManager m_LandManager;
+ private readonly LandManager m_LandManager;
public LandManager LandManager
{
get { return m_LandManager; }
}
- private EstateManager m_estateManager;
+ private readonly EstateManager m_estateManager;
+
+ private PhysicsScene phyScene;
+ public PhysicsScene PhysScene
+ {
+ set { phyScene = value; }
+ get { return (phyScene); }
+ }
public EstateManager EstateManager
{
get { return m_estateManager; }
}
- private PermissionManager m_permissionManager;
+ private readonly PermissionManager m_permissionManager;
public PermissionManager PermissionsMngr
{
@@ -140,7 +135,7 @@ namespace OpenSim.Region.Environment.Scenes
public Dictionary Objects
{
- get { return Prims; }
+ get { return m_sceneObjects; }
}
public int TimePhase
@@ -191,8 +186,8 @@ namespace OpenSim.Region.Environment.Scenes
MainLog.Instance.Verbose("Creating new entitities instance");
Entities = new Dictionary();
- Avatars = new Dictionary();
- Prims = new Dictionary();
+ m_scenePresences = new Dictionary();
+ m_sceneObjects = new Dictionary();
MainLog.Instance.Verbose("Creating LandMap");
Terrain = new TerrainEngine((int)RegionInfo.RegionLocX, (int)RegionInfo.RegionLocY);
@@ -804,15 +799,15 @@ namespace OpenSim.Region.Environment.Scenes
Entities[client.AgentId] = newAvatar;
}
}
- lock (Avatars)
+ lock (m_scenePresences)
{
- if (Avatars.ContainsKey(client.AgentId))
+ if (m_scenePresences.ContainsKey(client.AgentId))
{
- Avatars[client.AgentId] = newAvatar;
+ m_scenePresences[client.AgentId] = newAvatar;
}
else
{
- Avatars.Add(client.AgentId, newAvatar);
+ m_scenePresences.Add(client.AgentId, newAvatar);
}
}
@@ -841,11 +836,11 @@ namespace OpenSim.Region.Environment.Scenes
}
});
- lock (Avatars)
+ lock (m_scenePresences)
{
- if (Avatars.ContainsKey(agentID))
+ if (m_scenePresences.ContainsKey(agentID))
{
- Avatars.Remove(agentID);
+ m_scenePresences.Remove(agentID);
}
}
lock (Entities)
@@ -865,18 +860,18 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
- #region Request Avatars List Methods
+ #region Request m_scenePresences List Methods
//The idea is to have a group of method that return a list of avatars meeting some requirement
- // ie it could be all Avatars within a certain range of the calling prim/avatar.
+ // ie it could be all m_scenePresences within a certain range of the calling prim/avatar.
///
- /// Request a List of all Avatars in this World
+ /// Request a List of all m_scenePresences in this World
///
///
public List GetScenePresences()
{
- List result = new List(Avatars.Values);
+ List result = new List(m_scenePresences.Values);
return result;
}
@@ -892,14 +887,14 @@ namespace OpenSim.Region.Environment.Scenes
}
///
- /// Request a filtered list of Avatars in this World
+ /// Request a filtered list of m_scenePresences in this World
///
///
public List GetScenePresences(FilterAvatarList filter)
{
List result = new List();
- foreach (ScenePresence avatar in Avatars.Values)
+ foreach (ScenePresence avatar in m_scenePresences.Values)
{
if (filter(avatar))
{
@@ -917,9 +912,9 @@ namespace OpenSim.Region.Environment.Scenes
///
public ScenePresence GetScenePresence(LLUUID avatarID)
{
- if (Avatars.ContainsKey(avatarID))
+ if (m_scenePresences.ContainsKey(avatarID))
{
- return Avatars[avatarID];
+ return m_scenePresences[avatarID];
}
return null;
}
@@ -928,9 +923,9 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public void ForEachScenePresence(ForEachScenePresenceDelegate whatToDo)
+ public void ForEachScenePresence(Action whatToDo)
{
- foreach (ScenePresence presence in Avatars.Values)
+ foreach (ScenePresence presence in m_scenePresences.Values)
{
whatToDo(presence);
}
@@ -1031,9 +1026,9 @@ namespace OpenSim.Region.Environment.Scenes
{
if (regionHandle == m_regInfo.RegionHandle)
{
- if (Avatars.ContainsKey(agentID))
+ if (m_scenePresences.ContainsKey(agentID))
{
- Avatars[agentID].MakeAvatar(position, isFlying);
+ m_scenePresences[agentID].MakeAvatar(position, isFlying);
}
}
}
@@ -1098,11 +1093,11 @@ namespace OpenSim.Region.Environment.Scenes
{
if (regionHandle == m_regionHandle)
{
- if (Avatars.ContainsKey(remoteClient.AgentId))
+ if (m_scenePresences.ContainsKey(remoteClient.AgentId))
{
remoteClient.SendTeleportLocationStart();
remoteClient.SendLocalTeleport(position, lookAt, flags);
- Avatars[remoteClient.AgentId].Teleport(position);
+ m_scenePresences[remoteClient.AgentId].Teleport(position);
}
}
else
@@ -1184,9 +1179,9 @@ namespace OpenSim.Region.Environment.Scenes
public void SendUrlToUser(LLUUID avatarID, string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned,
string message, string url)
{
- if (Avatars.ContainsKey(avatarID))
+ if (m_scenePresences.ContainsKey(avatarID))
{
- Avatars[avatarID].ControllingClient.SendLoadURL(objectname, objectID, ownerID, groupOwned, message, url);
+ m_scenePresences[avatarID].ControllingClient.SendLoadURL(objectname, objectID, ownerID, groupOwned, message, url);
}
}
@@ -1200,7 +1195,7 @@ namespace OpenSim.Region.Environment.Scenes
public void SendGeneralAlert(string message)
{
- foreach (ScenePresence presence in Avatars.Values)
+ foreach (ScenePresence presence in m_scenePresences.Values)
{
presence.ControllingClient.SendAlertMessage(message);
}
@@ -1208,15 +1203,15 @@ namespace OpenSim.Region.Environment.Scenes
public void SendAlertToUser(LLUUID agentID, string message, bool modal)
{
- if (Avatars.ContainsKey(agentID))
+ if (m_scenePresences.ContainsKey(agentID))
{
- Avatars[agentID].ControllingClient.SendAgentAlertMessage(message, modal);
+ m_scenePresences[agentID].ControllingClient.SendAgentAlertMessage(message, modal);
}
}
public void SendAlertToUser(string firstName, string lastName, string message, bool modal)
{
- foreach (ScenePresence presence in Avatars.Values)
+ foreach (ScenePresence presence in m_scenePresences.Values)
{
if ((presence.Firstname == firstName) && (presence.Lastname == lastName))
{
@@ -1405,7 +1400,7 @@ namespace OpenSim.Region.Environment.Scenes
internal bool TryGetAvatar(LLUUID avatarId, out ScenePresence avatar)
{
ScenePresence presence;
- if (Avatars.TryGetValue(avatarId, out presence))
+ if (m_scenePresences.TryGetValue(avatarId, out presence))
{
if (!presence.childAgent)
{
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 08c8d59..890008d 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -314,7 +314,7 @@ namespace OpenSim.Region.Environment.Scenes
/// may need to create a new Physics actor.
if (dupe.RootPart.PhysActor != null)
{
- dupe.RootPart.PhysActor = m_scene.phyScene.AddPrim(
+ dupe.RootPart.PhysActor = m_scene.PhysScene.AddPrim(
new PhysicsVector(dupe.RootPart.AbsolutePosition.X, dupe.RootPart.AbsolutePosition.Y,
dupe.RootPart.AbsolutePosition.Z),
new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z),
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 538e46c..bcffe39 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -291,7 +291,7 @@ namespace OpenSim.Region.Environment.Scenes
private void RemoveFromPhysicalScene()
{
- m_scene.phyScene.RemoveAvatar( this.PhysActor );
+ m_scene.PhysScene.RemoveAvatar( this.PhysActor );
}
///
@@ -844,7 +844,7 @@ namespace OpenSim.Region.Environment.Scenes
public void AddToPhysicalScene( )
{
- PhysicsScene scene = m_scene.phyScene;
+ PhysicsScene scene = m_scene.PhysScene;
PhysicsVector pVec =
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
--
cgit v1.1