Adds osGetMapTexture() and osGetRegionMapTexture() methods to retrieve region map texture uuids
0.6.8-post-fixes
Justin Clark-Casey (justincc) 2009-11-12 19:42:35 +00:00
parent d95df603df
commit fe82471c2b
3 changed files with 81 additions and 32 deletions

View File

@ -1910,5 +1910,42 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
module.DeleteNPC(new UUID(npc.m_string), World);
}
}
/// <summary>
/// Get current region's map texture UUID
/// </summary>
/// <returns></returns>
public LSL_Key osGetMapTexture()
{
CheckThreatLevel(ThreatLevel.None, "osGetMapTexture");
return m_ScriptEngine.World.RegionInfo.RegionSettings.TerrainImageID.ToString();
}
/// <summary>
/// Get a region's map texture UUID by region UUID or name.
/// </summary>
/// <param name="regionName"></param>
/// <returns></returns>
public LSL_Key osGetRegionMapTexture(string regionName)
{
CheckThreatLevel(ThreatLevel.High, "osGetRegionMapTexture");
Scene scene = m_ScriptEngine.World;
UUID key = UUID.Zero;
GridRegion region;
//If string is a key, use it. Otherwise, try to locate region by name.
if (UUID.TryParse(regionName, out key))
region = scene.GridService.GetRegionByUUID(UUID.Zero, key);
else
region = scene.GridService.GetRegionByName(UUID.Zero, regionName);
// If region was found, return the regions map texture key.
if (region != null)
key = region.TerrainImage;
ScriptSleep(1000);
return key.ToString();
}
}
}

View File

@ -160,5 +160,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osNpcSay(key npc, string message);
void osNpcRemove(key npc);
key osGetMapTexture();
key osGetRegionMapTexture(string regionName);
}
}

View File

@ -622,5 +622,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
}
}
}
public key osGetMapTexture()
{
return m_OSSL_Functions.osGetMapTexture();
}
public key osGetRegionMapTexture(string regionName)
{
return m_OSSL_Functions.osGetRegionMapTexture(regionName);
}
}
}