From 4224b695acc2e1ad0199dc0ad7f560494182ed54 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sat, 9 Jun 2007 21:45:58 +0000 Subject: * LogFile now defaults to "{apptype}.log" * cleaned away suo and user files. * added handy string chat variety to the API * Moved LockPhysicsEngine on World to SyncRoot on IWorld * Introduced NextLocalId instead of World fuggliness. * Transformed GetRegionInfo to Property on IWorld for great justice * Extracted default wearables (good to have) * Deleted unused BaseServer * Used IWorld instead of World wherever possible * The client constructor's not getting unused port any longer. * Extracted ClientView factoring so PacketServer can be tweaked. * Added SendLayerData to World * Made WorldBase abstract and cleaned it up a bit * added OpenGrid.Framework.Communications.dll.build and OpenSim.World.dll.build to svn * Added code for two examples (but not in prebuild yet) --- OpenSim/OpenSim.World/Avatar.cs | 11 +-- OpenSim/OpenSim.World/Entity.cs | 2 +- OpenSim/OpenSim.World/OpenSim.World.csproj | 32 ++++----- OpenSim/OpenSim.World/OpenSim.World.csproj.user | 12 ---- OpenSim/OpenSim.World/OpenSim.World.dll.build | 71 +++++++++++++++++++ OpenSim/OpenSim.World/World.cs | 18 +++-- OpenSim/OpenSim.World/WorldBase.cs | 91 ++++++++----------------- 7 files changed, 129 insertions(+), 108 deletions(-) delete mode 100644 OpenSim/OpenSim.World/OpenSim.World.csproj.user create mode 100644 OpenSim/OpenSim.World/OpenSim.World.dll.build (limited to 'OpenSim/OpenSim.World') diff --git a/OpenSim/OpenSim.World/Avatar.cs b/OpenSim/OpenSim.World/Avatar.cs index c251d57..4ab576c 100644 --- a/OpenSim/OpenSim.World/Avatar.cs +++ b/OpenSim/OpenSim.World/Avatar.cs @@ -55,21 +55,16 @@ namespace OpenSim.world ControllingClient = theClient; this.firstname = ControllingClient.FirstName; this.lastname = ControllingClient.LastName; - localid = 8880000 + (this.m_world._localNumber++); + localid = this.m_world.NextLocalId; Pos = ControllingClient.StartPos; visualParams = new byte[218]; for (int i = 0; i < 218; i++) { visualParams[i] = 100; } - Wearables = new AvatarWearable[13]; //should be 13 of these - for (int i = 0; i < 13; i++) - { - Wearables[i] = new AvatarWearable(); - } - this.Wearables[0].AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); - this.Wearables[0].ItemID = LLUUID.Random(); + Wearables = AvatarWearable.DefaultWearables; + this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); Console.WriteLine("avatar point 4"); diff --git a/OpenSim/OpenSim.World/Entity.cs b/OpenSim/OpenSim.World/Entity.cs index b14beed..dd5f9a6 100644 --- a/OpenSim/OpenSim.World/Entity.cs +++ b/OpenSim/OpenSim.World/Entity.cs @@ -51,7 +51,7 @@ namespace OpenSim.world { try { - lock (this.m_world.LockPhysicsEngine) + lock (this.m_world.SyncRoot) { this._physActor.Position = new PhysicsVector(value.X, value.Y, value.Z); diff --git a/OpenSim/OpenSim.World/OpenSim.World.csproj b/OpenSim/OpenSim.World/OpenSim.World.csproj index f2fb596..46803d6 100644 --- a/OpenSim/OpenSim.World/OpenSim.World.csproj +++ b/OpenSim/OpenSim.World/OpenSim.World.csproj @@ -130,58 +130,58 @@ - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code Code - + Code - + Code - + Code Code - + Code diff --git a/OpenSim/OpenSim.World/OpenSim.World.csproj.user b/OpenSim/OpenSim.World/OpenSim.World.csproj.user deleted file mode 100644 index 082d673..0000000 --- a/OpenSim/OpenSim.World/OpenSim.World.csproj.user +++ /dev/null @@ -1,12 +0,0 @@ - - - Debug - AnyCPU - C:\sugilite\bin\ - 8.0.50727 - ProjectFiles - 0 - - - - diff --git a/OpenSim/OpenSim.World/OpenSim.World.dll.build b/OpenSim/OpenSim.World/OpenSim.World.dll.build new file mode 100644 index 0000000..3fa534e --- /dev/null +++ b/OpenSim/OpenSim.World/OpenSim.World.dll.build @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/OpenSim.World/World.cs b/OpenSim/OpenSim.World/World.cs index 011e39a..7ef06e2 100644 --- a/OpenSim/OpenSim.World/World.cs +++ b/OpenSim/OpenSim.World/World.cs @@ -23,10 +23,8 @@ namespace OpenSim.world public partial class World : WorldBase, ILocalStorageReceiver, IScriptAPI { protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer(); - public object LockPhysicsEngine = new object(); protected Dictionary Avatars; protected Dictionary Prims; - public uint _localNumber = 0; private PhysicsScene phyScene; private float timeStep = 0.1f; public ILocalStorage localStorage; @@ -59,6 +57,7 @@ namespace OpenSim.world return (this.phyScene); } } + #endregion #region Constructors @@ -155,7 +154,7 @@ namespace OpenSim.world Entities[UUID].addForces(); } - lock (this.LockPhysicsEngine) + lock (this.m_syncRoot) { this.phyScene.Simulate(timeStep); } @@ -203,7 +202,7 @@ namespace OpenSim.world OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: Backup() - Terrain tainted, saving."); localStorage.SaveMap(Terrain.getHeights1D()); OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: Backup() - Terrain saved, informing Physics."); - lock (this.LockPhysicsEngine) + lock (this.m_syncRoot) { phyScene.SetTerrain(Terrain.getHeights1D()); } @@ -297,7 +296,7 @@ namespace OpenSim.world { Terrain.hills(); - lock (this.LockPhysicsEngine) + lock (this.m_syncRoot) { this.phyScene.SetTerrain(Terrain.getHeights1D()); } @@ -328,7 +327,7 @@ namespace OpenSim.world try { this.Terrain.setHeights2D(newMap); - lock (this.LockPhysicsEngine) + lock (this.m_syncRoot) { this.phyScene.SetTerrain(this.Terrain.getHeights1D()); } @@ -483,7 +482,7 @@ namespace OpenSim.world this.estateManager.sendRegionHandshake(remoteClient); PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); - lock (this.LockPhysicsEngine) + lock (this.m_syncRoot) { newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); } @@ -612,5 +611,10 @@ namespace OpenSim.world } #endregion + + public override void SendLayerData(int px, int py, IClientAPI RemoteClient) + { + RemoteClient.SendLayerData( Terrain.getHeights1D() ); + } } } diff --git a/OpenSim/OpenSim.World/WorldBase.cs b/OpenSim/OpenSim.World/WorldBase.cs index 19a8fb5..92bc6a3 100644 --- a/OpenSim/OpenSim.World/WorldBase.cs +++ b/OpenSim/OpenSim.World/WorldBase.cs @@ -15,61 +15,25 @@ using OpenSim.Terrain; namespace OpenSim.world { - public class WorldBase : IWorld + public abstract class WorldBase : IWorld { public Dictionary Entities; protected Dictionary m_clientThreads; protected ulong m_regionHandle; protected string m_regionName; - // protected InventoryCache _inventoryCache; - // protected AssetCache _assetCache; protected RegionInfo m_regInfo; public TerrainEngine Terrain; //TODO: Replace TerrainManager with this. protected libsecondlife.TerrainManager TerrainManager; // To be referenced via TerrainEngine - - #region Properties - /* - public InventoryCache InventoryCache - { - set - { - this._inventoryCache = value; - } - } - - public AssetCache AssetCache - { - set - { - this._assetCache = value; - } - } - */ - #endregion - - #region Constructors - /// - /// - /// - public WorldBase() - { - - } - #endregion - - #region Setup Methods - - #endregion + protected object m_syncRoot = new object(); + private uint m_nextLocalId = 8880000; #region Update Methods /// /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation) /// - public virtual void Update() - { + public abstract void Update(); - } #endregion #region Terrain Methods @@ -77,11 +41,8 @@ namespace OpenSim.world /// /// Loads the World heightmap /// - public virtual void LoadWorldMap() - { - - } - + public abstract void LoadWorldMap(); + /// /// Send the region heightmap to the client /// @@ -97,10 +58,8 @@ namespace OpenSim.world /// Patch coordinate (x) 0..16 /// Patch coordinate (y) 0..16 /// The client to send to - public void SendLayerData(int px, int py, IClientAPI RemoteClient) - { - - } + public abstract void SendLayerData(int px, int py, IClientAPI RemoteClient); + #endregion #region Add/Remove Agent/Avatar @@ -110,39 +69,43 @@ namespace OpenSim.world /// /// /// - public virtual void AddNewAvatar(IClientAPI remoteClient, LLUUID agentID, bool child) - { - return ; - } - + public abstract void AddNewAvatar(IClientAPI remoteClient, LLUUID agentID, bool child); + /// /// /// /// - public virtual void RemoveAvatar(LLUUID agentID) - { - return ; - } - + public abstract void RemoveAvatar(LLUUID agentID); + #endregion /// /// /// /// - public virtual RegionInfo GetRegionInfo() + public virtual RegionInfo RegionInfo + { + get { return null; } + } + + public object SyncRoot + { + get { return m_syncRoot; } + } + + public uint NextLocalId { - return null; + get { return m_nextLocalId++; } } #region Shutdown /// /// Tidy before shutdown /// - public virtual void Close() - { + public abstract void Close(); - } #endregion + + } } -- cgit v1.1