Merge branch 'master' into 0.7.1-dev

0.7.1-dev
Justin Clark-Casey (justincc) 2011-04-08 21:07:43 +01:00
commit 7c88821020
7 changed files with 100 additions and 15 deletions

View File

@ -250,9 +250,7 @@ namespace OpenSim
m_saveCrashDumps = configSource.Configs["Startup"].GetBoolean("save_crashes", false); m_saveCrashDumps = configSource.Configs["Startup"].GetBoolean("save_crashes", false);
// load Crash directory config // load Crash directory config
m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir); m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir);
if (background) if (background)
{ {
@ -260,15 +258,9 @@ namespace OpenSim
m_sim.Startup(); m_sim.Startup();
} }
else else
{ {
m_sim = new OpenSim(configSource); m_sim = new OpenSim(configSource);
m_sim.Startup(); m_sim.Startup();
while (true) while (true)

View File

@ -10268,6 +10268,55 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_log.Info("LSL print():" + str); m_log.Info("LSL print():" + str);
} }
} }
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 public class NotecardCache

View File

@ -50,6 +50,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
private Object SenseLock = new Object(); private Object SenseLock = new Object();
private const int AGENT = 1; private const int AGENT = 1;
private const int AGENT_BY_USERNAME = 0x10;
private const int ACTIVE = 2; private const int ACTIVE = 2;
private const int PASSIVE = 4; private const int PASSIVE = 4;
private const int SCRIPTED = 8; private const int SCRIPTED = 8;
@ -202,7 +203,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
List<SensedEntity> sensedEntities = new List<SensedEntity>(); List<SensedEntity> sensedEntities = new List<SensedEntity>();
// Is the sensor type is AGENT and not SCRIPTED then include agents // 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)); sensedEntities.AddRange(doAgentSensor(ts));
} }
@ -493,9 +494,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
{ {
ScenePresence sp; ScenePresence sp;
// Try lookup by name will return if/when found // Try lookup by name will return if/when found
if (!m_CmdManager.m_ScriptEngine.World.TryGetAvatarByName(ts.name, out sp)) if (((ts.type & AGENT) != 0) && m_CmdManager.m_ScriptEngine.World.TryGetAvatarByName(ts.name, out sp))
return sensedEntities; senseEntity(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 else
{ {

View File

@ -209,6 +209,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void llInstantMessage(string user, string message); void llInstantMessage(string user, string message);
LSL_String llIntegerToBase64(int number); LSL_String llIntegerToBase64(int number);
LSL_String llKey2Name(string id); 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); void llLinkParticleSystem(int linknum, LSL_List rules);
LSL_String llList2CSV(LSL_List src); LSL_String llList2CSV(LSL_List src);
LSL_Float llList2Float(LSL_List src, int index); LSL_Float llList2Float(LSL_List src, int index);

View File

@ -50,6 +50,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int STATUS_CAST_SHADOWS = 512; public const int STATUS_CAST_SHADOWS = 512;
public const int AGENT = 1; 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 ACTIVE = 2;
public const int PASSIVE = 4; public const int PASSIVE = 4;
public const int SCRIPTED = 8; public const int SCRIPTED = 8;

View File

@ -894,6 +894,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_LSL_Functions.llKey2Name(id); 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) public void llLinkParticleSystem(int linknum, LSL_List rules)
{ {
m_LSL_Functions.llLinkParticleSystem(linknum, rules); m_LSL_Functions.llLinkParticleSystem(linknum, rules);

Binary file not shown.