From f1e13468069b8dc2719b12f0bc9bb3cc0d999e2a Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 31 May 2007 10:12:55 +0000 Subject: Added a few summary comments to OpenSim.World files --- OpenSim/OpenSim.World/Avatar.Client.cs | 15 +++ OpenSim/OpenSim.World/Avatar.Update.cs | 48 +++++++++- OpenSim/OpenSim.World/Avatar.cs | 50 +++++++++- OpenSim/OpenSim.World/AvatarAnimations.cs | 6 ++ OpenSim/OpenSim.World/Entity.cs | 24 ++++- OpenSim/OpenSim.World/SceneObject.cs | 23 +++++ OpenSim/OpenSim.World/World.PacketHandlers.cs | 82 ++++++++++++++++ OpenSim/OpenSim.World/World.Scripting.cs | 33 +++++++ OpenSim/OpenSim.World/World.cs | 133 ++++++++------------------ OpenSim/OpenSim.World/WorldBase.cs | 17 ++++ OpenSim/OpenSim.World/types/Mesh.cs | 13 +++ OpenSim/OpenSim.World/types/Triangle.cs | 9 ++ OpenSim/OpenSim/OpenSimMain.cs | 3 +- 13 files changed, 351 insertions(+), 105 deletions(-) diff --git a/OpenSim/OpenSim.World/Avatar.Client.cs b/OpenSim/OpenSim.World/Avatar.Client.cs index 7656a89..2338f27 100644 --- a/OpenSim/OpenSim.World/Avatar.Client.cs +++ b/OpenSim/OpenSim.World/Avatar.Client.cs @@ -10,21 +10,36 @@ namespace OpenSim.world private List updateList = new List(); private List interestList = new List(); + /// + /// Forwards a packet to the Avatar's client (IClientAPI object). + /// Note: Quite likely to be obsolete once the Client API is finished + /// + /// public void SendPacketToViewer(Packet packet) { this.ControllingClient.OutPacket(packet); } + /// + /// + /// + /// public void AddTerseUpdateToViewersList(ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock) { } + /// + /// + /// public void SendUpdateListToViewer() { } + /// + /// + /// private void UpdateInterestList() { diff --git a/OpenSim/OpenSim.World/Avatar.Update.cs b/OpenSim/OpenSim.World/Avatar.Update.cs index c8d92ec..478f224 100644 --- a/OpenSim/OpenSim.World/Avatar.Update.cs +++ b/OpenSim/OpenSim.World/Avatar.Update.cs @@ -10,65 +10,109 @@ namespace OpenSim.world { partial class Avatar { + /// + /// + /// public override void update() { } + /// + /// + /// + /// public void SendUpdateToOtherClient(Avatar remoteAvatar) { } + /// + /// + /// + /// public ObjectUpdatePacket CreateUpdatePacket() { return null; } + /// + /// + /// public void SendInitialPosition() { Console.WriteLine("sending initial Avatar data"); this.ControllingClient.SendAvatarData(this.regionData, this.firstname, this.lastname, this.uuid, this.localid, new LLVector3(128, 128, 60)); } + /// + /// + /// public void SendOurAppearance() { } - + + /// + /// + /// + /// public void SendOurAppearance(IClientAPI OurClient) { this.ControllingClient.SendWearables(this.Wearables); } + /// + /// + /// + /// public void SendAppearanceToOtherAgent(Avatar avatarInfo) { } + /// + /// + /// + /// + /// public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) { } + /// + /// + /// public void StopMovement() { } + /// + /// Very likely to be deleted soon! + /// + /// public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock() { return null; } - // Sends animation update + /// + /// + /// + /// + /// public void SendAnimPack(LLUUID animID, int seq) { } + /// + /// + /// public void SendAnimPack() { diff --git a/OpenSim/OpenSim.World/Avatar.cs b/OpenSim/OpenSim.World/Avatar.cs index 1c22977..ecd938b 100644 --- a/OpenSim/OpenSim.World/Avatar.cs +++ b/OpenSim/OpenSim.World/Avatar.cs @@ -39,6 +39,13 @@ namespace OpenSim.world private bool childAvatar = false; private RegionInfo regionData; + /// + /// + /// + /// + /// + /// + /// public Avatar(IClientAPI theClient, World world, Dictionary clientThreads, RegionInfo regionDat) { @@ -84,6 +91,9 @@ namespace OpenSim.world * */ } + /// + /// + /// public PhysicsActor PhysActor { set @@ -96,21 +106,36 @@ namespace OpenSim.world } } + /// + /// + /// + /// public void ChildStatusChange(bool status) { } - + + /// + /// + /// public override void addForces() { } + /// + /// likely to removed very soon + /// + /// public static void SetupTemplate(string name) { } + /// + /// likely to removed very soon + /// + /// protected static void SetDefaultPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata) { @@ -118,32 +143,51 @@ namespace OpenSim.world } + /// + /// + /// public void CompleteMovement() { this.ControllingClient.MoveAgentIntoRegion(this.regionData); } + /// + /// + /// + /// public void HandleAgentUpdate(Packet pack) { this.HandleUpdate((AgentUpdatePacket)pack); } + /// + /// + /// + /// public void HandleUpdate(AgentUpdatePacket pack) { } - //really really should be moved somewhere else (RegionInfo.cs ?) + /// + /// + /// public void SendRegionHandshake() { this.ControllingClient.SendRegionHandshake(this.regionData); } + /// + /// + /// public static void LoadAnims() { } - + + /// + /// + /// public override void LandRenegerated() { diff --git a/OpenSim/OpenSim.World/AvatarAnimations.cs b/OpenSim/OpenSim.World/AvatarAnimations.cs index b554af8..21de457 100644 --- a/OpenSim/OpenSim.World/AvatarAnimations.cs +++ b/OpenSim/OpenSim.World/AvatarAnimations.cs @@ -11,10 +11,16 @@ namespace OpenSim.world public Dictionary AnimsLLUUID = new Dictionary(); public Dictionary AnimsNames = new Dictionary(); + /// + /// + /// public AvatarAnimations() { } + /// + /// + /// public void LoadAnims() { OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Avatar.cs:LoadAnims() - Loading avatar animations"); diff --git a/OpenSim/OpenSim.World/Entity.cs b/OpenSim/OpenSim.World/Entity.cs index 96e039a..b14beed 100644 --- a/OpenSim/OpenSim.World/Entity.cs +++ b/OpenSim/OpenSim.World/Entity.cs @@ -16,17 +16,22 @@ namespace OpenSim.world public LLVector3 velocity; public Quaternion rotation; protected List children; - + protected LLVector3 m_pos; + protected PhysicsActor _physActor; + protected World m_world; protected string m_name; + + /// + /// + /// public virtual string Name { get { return m_name; } } - protected LLVector3 m_pos; - protected PhysicsActor _physActor; - protected World m_world; - + /// + /// + /// public virtual LLVector3 Pos { get @@ -76,6 +81,9 @@ namespace OpenSim.world children = new List(); } + /// + /// + /// public virtual void addForces() { foreach (Entity child in children) @@ -111,11 +119,17 @@ namespace OpenSim.world return mesh; } + /// + /// Called at a set interval to inform entities that they should back themsleves up to the DB + /// public virtual void BackUp() { } + /// + /// Infoms the entity that the land (heightmap) has changed + /// public virtual void LandRenegerated() { diff --git a/OpenSim/OpenSim.World/SceneObject.cs b/OpenSim/OpenSim.World/SceneObject.cs index d78c7a2..9ed99ba 100644 --- a/OpenSim/OpenSim.World/SceneObject.cs +++ b/OpenSim/OpenSim.World/SceneObject.cs @@ -18,30 +18,53 @@ namespace OpenSim.world private Dictionary m_clientThreads; private World m_world; + /// + /// + /// public SceneObject() { } + /// + /// + /// + /// + /// + /// public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) { } + /// + /// + /// + /// public void CreateFromBytes(byte[] data) { } + /// + /// + /// public override void update() { } + /// + /// + /// public override void BackUp() { } + /// + /// + /// + /// public void GetProperites(IClientAPI client) { /* diff --git a/OpenSim/OpenSim.World/World.PacketHandlers.cs b/OpenSim/OpenSim.World/World.PacketHandlers.cs index 9bd09f0..dd340d7 100644 --- a/OpenSim/OpenSim.World/World.PacketHandlers.cs +++ b/OpenSim/OpenSim.World/World.PacketHandlers.cs @@ -13,6 +13,12 @@ namespace OpenSim.world { public partial class World { + /// + /// + /// + /// + /// + /// public void ModifyTerrain(byte action, float north, float west) { switch (action) @@ -31,6 +37,14 @@ namespace OpenSim.world return; } + /// + /// + /// + /// + /// + /// + /// + /// public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { Console.WriteLine("Chat message"); @@ -79,59 +93,127 @@ namespace OpenSim.world } } + /// + /// + /// + /// + /// public void RezObject(AssetBase primAsset, LLVector3 pos) { } + /// + /// + /// + /// + /// public void DeRezObject(Packet packet, IClientAPI simClient) { } + /// + /// + /// + /// public void SendAvatarsToClient(IClientAPI remoteClient) { } + /// + /// + /// + /// + /// public void LinkObjects(uint parentPrim, List childPrims) { } + /// + /// + /// + /// + /// public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock) { } + /// + /// + /// + /// + /// public void SelectPrim(uint primLocalID, IClientAPI remoteClient) { } + /// + /// + /// + /// + /// + /// public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient) { } + /// + /// + /// + /// + /// + /// public void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient) { } + /// + /// + /// + /// + /// + /// public void UpdatePrimPosition(uint localID, LLVector3 pos, IClientAPI remoteClient) { } + /// + /// + /// + /// + /// + /// public void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient) { } + /// + /// + /// + /// + /// + /// public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient) { } + + /// + /// Sends prims to a client + /// + /// Client to send to + public void GetInitialPrims(IClientAPI RemoteClient) + { + + } } } diff --git a/OpenSim/OpenSim.World/World.Scripting.cs b/OpenSim/OpenSim.World/World.Scripting.cs index 24d887c..048a97f 100644 --- a/OpenSim/OpenSim.World/World.Scripting.cs +++ b/OpenSim/OpenSim.World/World.Scripting.cs @@ -14,11 +14,17 @@ namespace OpenSim.world { private Dictionary scriptEngines = new Dictionary(); + /// + /// + /// private void LoadScriptEngines() { this.LoadScriptPlugins(); } + /// + /// + /// public void LoadScriptPlugins() { string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "ScriptEngines"); @@ -31,6 +37,10 @@ namespace OpenSim.world } } + /// + /// + /// + /// private void AddPlugin(string FileName) { Assembly pluginAssembly = Assembly.LoadFrom(FileName); @@ -59,6 +69,13 @@ namespace OpenSim.world pluginAssembly = null; } + /// + /// + /// + /// + /// + /// + /// public void LoadScript(string scriptType, string scriptName, string script, Entity ent) { if(this.scriptEngines.ContainsKey(scriptType)) @@ -69,6 +86,11 @@ namespace OpenSim.world #region IScriptAPI Methods + /// + /// + /// + /// + /// public OSVector3 GetEntityPosition(uint localID) { OSVector3 res = new OSVector3(); @@ -85,6 +107,13 @@ namespace OpenSim.world return res; } + /// + /// + /// + /// + /// + /// + /// public void SetEntityPosition(uint localID, float x , float y, float z) { foreach (Entity entity in this.Entities.Values) @@ -103,6 +132,10 @@ namespace OpenSim.world } + /// + /// + /// + /// public uint GetRandomAvatarID() { //Console.WriteLine("script- getting random avatar id"); diff --git a/OpenSim/OpenSim.World/World.cs b/OpenSim/OpenSim.World/World.cs index 29c75e8..77af862 100644 --- a/OpenSim/OpenSim.World/World.cs +++ b/OpenSim/OpenSim.World/World.cs @@ -36,6 +36,9 @@ namespace OpenSim.world public string m_datastore; #region Properties + /// + /// + /// public PhysicsScene PhysScene { set @@ -79,12 +82,11 @@ namespace OpenSim.world TerrainManager = new TerrainManager(new SecondLife()); Terrain = new TerrainEngine(); Avatar.SetupTemplate("avatar-texture.dat"); - // MainConsole.Instance.WriteLine("World.cs - Creating script engine instance"); - // Initialise this only after the world has loaded - // Scripts = new ScriptEngine(this); + Avatar.LoadAnims(); - this.SetDefaultScripts(); - this.LoadScriptEngines(); + + //this.SetDefaultScripts(); + //this.LoadScriptEngines(); } @@ -95,6 +97,9 @@ namespace OpenSim.world } #endregion + /// + /// + /// public void StartTimer() { m_heartbeatTimer.Enabled = true; @@ -102,79 +107,7 @@ namespace OpenSim.world m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat); } - #region Script Methods - /// - /// Loads a new script into the specified entity - /// - /// Entity to be scripted - /// The script to load - public void AddScript(Entity entity, Script script) - { - try - { - ScriptHandler scriptHandler = new ScriptHandler(script, entity, this); - m_scriptHandlers.Add(scriptHandler.ScriptId, scriptHandler); - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: AddScript() - Failed with exception " + e.ToString()); - } - } - - /// - /// Loads a new script into the specified entity, using a script loaded from a string. - /// - /// The entity to be scripted - /// The string containing the script - public void AddScript(Entity entity, string scriptData) - { - try - { - int scriptstart = 0; - int scriptend = 0; - string substring; - scriptstart = scriptData.LastIndexOf(""); - substring = scriptData.Substring(scriptstart + 8, scriptend - scriptstart - 8); - substring = substring.Trim(); - //Console.WriteLine("searching for script to add: " + substring); - - ScriptFactory scriptFactory; - //Console.WriteLine("script string is " + substring); - if (substring.StartsWith("'); - string sName = substring1.Substring(0, end); - //Console.WriteLine(" script info : " + sEngine + " , " + sName); - int startscript = substring.IndexOf('>'); - script = substring.Remove(0, startscript + 1); - // Console.WriteLine("script data is " + script); - if (this.scriptEngines.ContainsKey(sEngine)) - { - this.scriptEngines[sEngine].LoadScript(script, sName, entity.localid); - } - } - else if (this.m_scripts.TryGetValue(substring, out scriptFactory)) - { - //Console.WriteLine("added script"); - this.AddScript(entity, scriptFactory()); - } - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: AddScript() - Failed with exception " + e.ToString()); - } - } - - #endregion - + #region Update Methods @@ -240,6 +173,10 @@ namespace OpenSim.world updateLock.ReleaseMutex(); } + /// + /// + /// + /// public bool Backup() { try @@ -321,14 +258,6 @@ namespace OpenSim.world } } - public void SetDefaultScripts() - { - this.m_scripts.Add("FollowRandomAvatar", delegate() - { - return new OpenSim.RegionServer.world.scripting.FollowRandomAvatar(); - }); - } - #endregion #region Regenerate Terrain @@ -453,14 +382,6 @@ namespace OpenSim.world #region Primitives Methods - /// - /// Sends prims to a client - /// - /// Client to send to - public void GetInitialPrims(IClientAPI RemoteClient) - { - - } /// /// Loads the World's objects @@ -487,11 +408,21 @@ namespace OpenSim.world } + /// + /// + /// + /// + /// public void AddNewPrim(Packet addPacket, IClientAPI agentClient) { AddNewPrim((ObjectAddPacket)addPacket, agentClient.AgentId); } + /// + /// + /// + /// + /// public void AddNewPrim(ObjectAddPacket addPacket, LLUUID ownerID) { @@ -501,6 +432,12 @@ namespace OpenSim.world #region Add/Remove Avatar Methods + /// + /// + /// + /// + /// + /// public override void AddNewAvatar(IClientAPI remoteClient, LLUUID agentID, bool child) { remoteClient.OnRegionHandShakeReply += new GenericCall(this.SendLayerData); @@ -552,6 +489,10 @@ namespace OpenSim.world return; } + /// + /// + /// + /// public override void RemoveAvatar(LLUUID agentID) { return; @@ -562,6 +503,10 @@ namespace OpenSim.world //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. + /// + /// + /// + /// public List RequestAvatarList() { List result = new List(); diff --git a/OpenSim/OpenSim.World/WorldBase.cs b/OpenSim/OpenSim.World/WorldBase.cs index 4371b6d..19a8fb5 100644 --- a/OpenSim/OpenSim.World/WorldBase.cs +++ b/OpenSim/OpenSim.World/WorldBase.cs @@ -49,6 +49,9 @@ namespace OpenSim.world #endregion #region Constructors + /// + /// + /// public WorldBase() { @@ -101,11 +104,21 @@ namespace OpenSim.world #endregion #region Add/Remove Agent/Avatar + /// + /// + /// + /// + /// + /// public virtual void AddNewAvatar(IClientAPI remoteClient, LLUUID agentID, bool child) { return ; } + /// + /// + /// + /// public virtual void RemoveAvatar(LLUUID agentID) { return ; @@ -113,6 +126,10 @@ namespace OpenSim.world #endregion + /// + /// + /// + /// public virtual RegionInfo GetRegionInfo() { return null; diff --git a/OpenSim/OpenSim.World/types/Mesh.cs b/OpenSim/OpenSim.World/types/Mesh.cs index 3e00c91..ff0cc65 100644 --- a/OpenSim/OpenSim.World/types/Mesh.cs +++ b/OpenSim/OpenSim.World/types/Mesh.cs @@ -9,16 +9,29 @@ namespace OpenSim.types { public List mesh; + /// + /// + /// public Mesh() { mesh = new List(); } + /// + /// + /// + /// public void AddTri(Triangle tri) { mesh.Add(tri); } + /// + /// + /// + /// + /// + /// public static Mesh operator +(Mesh a, Mesh b) { a.mesh.AddRange(b.mesh); diff --git a/OpenSim/OpenSim.World/types/Triangle.cs b/OpenSim/OpenSim.World/types/Triangle.cs index 8dfea6e..07c0a91 100644 --- a/OpenSim/OpenSim.World/types/Triangle.cs +++ b/OpenSim/OpenSim.World/types/Triangle.cs @@ -11,6 +11,9 @@ namespace OpenSim.types Vector3 b; Vector3 c; + /// + /// + /// public Triangle() { a = new Vector3(); @@ -18,6 +21,12 @@ namespace OpenSim.types c = new Vector3(); } + /// + /// + /// + /// + /// + /// public Triangle(Vector3 A, Vector3 B, Vector3 C) { a = A; diff --git a/OpenSim/OpenSim/OpenSimMain.cs b/OpenSim/OpenSim/OpenSimMain.cs index acbc15e..0a30928 100644 --- a/OpenSim/OpenSim/OpenSimMain.cs +++ b/OpenSim/OpenSim/OpenSimMain.cs @@ -94,6 +94,7 @@ namespace OpenSim this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change ClientView.TerrainManager = new TerrainManager(new SecondLife()); + if (m_sandbox) { this.SetupLocalGridServers(); @@ -138,7 +139,7 @@ namespace OpenSim m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting HTTP server"); httpServer.Start(); - // Start UDP server + // Start UDP servers for (int i = 0; i < m_udpServer.Count; i++) { this.m_udpServer[i].ServerListener(); -- cgit v1.1