* encapsulated firstname/lastname on ScenePresence

* fixed 'users' console command
* minor refactorings
afrisby
lbsa71 2007-08-06 13:21:30 +00:00
parent 1b100e17a5
commit 9924f35613
7 changed files with 65 additions and 55 deletions

View File

@ -65,7 +65,7 @@ namespace OpenSim
protected List<UDPServer> m_udpServers = new List<UDPServer>(); protected List<UDPServer> m_udpServers = new List<UDPServer>();
protected List<RegionInfo> m_regionData = new List<RegionInfo>(); protected List<RegionInfo> m_regionData = new List<RegionInfo>();
protected List<IScene> m_localScenes = new List<IScene>(); protected List<Scene> m_localScenes = new List<Scene>();
private bool m_silent; private bool m_silent;
private string m_logFilename = ("region-console-" + Guid.NewGuid().ToString() + ".log"); private string m_logFilename = ("region-console-" + Guid.NewGuid().ToString() + ".log");
@ -430,16 +430,15 @@ namespace OpenSim
m_log.Error("That is " + (DateTime.Now - m_startuptime).ToString()); m_log.Error("That is " + (DateTime.Now - m_startuptime).ToString());
break; break;
case "users": case "users":
ScenePresence TempAv;
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")); 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"));
for (int i = 0; i < m_localScenes.Count; i++) for (int i = 0; i < m_localScenes.Count; i++)
{ {
foreach (libsecondlife.LLUUID UUID in ((Scene)m_localScenes[i]).Entities.Keys) foreach (Entity entity in m_localScenes[i].Entities.Values )
{ {
if (((Scene)m_localScenes[i]).Entities[UUID].ToString() == "OpenSim.world.Avatar") if ( entity is ScenePresence )
{ {
TempAv = (ScenePresence)((Scene)m_localScenes[i]).Entities[UUID]; ScenePresence scenePrescence = entity as ScenePresence;
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); 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);
} }
} }
} }

View File

@ -124,7 +124,7 @@ namespace OpenSim.Region.Environment.Scenes
// Local sim message // Local sim message
ScenePresence fromAvatar = this.Avatars[fromAgentID]; ScenePresence fromAvatar = this.Avatars[fromAgentID];
ScenePresence toAvatar = this.Avatars[toAgentID]; ScenePresence toAvatar = this.Avatars[toAgentID];
string fromName = fromAvatar.firstname + " " + fromAvatar.lastname; string fromName = fromAvatar.Firstname + " " + fromAvatar.Lastname;
toAvatar.ControllingClient.SendInstantMessage(message, toAgentID, fromName); toAvatar.ControllingClient.SendInstantMessage(message, toAgentID, fromName);
} }
else else
@ -153,7 +153,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
avatar = this.Avatars[fromAgentID]; avatar = this.Avatars[fromAgentID];
fromPos = avatar.Pos; fromPos = avatar.Pos;
fromName = avatar.firstname + " " + avatar.lastname; fromName = avatar.Firstname + " " + avatar.Lastname;
avatar = null; avatar = null;
} }

View File

@ -963,7 +963,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
foreach (ScenePresence presence in this.Avatars.Values) foreach (ScenePresence presence in this.Avatars.Values)
{ {
if ((presence.firstname == firstName) && (presence.lastname == lastName)) if ((presence.Firstname == firstName) && (presence.Lastname == lastName))
{ {
presence.ControllingClient.SendAgentAlertMessage(message, modal); presence.ControllingClient.SendAgentAlertMessage(message, modal);
break; break;

View File

@ -43,8 +43,6 @@ namespace OpenSim.Region.Environment.Scenes
public static bool PhysicsEngineFlying = false; public static bool PhysicsEngineFlying = false;
public static AvatarAnimations Animations; public static AvatarAnimations Animations;
public static byte[] DefaultTexture; public static byte[] DefaultTexture;
public string firstname;
public string lastname;
public IClientAPI ControllingClient; public IClientAPI ControllingClient;
public LLUUID current_anim; public LLUUID current_anim;
public int anim_seq; public int anim_seq;
@ -122,6 +120,18 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_regionHandle; } get { return m_regionHandle; }
} }
private string m_firstname;
public string Firstname
{
get { return m_firstname; }
}
private string m_lastname;
public string Lastname
{
get { return m_lastname; }
}
#endregion #endregion
#region Constructor(s) #region Constructor(s)
@ -142,8 +152,8 @@ namespace OpenSim.Region.Environment.Scenes
m_regionHandle = reginfo.RegionHandle; m_regionHandle = reginfo.RegionHandle;
MainLog.Instance.Verbose("Avatar.cs "); MainLog.Instance.Verbose("Avatar.cs ");
ControllingClient = theClient; ControllingClient = theClient;
this.firstname = ControllingClient.FirstName; this.m_firstname = ControllingClient.FirstName;
this.lastname = ControllingClient.LastName; this.m_lastname = ControllingClient.LastName;
m_localId = m_scene.NextLocalId; m_localId = m_scene.NextLocalId;
Pos = ControllingClient.StartPos; Pos = ControllingClient.StartPos;
@ -434,7 +444,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="remoteAvatar"></param> /// <param name="remoteAvatar"></param>
public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar)
{ {
remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.m_uuid, this.LocalId, this.Pos, this.m_textureEntry.ToBytes()); remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.m_firstname, this.m_lastname, this.m_uuid, this.LocalId, this.Pos, this.m_textureEntry.ToBytes());
} }
public void SendFullUpdateToALLClients() public void SendFullUpdateToALLClients()
@ -456,7 +466,7 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
public void SendInitialData() public void SendInitialData()
{ {
this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.m_uuid, this.LocalId, this.Pos, this.m_textureEntry.ToBytes()); this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.m_firstname, this.m_lastname, this.m_uuid, this.LocalId, this.Pos, this.m_textureEntry.ToBytes());
if (this.newAvatar) if (this.newAvatar)
{ {
this.m_scene.InformClientOfNeighbours(this.ControllingClient); this.m_scene.InformClientOfNeighbours(this.ControllingClient);

View File

@ -10,7 +10,7 @@ namespace OpenSim.Region.Scripting.LSL
class LSLScript : IScript class LSLScript : IScript
{ {
ScriptInfo scriptInfo; ScriptInfo scriptInfo;
LSL.Engine lindenScriptEngine; Engine lindenScriptEngine;
public LSLScript(string filename, libsecondlife.LLUUID taskObject) public LSLScript(string filename, libsecondlife.LLUUID taskObject)
{ {

View File

@ -53,7 +53,7 @@ namespace OpenSim.Region.Scripting
void events_OnNewPresence(ScenePresence presence) void events_OnNewPresence(ScenePresence presence)
{ {
script.logger.Verbose("Hello " + presence.firstname.ToString() + "!"); script.logger.Verbose("Hello " + presence.Firstname.ToString() + "!");
} }
void events_OnFrame() void events_OnFrame()

View File

@ -8,6 +8,7 @@ using LSLList = System.Collections.Generic.List<string>;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.LandManagement; using OpenSim.Region.Environment.LandManagement;
using libsecondlife;
namespace OpenSim.Region.Scripting namespace OpenSim.Region.Scripting
{ {
@ -17,13 +18,13 @@ namespace OpenSim.Region.Scripting
/// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks> /// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks>
class ScriptInterpretedAPI class ScriptInterpretedAPI
{ {
protected libsecondlife.LLUUID m_object; protected LLUUID m_object;
protected Scene m_scene; protected Scene m_scene;
/// <summary> /// <summary>
/// The scene in which this script is acting /// The scene in which this script is acting
/// </summary> /// </summary>
public Scene World public Scene Scene
{ {
get { return m_scene; } get { return m_scene; }
} }
@ -41,7 +42,7 @@ namespace OpenSim.Region.Scripting
/// </summary> /// </summary>
public SceneObject Task public SceneObject Task
{ {
get { return World.Objects[ObjectID]; } get { return Scene.Objects[ObjectID]; }
} }
/// <summary> /// <summary>
@ -74,7 +75,7 @@ namespace OpenSim.Region.Scripting
public void osAddToLandPassList(Key avatar, float hours) public void osAddToLandPassList(Key avatar, float hours)
{ {
Vector myPosition = Task.Pos; Vector myPosition = Task.Pos;
Land myParcel = World.LandManager.getLandObject(myPosition.X, myPosition.Y); Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y);
OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)"); OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)");
return; return;
@ -228,8 +229,8 @@ namespace OpenSim.Region.Scripting
public void osCreateLink(Key target, int parent) public void osCreateLink(Key target, int parent)
{ {
if(World.Entities[target] is SceneObject) if(Scene.Entities[target] is SceneObject)
Task.AddNewChildPrims((SceneObject)World.Entities[target]); Task.AddNewChildPrims((SceneObject)Scene.Entities[target]);
return; return;
} }