Increment LPS script stat for OSSL functions that were not already doing this

iar_mods
Justin Clark-Casey (justincc) 2012-01-27 23:24:49 +00:00
parent 7c1d075a5a
commit 31b87ff07b
1 changed files with 41 additions and 2 deletions

View File

@ -416,6 +416,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer osSetTerrainHeight(int x, int y, double val)
{
CheckThreatLevel(ThreatLevel.High, "osSetTerrainHeight");
return SetTerrainHeight(x, y, val);
}
@ -423,12 +424,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight");
OSSLDeprecated("osTerrainSetHeight", "osSetTerrainHeight");
return SetTerrainHeight(x, y, val);
}
private LSL_Integer SetTerrainHeight(int x, int y, double val)
{
m_host.AddScriptLPS(1);
if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0)
OSSLError("osSetTerrainHeight: Coordinate out of bounds");
@ -468,6 +471,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void osTerrainFlush()
{
CheckThreatLevel(ThreatLevel.VeryLow, "osTerrainFlush");
m_host.AddScriptLPS(1);
ITerrainModule terrainModule = World.RequestModuleInterface<ITerrainModule>();
if (terrainModule != null) terrainModule.TaintTerrain();
@ -884,6 +888,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// threat level is None as we could get this information with an
// in-world script as well, just not as efficient
CheckThreatLevel(ThreatLevel.None, "osGetAgents");
m_host.AddScriptLPS(1);
LSL_List result = new LSL_List();
World.ForEachRootScenePresence(delegate(ScenePresence sp)
@ -1164,6 +1169,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// should be removed
//
CheckThreatLevel(ThreatLevel.High, "osSetStateEvents");
m_host.AddScriptLPS(1);
m_host.SetScriptEvents(m_itemID, events);
}
@ -1511,7 +1517,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
ILandObject land
= World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
@ -1572,6 +1577,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//
CheckThreatLevel(ThreatLevel.High,"osGetSimulatorVersion");
m_host.AddScriptLPS(1);
return m_ScriptEngine.World.GetSimulatorVersion();
}
@ -1909,6 +1915,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public string osAvatarName2Key(string firstname, string lastname)
{
CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key");
m_host.AddScriptLPS(1);
UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, firstname, lastname);
if (null == account)
@ -1924,6 +1931,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public string osKey2Name(string id)
{
CheckThreatLevel(ThreatLevel.Low, "osKey2Name");
m_host.AddScriptLPS(1);
UUID key = new UUID();
if (UUID.TryParse(id, out key))
@ -2222,12 +2231,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard)
{
CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
m_host.AddScriptLPS(1);
return NpcCreate(firstname, lastname, position, notecard, true);
}
public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, int options)
{
CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
m_host.AddScriptLPS(1);
return NpcCreate(firstname, lastname, position, notecard, (options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0);
}
@ -2285,6 +2298,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Key osNpcSaveAppearance(LSL_Key npc, string notecard)
{
CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance");
m_host.AddScriptLPS(1);
INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
@ -2306,6 +2320,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void osNpcLoadAppearance(LSL_Key npc, string notecard)
{
CheckThreatLevel(ThreatLevel.High, "osNpcLoadAppearance");
m_host.AddScriptLPS(1);
INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
@ -2333,6 +2348,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Key osNpcGetOwner(LSL_Key npc)
{
CheckThreatLevel(ThreatLevel.None, "osNpcGetOwner");
m_host.AddScriptLPS(1);
INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
if (npcModule != null)
@ -2354,6 +2370,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector osNpcGetPos(LSL_Key npc)
{
CheckThreatLevel(ThreatLevel.High, "osNpcGetPos");
m_host.AddScriptLPS(1);
INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
if (npcModule != null)
@ -2375,6 +2392,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void osNpcMoveTo(LSL_Key npc, LSL_Vector position)
{
CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo");
m_host.AddScriptLPS(1);
INPCModule module = World.RequestModuleInterface<INPCModule>();
if (module != null)
@ -2394,6 +2412,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector target, int options)
{
CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget");
m_host.AddScriptLPS(1);
INPCModule module = World.RequestModuleInterface<INPCModule>();
if (module != null)
@ -2418,6 +2437,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Rotation osNpcGetRot(LSL_Key npc)
{
CheckThreatLevel(ThreatLevel.High, "osNpcGetRot");
m_host.AddScriptLPS(1);
INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
if (npcModule != null)
@ -2441,6 +2461,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void osNpcSetRot(LSL_Key npc, LSL_Rotation rotation)
{
CheckThreatLevel(ThreatLevel.High, "osNpcSetRot");
m_host.AddScriptLPS(1);
INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
if (npcModule != null)
@ -2460,6 +2481,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void osNpcStopMoveToTarget(LSL_Key npc)
{
CheckThreatLevel(ThreatLevel.VeryLow, "osNpcStopMoveTo");
m_host.AddScriptLPS(1);
INPCModule module = World.RequestModuleInterface<INPCModule>();
if (module != null)
@ -2476,6 +2498,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void osNpcSay(LSL_Key npc, string message)
{
CheckThreatLevel(ThreatLevel.High, "osNpcSay");
m_host.AddScriptLPS(1);
INPCModule module = World.RequestModuleInterface<INPCModule>();
if (module != null)
@ -2492,6 +2515,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void osNpcSit(LSL_Key npc, LSL_Key target, int options)
{
CheckThreatLevel(ThreatLevel.High, "osNpcSit");
m_host.AddScriptLPS(1);
INPCModule module = World.RequestModuleInterface<INPCModule>();
if (module != null)
@ -2508,6 +2532,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void osNpcStand(LSL_Key npc)
{
CheckThreatLevel(ThreatLevel.High, "osNpcStand");
m_host.AddScriptLPS(1);
INPCModule module = World.RequestModuleInterface<INPCModule>();
if (module != null)
@ -2524,6 +2549,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void osNpcRemove(LSL_Key npc)
{
CheckThreatLevel(ThreatLevel.High, "osNpcRemove");
m_host.AddScriptLPS(1);
INPCModule module = World.RequestModuleInterface<INPCModule>();
if (module != null)
@ -2540,6 +2566,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void osNpcPlayAnimation(LSL_Key npc, string animation)
{
CheckThreatLevel(ThreatLevel.High, "osNpcPlayAnimation");
m_host.AddScriptLPS(1);
INPCModule module = World.RequestModuleInterface<INPCModule>();
if (module != null)
@ -2554,6 +2581,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void osNpcStopAnimation(LSL_Key npc, string animation)
{
CheckThreatLevel(ThreatLevel.High, "osNpcStopAnimation");
m_host.AddScriptLPS(1);
INPCModule module = World.RequestModuleInterface<INPCModule>();
if (module != null)
@ -2573,6 +2601,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Key osOwnerSaveAppearance(string notecard)
{
CheckThreatLevel(ThreatLevel.High, "osOwnerSaveAppearance");
m_host.AddScriptLPS(1);
return SaveAppearanceToNotecard(m_host.OwnerID, notecard);
}
@ -2580,6 +2609,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Key osAgentSaveAppearance(LSL_Key avatarId, string notecard)
{
CheckThreatLevel(ThreatLevel.VeryHigh, "osAgentSaveAppearance");
m_host.AddScriptLPS(1);
return SaveAppearanceToNotecard(avatarId, notecard);
}
@ -2630,6 +2660,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Key osGetMapTexture()
{
CheckThreatLevel(ThreatLevel.None, "osGetMapTexture");
m_host.AddScriptLPS(1);
return m_ScriptEngine.World.RegionInfo.RegionSettings.TerrainImageID.ToString();
}
@ -2641,6 +2673,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Key osGetRegionMapTexture(string regionName)
{
CheckThreatLevel(ThreatLevel.High, "osGetRegionMapTexture");
m_host.AddScriptLPS(1);
Scene scene = m_ScriptEngine.World;
UUID key = UUID.Zero;
GridRegion region;
@ -2706,6 +2740,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void osKickAvatar(string FirstName,string SurName,string alert)
{
CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar");
m_host.AddScriptLPS(1);
if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
{
World.ForEachRootScenePresence(delegate(ScenePresence sp)
@ -2840,6 +2876,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_List osGetAvatarList()
{
CheckThreatLevel(ThreatLevel.None, "osGetAvatarList");
m_host.AddScriptLPS(1);
LSL_List result = new LSL_List();
World.ForEachRootScenePresence(delegate (ScenePresence avatar)
@ -2864,6 +2901,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String osUnixTimeToTimestamp(long time)
{
CheckThreatLevel(ThreatLevel.VeryLow, "osUnixTimeToTimestamp");
m_host.AddScriptLPS(1);
long baseTicks = 621355968000000000;
long tickResolution = 10000000;
long epochTicks = (time * tickResolution) + baseTicks;
@ -2872,4 +2911,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return date.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ");
}
}
}
}