mantis8564: add region_up_time to llGetEnv. Returns string with seconds since region start. There where ways do get it, but this makes life easier

0.9.1.0-post-fixes
UbitUmarov 2019-07-31 14:34:35 +01:00
parent b5b518dc0d
commit 1499baf13e
1 changed files with 55 additions and 66 deletions

View File

@ -6387,75 +6387,64 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetEnv(LSL_String name)
{
m_host.AddScriptLPS(1);
if (name == "agent_limit")
switch(name)
{
case "agent_limit":
return World.RegionInfo.RegionSettings.AgentLimit.ToString();
}
else if (name == "dynamic_pathfinding")
{
case "dynamic_pathfinding":
return "0";
}
else if (name == "estate_id")
{
case "estate_id":
return World.RegionInfo.EstateSettings.EstateID.ToString();
}
else if (name == "estate_name")
{
case "estate_name":
return World.RegionInfo.EstateSettings.EstateName;
}
else if (name == "frame_number")
{
case "frame_number":
return World.Frame.ToString();
}
else if (name == "region_cpu_ratio")
{
case "region_cpu_ratio":
return "1";
}
else if (name == "region_idle")
{
case "region_idle":
return "0";
}
else if (name == "region_product_name")
{
case "region_product_name":
if (World.RegionInfo.RegionType != String.Empty)
return World.RegionInfo.RegionType;
else
return "";
}
else if (name == "region_product_sku")
{
case "region_product_sku":
return "OpenSim";
}
else if (name == "region_start_time")
{
case "region_start_time":
return World.UnixStartTime.ToString();
}
else if (name == "sim_channel")
{
case "region_up_time":
int time = Util.UnixTimeSinceEpoch() - World.UnixStartTime;
return time.ToString();
case "sim_channel":
return "OpenSim";
}
else if (name == "sim_version")
{
case "sim_version":
return World.GetSimulatorVersion();
}
else if (name == "simulator_hostname")
{
case "simulator_hostname":
IUrlModule UrlModule = World.RequestModuleInterface<IUrlModule>();
return UrlModule.ExternalHostNameForLSL;
}
else if (name == "region_max_prims")
{
case "region_max_prims":
return World.RegionInfo.ObjectCapacity.ToString();
}
else if (name == "region_object_bonus")
{
case "region_object_bonus":
return World.RegionInfo.RegionSettings.ObjectBonus.ToString();
}
else
{
default:
return "";
}
}
/// <summary>