aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.World/World.cs
diff options
context:
space:
mode:
authorMW2007-05-31 10:12:55 +0000
committerMW2007-05-31 10:12:55 +0000
commitf1e13468069b8dc2719b12f0bc9bb3cc0d999e2a (patch)
tree133e7386341314afa4d7acdc6b8ec0634ce06af1 /OpenSim/OpenSim.World/World.cs
parentAs its my last commit for the day, it just looks better to leave it on a even... (diff)
downloadopensim-SC-f1e13468069b8dc2719b12f0bc9bb3cc0d999e2a.zip
opensim-SC-f1e13468069b8dc2719b12f0bc9bb3cc0d999e2a.tar.gz
opensim-SC-f1e13468069b8dc2719b12f0bc9bb3cc0d999e2a.tar.bz2
opensim-SC-f1e13468069b8dc2719b12f0bc9bb3cc0d999e2a.tar.xz
Added a few summary comments to OpenSim.World files
Diffstat (limited to 'OpenSim/OpenSim.World/World.cs')
-rw-r--r--OpenSim/OpenSim.World/World.cs133
1 files changed, 39 insertions, 94 deletions
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
36 public string m_datastore; 36 public string m_datastore;
37 37
38 #region Properties 38 #region Properties
39 /// <summary>
40 ///
41 /// </summary>
39 public PhysicsScene PhysScene 42 public PhysicsScene PhysScene
40 { 43 {
41 set 44 set
@@ -79,12 +82,11 @@ namespace OpenSim.world
79 TerrainManager = new TerrainManager(new SecondLife()); 82 TerrainManager = new TerrainManager(new SecondLife());
80 Terrain = new TerrainEngine(); 83 Terrain = new TerrainEngine();
81 Avatar.SetupTemplate("avatar-texture.dat"); 84 Avatar.SetupTemplate("avatar-texture.dat");
82 // MainConsole.Instance.WriteLine("World.cs - Creating script engine instance"); 85
83 // Initialise this only after the world has loaded
84 // Scripts = new ScriptEngine(this);
85 Avatar.LoadAnims(); 86 Avatar.LoadAnims();
86 this.SetDefaultScripts(); 87
87 this.LoadScriptEngines(); 88 //this.SetDefaultScripts();
89 //this.LoadScriptEngines();
88 90
89 91
90 } 92 }
@@ -95,6 +97,9 @@ namespace OpenSim.world
95 } 97 }
96 #endregion 98 #endregion
97 99
100 /// <summary>
101 ///
102 /// </summary>
98 public void StartTimer() 103 public void StartTimer()
99 { 104 {
100 m_heartbeatTimer.Enabled = true; 105 m_heartbeatTimer.Enabled = true;
@@ -102,79 +107,7 @@ namespace OpenSim.world
102 m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat); 107 m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat);
103 } 108 }
104 109
105 #region Script Methods 110
106 /// <summary>
107 /// Loads a new script into the specified entity
108 /// </summary>
109 /// <param name="entity">Entity to be scripted</param>
110 /// <param name="script">The script to load</param>
111 public void AddScript(Entity entity, Script script)
112 {
113 try
114 {
115 ScriptHandler scriptHandler = new ScriptHandler(script, entity, this);
116 m_scriptHandlers.Add(scriptHandler.ScriptId, scriptHandler);
117 }
118 catch (Exception e)
119 {
120 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: AddScript() - Failed with exception " + e.ToString());
121 }
122 }
123
124 /// <summary>
125 /// Loads a new script into the specified entity, using a script loaded from a string.
126 /// </summary>
127 /// <param name="entity">The entity to be scripted</param>
128 /// <param name="scriptData">The string containing the script</param>
129 public void AddScript(Entity entity, string scriptData)
130 {
131 try
132 {
133 int scriptstart = 0;
134 int scriptend = 0;
135 string substring;
136 scriptstart = scriptData.LastIndexOf("<Script>");
137 scriptend = scriptData.LastIndexOf("</Script>");
138 substring = scriptData.Substring(scriptstart + 8, scriptend - scriptstart - 8);
139 substring = substring.Trim();
140 //Console.WriteLine("searching for script to add: " + substring);
141
142 ScriptFactory scriptFactory;
143 //Console.WriteLine("script string is " + substring);
144 if (substring.StartsWith("<ScriptEngine:"))
145 {
146 string substring1 = "";
147 string script = "";
148 // Console.WriteLine("searching for script engine");
149 substring1 = substring.Remove(0, 14);
150 int dev = substring1.IndexOf(',');
151 string sEngine = substring1.Substring(0, dev);
152 substring1 = substring1.Remove(0, dev + 1);
153 int end = substring1.IndexOf('>');
154 string sName = substring1.Substring(0, end);
155 //Console.WriteLine(" script info : " + sEngine + " , " + sName);
156 int startscript = substring.IndexOf('>');
157 script = substring.Remove(0, startscript + 1);
158 // Console.WriteLine("script data is " + script);
159 if (this.scriptEngines.ContainsKey(sEngine))
160 {
161 this.scriptEngines[sEngine].LoadScript(script, sName, entity.localid);
162 }
163 }
164 else if (this.m_scripts.TryGetValue(substring, out scriptFactory))
165 {
166 //Console.WriteLine("added script");
167 this.AddScript(entity, scriptFactory());
168 }
169 }
170 catch (Exception e)
171 {
172 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: AddScript() - Failed with exception " + e.ToString());
173 }
174 }
175
176 #endregion
177
178 #region Update Methods 111 #region Update Methods
179 112
180 113
@@ -240,6 +173,10 @@ namespace OpenSim.world
240 updateLock.ReleaseMutex(); 173 updateLock.ReleaseMutex();
241 } 174 }
242 175
176 /// <summary>
177 ///
178 /// </summary>
179 /// <returns></returns>
243 public bool Backup() 180 public bool Backup()
244 { 181 {
245 try 182 try
@@ -321,14 +258,6 @@ namespace OpenSim.world
321 } 258 }
322 } 259 }
323 260
324 public void SetDefaultScripts()
325 {
326 this.m_scripts.Add("FollowRandomAvatar", delegate()
327 {
328 return new OpenSim.RegionServer.world.scripting.FollowRandomAvatar();
329 });
330 }
331
332 #endregion 261 #endregion
333 262
334 #region Regenerate Terrain 263 #region Regenerate Terrain
@@ -453,14 +382,6 @@ namespace OpenSim.world
453 382
454 #region Primitives Methods 383 #region Primitives Methods
455 384
456 /// <summary>
457 /// Sends prims to a client
458 /// </summary>
459 /// <param name="RemoteClient">Client to send to</param>
460 public void GetInitialPrims(IClientAPI RemoteClient)
461 {
462
463 }
464 385
465 /// <summary> 386 /// <summary>
466 /// Loads the World's objects 387 /// Loads the World's objects
@@ -487,11 +408,21 @@ namespace OpenSim.world
487 408
488 } 409 }
489 410
411 /// <summary>
412 ///
413 /// </summary>
414 /// <param name="addPacket"></param>
415 /// <param name="agentClient"></param>
490 public void AddNewPrim(Packet addPacket, IClientAPI agentClient) 416 public void AddNewPrim(Packet addPacket, IClientAPI agentClient)
491 { 417 {
492 AddNewPrim((ObjectAddPacket)addPacket, agentClient.AgentId); 418 AddNewPrim((ObjectAddPacket)addPacket, agentClient.AgentId);
493 } 419 }
494 420
421 /// <summary>
422 ///
423 /// </summary>
424 /// <param name="addPacket"></param>
425 /// <param name="ownerID"></param>
495 public void AddNewPrim(ObjectAddPacket addPacket, LLUUID ownerID) 426 public void AddNewPrim(ObjectAddPacket addPacket, LLUUID ownerID)
496 { 427 {
497 428
@@ -501,6 +432,12 @@ namespace OpenSim.world
501 432
502 #region Add/Remove Avatar Methods 433 #region Add/Remove Avatar Methods
503 434
435 /// <summary>
436 ///
437 /// </summary>
438 /// <param name="remoteClient"></param>
439 /// <param name="agentID"></param>
440 /// <param name="child"></param>
504 public override void AddNewAvatar(IClientAPI remoteClient, LLUUID agentID, bool child) 441 public override void AddNewAvatar(IClientAPI remoteClient, LLUUID agentID, bool child)
505 { 442 {
506 remoteClient.OnRegionHandShakeReply += new GenericCall(this.SendLayerData); 443 remoteClient.OnRegionHandShakeReply += new GenericCall(this.SendLayerData);
@@ -552,6 +489,10 @@ namespace OpenSim.world
552 return; 489 return;
553 } 490 }
554 491
492 /// <summary>
493 ///
494 /// </summary>
495 /// <param name="agentID"></param>
555 public override void RemoveAvatar(LLUUID agentID) 496 public override void RemoveAvatar(LLUUID agentID)
556 { 497 {
557 return; 498 return;
@@ -562,6 +503,10 @@ namespace OpenSim.world
562 //The idea is to have a group of method that return a list of avatars meeting some requirement 503 //The idea is to have a group of method that return a list of avatars meeting some requirement
563 // ie it could be all Avatars within a certain range of the calling prim/avatar. 504 // ie it could be all Avatars within a certain range of the calling prim/avatar.
564 505
506 /// <summary>
507 ///
508 /// </summary>
509 /// <returns></returns>
565 public List<Avatar> RequestAvatarList() 510 public List<Avatar> RequestAvatarList()
566 { 511 {
567 List<Avatar> result = new List<Avatar>(); 512 List<Avatar> result = new List<Avatar>();