From 0232f01a58a3c0a88e95c22589efec21f502f081 Mon Sep 17 00:00:00 2001 From: mingchen Date: Wed, 27 Jun 2007 19:43:46 +0000 Subject: *Moved all the classes into their own file from LLSDHelpers.cs *Some folder renaming to follow project Name *Updated prebuild.xml --- OpenSim/Region/Environment/Scenes/Scene.cs | 795 +++++++++++++++++++++++++++++ 1 file changed, 795 insertions(+) create mode 100644 OpenSim/Region/Environment/Scenes/Scene.cs (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs new file mode 100644 index 0000000..ff54efa --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -0,0 +1,795 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.org/ +* See CONTRIBUTORS.TXT for a full list of copyright holders. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of the OpenSim Project nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +using System; +using libsecondlife; +using libsecondlife.Packets; +using System.Collections.Generic; +using System.Text; +using System.Reflection; +using System.IO; +using System.Threading; +using System.Timers; +using OpenSim.Physics.Manager; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Types; +using OpenSim.Framework.Inventory; +using OpenSim.Framework; +using OpenSim.Region.Environment.Scripting; +using OpenSim.Region.Terrain; +using OpenSim.Framework.Communications; +using OpenSim.Region.Caches; +using OpenSim.Region.Environment; +using OpenSim.Framework.Servers; + +namespace OpenSim.Region.Environment.Scenes +{ + public delegate bool FilterAvatarList(ScenePresence avatar); + + public partial class Scene : SceneBase, ILocalStorageReceiver, IScriptAPI + { + protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer(); + protected Dictionary Avatars; + protected Dictionary Prims; + private PhysicsScene phyScene; + private float timeStep = 0.1f; + private Random Rand = new Random(); + private uint _primCount = 702000; + private int storageCount; + private Dictionary m_scriptHandlers; + private Dictionary m_scripts; + private Mutex updateLock; + + protected AuthenticateSessionsBase authenticateHandler; + protected RegionCommsListener regionCommsHost; + protected CommunicationsManager commsManager; + + protected Dictionary capsHandlers = new Dictionary(); + protected BaseHttpServer httpListener; + + public ParcelManager parcelManager; + public EstateManager estateManager; + public EventManager eventManager; + + #region Properties + /// + /// + /// + public PhysicsScene PhysScene + { + set + { + this.phyScene = value; + } + get + { + return (this.phyScene); + } + } + + #endregion + + #region Constructors + /// + /// Creates a new World class, and a region to go with it. + /// + /// Dictionary to contain client threads + /// Region Handle for this region + /// Region Name for this region + public Scene(Dictionary clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) + { + try + { + updateLock = new Mutex(false); + this.authenticateHandler = authen; + this.commsManager = commsMan; + this.assetCache = assetCach; + m_clientThreads = clientThreads; + m_regInfo = regInfo; + m_regionHandle = m_regInfo.RegionHandle; + m_regionName = m_regInfo.RegionName; + this.m_datastore = m_regInfo.DataStore; + this.RegisterRegionWithComms(); + + parcelManager = new ParcelManager(this, this.m_regInfo); + estateManager = new EstateManager(this, this.m_regInfo); + + eventManager = new EventManager(); + + m_scriptHandlers = new Dictionary(); + m_scripts = new Dictionary(); + + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating new entitities instance"); + Entities = new Dictionary(); + Avatars = new Dictionary(); + Prims = new Dictionary(); + + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating LandMap"); + Terrain = new TerrainEngine(); + + ScenePresence.LoadAnims(); + this.httpListener = httpServer; + + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Error( "World.cs: Constructor failed with exception " + e.ToString()); + } + } + #endregion + + /// + /// + /// + public void StartTimer() + { + m_heartbeatTimer.Enabled = true; + m_heartbeatTimer.Interval = 100; + m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat); + } + + + #region Update Methods + + + /// + /// Performs per-frame updates regularly + /// + /// + /// + void Heartbeat(object sender, System.EventArgs e) + { + this.Update(); + } + + /// + /// Performs per-frame updates on the world, this should be the central world loop + /// + public override void Update() + { + updateLock.WaitOne(); + try + { + if (this.phyScene.IsThreaded) + { + this.phyScene.GetResults(); + + } + + foreach (libsecondlife.LLUUID UUID in Entities.Keys) + { + Entities[UUID].updateMovement(); + } + + lock (this.m_syncRoot) + { + this.phyScene.Simulate(timeStep); + } + + foreach (libsecondlife.LLUUID UUID in Entities.Keys) + { + Entities[UUID].update(); + } + + // New + eventManager.TriggerOnFrame(); + + // TODO: Obsolete - Phase out + foreach (ScriptHandler scriptHandler in m_scriptHandlers.Values) + { + scriptHandler.OnFrame(); + } + foreach (IScriptEngine scripteng in this.scriptEngines.Values) + { + scripteng.OnFrame(); + } + + //backup world data + this.storageCount++; + if (storageCount > 1200) //set to how often you want to backup + { + this.Backup(); + storageCount = 0; + } + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: Update() - Failed with exception " + e.ToString()); + } + updateLock.ReleaseMutex(); + + } + + /// + /// + /// + /// + public bool Backup() + { + /* + try + { + // Terrain backup routines + if (Terrain.tainted > 0) + { + Terrain.tainted = 0; + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Terrain tainted, saving."); + localStorage.SaveMap(Terrain.getHeights1D()); + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Terrain saved, informing Physics."); + lock (this.m_syncRoot) + { + phyScene.SetTerrain(Terrain.getHeights1D()); + } + } + + // Primitive backup routines + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Backing up Primitives"); + foreach (libsecondlife.LLUUID UUID in Entities.Keys) + { + Entities[UUID].BackUp(); + } + + //Parcel backup routines + ParcelData[] parcels = new ParcelData[parcelManager.parcelList.Count]; + int i = 0; + foreach (OpenSim.Region.Environment.Parcel parcel in parcelManager.parcelList.Values) + { + parcels[i] = parcel.parcelData; + i++; + } + localStorage.SaveParcels(parcels); + + // Backup successful + return true; + } + catch (Exception e) + { + // Backup failed + OpenSim.Framework.Console.MainLog.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "World.cs: Backup() - Backup Failed with exception " + e.ToString()); + return false; + } + */ + return true; + } + #endregion + + #region Regenerate Terrain + + /// + /// Rebuilds the terrain using a procedural algorithm + /// + public void RegenerateTerrain() + { + try + { + Terrain.hills(); + + lock (this.m_syncRoot) + { + this.phyScene.SetTerrain(Terrain.getHeights1D()); + } + this.localStorage.SaveMap(this.Terrain.getHeights1D()); + + foreach (IClientAPI client in m_clientThreads.Values) + { + this.SendLayerData(client); + } + + foreach (libsecondlife.LLUUID UUID in Entities.Keys) + { + Entities[UUID].LandRenegerated(); + } + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); + } + } + + /// + /// Rebuilds the terrain using a 2D float array + /// + /// 256,256 float array containing heights + public void RegenerateTerrain(float[,] newMap) + { + try + { + this.Terrain.setHeights2D(newMap); + lock (this.m_syncRoot) + { + this.phyScene.SetTerrain(this.Terrain.getHeights1D()); + } + this.localStorage.SaveMap(this.Terrain.getHeights1D()); + + foreach (IClientAPI client in m_clientThreads.Values) + { + this.SendLayerData(client); + } + + foreach (libsecondlife.LLUUID UUID in Entities.Keys) + { + Entities[UUID].LandRenegerated(); + } + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); + } + } + + /// + /// Rebuilds the terrain assuming changes occured at a specified point[?] + /// + /// ??? + /// ??? + /// ??? + public void RegenerateTerrain(bool changes, int pointx, int pointy) + { + try + { + if (changes) + { + /* Dont save here, rely on tainting system instead */ + + foreach (IClientAPI client in m_clientThreads.Values) + { + this.SendLayerData(pointx, pointy, client); + } + } + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); + } + } + + #endregion + + #region Load Terrain + /// + /// Loads the World heightmap + /// + /// + public override void LoadWorldMap() + { + try + { + float[] map = this.localStorage.LoadWorld(); + if (map == null) + { + if (string.IsNullOrEmpty(this.m_regInfo.estateSettings.terrainFile)) + { + Console.WriteLine("No default terrain, procedurally generating..."); + this.Terrain.hills(); + + this.localStorage.SaveMap(this.Terrain.getHeights1D()); + } + else + { + try + { + this.Terrain.loadFromFileF32(this.m_regInfo.estateSettings.terrainFile); + this.Terrain *= this.m_regInfo.estateSettings.terrainMultiplier; + } + catch + { + Console.WriteLine("Unable to load default terrain, procedurally generating instead..."); + Terrain.hills(); + } + this.localStorage.SaveMap(this.Terrain.getHeights1D()); + } + } + else + { + this.Terrain.setHeights1D(map); + } + + CreateTerrainTexture(); + + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: LoadWorldMap() - Failed with exception " + e.ToString()); + } + } + + /// + /// + /// + private void CreateTerrainTexture() + { + //create a texture asset of the terrain + byte[] data = this.Terrain.exportJpegImage("defaultstripe.png"); + this.m_regInfo.estateSettings.terrainImageID = LLUUID.Random(); + AssetBase asset = new AssetBase(); + asset.FullID = this.m_regInfo.estateSettings.terrainImageID; + asset.Data = data; + asset.Name = "terrainImage"; + asset.Type = 0; + this.assetCache.AddAsset(asset); + } + #endregion + + #region Primitives Methods + + + /// + /// Loads the World's objects + /// + public void LoadPrimsFromStorage() + { + try + { + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: LoadPrimsFromStorage() - Loading primitives"); + this.localStorage.LoadPrimitives(this); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: LoadPrimsFromStorage() - Failed with exception " + e.ToString()); + } + } + + /// + /// Loads a specific object from storage + /// + /// The object to load + public void PrimFromStorage(PrimData prim) + { + + } + + /// + /// + /// + /// + /// + public void AddNewPrim(Packet addPacket, IClientAPI agentClient) + { + AddNewPrim((ObjectAddPacket)addPacket, agentClient.AgentId); + } + + /// + /// + /// + /// + /// + public void AddNewPrim(ObjectAddPacket addPacket, LLUUID ownerID) + { + try + { + Primitive prim = new Primitive(m_regionHandle, this, addPacket, ownerID, this._primCount); + + this.Entities.Add(prim.uuid, prim); + this._primCount++; + + // Trigger event for listeners + eventManager.TriggerOnNewPrimitive(prim); + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: AddNewPrim() - Failed with exception " + e.ToString()); + } + } + + #endregion + + #region Add/Remove Avatar Methods + + /// + /// + /// + /// + /// + public override void AddNewClient(IClientAPI remoteClient, LLUUID agentID, bool child) + { + remoteClient.OnRegionHandShakeReply += this.SendLayerData; + //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); + remoteClient.OnChatFromViewer += this.SimChat; + remoteClient.OnRequestWearables += this.InformClientOfNeighbours; + remoteClient.OnAddPrim += this.AddNewPrim; + remoteClient.OnUpdatePrimPosition += this.UpdatePrimPosition; + remoteClient.OnRequestMapBlocks += this.RequestMapBlocks; + remoteClient.OnTeleportLocationRequest += this.RequestTeleportLocation; + //remoteClient.OnObjectSelect += this.SelectPrim; + remoteClient.OnGrapUpdate += this.MoveObject; + + /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); + remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); + remoteClient.OnParcelJoinRequest += new ParcelJoinRequest(parcelManager.handleParcelJoinRequest); + remoteClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest); + remoteClient.OnEstateOwnerMessage += new EstateOwnerMessageRequest(estateManager.handleEstateOwnerMessage); + */ + + ScenePresence newAvatar = null; + try + { + + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); + newAvatar = new ScenePresence(remoteClient, this, this.m_regInfo); + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Adding new avatar to world"); + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Starting RegionHandshake "); + + //newAvatar.SendRegionHandshake(); + this.estateManager.sendRegionHandshake(remoteClient); + + PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); + lock (this.m_syncRoot) + { + newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); + } + + lock (Entities) + { + if (!Entities.ContainsKey(agentID)) + { + this.Entities.Add(agentID, newAvatar); + } + else + { + Entities[agentID] = newAvatar; + } + } + lock (Avatars) + { + if (Avatars.ContainsKey(agentID)) + { + Avatars[agentID] = newAvatar; + } + else + { + this.Avatars.Add(agentID, newAvatar); + } + } + } + catch (Exception e) + { + OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: AddViewerAgent() - Failed with exception " + e.ToString()); + } + return; + } + + + + /// + /// + /// + /// + public override void RemoveClient(LLUUID agentID) + { + eventManager.TriggerOnRemovePresence(agentID); + + return; + } + #endregion + + #region Request Avatars 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. + + /// + /// Request a List of all Avatars in this World + /// + /// + public List RequestAvatarList() + { + List result = new List(); + + foreach (ScenePresence avatar in Avatars.Values) + { + result.Add(avatar); + } + + return result; + } + + /// + /// Request a filtered list of Avatars in this World + /// + /// + public List RequestAvatarList(FilterAvatarList filter) + { + List result = new List(); + + foreach (ScenePresence avatar in Avatars.Values) + { + if (filter(avatar)) + { + result.Add(avatar); + } + } + + return result; + } + + /// + /// Request a Avatar by UUID + /// + /// + /// + public ScenePresence RequestAvatar(LLUUID avatarID) + { + if (this.Avatars.ContainsKey(avatarID)) + { + return Avatars[avatarID]; + } + return null; + } + #endregion + + + #region RegionCommsHost + + /// + /// + /// + public void RegisterRegionWithComms() + { + GridInfo gridSettings = new GridInfo(); + this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo,gridSettings); + if (this.regionCommsHost != null) + { + this.regionCommsHost.OnExpectUser += new ExpectUserDelegate(this.NewUserConnection); + this.regionCommsHost.OnAvatarCrossingIntoRegion += new AgentCrossing(this.AgentCrossing); + } + } + + /// + /// + /// + /// + /// + public void NewUserConnection(ulong regionHandle, AgentCircuitData agent) + { + // Console.WriteLine("World.cs - add new user connection"); + //should just check that its meant for this region + if (regionHandle == this.m_regInfo.RegionHandle) + { + if (agent.CapsPath != "") + { + //Console.WriteLine("new user, so creating caps handler for it"); + Capabilities.Caps cap = new Capabilities.Caps(this.assetCache, httpListener, this.m_regInfo.CommsIPListenAddr, 9000, agent.CapsPath, agent.AgentID); + cap.RegisterHandlers(); + this.capsHandlers.Add(agent.AgentID, cap); + } + this.authenticateHandler.AddNewCircuit(agent.circuitcode, agent); + } + } + + public void AgentCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + { + if (regionHandle == this.m_regInfo.RegionHandle) + { + if (this.Avatars.ContainsKey(agentID)) + { + this.Avatars[agentID].MakeAvatar(position); + } + } + } + + /// + /// + /// + public void InformClientOfNeighbours(IClientAPI remoteClient) + { + // Console.WriteLine("informing client of neighbouring regions"); + List neighbours = this.commsManager.GridServer.RequestNeighbours(this.m_regInfo); + + //Console.WriteLine("we have " + neighbours.Count + " neighbouring regions"); + if (neighbours != null) + { + for (int i = 0; i < neighbours.Count; i++) + { + // Console.WriteLine("sending neighbours data"); + AgentCircuitData agent = remoteClient.RequestClientInfo(); + agent.BaseFolder = LLUUID.Zero; + agent.InventoryFolder = LLUUID.Zero; + agent.startpos = new LLVector3(128, 128, 70); + agent.child = true; + this.commsManager.InterRegion.InformRegionOfChildAgent(neighbours[i].RegionHandle, agent); + remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr), (ushort)neighbours[i].CommsIPListenPort); + //this.capsHandlers[remoteClient.AgentId].CreateEstablishAgentComms("", System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr) + ":" + neighbours[i].CommsIPListenPort); + } + } + } + + /// + /// + /// + /// + /// + public RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle) + { + return this.commsManager.GridServer.RequestNeighbourInfo(regionHandle); + } + + /// + /// + /// + /// + /// + /// + /// + public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY) + { + List mapBlocks; + mapBlocks = this.commsManager.GridServer.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); + remoteClient.SendMapBlock(mapBlocks); + } + + /// + /// + /// + /// + /// + /// + /// + /// + public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags) + { + if (regionHandle == this.m_regionHandle) + { + if (this.Avatars.ContainsKey(remoteClient.AgentId)) + { + remoteClient.SendTeleportLocationStart(); + remoteClient.SendLocalTeleport(position, lookAt, flags); + this.Avatars[remoteClient.AgentId].Teleport(position); + } + } + else + { + RegionInfo reg = this.RequestNeighbouringRegionInfo(regionHandle); + if (reg != null) + { + remoteClient.SendTeleportLocationStart(); + AgentCircuitData agent = remoteClient.RequestClientInfo(); + agent.BaseFolder = LLUUID.Zero; + agent.InventoryFolder = LLUUID.Zero; + agent.startpos = new LLVector3(128, 128, 70); + agent.child = true; + this.commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); + this.commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position); + remoteClient.SendRegionTeleport(regionHandle, 13, reg.CommsIPListenAddr, (ushort)reg.CommsIPListenPort, 4, (1 << 4)); + } + //remoteClient.SendTeleportCancel(); + } + } + + /// + /// + /// + /// + /// + /// + public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position) + { + return this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position); + } + + #endregion + } +} -- cgit v1.1 From 3456d951d89fbc83f742d40ca8ca2a1a79d414eb Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 28 Jun 2007 13:13:17 +0000 Subject: Imported the scripting changes, so now should be up to date with sugilite. --- OpenSim/Region/Environment/Scenes/Scene.cs | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index ff54efa..b345c0c 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -39,12 +39,14 @@ using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework.Inventory; using OpenSim.Framework; -using OpenSim.Region.Environment.Scripting; using OpenSim.Region.Terrain; using OpenSim.Framework.Communications; using OpenSim.Region.Caches; using OpenSim.Region.Environment; using OpenSim.Framework.Servers; +using OpenSim.Scripting; +using OpenSim.Region.Capabilities; +using Caps = OpenSim.Region.Capabilities.Caps; namespace OpenSim.Region.Environment.Scenes { @@ -60,20 +62,19 @@ namespace OpenSim.Region.Environment.Scenes private Random Rand = new Random(); private uint _primCount = 702000; private int storageCount; - private Dictionary m_scriptHandlers; - private Dictionary m_scripts; private Mutex updateLock; protected AuthenticateSessionsBase authenticateHandler; protected RegionCommsListener regionCommsHost; protected CommunicationsManager commsManager; - protected Dictionary capsHandlers = new Dictionary(); + protected Dictionary capsHandlers = new Dictionary(); protected BaseHttpServer httpListener; public ParcelManager parcelManager; public EstateManager estateManager; public EventManager eventManager; + public ScriptManager scriptManager; #region Properties /// @@ -117,12 +118,9 @@ namespace OpenSim.Region.Environment.Scenes parcelManager = new ParcelManager(this, this.m_regInfo); estateManager = new EstateManager(this, this.m_regInfo); - + scriptManager = new ScriptManager(this); eventManager = new EventManager(); - m_scriptHandlers = new Dictionary(); - m_scripts = new Dictionary(); - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating new entitities instance"); Entities = new Dictionary(); Avatars = new Dictionary(); @@ -195,19 +193,9 @@ namespace OpenSim.Region.Environment.Scenes Entities[UUID].update(); } - // New + // General purpose event manager eventManager.TriggerOnFrame(); - // TODO: Obsolete - Phase out - foreach (ScriptHandler scriptHandler in m_scriptHandlers.Values) - { - scriptHandler.OnFrame(); - } - foreach (IScriptEngine scripteng in this.scriptEngines.Values) - { - scripteng.OnFrame(); - } - //backup world data this.storageCount++; if (storageCount > 1200) //set to how often you want to backup @@ -256,7 +244,7 @@ namespace OpenSim.Region.Environment.Scenes //Parcel backup routines ParcelData[] parcels = new ParcelData[parcelManager.parcelList.Count]; int i = 0; - foreach (OpenSim.Region.Environment.Parcel parcel in parcelManager.parcelList.Values) + foreach (OpenSim.Region.Parcel parcel in parcelManager.parcelList.Values) { parcels[i] = parcel.parcelData; i++; @@ -672,7 +660,7 @@ namespace OpenSim.Region.Environment.Scenes if (agent.CapsPath != "") { //Console.WriteLine("new user, so creating caps handler for it"); - Capabilities.Caps cap = new Capabilities.Caps(this.assetCache, httpListener, this.m_regInfo.CommsIPListenAddr, 9000, agent.CapsPath, agent.AgentID); + Caps cap = new Caps(this.assetCache, httpListener, this.m_regInfo.CommsIPListenAddr, 9000, agent.CapsPath, agent.AgentID); cap.RegisterHandlers(); this.capsHandlers.Add(agent.AgentID, cap); } -- cgit v1.1 From 561db23e5fbfcd110423c6a408ac0a11bebbedac Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 28 Jun 2007 14:10:05 +0000 Subject: Finished removing the old scripting code, Scene.Scripting.cs and OpenSim.Framework.Interfaces.Scripting. --- OpenSim/Region/Environment/Scenes/Scene.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index b345c0c..f1de803 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -44,7 +44,7 @@ using OpenSim.Framework.Communications; using OpenSim.Region.Caches; using OpenSim.Region.Environment; using OpenSim.Framework.Servers; -using OpenSim.Scripting; +using OpenSim.Region.Enviorment.Scripting; using OpenSim.Region.Capabilities; using Caps = OpenSim.Region.Capabilities.Caps; @@ -52,7 +52,7 @@ namespace OpenSim.Region.Environment.Scenes { public delegate bool FilterAvatarList(ScenePresence avatar); - public partial class Scene : SceneBase, ILocalStorageReceiver, IScriptAPI + public partial class Scene : SceneBase, ILocalStorageReceiver { protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer(); protected Dictionary Avatars; -- cgit v1.1 From fe0528b98cfc13d26ac7f1bf6bc23655be1f52e5 Mon Sep 17 00:00:00 2001 From: mingchen Date: Thu, 28 Jun 2007 19:09:50 +0000 Subject: *Added UUIDNameRequest packet support (untested, but should work -- at least in sandbox mode) *Various small renamings --- OpenSim/Region/Environment/Scenes/Scene.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index f1de803..8c912d0 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -505,6 +505,7 @@ namespace OpenSim.Region.Environment.Scenes remoteClient.OnTeleportLocationRequest += this.RequestTeleportLocation; //remoteClient.OnObjectSelect += this.SelectPrim; remoteClient.OnGrapUpdate += this.MoveObject; + remoteClient.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); @@ -512,7 +513,7 @@ namespace OpenSim.Region.Environment.Scenes remoteClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest); remoteClient.OnEstateOwnerMessage += new EstateOwnerMessageRequest(estateManager.handleEstateOwnerMessage); */ - + ScenePresence newAvatar = null; try { -- cgit v1.1 From 5e805656db1215518a344d6d5364629a4997fd47 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sun, 1 Jul 2007 13:17:27 +0000 Subject: Fixed SimpleApp - aka thankgoditssundaycommit * Updated SimpleApp with various introduced dependencies * Extracted ScenePrescence creation in Scene * removed try-catchall from UserManagerBase (that actually hid a bug) * Refactored RegionInfo * handle is calculated * it will explode upon accessing x,y,ip,port,externalip if not explicitly initialized * Removed superfluous 'ref' keywords * Removed a shitload of 'catch Exception e' that causes build warnings * Lots of small refactorings, renames et c * Ignored some bins --- OpenSim/Region/Environment/Scenes/Scene.cs | 61 ++++++++++++++---------------- 1 file changed, 28 insertions(+), 33 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 8c912d0..d5406b6 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -493,19 +493,19 @@ namespace OpenSim.Region.Environment.Scenes /// /// - public override void AddNewClient(IClientAPI remoteClient, LLUUID agentID, bool child) + public override void AddNewClient(IClientAPI client, bool child) { - remoteClient.OnRegionHandShakeReply += this.SendLayerData; + client.OnRegionHandShakeReply += this.SendLayerData; //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); - remoteClient.OnChatFromViewer += this.SimChat; - remoteClient.OnRequestWearables += this.InformClientOfNeighbours; - remoteClient.OnAddPrim += this.AddNewPrim; - remoteClient.OnUpdatePrimPosition += this.UpdatePrimPosition; - remoteClient.OnRequestMapBlocks += this.RequestMapBlocks; - remoteClient.OnTeleportLocationRequest += this.RequestTeleportLocation; + client.OnChatFromViewer += this.SimChat; + client.OnRequestWearables += this.InformClientOfNeighbours; + client.OnAddPrim += this.AddNewPrim; + client.OnUpdatePrimPosition += this.UpdatePrimPosition; + client.OnRequestMapBlocks += this.RequestMapBlocks; + client.OnTeleportLocationRequest += this.RequestTeleportLocation; //remoteClient.OnObjectSelect += this.SelectPrim; - remoteClient.OnGrapUpdate += this.MoveObject; - remoteClient.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; + client.OnGrapUpdate += this.MoveObject; + client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); @@ -513,19 +513,21 @@ namespace OpenSim.Region.Environment.Scenes remoteClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest); remoteClient.OnEstateOwnerMessage += new EstateOwnerMessageRequest(estateManager.handleEstateOwnerMessage); */ - + this.estateManager.sendRegionHandshake(client); + + CreateAndAddScenePresence(client); + return; + } + + protected void CreateAndAddScenePresence(IClientAPI client) + { ScenePresence newAvatar = null; - try - { - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); - newAvatar = new ScenePresence(remoteClient, this, this.m_regInfo); + OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); + newAvatar = new ScenePresence(client, this, this.m_regInfo); OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Adding new avatar to world"); OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Starting RegionHandshake "); - //newAvatar.SendRegionHandshake(); - this.estateManager.sendRegionHandshake(remoteClient); - PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); lock (this.m_syncRoot) { @@ -534,36 +536,29 @@ namespace OpenSim.Region.Environment.Scenes lock (Entities) { - if (!Entities.ContainsKey(agentID)) + if (!Entities.ContainsKey(client.AgentId)) { - this.Entities.Add(agentID, newAvatar); + this.Entities.Add(client.AgentId, newAvatar); } else { - Entities[agentID] = newAvatar; + Entities[client.AgentId] = newAvatar; } } lock (Avatars) { - if (Avatars.ContainsKey(agentID)) + if (Avatars.ContainsKey(client.AgentId)) { - Avatars[agentID] = newAvatar; + Avatars[client.AgentId] = newAvatar; } else { - this.Avatars.Add(agentID, newAvatar); + this.Avatars.Add(client.AgentId, newAvatar); } } - } - catch (Exception e) - { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: AddViewerAgent() - Failed with exception " + e.ToString()); - } - return; } - /// /// /// @@ -642,8 +637,8 @@ namespace OpenSim.Region.Environment.Scenes this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo,gridSettings); if (this.regionCommsHost != null) { - this.regionCommsHost.OnExpectUser += new ExpectUserDelegate(this.NewUserConnection); - this.regionCommsHost.OnAvatarCrossingIntoRegion += new AgentCrossing(this.AgentCrossing); + this.regionCommsHost.OnExpectUser += this.NewUserConnection; + this.regionCommsHost.OnAvatarCrossingIntoRegion += this.AgentCrossing; } } -- cgit v1.1 From 06a8c132005b4ab804f25d54c0c0f899fc98e3a1 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sun, 1 Jul 2007 16:07:41 +0000 Subject: MAJOR IP RESTRUCTURING * moving towards IPEndPoints all over the place * trying to make the internal/external division --- OpenSim/Region/Environment/Scenes/Scene.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index d5406b6..dbf385d 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -656,7 +656,7 @@ namespace OpenSim.Region.Environment.Scenes if (agent.CapsPath != "") { //Console.WriteLine("new user, so creating caps handler for it"); - Caps cap = new Caps(this.assetCache, httpListener, this.m_regInfo.CommsIPListenAddr, 9000, agent.CapsPath, agent.AgentID); + Caps cap = new Caps(this.assetCache, httpListener, this.m_regInfo.ExternalHostName, this.m_regInfo.ExternalEndPoint.Port, agent.CapsPath, agent.AgentID); cap.RegisterHandlers(); this.capsHandlers.Add(agent.AgentID, cap); } @@ -695,7 +695,7 @@ namespace OpenSim.Region.Environment.Scenes agent.startpos = new LLVector3(128, 128, 70); agent.child = true; this.commsManager.InterRegion.InformRegionOfChildAgent(neighbours[i].RegionHandle, agent); - remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr), (ushort)neighbours[i].CommsIPListenPort); + remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, neighbours[i].ExternalEndPoint ); //this.capsHandlers[remoteClient.AgentId].CreateEstablishAgentComms("", System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr) + ":" + neighbours[i].CommsIPListenPort); } } @@ -757,7 +757,7 @@ namespace OpenSim.Region.Environment.Scenes agent.child = true; this.commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); this.commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position); - remoteClient.SendRegionTeleport(regionHandle, 13, reg.CommsIPListenAddr, (ushort)reg.CommsIPListenPort, 4, (1 << 4)); + remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4)); } //remoteClient.SendTeleportCancel(); } -- cgit v1.1 From 9800c05c1b3c7804466d6f3a9c38a739156625fd Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 1 Jul 2007 17:26:33 +0000 Subject: Started change to having SceneObject and then that having child Primitives which in turn have a Shape object (currently PrimitiveBaseShape). The plan is only for the SceneObject to interface with the physics engines. As a physics Entity should be able to have mulitple shapes connected to it. --- OpenSim/Region/Environment/Scenes/Scene.cs | 131 ++++++++++------------------- 1 file changed, 45 insertions(+), 86 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index dbf385d..2ff3976 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -63,12 +63,12 @@ namespace OpenSim.Region.Environment.Scenes private uint _primCount = 702000; private int storageCount; private Mutex updateLock; - + protected AuthenticateSessionsBase authenticateHandler; protected RegionCommsListener regionCommsHost; protected CommunicationsManager commsManager; - protected Dictionary capsHandlers = new Dictionary(); + protected Dictionary capsHandlers = new Dictionary(); protected BaseHttpServer httpListener; public ParcelManager parcelManager; @@ -121,21 +121,21 @@ namespace OpenSim.Region.Environment.Scenes scriptManager = new ScriptManager(this); eventManager = new EventManager(); - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating new entitities instance"); - Entities = new Dictionary(); + OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating new entitities instance"); + Entities = new Dictionary(); Avatars = new Dictionary(); Prims = new Dictionary(); - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating LandMap"); + OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating LandMap"); Terrain = new TerrainEngine(); ScenePresence.LoadAnims(); this.httpListener = httpServer; - + } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Error( "World.cs: Constructor failed with exception " + e.ToString()); + OpenSim.Framework.Console.MainLog.Instance.Error("World.cs: Constructor failed with exception " + e.ToString()); } } #endregion @@ -218,49 +218,7 @@ namespace OpenSim.Region.Environment.Scenes /// public bool Backup() { - /* - try - { - // Terrain backup routines - if (Terrain.tainted > 0) - { - Terrain.tainted = 0; - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Terrain tainted, saving."); - localStorage.SaveMap(Terrain.getHeights1D()); - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Terrain saved, informing Physics."); - lock (this.m_syncRoot) - { - phyScene.SetTerrain(Terrain.getHeights1D()); - } - } - - // Primitive backup routines - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: Backup() - Backing up Primitives"); - foreach (libsecondlife.LLUUID UUID in Entities.Keys) - { - Entities[UUID].BackUp(); - } - - //Parcel backup routines - ParcelData[] parcels = new ParcelData[parcelManager.parcelList.Count]; - int i = 0; - foreach (OpenSim.Region.Parcel parcel in parcelManager.parcelList.Values) - { - parcels[i] = parcel.parcelData; - i++; - } - localStorage.SaveParcels(parcels); - - // Backup successful - return true; - } - catch (Exception e) - { - // Backup failed - OpenSim.Framework.Console.MainLog.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "World.cs: Backup() - Backup Failed with exception " + e.ToString()); - return false; - } - */ + return true; } #endregion @@ -432,7 +390,7 @@ namespace OpenSim.Region.Environment.Scenes { try { - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs: LoadPrimsFromStorage() - Loading primitives"); + OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs: LoadPrimsFromStorage() - Loading primitives"); this.localStorage.LoadPrimitives(this); } catch (Exception e) @@ -469,13 +427,12 @@ namespace OpenSim.Region.Environment.Scenes { try { - Primitive prim = new Primitive(m_regionHandle, this, addPacket, ownerID, this._primCount); - - this.Entities.Add(prim.uuid, prim); + SceneObject sceneOb = new SceneObject(m_regionHandle, this, addPacket, ownerID, this._primCount); + this.Entities.Add(sceneOb.rootUUID, sceneOb); this._primCount++; // Trigger event for listeners - eventManager.TriggerOnNewPrimitive(prim); + // eventManager.TriggerOnNewPrimitive(prim); } catch (Exception e) { @@ -500,11 +457,11 @@ namespace OpenSim.Region.Environment.Scenes client.OnChatFromViewer += this.SimChat; client.OnRequestWearables += this.InformClientOfNeighbours; client.OnAddPrim += this.AddNewPrim; - client.OnUpdatePrimPosition += this.UpdatePrimPosition; + //client.OnUpdatePrimPosition += this.UpdatePrimPosition; client.OnRequestMapBlocks += this.RequestMapBlocks; client.OnTeleportLocationRequest += this.RequestTeleportLocation; - //remoteClient.OnObjectSelect += this.SelectPrim; - client.OnGrapUpdate += this.MoveObject; + client.OnObjectSelect += this.SelectPrim; + // client.OnGrapUpdate += this.MoveObject; client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); @@ -523,39 +480,39 @@ namespace OpenSim.Region.Environment.Scenes { ScenePresence newAvatar = null; - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); - newAvatar = new ScenePresence(client, this, this.m_regInfo); - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Adding new avatar to world"); - OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs:AddViewerAgent() - Starting RegionHandshake "); + OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); + newAvatar = new ScenePresence(client, this, this.m_regInfo); + OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Adding new avatar to world"); + OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Starting RegionHandshake "); - PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); - lock (this.m_syncRoot) + PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); + lock (this.m_syncRoot) + { + newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); + } + + lock (Entities) + { + if (!Entities.ContainsKey(client.AgentId)) { - newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); + this.Entities.Add(client.AgentId, newAvatar); } - - lock (Entities) + else { - if (!Entities.ContainsKey(client.AgentId)) - { - this.Entities.Add(client.AgentId, newAvatar); - } - else - { - Entities[client.AgentId] = newAvatar; - } + Entities[client.AgentId] = newAvatar; } - lock (Avatars) + } + lock (Avatars) + { + if (Avatars.ContainsKey(client.AgentId)) { - if (Avatars.ContainsKey(client.AgentId)) - { - Avatars[client.AgentId] = newAvatar; - } - else - { - this.Avatars.Add(client.AgentId, newAvatar); - } + Avatars[client.AgentId] = newAvatar; } + else + { + this.Avatars.Add(client.AgentId, newAvatar); + } + } } @@ -634,7 +591,7 @@ namespace OpenSim.Region.Environment.Scenes public void RegisterRegionWithComms() { GridInfo gridSettings = new GridInfo(); - this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo,gridSettings); + this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo, gridSettings); if (this.regionCommsHost != null) { this.regionCommsHost.OnExpectUser += this.NewUserConnection; @@ -757,7 +714,9 @@ namespace OpenSim.Region.Environment.Scenes agent.child = true; this.commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); this.commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position); + remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4)); + } //remoteClient.SendTeleportCancel(); } @@ -771,7 +730,7 @@ namespace OpenSim.Region.Environment.Scenes /// public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position) { - return this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position); + return this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position); } #endregion -- cgit v1.1 From 54ef77f0fda5fabc6f4677e145fafb74d225a77e Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 1 Jul 2007 18:33:44 +0000 Subject: Can change the name and description of a prim. --- OpenSim/Region/Environment/Scenes/Scene.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 2ff3976..08adc84 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -56,7 +56,7 @@ namespace OpenSim.Region.Environment.Scenes { protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer(); protected Dictionary Avatars; - protected Dictionary Prims; + protected Dictionary Prims; private PhysicsScene phyScene; private float timeStep = 0.1f; private Random Rand = new Random(); @@ -124,7 +124,7 @@ namespace OpenSim.Region.Environment.Scenes OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating new entitities instance"); Entities = new Dictionary(); Avatars = new Dictionary(); - Prims = new Dictionary(); + Prims = new Dictionary(); OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating LandMap"); Terrain = new TerrainEngine(); @@ -463,6 +463,8 @@ namespace OpenSim.Region.Environment.Scenes client.OnObjectSelect += this.SelectPrim; // client.OnGrapUpdate += this.MoveObject; client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; + client.OnObjectDescription += this.PrimDescription; + client.OnObjectName += this.PrimName; /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); -- cgit v1.1 From 2852cda727f86567c18c6fab193ed31195c9934c Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 1 Jul 2007 21:04:33 +0000 Subject: More work on SceneObject/Primitive and building (Linking is a work in progress as is all). Committing now as I've finished for the night and will be continued tomorrow. --- OpenSim/Region/Environment/Scenes/Scene.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 08adc84..77058cc 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -461,10 +461,11 @@ namespace OpenSim.Region.Environment.Scenes client.OnRequestMapBlocks += this.RequestMapBlocks; client.OnTeleportLocationRequest += this.RequestTeleportLocation; client.OnObjectSelect += this.SelectPrim; - // client.OnGrapUpdate += this.MoveObject; + client.OnGrapUpdate += this.MoveObject; client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; client.OnObjectDescription += this.PrimDescription; client.OnObjectName += this.PrimName; + client.OnLinkObjects += this.LinkObjects; /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); @@ -585,6 +586,21 @@ namespace OpenSim.Region.Environment.Scenes #endregion + /// + /// + /// + /// + /// + public bool DeleteEntity(LLUUID entID) + { + if (this.Entities.ContainsKey(entID)) + { + this.Entities.Remove(entID); + return true; + } + return false; + } + #region RegionCommsHost /// -- cgit v1.1 From 2d34caabb9e3c346602566f7724c5e21014ed4ed Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sun, 1 Jul 2007 21:16:45 +0000 Subject: * removed try-catchall from scene constructor * added reference server-side addnewprim prototype to Scene - not implementet yet though. --- OpenSim/Region/Environment/Scenes/Scene.cs | 76 +++++++++++++++--------------- 1 file changed, 38 insertions(+), 38 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 77058cc..059bfd7 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -103,40 +103,32 @@ namespace OpenSim.Region.Environment.Scenes /// Region Name for this region public Scene(Dictionary clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) { - try - { - updateLock = new Mutex(false); - this.authenticateHandler = authen; - this.commsManager = commsMan; - this.assetCache = assetCach; - m_clientThreads = clientThreads; - m_regInfo = regInfo; - m_regionHandle = m_regInfo.RegionHandle; - m_regionName = m_regInfo.RegionName; - this.m_datastore = m_regInfo.DataStore; - this.RegisterRegionWithComms(); - - parcelManager = new ParcelManager(this, this.m_regInfo); - estateManager = new EstateManager(this, this.m_regInfo); - scriptManager = new ScriptManager(this); - eventManager = new EventManager(); - - OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating new entitities instance"); - Entities = new Dictionary(); - Avatars = new Dictionary(); - Prims = new Dictionary(); - - OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating LandMap"); - Terrain = new TerrainEngine(); - - ScenePresence.LoadAnims(); - this.httpListener = httpServer; - - } - catch (Exception e) - { - OpenSim.Framework.Console.MainLog.Instance.Error("World.cs: Constructor failed with exception " + e.ToString()); - } + updateLock = new Mutex(false); + this.authenticateHandler = authen; + this.commsManager = commsMan; + this.assetCache = assetCach; + m_clientThreads = clientThreads; + m_regInfo = regInfo; + m_regionHandle = m_regInfo.RegionHandle; + m_regionName = m_regInfo.RegionName; + this.m_datastore = m_regInfo.DataStore; + this.RegisterRegionWithComms(); + + parcelManager = new ParcelManager(this, this.m_regInfo); + estateManager = new EstateManager(this, this.m_regInfo); + scriptManager = new ScriptManager(this); + eventManager = new EventManager(); + + OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating new entitities instance"); + Entities = new Dictionary(); + Avatars = new Dictionary(); + Prims = new Dictionary(); + + OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating LandMap"); + Terrain = new TerrainEngine(); + + ScenePresence.LoadAnims(); + this.httpListener = httpServer; } #endregion @@ -218,7 +210,7 @@ namespace OpenSim.Region.Environment.Scenes /// public bool Backup() { - + return true; } #endregion @@ -432,7 +424,7 @@ namespace OpenSim.Region.Environment.Scenes this._primCount++; // Trigger event for listeners - // eventManager.TriggerOnNewPrimitive(prim); + // eventManager.TriggerOnNewPrimitive(prim); } catch (Exception e) { @@ -440,6 +432,13 @@ namespace OpenSim.Region.Environment.Scenes } } + public override uint AddNewPrim(LLUUID ownerId, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID texture, int flags) + { + uint id = NextLocalId; + + throw new NotImplementedException("Not implemented yet."); + } + #endregion #region Add/Remove Avatar Methods @@ -670,7 +669,7 @@ namespace OpenSim.Region.Environment.Scenes agent.startpos = new LLVector3(128, 128, 70); agent.child = true; this.commsManager.InterRegion.InformRegionOfChildAgent(neighbours[i].RegionHandle, agent); - remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, neighbours[i].ExternalEndPoint ); + remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, neighbours[i].ExternalEndPoint); //this.capsHandlers[remoteClient.AgentId].CreateEstablishAgentComms("", System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr) + ":" + neighbours[i].CommsIPListenPort); } } @@ -733,7 +732,7 @@ namespace OpenSim.Region.Environment.Scenes this.commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); this.commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position); - remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4)); + remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4)); } //remoteClient.SendTeleportCancel(); @@ -752,5 +751,6 @@ namespace OpenSim.Region.Environment.Scenes } #endregion + } } -- cgit v1.1 From 9b6b6d05d45cf0f754a0b26bf6240ef50be66563 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Tue, 3 Jul 2007 14:37:29 +0000 Subject: * Optimized usings (the 'LL ate my scripts' commit) * added some licensing info --- OpenSim/Region/Environment/Scenes/Scene.cs | 70 ++++++++++++++---------------- 1 file changed, 33 insertions(+), 37 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 059bfd7..2bc3f8c 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -26,27 +26,23 @@ * */ using System; -using libsecondlife; -using libsecondlife.Packets; using System.Collections.Generic; -using System.Text; -using System.Reflection; -using System.IO; using System.Threading; using System.Timers; -using OpenSim.Physics.Manager; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using OpenSim.Framework.Inventory; +using libsecondlife; +using libsecondlife.Packets; using OpenSim.Framework; -using OpenSim.Region.Terrain; using OpenSim.Framework.Communications; -using OpenSim.Region.Caches; -using OpenSim.Region.Environment; +using OpenSim.Framework.Console; +using OpenSim.Framework.Interfaces; using OpenSim.Framework.Servers; +using OpenSim.Framework.Types; +using OpenSim.Physics.Manager; +using OpenSim.Region.Caches; using OpenSim.Region.Enviorment.Scripting; -using OpenSim.Region.Capabilities; -using Caps = OpenSim.Region.Capabilities.Caps; +using OpenSim.Region.Terrain; +using Caps=OpenSim.Region.Capabilities.Caps; +using Timer=System.Timers.Timer; namespace OpenSim.Region.Environment.Scenes { @@ -54,9 +50,9 @@ namespace OpenSim.Region.Environment.Scenes public partial class Scene : SceneBase, ILocalStorageReceiver { - protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer(); - protected Dictionary Avatars; - protected Dictionary Prims; + protected Timer m_heartbeatTimer = new Timer(); + protected Dictionary Avatars; + protected Dictionary Prims; private PhysicsScene phyScene; private float timeStep = 0.1f; private Random Rand = new Random(); @@ -119,12 +115,12 @@ namespace OpenSim.Region.Environment.Scenes scriptManager = new ScriptManager(this); eventManager = new EventManager(); - OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating new entitities instance"); - Entities = new Dictionary(); + MainLog.Instance.Verbose("World.cs - creating new entitities instance"); + Entities = new Dictionary(); Avatars = new Dictionary(); Prims = new Dictionary(); - OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating LandMap"); + MainLog.Instance.Verbose("World.cs - creating LandMap"); Terrain = new TerrainEngine(); ScenePresence.LoadAnims(); @@ -151,7 +147,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - void Heartbeat(object sender, System.EventArgs e) + void Heartbeat(object sender, EventArgs e) { this.Update(); } @@ -170,7 +166,7 @@ namespace OpenSim.Region.Environment.Scenes } - foreach (libsecondlife.LLUUID UUID in Entities.Keys) + foreach (LLUUID UUID in Entities.Keys) { Entities[UUID].updateMovement(); } @@ -180,7 +176,7 @@ namespace OpenSim.Region.Environment.Scenes this.phyScene.Simulate(timeStep); } - foreach (libsecondlife.LLUUID UUID in Entities.Keys) + foreach (LLUUID UUID in Entities.Keys) { Entities[UUID].update(); } @@ -198,7 +194,7 @@ namespace OpenSim.Region.Environment.Scenes } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: Update() - Failed with exception " + e.ToString()); + MainLog.Instance.Warn("World.cs: Update() - Failed with exception " + e.ToString()); } updateLock.ReleaseMutex(); @@ -237,14 +233,14 @@ namespace OpenSim.Region.Environment.Scenes this.SendLayerData(client); } - foreach (libsecondlife.LLUUID UUID in Entities.Keys) + foreach (LLUUID UUID in Entities.Keys) { Entities[UUID].LandRenegerated(); } } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); + MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); } } @@ -268,14 +264,14 @@ namespace OpenSim.Region.Environment.Scenes this.SendLayerData(client); } - foreach (libsecondlife.LLUUID UUID in Entities.Keys) + foreach (LLUUID UUID in Entities.Keys) { Entities[UUID].LandRenegerated(); } } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); + MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); } } @@ -301,7 +297,7 @@ namespace OpenSim.Region.Environment.Scenes } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); + MainLog.Instance.Warn("World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); } } @@ -351,7 +347,7 @@ namespace OpenSim.Region.Environment.Scenes } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: LoadWorldMap() - Failed with exception " + e.ToString()); + MainLog.Instance.Warn("World.cs: LoadWorldMap() - Failed with exception " + e.ToString()); } } @@ -382,12 +378,12 @@ namespace OpenSim.Region.Environment.Scenes { try { - OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs: LoadPrimsFromStorage() - Loading primitives"); + MainLog.Instance.Verbose("World.cs: LoadPrimsFromStorage() - Loading primitives"); this.localStorage.LoadPrimitives(this); } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: LoadPrimsFromStorage() - Failed with exception " + e.ToString()); + MainLog.Instance.Warn("World.cs: LoadPrimsFromStorage() - Failed with exception " + e.ToString()); } } @@ -428,7 +424,7 @@ namespace OpenSim.Region.Environment.Scenes } catch (Exception e) { - OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: AddNewPrim() - Failed with exception " + e.ToString()); + MainLog.Instance.Warn("World.cs: AddNewPrim() - Failed with exception " + e.ToString()); } } @@ -482,10 +478,10 @@ namespace OpenSim.Region.Environment.Scenes { ScenePresence newAvatar = null; - OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); + MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); newAvatar = new ScenePresence(client, this, this.m_regInfo); - OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Adding new avatar to world"); - OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Starting RegionHandshake "); + MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Adding new avatar to world"); + MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Starting RegionHandshake "); PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); lock (this.m_syncRoot) @@ -638,7 +634,7 @@ namespace OpenSim.Region.Environment.Scenes } } - public void AgentCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + public void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position) { if (regionHandle == this.m_regInfo.RegionHandle) { -- cgit v1.1 From e06ffb3981d29ddb3383690b4a05dc684813b6d9 Mon Sep 17 00:00:00 2001 From: mingchen Date: Tue, 3 Jul 2007 17:03:14 +0000 Subject: *Removed GridInfo class as it has been previously replaced with the much better NetworkServersInfo class *Got the GridServer in OGS1 to go through with registering the region, but the actual storage of the region isnt working right now. **After this is fixed, grid mode should work! --- OpenSim/Region/Environment/Scenes/Scene.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 2bc3f8c..d13b3ab 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -603,8 +603,8 @@ namespace OpenSim.Region.Environment.Scenes /// public void RegisterRegionWithComms() { - GridInfo gridSettings = new GridInfo(); - this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo, gridSettings); + + this.regionCommsHost = this.commsManager.GridServer.RegisterRegion(this.m_regInfo); if (this.regionCommsHost != null) { this.regionCommsHost.OnExpectUser += this.NewUserConnection; -- cgit v1.1 From bd8018fa1cb32aa42e2a1a41ebb01fc0f1b0a04b Mon Sep 17 00:00:00 2001 From: MW Date: Tue, 3 Jul 2007 20:10:20 +0000 Subject: Today's work on Building support/tools. Think I am slowly getting there. --- OpenSim/Region/Environment/Scenes/Scene.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index d13b3ab..838d722 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -452,7 +452,11 @@ namespace OpenSim.Region.Environment.Scenes client.OnChatFromViewer += this.SimChat; client.OnRequestWearables += this.InformClientOfNeighbours; client.OnAddPrim += this.AddNewPrim; - //client.OnUpdatePrimPosition += this.UpdatePrimPosition; + client.OnUpdatePrimPosition += this.UpdatePrimPosition; + client.OnUpdatePrimRotation += this.UpdatePrimRotation; + client.OnUpdatePrimGroupRotation += this.UpdatePrimRotation; + client.OnUpdatePrimScale += this.UpdatePrimScale; + client.OnUpdatePrimShape += this.UpdatePrimShape; client.OnRequestMapBlocks += this.RequestMapBlocks; client.OnTeleportLocationRequest += this.RequestTeleportLocation; client.OnObjectSelect += this.SelectPrim; @@ -596,6 +600,17 @@ namespace OpenSim.Region.Environment.Scenes return false; } + public void SendAllSceneObjectsToClient(IClientAPI client) + { + foreach (EntityBase ent in Entities.Values) + { + if (ent is SceneObject) + { + ((SceneObject)ent).SendAllChildPrimsToClient(client); + } + } + } + #region RegionCommsHost /// -- cgit v1.1 From beb3073bec9438a439e13eaec40a8320a9279adc Mon Sep 17 00:00:00 2001 From: MW Date: Wed, 4 Jul 2007 19:07:27 +0000 Subject: A bit more work on Building tools/support. updated Axiom.MathLib.dll. --- OpenSim/Region/Environment/Scenes/Scene.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 838d722..0797566 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -453,8 +453,10 @@ namespace OpenSim.Region.Environment.Scenes client.OnRequestWearables += this.InformClientOfNeighbours; client.OnAddPrim += this.AddNewPrim; client.OnUpdatePrimPosition += this.UpdatePrimPosition; + client.OnUpdatePrimSinglePosition += this.UpdatePrimSinglePosition; client.OnUpdatePrimRotation += this.UpdatePrimRotation; client.OnUpdatePrimGroupRotation += this.UpdatePrimRotation; + client.OnUpdatePrimSingleRotation += this.UpdatePrimSingleRotation; client.OnUpdatePrimScale += this.UpdatePrimScale; client.OnUpdatePrimShape += this.UpdatePrimShape; client.OnRequestMapBlocks += this.RequestMapBlocks; -- cgit v1.1 From 3c46e5b170991e41e8c82e25bae65cf46152b924 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 5 Jul 2007 00:09:45 +0000 Subject: * Added Java support back into Sugilite (although it still needs a calling host to be added). --- OpenSim/Region/Environment/Scenes/Scene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 0797566..1f370c4 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -39,7 +39,7 @@ using OpenSim.Framework.Servers; using OpenSim.Framework.Types; using OpenSim.Physics.Manager; using OpenSim.Region.Caches; -using OpenSim.Region.Enviorment.Scripting; +using OpenSim.Region.Environment.Scripting; using OpenSim.Region.Terrain; using Caps=OpenSim.Region.Capabilities.Caps; using Timer=System.Timers.Timer; -- cgit v1.1 From bdab40280b64e31b763a99f6c2011e7e91e7d0fa Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 8 Jul 2007 03:32:27 +0000 Subject: * Added instant message support for the local region. Grid support forthcoming. --- OpenSim/Region/Environment/Scenes/Scene.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 1f370c4..fdf3cc8 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -450,6 +450,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnRegionHandShakeReply += this.SendLayerData; //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); client.OnChatFromViewer += this.SimChat; + client.OnInstantMessage += this.InstantMessage; client.OnRequestWearables += this.InformClientOfNeighbours; client.OnAddPrim += this.AddNewPrim; client.OnUpdatePrimPosition += this.UpdatePrimPosition; -- cgit v1.1 From e8acf1cca92592fea38208dbfe4137555431434d Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Mon, 9 Jul 2007 15:29:39 +0000 Subject: * Begun work on Primitive Duplication. Not hooked up yet, but theoretically could be done so. In practice, more work needs to be done. --- OpenSim/Region/Environment/Scenes/Scene.cs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index fdf3cc8..1798cba 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -57,6 +57,7 @@ namespace OpenSim.Region.Environment.Scenes private float timeStep = 0.1f; private Random Rand = new Random(); private uint _primCount = 702000; + private System.Threading.Mutex _primAllocateMutex = new Mutex(false); private int storageCount; private Mutex updateLock; @@ -397,6 +398,22 @@ namespace OpenSim.Region.Environment.Scenes } /// + /// Returns a new unallocated primitive ID + /// + /// A brand new primitive ID + public uint PrimIDAllocate() + { + uint myID; + + _primAllocateMutex.WaitOne(); + ++_primCount; + myID = _primCount; + _primAllocateMutex.ReleaseMutex(); + + return myID; + } + + /// /// /// /// @@ -415,9 +432,8 @@ namespace OpenSim.Region.Environment.Scenes { try { - SceneObject sceneOb = new SceneObject(m_regionHandle, this, addPacket, ownerID, this._primCount); + SceneObject sceneOb = new SceneObject(m_regionHandle, this, addPacket, ownerID, this.PrimIDAllocate()); this.Entities.Add(sceneOb.rootUUID, sceneOb); - this._primCount++; // Trigger event for listeners // eventManager.TriggerOnNewPrimitive(prim); @@ -468,6 +484,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnObjectDescription += this.PrimDescription; client.OnObjectName += this.PrimName; client.OnLinkObjects += this.LinkObjects; + client.OnObjectDuplicate += this.DuplicateObject; /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); -- cgit v1.1 From 93f3ef7e0d1c7d8b9c578ffdf4e45d9c0d2dde6c Mon Sep 17 00:00:00 2001 From: MW Date: Mon, 9 Jul 2007 15:59:35 +0000 Subject: Done a little bit of renaming in primitive.cs and on a few events in IClientAPI. Disabled CAPS asset uploading as it seems it now crashes the server. --- OpenSim/Region/Environment/Scenes/Scene.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 1798cba..5e08d53 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -469,10 +469,10 @@ namespace OpenSim.Region.Environment.Scenes client.OnInstantMessage += this.InstantMessage; client.OnRequestWearables += this.InformClientOfNeighbours; client.OnAddPrim += this.AddNewPrim; - client.OnUpdatePrimPosition += this.UpdatePrimPosition; + client.OnUpdatePrimGroupPosition += this.UpdatePrimPosition; client.OnUpdatePrimSinglePosition += this.UpdatePrimSinglePosition; - client.OnUpdatePrimRotation += this.UpdatePrimRotation; client.OnUpdatePrimGroupRotation += this.UpdatePrimRotation; + client.OnUpdatePrimGroupMouseRotation += this.UpdatePrimRotation; client.OnUpdatePrimSingleRotation += this.UpdatePrimSingleRotation; client.OnUpdatePrimScale += this.UpdatePrimScale; client.OnUpdatePrimShape += this.UpdatePrimShape; -- cgit v1.1 From 08a1fa3f96eee5e067475da453a3770ff15780f9 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 9 Jul 2007 21:03:36 +0000 Subject: * Introduced ClientManager for great justice. --- OpenSim/Region/Environment/Scenes/Scene.cs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 5e08d53..043dcd7 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -98,7 +98,7 @@ namespace OpenSim.Region.Environment.Scenes /// Dictionary to contain client threads /// Region Handle for this region /// Region Name for this region - public Scene(Dictionary clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) + public Scene(ClientManager clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) { updateLock = new Mutex(false); this.authenticateHandler = authen; @@ -229,11 +229,11 @@ namespace OpenSim.Region.Environment.Scenes } this.localStorage.SaveMap(this.Terrain.getHeights1D()); - foreach (IClientAPI client in m_clientThreads.Values) - { - this.SendLayerData(client); - } - + m_clientThreads.ForEachClient(delegate(IClientAPI client) + { + this.SendLayerData(client); + }); + foreach (LLUUID UUID in Entities.Keys) { Entities[UUID].LandRenegerated(); @@ -260,10 +260,10 @@ namespace OpenSim.Region.Environment.Scenes } this.localStorage.SaveMap(this.Terrain.getHeights1D()); - foreach (IClientAPI client in m_clientThreads.Values) - { - this.SendLayerData(client); - } + m_clientThreads.ForEachClient(delegate(IClientAPI client) + { + this.SendLayerData(client); + }); foreach (LLUUID UUID in Entities.Keys) { @@ -290,10 +290,10 @@ namespace OpenSim.Region.Environment.Scenes { /* Dont save here, rely on tainting system instead */ - foreach (IClientAPI client in m_clientThreads.Values) - { - this.SendLayerData(pointx, pointy, client); - } + m_clientThreads.ForEachClient(delegate(IClientAPI client) + { + this.SendLayerData(pointx, pointy, client); + }); } } catch (Exception e) -- cgit v1.1 From 85dd493614cda12488eb7920713ddda07c921dbc Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 9 Jul 2007 21:25:43 +0000 Subject: * some follow up renaming of members et c. --- OpenSim/Region/Environment/Scenes/Scene.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 043dcd7..81c56c4 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -98,13 +98,13 @@ namespace OpenSim.Region.Environment.Scenes /// Dictionary to contain client threads /// Region Handle for this region /// Region Name for this region - public Scene(ClientManager clientThreads, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) + public Scene(ClientManager clientManager, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer) { updateLock = new Mutex(false); this.authenticateHandler = authen; this.commsManager = commsMan; this.assetCache = assetCach; - m_clientThreads = clientThreads; + m_clientManager = clientManager; m_regInfo = regInfo; m_regionHandle = m_regInfo.RegionHandle; m_regionName = m_regInfo.RegionName; @@ -229,7 +229,7 @@ namespace OpenSim.Region.Environment.Scenes } this.localStorage.SaveMap(this.Terrain.getHeights1D()); - m_clientThreads.ForEachClient(delegate(IClientAPI client) + m_clientManager.ForEachClient(delegate(IClientAPI client) { this.SendLayerData(client); }); @@ -260,7 +260,7 @@ namespace OpenSim.Region.Environment.Scenes } this.localStorage.SaveMap(this.Terrain.getHeights1D()); - m_clientThreads.ForEachClient(delegate(IClientAPI client) + m_clientManager.ForEachClient(delegate(IClientAPI client) { this.SendLayerData(client); }); @@ -290,7 +290,7 @@ namespace OpenSim.Region.Environment.Scenes { /* Dont save here, rely on tainting system instead */ - m_clientThreads.ForEachClient(delegate(IClientAPI client) + m_clientManager.ForEachClient(delegate(IClientAPI client) { this.SendLayerData(pointx, pointy, client); }); -- cgit v1.1 From 7f03246653a6f277505d2055528cbb8dd2e1f4c1 Mon Sep 17 00:00:00 2001 From: MW Date: Tue, 10 Jul 2007 17:56:31 +0000 Subject: Gird mode in sugilite should now work in so far as you should be able to login and move between regions in the same instance. Moving to regions in a different instance of opensim still needs implementing (working on it now). Also trying to look at the map in grid mode will crash the server. --- OpenSim/Region/Environment/Scenes/Scene.cs | 3 --- 1 file changed, 3 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 81c56c4..cd81384 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -685,15 +685,12 @@ namespace OpenSim.Region.Environment.Scenes /// public void InformClientOfNeighbours(IClientAPI remoteClient) { - // Console.WriteLine("informing client of neighbouring regions"); List neighbours = this.commsManager.GridServer.RequestNeighbours(this.m_regInfo); - //Console.WriteLine("we have " + neighbours.Count + " neighbouring regions"); if (neighbours != null) { for (int i = 0; i < neighbours.Count; i++) { - // Console.WriteLine("sending neighbours data"); AgentCircuitData agent = remoteClient.RequestClientInfo(); agent.BaseFolder = LLUUID.Zero; agent.InventoryFolder = LLUUID.Zero; -- cgit v1.1 From 561b87b303e8e141ef516b8725ebd3c0be8b1122 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Wed, 11 Jul 2007 02:51:51 +0000 Subject: * Applying dalien's patches from bug#177 and #179 --- OpenSim/Region/Environment/Scenes/Scene.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index cd81384..d1f6038 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -546,6 +546,28 @@ namespace OpenSim.Region.Environment.Scenes { eventManager.TriggerOnRemovePresence(agentID); + ScenePresence avatar = this.RequestAvatar(agentID); + + m_clientManager.ForEachClient( + delegate(IClientAPI client) + { + client.SendKillObject(avatar.RegionHandle, avatar.LocalId); + }); + + lock (Avatars) { + if (Avatars.ContainsKey(agentID)) { + Avatars.Remove(agentID); + } + } + lock (Entities) { + if (Entities.ContainsKey(agentID)) { + Entities.Remove(agentID); + } + } + // TODO: Add the removal from physics ? + + + return; } #endregion -- cgit v1.1