From d216f5779c5f03709d718e279420e13472d08aae Mon Sep 17 00:00:00 2001 From: mingchen Date: Mon, 16 Jul 2007 14:56:35 +0000 Subject: *Trunk compiles now *Added "RemoveEntity" and renamed "AddNewEntity" to "AddEntity" --- OpenSim/Region/Application/OpenSimMain.cs | 2 +- OpenSim/Region/Environment/ParcelManager.cs | 16 ++++++++++- OpenSim/Region/Environment/Scenes/Scene.cs | 32 ++++++++++++++++++++-- .../Region/Examples/SimpleApp/MyNpcCharacter.cs | 3 +- OpenSim/Region/Examples/SimpleApp/Program.cs | 2 +- 5 files changed, 48 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 0016d15..99164f1 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -240,7 +240,7 @@ namespace OpenSim scene.RegionInfo.MasterAvatarAssignedUUID = libsecondlife.LLUUID.Zero; scene.localStorage.LoadParcels((ILocalStorageParcelReceiver)scene.ParcelManager); } - LocalWorld.performParcelPrimCountUpdate(); + scene.performParcelPrimCountUpdate(); scene.StartTimer(); } } diff --git a/OpenSim/Region/Environment/ParcelManager.cs b/OpenSim/Region/Environment/ParcelManager.cs index e413650..31b9b1d 100644 --- a/OpenSim/Region/Environment/ParcelManager.cs +++ b/OpenSim/Region/Environment/ParcelManager.cs @@ -1024,6 +1024,7 @@ namespace OpenSim.Region.Environment } #endregion + #region Object Select and Object Owner Listing public void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client) { List resultLocalIDs = new List(); @@ -1123,6 +1124,19 @@ namespace OpenSim.Region.Environment remote_client.OutPacket(pack); } } + #endregion + + #region Object Returning + public void returnObject(SceneObject obj) + { + } + public void returnParcelObjects(int type, LLUUID owner) + { + + } + #endregion + + #region Object Adding/Removing from Parcel public void resetParcelPrimCounts() { parcelData.groupPrims = 0; @@ -1180,7 +1194,7 @@ namespace OpenSim.Region.Environment primsOverMe.Remove(obj); } } - + #endregion #endregion diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index ba57115..1e69c9e 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -155,7 +155,7 @@ namespace OpenSim.Region.Environment.Scenes List PrimsFromDB = storageManager.DataStore.LoadObjects(); foreach (SceneObject prim in PrimsFromDB) { - Prims.Add(prim.uuid, prim); + AddEntity(prim); } MainLog.Instance.Verbose("World.cs - loaded " + PrimsFromDB.Count.ToString() + " object(s)"); @@ -483,14 +483,40 @@ namespace OpenSim.Region.Environment.Scenes { SceneObject sceneOb = new SceneObject(this, m_eventManager, ownerID, this.PrimIDAllocate(), pos, shape); - AddNewEntity(sceneOb); + AddEntity(sceneOb); } - public void AddNewEntity(SceneObject sceneObject) + public void RemovePrim(uint localID, LLUUID avatar_deleter) + { + foreach (EntityBase obj in Entities.Values) + { + if (obj is SceneObject) + { + if (((SceneObject)obj).LocalId == localID) + { + RemoveEntity((SceneObject)obj); + return; + } + } + } + + } + + public void AddEntity(SceneObject sceneObject) { this.Entities.Add(sceneObject.rootUUID, sceneObject); } + public void RemoveEntity(SceneObject sceneObject) + { + if (this.Entities.ContainsKey(sceneObject.rootUUID)) + { + m_parcelManager.removePrimFromParcelCounts(sceneObject); + this.Entities.Remove(sceneObject.rootUUID); + m_parcelManager.setPrimsTainted(); + } + } + /// /// Called by a prim when it has been created/cloned, so that its events can be subscribed to /// diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 6b332eb..7e6b1af 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs @@ -69,7 +69,8 @@ namespace SimpleApp public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; public event ParcelSelectObjects OnParcelSelectObjects; - + public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; + public event ObjectDeselect OnObjectDeselect; public event EstateOwnerMessageRequest OnEstateOwnerMessage; private LLUUID myID = LLUUID.Random(); diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index d417851..c3edf0c 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -92,7 +92,7 @@ namespace SimpleApp LLVector3 pos = new LLVector3(138, 129, 27); m_sceneObject = new MySceneObject(world, world.EventManager, LLUUID.Zero, world.PrimIDAllocate(), pos, shape); - world.AddNewEntity(m_sceneObject); + world.AddEntity(m_sceneObject); m_character = new MyNpcCharacter(); world.AddNewClient(m_character, false); -- cgit v1.1