aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorlbsa712007-08-06 13:21:30 +0000
committerlbsa712007-08-06 13:21:30 +0000
commit9924f35613e7cbb1a30316c032f16e69234d9983 (patch)
tree0d1759cb609449e75f986be3b2c650777092cec9
parent* minor refactorings (diff)
downloadopensim-SC_OLD-9924f35613e7cbb1a30316c032f16e69234d9983.zip
opensim-SC_OLD-9924f35613e7cbb1a30316c032f16e69234d9983.tar.gz
opensim-SC_OLD-9924f35613e7cbb1a30316c032f16e69234d9983.tar.bz2
opensim-SC_OLD-9924f35613e7cbb1a30316c032f16e69234d9983.tar.xz
* encapsulated firstname/lastname on ScenePresence
* fixed 'users' console command * minor refactorings
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs11
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs86
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/Engines/LSLEngine/LSLScript.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/Script.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/ScriptInterpretedAPI.cs13
7 files changed, 65 insertions, 55 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index 7fb48b0..28d0477 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -65,7 +65,7 @@ namespace OpenSim
65 65
66 protected List<UDPServer> m_udpServers = new List<UDPServer>(); 66 protected List<UDPServer> m_udpServers = new List<UDPServer>();
67 protected List<RegionInfo> m_regionData = new List<RegionInfo>(); 67 protected List<RegionInfo> m_regionData = new List<RegionInfo>();
68 protected List<IScene> m_localScenes = new List<IScene>(); 68 protected List<Scene> m_localScenes = new List<Scene>();
69 69
70 private bool m_silent; 70 private bool m_silent;
71 private string m_logFilename = ("region-console-" + Guid.NewGuid().ToString() + ".log"); 71 private string m_logFilename = ("region-console-" + Guid.NewGuid().ToString() + ".log");
@@ -430,16 +430,15 @@ namespace OpenSim
430 m_log.Error("That is " + (DateTime.Now - m_startuptime).ToString()); 430 m_log.Error("That is " + (DateTime.Now - m_startuptime).ToString());
431 break; 431 break;
432 case "users": 432 case "users":
433 ScenePresence TempAv;
434 m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP", "World")); 433 m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP", "World"));
435 for (int i = 0; i < m_localScenes.Count; i++) 434 for (int i = 0; i < m_localScenes.Count; i++)
436 { 435 {
437 foreach (libsecondlife.LLUUID UUID in ((Scene)m_localScenes[i]).Entities.Keys) 436 foreach (Entity entity in m_localScenes[i].Entities.Values )
438 { 437 {
439 if (((Scene)m_localScenes[i]).Entities[UUID].ToString() == "OpenSim.world.Avatar") 438 if ( entity is ScenePresence )
440 { 439 {
441 TempAv = (ScenePresence)((Scene)m_localScenes[i]).Entities[UUID]; 440 ScenePresence scenePrescence = entity as ScenePresence;
442 m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.AgentId, "Unknown", "Unknown"), ((Scene)m_localScenes[i]).RegionInfo.RegionName); 441 m_log.Error(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", scenePrescence.Firstname, scenePrescence.Lastname, scenePrescence.UUID, scenePrescence.ControllingClient.AgentId, "Unknown", "Unknown"), ((Scene)m_localScenes[i]).RegionInfo.RegionName);
443 } 442 }
444 } 443 }
445 } 444 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index e839961..2f3ce6e 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -124,7 +124,7 @@ namespace OpenSim.Region.Environment.Scenes
124 // Local sim message 124 // Local sim message
125 ScenePresence fromAvatar = this.Avatars[fromAgentID]; 125 ScenePresence fromAvatar = this.Avatars[fromAgentID];
126 ScenePresence toAvatar = this.Avatars[toAgentID]; 126 ScenePresence toAvatar = this.Avatars[toAgentID];
127 string fromName = fromAvatar.firstname + " " + fromAvatar.lastname; 127 string fromName = fromAvatar.Firstname + " " + fromAvatar.Lastname;
128 toAvatar.ControllingClient.SendInstantMessage(message, toAgentID, fromName); 128 toAvatar.ControllingClient.SendInstantMessage(message, toAgentID, fromName);
129 } 129 }
130 else 130 else
@@ -153,7 +153,7 @@ namespace OpenSim.Region.Environment.Scenes
153 { 153 {
154 avatar = this.Avatars[fromAgentID]; 154 avatar = this.Avatars[fromAgentID];
155 fromPos = avatar.Pos; 155 fromPos = avatar.Pos;
156 fromName = avatar.firstname + " " + avatar.lastname; 156 fromName = avatar.Firstname + " " + avatar.Lastname;
157 avatar = null; 157 avatar = null;
158 } 158 }
159 159
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 56e5a0a..4a57d13 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -963,7 +963,7 @@ namespace OpenSim.Region.Environment.Scenes
963 { 963 {
964 foreach (ScenePresence presence in this.Avatars.Values) 964 foreach (ScenePresence presence in this.Avatars.Values)
965 { 965 {
966 if ((presence.firstname == firstName) && (presence.lastname == lastName)) 966 if ((presence.Firstname == firstName) && (presence.Lastname == lastName))
967 { 967 {
968 presence.ControllingClient.SendAgentAlertMessage(message, modal); 968 presence.ControllingClient.SendAgentAlertMessage(message, modal);
969 break; 969 break;
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 882bb20..cc66b2e 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -43,8 +43,6 @@ namespace OpenSim.Region.Environment.Scenes
43 public static bool PhysicsEngineFlying = false; 43 public static bool PhysicsEngineFlying = false;
44 public static AvatarAnimations Animations; 44 public static AvatarAnimations Animations;
45 public static byte[] DefaultTexture; 45 public static byte[] DefaultTexture;
46 public string firstname;
47 public string lastname;
48 public IClientAPI ControllingClient; 46 public IClientAPI ControllingClient;
49 public LLUUID current_anim; 47 public LLUUID current_anim;
50 public int anim_seq; 48 public int anim_seq;
@@ -69,7 +67,7 @@ namespace OpenSim.Region.Environment.Scenes
69 protected RegionInfo m_regionInfo; 67 protected RegionInfo m_regionInfo;
70 protected ulong crossingFromRegion = 0; 68 protected ulong crossingFromRegion = 0;
71 69
72 private IScenePresenceBody m_body; 70 private IScenePresenceBody m_body;
73 71
74 private Vector3[] Dir_Vectors = new Vector3[6]; 72 private Vector3[] Dir_Vectors = new Vector3[6];
75 private enum Dir_ControlFlags 73 private enum Dir_ControlFlags
@@ -117,10 +115,22 @@ namespace OpenSim.Region.Environment.Scenes
117 } 115 }
118 } 116 }
119 117
120 public ulong RegionHandle 118 public ulong RegionHandle
121 { 119 {
122 get { return m_regionHandle; } 120 get { return m_regionHandle; }
123 } 121 }
122
123 private string m_firstname;
124 public string Firstname
125 {
126 get { return m_firstname; }
127 }
128
129 private string m_lastname;
130 public string Lastname
131 {
132 get { return m_lastname; }
133 }
124 134
125 #endregion 135 #endregion
126 136
@@ -142,8 +152,8 @@ namespace OpenSim.Region.Environment.Scenes
142 m_regionHandle = reginfo.RegionHandle; 152 m_regionHandle = reginfo.RegionHandle;
143 MainLog.Instance.Verbose("Avatar.cs "); 153 MainLog.Instance.Verbose("Avatar.cs ");
144 ControllingClient = theClient; 154 ControllingClient = theClient;
145 this.firstname = ControllingClient.FirstName; 155 this.m_firstname = ControllingClient.FirstName;
146 this.lastname = ControllingClient.LastName; 156 this.m_lastname = ControllingClient.LastName;
147 m_localId = m_scene.NextLocalId; 157 m_localId = m_scene.NextLocalId;
148 Pos = ControllingClient.StartPos; 158 Pos = ControllingClient.StartPos;
149 159
@@ -166,7 +176,7 @@ namespace OpenSim.Region.Environment.Scenes
166 // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); 176 // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
167 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); 177 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
168 //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); 178 //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
169 179
170 Dir_Vectors[0] = new Vector3(1, 0, 0); //FOWARD 180 Dir_Vectors[0] = new Vector3(1, 0, 0); //FOWARD
171 Dir_Vectors[1] = new Vector3(-1, 0, 0); //BACK 181 Dir_Vectors[1] = new Vector3(-1, 0, 0); //BACK
172 Dir_Vectors[2] = new Vector3(0, 1, 0); //LEFT 182 Dir_Vectors[2] = new Vector3(0, 1, 0); //LEFT
@@ -312,7 +322,7 @@ namespace OpenSim.Region.Environment.Scenes
312 { 322 {
313 movementflag -= (byte)(uint)DCF; 323 movementflag -= (byte)(uint)DCF;
314 update_movementflag = true; 324 update_movementflag = true;
315 325
316 } 326 }
317 } 327 }
318 i++; 328 i++;
@@ -399,7 +409,7 @@ namespace OpenSim.Region.Environment.Scenes
399 409
400 this.CheckForSignificantMovement(); 410 this.CheckForSignificantMovement();
401 this.CheckForBorderCrossing(); 411 this.CheckForBorderCrossing();
402 412
403 } 413 }
404 } 414 }
405 #endregion 415 #endregion
@@ -434,7 +444,7 @@ namespace OpenSim.Region.Environment.Scenes
434 /// <param name="remoteAvatar"></param> 444 /// <param name="remoteAvatar"></param>
435 public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) 445 public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar)
436 { 446 {
437 remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.m_uuid, this.LocalId, this.Pos, this.m_textureEntry.ToBytes()); 447 remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.m_firstname, this.m_lastname, this.m_uuid, this.LocalId, this.Pos, this.m_textureEntry.ToBytes());
438 } 448 }
439 449
440 public void SendFullUpdateToALLClients() 450 public void SendFullUpdateToALLClients()
@@ -456,15 +466,15 @@ namespace OpenSim.Region.Environment.Scenes
456 /// </summary> 466 /// </summary>
457 public void SendInitialData() 467 public void SendInitialData()
458 { 468 {
459 this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.m_uuid, this.LocalId, this.Pos, this.m_textureEntry.ToBytes()); 469 this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.m_firstname, this.m_lastname, this.m_uuid, this.LocalId, this.Pos, this.m_textureEntry.ToBytes());
460 if (this.newAvatar) 470 if (this.newAvatar)
461 { 471 {
462 this.m_scene.InformClientOfNeighbours(this.ControllingClient); 472 this.m_scene.InformClientOfNeighbours(this.ControllingClient);
463 this.newAvatar = false; 473 this.newAvatar = false;
464 } 474 }
465 475
466 // this.SendFullUpdateToALLClients(); 476 // this.SendFullUpdateToALLClients();
467 // this.SendArrearanceToAllOtherAgents(); 477 // this.SendArrearanceToAllOtherAgents();
468 } 478 }
469 479
470 /// <summary> 480 /// <summary>
@@ -486,11 +496,11 @@ namespace OpenSim.Region.Environment.Scenes
486 /// </summary> 496 /// </summary>
487 public void SendArrearanceToAllOtherAgents() 497 public void SendArrearanceToAllOtherAgents()
488 { 498 {
489 List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); 499 List<ScenePresence> avatars = this.m_scene.RequestAvatarList();
490 foreach (ScenePresence avatar in this.m_scene.RequestAvatarList()) 500 foreach (ScenePresence avatar in this.m_scene.RequestAvatarList())
491 { 501 {
492 this.SendAppearanceToOtherAgent(avatar); 502 this.SendAppearanceToOtherAgent(avatar);
493 } 503 }
494 } 504 }
495 505
496 /// <summary> 506 /// <summary>
@@ -509,13 +519,13 @@ namespace OpenSim.Region.Environment.Scenes
509 /// <param name="seq"></param> 519 /// <param name="seq"></param>
510 public void SendAnimPack(LLUUID animID, int seq) 520 public void SendAnimPack(LLUUID animID, int seq)
511 { 521 {
512 this.current_anim = animID; 522 this.current_anim = animID;
513 this.anim_seq = seq; 523 this.anim_seq = seq;
514 List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); 524 List<ScenePresence> avatars = this.m_scene.RequestAvatarList();
515 for (int i = 0; i < avatars.Count; i++) 525 for (int i = 0; i < avatars.Count; i++)
516 { 526 {
517 avatars[i].ControllingClient.SendAnimation(animID, seq, this.ControllingClient.AgentId); 527 avatars[i].ControllingClient.SendAnimation(animID, seq, this.ControllingClient.AgentId);
518 } 528 }
519 } 529 }
520 530
521 /// <summary> 531 /// <summary>
@@ -648,16 +658,16 @@ namespace OpenSim.Region.Environment.Scenes
648 658
649 public static void CreateDefaultTextureEntry(string name) 659 public static void CreateDefaultTextureEntry(string name)
650 { 660 {
651 /* FileInfo fInfo = new FileInfo(name); 661 /* FileInfo fInfo = new FileInfo(name);
652 long numBytes = fInfo.Length; 662 long numBytes = fInfo.Length;
653 FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); 663 FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
654 BinaryReader br = new BinaryReader(fStream); 664 BinaryReader br = new BinaryReader(fStream);
655 byte[] data1 = br.ReadBytes((int)numBytes); 665 byte[] data1 = br.ReadBytes((int)numBytes);
656 br.Close(); 666 br.Close();
657 fStream.Close(); 667 fStream.Close();
658 DefaultTexture = data1; 668 DefaultTexture = data1;
659 LLObject.TextureEntry textu = new LLObject.TextureEntry(data1, 0, data1.Length); 669 LLObject.TextureEntry textu = new LLObject.TextureEntry(data1, 0, data1.Length);
660 Console.WriteLine("default texture entry: " + textu.ToString());*/ 670 Console.WriteLine("default texture entry: " + textu.ToString());*/
661 671
662 LLObject.TextureEntry textu = new LLObject.TextureEntry(new LLUUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); 672 LLObject.TextureEntry textu = new LLObject.TextureEntry(new LLUUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97"));
663 textu.CreateFace(0).TextureID = new LLUUID("00000000-0000-1111-9999-000000000012"); 673 textu.CreateFace(0).TextureID = new LLUUID("00000000-0000-1111-9999-000000000012");
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Engines/LSLEngine/LSLScript.cs b/OpenSim/Region/Environment/Scenes/Scripting/Engines/LSLEngine/LSLScript.cs
index 6eca69a..71d4c7e 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/Engines/LSLEngine/LSLScript.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/Engines/LSLEngine/LSLScript.cs
@@ -10,7 +10,7 @@ namespace OpenSim.Region.Scripting.LSL
10 class LSLScript : IScript 10 class LSLScript : IScript
11 { 11 {
12 ScriptInfo scriptInfo; 12 ScriptInfo scriptInfo;
13 LSL.Engine lindenScriptEngine; 13 Engine lindenScriptEngine;
14 14
15 public LSLScript(string filename, libsecondlife.LLUUID taskObject) 15 public LSLScript(string filename, libsecondlife.LLUUID taskObject)
16 { 16 {
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/Script.cs b/OpenSim/Region/Environment/Scenes/Scripting/Script.cs
index fa4bdde..e1e1d87 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/Script.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/Script.cs
@@ -53,7 +53,7 @@ namespace OpenSim.Region.Scripting
53 53
54 void events_OnNewPresence(ScenePresence presence) 54 void events_OnNewPresence(ScenePresence presence)
55 { 55 {
56 script.logger.Verbose("Hello " + presence.firstname.ToString() + "!"); 56 script.logger.Verbose("Hello " + presence.Firstname.ToString() + "!");
57 } 57 }
58 58
59 void events_OnFrame() 59 void events_OnFrame()
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptInterpretedAPI.cs b/OpenSim/Region/Environment/Scenes/Scripting/ScriptInterpretedAPI.cs
index 284ae74..af8a29f 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/ScriptInterpretedAPI.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/ScriptInterpretedAPI.cs
@@ -8,6 +8,7 @@ using LSLList = System.Collections.Generic.List<string>;
8 8
9using OpenSim.Region.Environment.Scenes; 9using OpenSim.Region.Environment.Scenes;
10using OpenSim.Region.Environment.LandManagement; 10using OpenSim.Region.Environment.LandManagement;
11using libsecondlife;
11 12
12namespace OpenSim.Region.Scripting 13namespace OpenSim.Region.Scripting
13{ 14{
@@ -17,13 +18,13 @@ namespace OpenSim.Region.Scripting
17 /// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks> 18 /// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks>
18 class ScriptInterpretedAPI 19 class ScriptInterpretedAPI
19 { 20 {
20 protected libsecondlife.LLUUID m_object; 21 protected LLUUID m_object;
21 protected Scene m_scene; 22 protected Scene m_scene;
22 23
23 /// <summary> 24 /// <summary>
24 /// The scene in which this script is acting 25 /// The scene in which this script is acting
25 /// </summary> 26 /// </summary>
26 public Scene World 27 public Scene Scene
27 { 28 {
28 get { return m_scene; } 29 get { return m_scene; }
29 } 30 }
@@ -41,7 +42,7 @@ namespace OpenSim.Region.Scripting
41 /// </summary> 42 /// </summary>
42 public SceneObject Task 43 public SceneObject Task
43 { 44 {
44 get { return World.Objects[ObjectID]; } 45 get { return Scene.Objects[ObjectID]; }
45 } 46 }
46 47
47 /// <summary> 48 /// <summary>
@@ -74,7 +75,7 @@ namespace OpenSim.Region.Scripting
74 public void osAddToLandPassList(Key avatar, float hours) 75 public void osAddToLandPassList(Key avatar, float hours)
75 { 76 {
76 Vector myPosition = Task.Pos; 77 Vector myPosition = Task.Pos;
77 Land myParcel = World.LandManager.getLandObject(myPosition.X, myPosition.Y); 78 Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y);
78 79
79 OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)"); 80 OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)");
80 return; 81 return;
@@ -228,8 +229,8 @@ namespace OpenSim.Region.Scripting
228 229
229 public void osCreateLink(Key target, int parent) 230 public void osCreateLink(Key target, int parent)
230 { 231 {
231 if(World.Entities[target] is SceneObject) 232 if(Scene.Entities[target] is SceneObject)
232 Task.AddNewChildPrims((SceneObject)World.Entities[target]); 233 Task.AddNewChildPrims((SceneObject)Scene.Entities[target]);
233 234
234 return; 235 return;
235 } 236 }