Add support for the new display name related functions in LSL. This does not
implement the display names functionality as such, but it allows scripts that are display name aware to function as if the display name were implemented and set to the avatar name.avinationmerge
parent
407c2b1823
commit
33dd74e410
|
@ -1264,7 +1264,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
{
|
||||
land.DeedToGroup(groupID);
|
||||
}
|
||||
EventManagerOnParcelPrimCountTainted();
|
||||
}
|
||||
|
||||
#region Land Object From Storage Functions
|
||||
|
|
|
@ -1337,12 +1337,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
terrainMS = Util.EnvironmentTickCountSubtract(terMS);
|
||||
}
|
||||
|
||||
if (Frame % m_update_land == 0)
|
||||
{
|
||||
int ldMS = Util.EnvironmentTickCount();
|
||||
UpdateLand();
|
||||
landMS = Util.EnvironmentTickCountSubtract(ldMS);
|
||||
}
|
||||
// if (Frame % m_update_land == 0)
|
||||
// {
|
||||
// int ldMS = Util.EnvironmentTickCount();
|
||||
// UpdateLand();
|
||||
// landMS = Util.EnvironmentTickCountSubtract(ldMS);
|
||||
// }
|
||||
|
||||
frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS);
|
||||
otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
|
||||
|
|
|
@ -10909,6 +10909,55 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
|
||||
return GetNumberOfSides(parts[0]);
|
||||
}
|
||||
|
||||
private string Name2Username(string name)
|
||||
{
|
||||
string[] parts = name.Split(new char[] {' '});
|
||||
if (parts.Length < 2)
|
||||
return name.ToLower();
|
||||
if (parts[1] == "Resident")
|
||||
return parts[0].ToLower();
|
||||
|
||||
return name.Replace(" ", ".").ToLower();
|
||||
}
|
||||
|
||||
public LSL_String llGetUsername(string id)
|
||||
{
|
||||
return Name2Username(llKey2Name(id));
|
||||
}
|
||||
|
||||
public LSL_String llRequestUsername(string id)
|
||||
{
|
||||
UUID rq = UUID.Random();
|
||||
|
||||
UUID tid = AsyncCommands.
|
||||
DataserverPlugin.RegisterRequest(m_localID,
|
||||
m_itemID, rq.ToString());
|
||||
|
||||
AsyncCommands.
|
||||
DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(id)));
|
||||
|
||||
return rq.ToString();
|
||||
}
|
||||
|
||||
public LSL_String llGetDisplayName(string id)
|
||||
{
|
||||
return llKey2Name(id);
|
||||
}
|
||||
|
||||
public LSL_String llRequestDisplayName(string id)
|
||||
{
|
||||
UUID rq = UUID.Random();
|
||||
|
||||
UUID tid = AsyncCommands.
|
||||
DataserverPlugin.RegisterRequest(m_localID,
|
||||
m_itemID, rq.ToString());
|
||||
|
||||
AsyncCommands.
|
||||
DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(id));
|
||||
|
||||
return rq.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public class NotecardCache
|
||||
|
|
|
@ -50,6 +50,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
private Object SenseLock = new Object();
|
||||
|
||||
private const int AGENT = 1;
|
||||
private const int AGENT_BY_USERNAME = 0x10;
|
||||
private const int ACTIVE = 2;
|
||||
private const int PASSIVE = 4;
|
||||
private const int SCRIPTED = 8;
|
||||
|
@ -202,7 +203,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
List<SensedEntity> sensedEntities = new List<SensedEntity>();
|
||||
|
||||
// Is the sensor type is AGENT and not SCRIPTED then include agents
|
||||
if ((ts.type & AGENT) != 0 && (ts.type & SCRIPTED) == 0)
|
||||
if ((ts.type & (AGENT | AGENT_BY_USERNAME)) != 0 && (ts.type & SCRIPTED) == 0)
|
||||
{
|
||||
sensedEntities.AddRange(doAgentSensor(ts));
|
||||
}
|
||||
|
@ -505,9 +506,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
{
|
||||
ScenePresence sp;
|
||||
// Try lookup by name will return if/when found
|
||||
if (!m_CmdManager.m_ScriptEngine.World.TryGetAvatarByName(ts.name, out sp))
|
||||
return sensedEntities;
|
||||
if (((ts.type & AGENT) != 0) && m_CmdManager.m_ScriptEngine.World.TryGetAvatarByName(ts.name, out sp))
|
||||
senseEntity(sp);
|
||||
if ((ts.type & AGENT_BY_USERNAME) != 0)
|
||||
{
|
||||
m_CmdManager.m_ScriptEngine.World.ForEachScenePresence(
|
||||
delegate (ScenePresence ssp)
|
||||
{
|
||||
if (ssp.Lastname == "Resident")
|
||||
{
|
||||
if (ssp.Firstname.ToLower() == ts.name)
|
||||
senseEntity(ssp);
|
||||
return;
|
||||
}
|
||||
if (ssp.Name.Replace(" ", ".").ToLower() == ts.name)
|
||||
senseEntity(ssp);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return sensedEntities;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -209,6 +209,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
void llInstantMessage(string user, string message);
|
||||
LSL_String llIntegerToBase64(int number);
|
||||
LSL_String llKey2Name(string id);
|
||||
LSL_String llGetUsername(string id);
|
||||
LSL_String llRequestUsername(string id);
|
||||
LSL_String llGetDisplayName(string id);
|
||||
LSL_String llRequestDisplayName(string id);
|
||||
void llLinkParticleSystem(int linknum, LSL_List rules);
|
||||
LSL_String llList2CSV(LSL_List src);
|
||||
LSL_Float llList2Float(LSL_List src, int index);
|
||||
|
|
|
@ -50,6 +50,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
public const int STATUS_CAST_SHADOWS = 512;
|
||||
|
||||
public const int AGENT = 1;
|
||||
public const int AGENT_BY_LEGACY_NAME = 1;
|
||||
public const int AGENT_BY_USERNAME = 0x10;
|
||||
public const int ACTIVE = 2;
|
||||
public const int PASSIVE = 4;
|
||||
public const int SCRIPTED = 8;
|
||||
|
|
|
@ -896,6 +896,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
return m_LSL_Functions.llKey2Name(id);
|
||||
}
|
||||
|
||||
public LSL_String llGetUsername(string id)
|
||||
{
|
||||
return m_LSL_Functions.llGetUsername(id);
|
||||
}
|
||||
|
||||
public LSL_String llRequestUsername(string id)
|
||||
{
|
||||
return m_LSL_Functions.llRequestUsername(id);
|
||||
}
|
||||
|
||||
public LSL_String llGetDisplayName(string id)
|
||||
{
|
||||
return m_LSL_Functions.llGetDisplayName(id);
|
||||
}
|
||||
|
||||
public LSL_String llRequestDisplayName(string id)
|
||||
{
|
||||
return m_LSL_Functions.llRequestDisplayName(id);
|
||||
}
|
||||
|
||||
public void llLinkParticleSystem(int linknum, LSL_List rules)
|
||||
{
|
||||
m_LSL_Functions.llLinkParticleSystem(linknum, rules);
|
||||
|
|
Loading…
Reference in New Issue