From 811d2b69c9c5d07dbb196cd2ee6353916d0b51c5 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sat, 14 Jul 2007 15:33:25 +0000 Subject: * Worked some more on SimpleApp * Removed SceneObject references to RegionHandle, ParcelManager, EventManager as they are public on Scene * Moved PulseScript behaviour into MySceneObject --- OpenSim/Region/Environment/Scenes/Scene.cs | 55 ++++++++++++------------ OpenSim/Region/Environment/Scenes/SceneObject.cs | 8 ++-- 2 files changed, 31 insertions(+), 32 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 81bab9a..13a8c89 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -41,8 +41,8 @@ using OpenSim.Physics.Manager; using OpenSim.Region.Caches; using OpenSim.Region.Scripting; using OpenSim.Region.Terrain; -using Caps=OpenSim.Region.Capabilities.Caps; -using Timer=System.Timers.Timer; +using Caps = OpenSim.Region.Capabilities.Caps; +using Timer = System.Timers.Timer; namespace OpenSim.Region.Environment.Scenes { @@ -223,7 +223,7 @@ namespace OpenSim.Region.Environment.Scenes //Perform parcel update of prim count performParcelPrimCountUpdate(); this.parcelPrimCheckCount = 0; - } + } } } @@ -267,7 +267,7 @@ namespace OpenSim.Region.Environment.Scenes { this.SendLayerData(client); }); - + foreach (LLUUID UUID in Entities.Keys) { Entities[UUID].LandRenegerated(); @@ -454,18 +454,13 @@ namespace OpenSim.Region.Environment.Scenes /// public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape) { - try - { - SceneObject sceneOb = new SceneObject(m_regionHandle, this, this.m_eventManager,this.m_parcelManager, ownerID, this.PrimIDAllocate(), pos, shape); - this.Entities.Add(sceneOb.rootUUID, sceneOb); + SceneObject sceneOb = new SceneObject(this, ownerID, this.PrimIDAllocate(), pos, shape); + AddNewEntity(sceneOb); + } - // Trigger event for listeners - // eventManager.TriggerOnNewPrimitive(prim); - } - catch (Exception e) - { - MainLog.Instance.Warn("World.cs: AddNewPrim() - Failed with exception " + e.ToString()); - } + public void AddNewEntity(SceneObject sceneObject) + { + this.Entities.Add(sceneObject.rootUUID, sceneObject); } #endregion @@ -484,7 +479,7 @@ namespace OpenSim.Region.Environment.Scenes this.m_estateManager.sendRegionHandshake(client); CreateAndAddScenePresence(client); this.m_parcelManager.sendParcelOverlay(client); - + } protected virtual void SubscribeToClientEvents(IClientAPI client) @@ -512,7 +507,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnObjectName += this.PrimName; client.OnLinkObjects += this.LinkObjects; client.OnObjectDuplicate += this.DuplicateObject; - + client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(m_parcelManager.handleParcelPropertiesRequest); client.OnParcelDivideRequest += new ParcelDivideRequest(m_parcelManager.handleParcelDivideRequest); client.OnParcelJoinRequest += new ParcelJoinRequest(m_parcelManager.handleParcelJoinRequest); @@ -571,26 +566,30 @@ namespace OpenSim.Region.Environment.Scenes { m_eventManager.TriggerOnRemovePresence(agentID); - ScenePresence avatar = this.RequestAvatar(agentID); + ScenePresence avatar = this.RequestAvatar(agentID); m_clientManager.ForEachClient( - delegate(IClientAPI client) + delegate(IClientAPI client) + { + client.SendKillObject(avatar.RegionHandle, avatar.LocalId); + }); + + lock (Avatars) + { + if (Avatars.ContainsKey(agentID)) { - client.SendKillObject(avatar.RegionHandle, avatar.LocalId); - }); - - lock (Avatars) { - if (Avatars.ContainsKey(agentID)) { Avatars.Remove(agentID); } } - lock (Entities) { - if (Entities.ContainsKey(agentID)) { + lock (Entities) + { + if (Entities.ContainsKey(agentID)) + { Entities.Remove(agentID); } } // TODO: Add the removal from physics ? - + return; @@ -685,7 +684,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void RegisterRegionWithComms() { - + this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo); if (this.regionCommsHost != null) { diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index f4c4083..7c49ddb 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs @@ -79,12 +79,12 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public SceneObject(ulong regionHandle, Scene world, EventManager eventManager, ParcelManager parcelManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) + public SceneObject(Scene world, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) { - m_regionHandle = regionHandle; + m_regionHandle = world.RegionInfo.RegionHandle; m_world = world; - m_eventManager = eventManager; - m_parcelManager = parcelManager; + m_eventManager = world.EventManager; + m_parcelManager = world.ParcelManager; this.Pos = pos; this.CreateRootFromShape(ownerID, localID, shape, pos); -- cgit v1.1