* 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<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 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());
break;
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"));
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];
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);
ScenePresence scenePrescence = entity as ScenePresence;
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
ScenePresence fromAvatar = this.Avatars[fromAgentID];
ScenePresence toAvatar = this.Avatars[toAgentID];
string fromName = fromAvatar.firstname + " " + fromAvatar.lastname;
string fromName = fromAvatar.Firstname + " " + fromAvatar.Lastname;
toAvatar.ControllingClient.SendInstantMessage(message, toAgentID, fromName);
}
else
@ -153,7 +153,7 @@ namespace OpenSim.Region.Environment.Scenes
{
avatar = this.Avatars[fromAgentID];
fromPos = avatar.Pos;
fromName = avatar.firstname + " " + avatar.lastname;
fromName = avatar.Firstname + " " + avatar.Lastname;
avatar = null;
}

View File

@ -963,7 +963,7 @@ namespace OpenSim.Region.Environment.Scenes
{
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);
break;

View File

@ -43,8 +43,6 @@ namespace OpenSim.Region.Environment.Scenes
public static bool PhysicsEngineFlying = false;
public static AvatarAnimations Animations;
public static byte[] DefaultTexture;
public string firstname;
public string lastname;
public IClientAPI ControllingClient;
public LLUUID current_anim;
public int anim_seq;
@ -69,7 +67,7 @@ namespace OpenSim.Region.Environment.Scenes
protected RegionInfo m_regionInfo;
protected ulong crossingFromRegion = 0;
private IScenePresenceBody m_body;
private IScenePresenceBody m_body;
private Vector3[] Dir_Vectors = new Vector3[6];
private enum Dir_ControlFlags
@ -117,10 +115,22 @@ namespace OpenSim.Region.Environment.Scenes
}
}
public ulong RegionHandle
{
get { return m_regionHandle; }
}
public ulong 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
@ -142,8 +152,8 @@ namespace OpenSim.Region.Environment.Scenes
m_regionHandle = reginfo.RegionHandle;
MainLog.Instance.Verbose("Avatar.cs ");
ControllingClient = theClient;
this.firstname = ControllingClient.FirstName;
this.lastname = ControllingClient.LastName;
this.m_firstname = ControllingClient.FirstName;
this.m_lastname = ControllingClient.LastName;
m_localId = m_scene.NextLocalId;
Pos = ControllingClient.StartPos;
@ -166,7 +176,7 @@ namespace OpenSim.Region.Environment.Scenes
// ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack);
// ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
//ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
Dir_Vectors[0] = new Vector3(1, 0, 0); //FOWARD
Dir_Vectors[1] = new Vector3(-1, 0, 0); //BACK
Dir_Vectors[2] = new Vector3(0, 1, 0); //LEFT
@ -312,7 +322,7 @@ namespace OpenSim.Region.Environment.Scenes
{
movementflag -= (byte)(uint)DCF;
update_movementflag = true;
}
}
i++;
@ -399,7 +409,7 @@ namespace OpenSim.Region.Environment.Scenes
this.CheckForSignificantMovement();
this.CheckForBorderCrossing();
}
}
#endregion
@ -434,7 +444,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="remoteAvatar"></param>
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()
@ -456,15 +466,15 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
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)
{
this.m_scene.InformClientOfNeighbours(this.ControllingClient);
this.newAvatar = false;
}
// this.SendFullUpdateToALLClients();
// this.SendArrearanceToAllOtherAgents();
// this.SendFullUpdateToALLClients();
// this.SendArrearanceToAllOtherAgents();
}
/// <summary>
@ -486,11 +496,11 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
public void SendArrearanceToAllOtherAgents()
{
List<ScenePresence> avatars = this.m_scene.RequestAvatarList();
foreach (ScenePresence avatar in this.m_scene.RequestAvatarList())
{
this.SendAppearanceToOtherAgent(avatar);
}
List<ScenePresence> avatars = this.m_scene.RequestAvatarList();
foreach (ScenePresence avatar in this.m_scene.RequestAvatarList())
{
this.SendAppearanceToOtherAgent(avatar);
}
}
/// <summary>
@ -509,13 +519,13 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="seq"></param>
public void SendAnimPack(LLUUID animID, int seq)
{
this.current_anim = animID;
this.anim_seq = seq;
List<ScenePresence> avatars = this.m_scene.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++)
{
avatars[i].ControllingClient.SendAnimation(animID, seq, this.ControllingClient.AgentId);
}
this.current_anim = animID;
this.anim_seq = seq;
List<ScenePresence> avatars = this.m_scene.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++)
{
avatars[i].ControllingClient.SendAnimation(animID, seq, this.ControllingClient.AgentId);
}
}
/// <summary>
@ -648,16 +658,16 @@ namespace OpenSim.Region.Environment.Scenes
public static void CreateDefaultTextureEntry(string name)
{
/* FileInfo fInfo = new FileInfo(name);
long numBytes = fInfo.Length;
FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fStream);
byte[] data1 = br.ReadBytes((int)numBytes);
br.Close();
fStream.Close();
DefaultTexture = data1;
LLObject.TextureEntry textu = new LLObject.TextureEntry(data1, 0, data1.Length);
Console.WriteLine("default texture entry: " + textu.ToString());*/
/* FileInfo fInfo = new FileInfo(name);
long numBytes = fInfo.Length;
FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fStream);
byte[] data1 = br.ReadBytes((int)numBytes);
br.Close();
fStream.Close();
DefaultTexture = data1;
LLObject.TextureEntry textu = new LLObject.TextureEntry(data1, 0, data1.Length);
Console.WriteLine("default texture entry: " + textu.ToString());*/
LLObject.TextureEntry textu = new LLObject.TextureEntry(new LLUUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97"));
textu.CreateFace(0).TextureID = new LLUUID("00000000-0000-1111-9999-000000000012");

View File

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

View File

@ -53,7 +53,7 @@ namespace OpenSim.Region.Scripting
void events_OnNewPresence(ScenePresence presence)
{
script.logger.Verbose("Hello " + presence.firstname.ToString() + "!");
script.logger.Verbose("Hello " + presence.Firstname.ToString() + "!");
}
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.LandManagement;
using libsecondlife;
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>
class ScriptInterpretedAPI
{
protected libsecondlife.LLUUID m_object;
protected LLUUID m_object;
protected Scene m_scene;
/// <summary>
/// The scene in which this script is acting
/// </summary>
public Scene World
public Scene Scene
{
get { return m_scene; }
}
@ -41,7 +42,7 @@ namespace OpenSim.Region.Scripting
/// </summary>
public SceneObject Task
{
get { return World.Objects[ObjectID]; }
get { return Scene.Objects[ObjectID]; }
}
/// <summary>
@ -74,7 +75,7 @@ namespace OpenSim.Region.Scripting
public void osAddToLandPassList(Key avatar, float hours)
{
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)");
return;
@ -228,8 +229,8 @@ namespace OpenSim.Region.Scripting
public void osCreateLink(Key target, int parent)
{
if(World.Entities[target] is SceneObject)
Task.AddNewChildPrims((SceneObject)World.Entities[target]);
if(Scene.Entities[target] is SceneObject)
Task.AddNewChildPrims((SceneObject)Scene.Entities[target]);
return;
}