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