diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
3 files changed, 139 insertions, 75 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8e73eb1..e9ec314 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -9990,7 +9990,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9990 | // child agents have a mass of 1.0 | 9990 | // child agents have a mass of 1.0 |
9991 | return 1; | 9991 | return 1; |
9992 | else | 9992 | else |
9993 | return avatar.GetMass(); | 9993 | return (double)avatar.GetMass(); |
9994 | } | 9994 | } |
9995 | catch (KeyNotFoundException) | 9995 | catch (KeyNotFoundException) |
9996 | { | 9996 | { |
@@ -11182,19 +11182,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11182 | break; | 11182 | break; |
11183 | // For the following 8 see the Object version below | 11183 | // For the following 8 see the Object version below |
11184 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: | 11184 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: |
11185 | ret.Add(new LSL_Integer(0)); | 11185 | ret.Add(new LSL_Integer(av.RunningScriptCount())); |
11186 | break; | 11186 | break; |
11187 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: | 11187 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: |
11188 | ret.Add(new LSL_Integer(0)); | 11188 | ret.Add(new LSL_Integer(av.ScriptCount())); |
11189 | break; | 11189 | break; |
11190 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: | 11190 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: |
11191 | ret.Add(new LSL_Integer(0)); | 11191 | ret.Add(new LSL_Integer(av.RunningScriptCount() * 16384)); |
11192 | break; | 11192 | break; |
11193 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: | 11193 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: |
11194 | ret.Add(new LSL_Float(0)); | 11194 | ret.Add(new LSL_Float(av.ScriptExecutionTime() / 1000.0f)); |
11195 | break; | 11195 | break; |
11196 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: | 11196 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: |
11197 | ret.Add(new LSL_Integer(0)); | 11197 | ret.Add(new LSL_Integer(1)); |
11198 | break; | 11198 | break; |
11199 | case ScriptBaseClass.OBJECT_SERVER_COST: | 11199 | case ScriptBaseClass.OBJECT_SERVER_COST: |
11200 | ret.Add(new LSL_Float(0)); | 11200 | ret.Add(new LSL_Float(0)); |
@@ -11246,43 +11246,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11246 | case ScriptBaseClass.OBJECT_CREATOR: | 11246 | case ScriptBaseClass.OBJECT_CREATOR: |
11247 | ret.Add(new LSL_String(obj.CreatorID.ToString())); | 11247 | ret.Add(new LSL_String(obj.CreatorID.ToString())); |
11248 | break; | 11248 | break; |
11249 | // The following 8 I have intentionaly coded to return zero. They are part of | ||
11250 | // "Land Impact" calculations. These calculations are probably not applicable | ||
11251 | // to OpenSim, required figures (cpu/memory usage) are not currently tracked | ||
11252 | // I have intentionally left these all at zero rather than return possibly | ||
11253 | // missleading numbers | ||
11254 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: | 11249 | case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: |
11255 | // in SL this currently includes crashed scripts | 11250 | ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount())); |
11256 | ret.Add(new LSL_Integer(0)); | ||
11257 | break; | 11251 | break; |
11258 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: | 11252 | case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: |
11259 | ret.Add(new LSL_Integer(0)); | 11253 | ret.Add(new LSL_Integer(obj.ParentGroup.ScriptCount())); |
11260 | break; | 11254 | break; |
11261 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: | 11255 | case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: |
11262 | // The value returned in SL for mono scripts is 65536 * number of active scripts | 11256 | // The value returned in SL for mono scripts is 65536 * number of active scripts |
11263 | ret.Add(new LSL_Integer(0)); | 11257 | // and 16384 * number of active scripts for LSO. since llGetFreememory |
11258 | // is coded to give the LSO value use it here | ||
11259 | ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount() * 16384)); | ||
11264 | break; | 11260 | break; |
11265 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: | 11261 | case ScriptBaseClass.OBJECT_SCRIPT_TIME: |
11266 | // Average cpu time per simulator frame expended on all scripts in the objetc | 11262 | // Average cpu time in seconds per simulator frame expended on all scripts in the object |
11267 | ret.Add(new LSL_Float(0)); | 11263 | ret.Add(new LSL_Float(obj.ParentGroup.ScriptExecutionTime() / 1000.0f)); |
11268 | break; | 11264 | break; |
11269 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: | 11265 | case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: |
11270 | // according to the SL wiki A prim or linkset will have prim | 11266 | // according to the SL wiki A prim or linkset will have prim |
11271 | // equivalent of the number of prims in a linkset if it does not | 11267 | // equivalent of the number of prims in a linkset if it does not |
11272 | // contain a mesh anywhere in the link set or is not a normal prim | 11268 | // contain a mesh anywhere in the link set or is not a normal prim |
11273 | // The value returned in SL for normal prims is prim count | 11269 | // The value returned in SL for normal prims is prim count |
11274 | ret.Add(new LSL_Integer(0)); | 11270 | ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount)); |
11275 | break; | 11271 | break; |
11272 | // The following 3 costs I have intentionaly coded to return zero. They are part of | ||
11273 | // "Land Impact" calculations. These calculations are probably not applicable | ||
11274 | // to OpenSim and are not yet complete in SL | ||
11276 | case ScriptBaseClass.OBJECT_SERVER_COST: | 11275 | case ScriptBaseClass.OBJECT_SERVER_COST: |
11277 | // The value returned in SL for normal prims is prim count | 11276 | // The linden calculation is here |
11277 | // http://wiki.secondlife.com/wiki/Mesh/Mesh_Server_Weight | ||
11278 | // The value returned in SL for normal prims looks like the prim count | ||
11278 | ret.Add(new LSL_Float(0)); | 11279 | ret.Add(new LSL_Float(0)); |
11279 | break; | 11280 | break; |
11280 | case ScriptBaseClass.OBJECT_STREAMING_COST: | 11281 | case ScriptBaseClass.OBJECT_STREAMING_COST: |
11281 | // The value returned in SL for normal prims is prim count * 0.06 | 11282 | // The linden calculation is here |
11283 | // http://wiki.secondlife.com/wiki/Mesh/Mesh_Streaming_Cost | ||
11284 | // The value returned in SL for normal prims looks like the prim count * 0.06 | ||
11282 | ret.Add(new LSL_Float(0)); | 11285 | ret.Add(new LSL_Float(0)); |
11283 | break; | 11286 | break; |
11284 | case ScriptBaseClass.OBJECT_PHYSICS_COST: | 11287 | case ScriptBaseClass.OBJECT_PHYSICS_COST: |
11285 | // The value returned in SL for normal prims is prim count | 11288 | // The linden calculation is here |
11289 | // http://wiki.secondlife.com/wiki/Mesh/Mesh_physics | ||
11290 | // The value returned in SL for normal prims looks like the prim count | ||
11286 | ret.Add(new LSL_Float(0)); | 11291 | ret.Add(new LSL_Float(0)); |
11287 | break; | 11292 | break; |
11288 | default: | 11293 | default: |
@@ -12037,7 +12042,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12037 | bool isAccount = false; | 12042 | bool isAccount = false; |
12038 | bool isGroup = false; | 12043 | bool isGroup = false; |
12039 | 12044 | ||
12040 | if (!estate.IsEstateOwner(m_host.OwnerID) || !estate.IsEstateManager(m_host.OwnerID)) | 12045 | if (!estate.IsEstateOwner(m_host.OwnerID) || !estate.IsEstateManagerOrOwner(m_host.OwnerID)) |
12041 | return 0; | 12046 | return 0; |
12042 | 12047 | ||
12043 | UUID id = new UUID(); | 12048 | UUID id = new UUID(); |
@@ -12099,35 +12104,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12099 | return 1; | 12104 | return 1; |
12100 | } | 12105 | } |
12101 | 12106 | ||
12102 | #region Not Implemented | 12107 | public LSL_Integer llGetMemoryLimit() |
12103 | // | 12108 | { |
12104 | // Listing the unimplemented lsl functions here, please move | 12109 | m_host.AddScriptLPS(1); |
12105 | // them from this region as they are completed | 12110 | // The value returned for LSO scripts in SL |
12106 | // | 12111 | return 16384; |
12112 | } | ||
12107 | 12113 | ||
12108 | public void llGetEnv(LSL_String name) | 12114 | public LSL_Integer llSetMemoryLimit(LSL_Integer limit) |
12109 | { | 12115 | { |
12110 | m_host.AddScriptLPS(1); | 12116 | m_host.AddScriptLPS(1); |
12111 | NotImplemented("llGetEnv"); | 12117 | // Treat as an LSO script |
12118 | return ScriptBaseClass.FALSE; | ||
12112 | } | 12119 | } |
12113 | 12120 | ||
12114 | public void llGetSPMaxMemory() | 12121 | public LSL_Integer llGetSPMaxMemory() |
12115 | { | 12122 | { |
12116 | m_host.AddScriptLPS(1); | 12123 | m_host.AddScriptLPS(1); |
12117 | NotImplemented("llGetSPMaxMemory"); | 12124 | // The value returned for LSO scripts in SL |
12125 | return 16384; | ||
12118 | } | 12126 | } |
12119 | 12127 | ||
12120 | public virtual LSL_Integer llGetUsedMemory() | 12128 | public virtual LSL_Integer llGetUsedMemory() |
12121 | { | 12129 | { |
12122 | m_host.AddScriptLPS(1); | 12130 | m_host.AddScriptLPS(1); |
12123 | NotImplemented("llGetUsedMemory"); | 12131 | // The value returned for LSO scripts in SL |
12124 | return 0; | 12132 | return 16384; |
12125 | } | 12133 | } |
12126 | 12134 | ||
12127 | public void llScriptProfiler(LSL_Integer flags) | 12135 | public void llScriptProfiler(LSL_Integer flags) |
12128 | { | 12136 | { |
12129 | m_host.AddScriptLPS(1); | 12137 | m_host.AddScriptLPS(1); |
12130 | //NotImplemented("llScriptProfiler"); | 12138 | // This does nothing for LSO scripts in SL |
12139 | } | ||
12140 | |||
12141 | #region Not Implemented | ||
12142 | // | ||
12143 | // Listing the unimplemented lsl functions here, please move | ||
12144 | // them from this region as they are completed | ||
12145 | // | ||
12146 | |||
12147 | public void llGetEnv(LSL_String name) | ||
12148 | { | ||
12149 | m_host.AddScriptLPS(1); | ||
12150 | NotImplemented("llGetEnv"); | ||
12131 | } | 12151 | } |
12132 | 12152 | ||
12133 | public void llSetSoundQueueing(int queue) | 12153 | public void llSetSoundQueueing(int queue) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index 77a784d..df20126 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | |||
@@ -449,7 +449,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
449 | LSShoutError("LightShare functions are not enabled."); | 449 | LSShoutError("LightShare functions are not enabled."); |
450 | return 0; | 450 | return 0; |
451 | } | 451 | } |
452 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) | 452 | if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) |
453 | { | 453 | { |
454 | LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); | 454 | LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); |
455 | return 0; | 455 | return 0; |
@@ -477,7 +477,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
477 | LSShoutError("LightShare functions are not enabled."); | 477 | LSShoutError("LightShare functions are not enabled."); |
478 | return; | 478 | return; |
479 | } | 479 | } |
480 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) | 480 | if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) |
481 | { | 481 | { |
482 | LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); | 482 | LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); |
483 | return; | 483 | return; |
@@ -500,7 +500,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
500 | LSShoutError("LightShare functions are not enabled."); | 500 | LSShoutError("LightShare functions are not enabled."); |
501 | return 0; | 501 | return 0; |
502 | } | 502 | } |
503 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) | 503 | if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) |
504 | { | 504 | { |
505 | LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners."); | 505 | LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners."); |
506 | return 0; | 506 | return 0; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 0dc2aa2..89e85a0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -378,7 +378,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
378 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("ESTATE_MANAGER")) | 378 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("ESTATE_MANAGER")) |
379 | { | 379 | { |
380 | //Only Estate Managers may use the function | 380 | //Only Estate Managers may use the function |
381 | if (World.RegionInfo.EstateSettings.IsEstateManager(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID) | 381 | if (World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID) |
382 | { | 382 | { |
383 | return; | 383 | return; |
384 | } | 384 | } |
@@ -1186,12 +1186,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1186 | CheckThreatLevel(ThreatLevel.High, "osSetRegionWaterHeight"); | 1186 | CheckThreatLevel(ThreatLevel.High, "osSetRegionWaterHeight"); |
1187 | 1187 | ||
1188 | m_host.AddScriptLPS(1); | 1188 | m_host.AddScriptLPS(1); |
1189 | //Check to make sure that the script's owner is the estate manager/master | 1189 | |
1190 | //World.Permissions.GenericEstatePermission( | 1190 | World.EventManager.TriggerRequestChangeWaterHeight((float)height); |
1191 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
1192 | { | ||
1193 | World.EventManager.TriggerRequestChangeWaterHeight((float)height); | ||
1194 | } | ||
1195 | } | 1191 | } |
1196 | 1192 | ||
1197 | /// <summary> | 1193 | /// <summary> |
@@ -1202,27 +1198,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1202 | /// <param name="sunHour">The "Sun Hour" that is desired, 0...24, with 0 just after SunRise</param> | 1198 | /// <param name="sunHour">The "Sun Hour" that is desired, 0...24, with 0 just after SunRise</param> |
1203 | public void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour) | 1199 | public void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour) |
1204 | { | 1200 | { |
1205 | CheckThreatLevel(ThreatLevel.Nuisance, "osSetRegionSunSettings"); | 1201 | CheckThreatLevel(ThreatLevel.High, "osSetRegionSunSettings"); |
1206 | 1202 | ||
1207 | m_host.AddScriptLPS(1); | 1203 | m_host.AddScriptLPS(1); |
1208 | //Check to make sure that the script's owner is the estate manager/master | ||
1209 | //World.Permissions.GenericEstatePermission( | ||
1210 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
1211 | { | ||
1212 | while (sunHour > 24.0) | ||
1213 | sunHour -= 24.0; | ||
1214 | 1204 | ||
1215 | while (sunHour < 0) | 1205 | while (sunHour > 24.0) |
1216 | sunHour += 24.0; | 1206 | sunHour -= 24.0; |
1217 | 1207 | ||
1208 | while (sunHour < 0) | ||
1209 | sunHour += 24.0; | ||
1218 | 1210 | ||
1219 | World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun; | 1211 | World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun; |
1220 | World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 | 1212 | World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 |
1221 | World.RegionInfo.RegionSettings.FixedSun = sunFixed; | 1213 | World.RegionInfo.RegionSettings.FixedSun = sunFixed; |
1222 | World.RegionInfo.RegionSettings.Save(); | 1214 | World.RegionInfo.RegionSettings.Save(); |
1223 | 1215 | ||
1224 | World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle, sunFixed, useEstateSun, (float)sunHour); | 1216 | World.EventManager.TriggerEstateToolsSunUpdate( |
1225 | } | 1217 | World.RegionInfo.RegionHandle, sunFixed, useEstateSun, (float)sunHour); |
1226 | } | 1218 | } |
1227 | 1219 | ||
1228 | /// <summary> | 1220 | /// <summary> |
@@ -1232,26 +1224,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1232 | /// <param name="sunHour">The "Sun Hour" that is desired, 0...24, with 0 just after SunRise</param> | 1224 | /// <param name="sunHour">The "Sun Hour" that is desired, 0...24, with 0 just after SunRise</param> |
1233 | public void osSetEstateSunSettings(bool sunFixed, double sunHour) | 1225 | public void osSetEstateSunSettings(bool sunFixed, double sunHour) |
1234 | { | 1226 | { |
1235 | CheckThreatLevel(ThreatLevel.Nuisance, "osSetEstateSunSettings"); | 1227 | CheckThreatLevel(ThreatLevel.High, "osSetEstateSunSettings"); |
1236 | 1228 | ||
1237 | m_host.AddScriptLPS(1); | 1229 | m_host.AddScriptLPS(1); |
1238 | //Check to make sure that the script's owner is the estate manager/master | ||
1239 | //World.Permissions.GenericEstatePermission( | ||
1240 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
1241 | { | ||
1242 | while (sunHour > 24.0) | ||
1243 | sunHour -= 24.0; | ||
1244 | 1230 | ||
1245 | while (sunHour < 0) | 1231 | while (sunHour > 24.0) |
1246 | sunHour += 24.0; | 1232 | sunHour -= 24.0; |
1247 | 1233 | ||
1248 | World.RegionInfo.EstateSettings.UseGlobalTime = !sunFixed; | 1234 | while (sunHour < 0) |
1249 | World.RegionInfo.EstateSettings.SunPosition = sunHour; | 1235 | sunHour += 24.0; |
1250 | World.RegionInfo.EstateSettings.FixedSun = sunFixed; | ||
1251 | World.RegionInfo.EstateSettings.Save(); | ||
1252 | 1236 | ||
1253 | World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle, sunFixed, World.RegionInfo.RegionSettings.UseEstateSun, (float)sunHour); | 1237 | World.RegionInfo.EstateSettings.UseGlobalTime = !sunFixed; |
1254 | } | 1238 | World.RegionInfo.EstateSettings.SunPosition = sunHour; |
1239 | World.RegionInfo.EstateSettings.FixedSun = sunFixed; | ||
1240 | World.RegionInfo.EstateSettings.Save(); | ||
1241 | |||
1242 | World.EventManager.TriggerEstateToolsSunUpdate( | ||
1243 | World.RegionInfo.RegionHandle, sunFixed, World.RegionInfo.RegionSettings.UseEstateSun, (float)sunHour); | ||
1255 | } | 1244 | } |
1256 | 1245 | ||
1257 | /// <summary> | 1246 | /// <summary> |
@@ -2555,7 +2544,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2555 | 2544 | ||
2556 | public void osNpcStopMoveToTarget(LSL_Key npc) | 2545 | public void osNpcStopMoveToTarget(LSL_Key npc) |
2557 | { | 2546 | { |
2558 | CheckThreatLevel(ThreatLevel.VeryLow, "osNpcStopMoveTo"); | 2547 | CheckThreatLevel(ThreatLevel.High, "osNpcStopMoveToTarget"); |
2559 | m_host.AddScriptLPS(1); | 2548 | m_host.AddScriptLPS(1); |
2560 | 2549 | ||
2561 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | 2550 | INPCModule module = World.RequestModuleInterface<INPCModule>(); |
@@ -3095,5 +3084,60 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3095 | 3084 | ||
3096 | return ScriptBaseClass.TRUE; | 3085 | return ScriptBaseClass.TRUE; |
3097 | } | 3086 | } |
3087 | |||
3088 | /// <summary> | ||
3089 | /// Sets terrain estate texture | ||
3090 | /// </summary> | ||
3091 | /// <param name="level"></param> | ||
3092 | /// <param name="texture"></param> | ||
3093 | /// <returns></returns> | ||
3094 | public void osSetTerrainTexture(int level, LSL_Key texture) | ||
3095 | { | ||
3096 | CheckThreatLevel(ThreatLevel.High, "osSetTerrainTexture"); | ||
3097 | |||
3098 | m_host.AddScriptLPS(1); | ||
3099 | //Check to make sure that the script's owner is the estate manager/master | ||
3100 | //World.Permissions.GenericEstatePermission( | ||
3101 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
3102 | { | ||
3103 | if (level < 0 || level > 3) | ||
3104 | return; | ||
3105 | |||
3106 | UUID textureID = new UUID(); | ||
3107 | if (!UUID.TryParse(texture, out textureID)) | ||
3108 | return; | ||
3109 | |||
3110 | // estate module is required | ||
3111 | IEstateModule estate = World.RequestModuleInterface<IEstateModule>(); | ||
3112 | if (estate != null) | ||
3113 | estate.setEstateTerrainBaseTexture(level, textureID); | ||
3114 | } | ||
3115 | } | ||
3116 | |||
3117 | /// <summary> | ||
3118 | /// Sets terrain heights of estate | ||
3119 | /// </summary> | ||
3120 | /// <param name="corner"></param> | ||
3121 | /// <param name="low"></param> | ||
3122 | /// <param name="high"></param> | ||
3123 | /// <returns></returns> | ||
3124 | public void osSetTerrainTextureHeight(int corner, double low, double high) | ||
3125 | { | ||
3126 | CheckThreatLevel(ThreatLevel.High, "osSetTerrainTextureHeight"); | ||
3127 | |||
3128 | m_host.AddScriptLPS(1); | ||
3129 | //Check to make sure that the script's owner is the estate manager/master | ||
3130 | //World.Permissions.GenericEstatePermission( | ||
3131 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
3132 | { | ||
3133 | if (corner < 0 || corner > 3) | ||
3134 | return; | ||
3135 | |||
3136 | // estate module is required | ||
3137 | IEstateModule estate = World.RequestModuleInterface<IEstateModule>(); | ||
3138 | if (estate != null) | ||
3139 | estate.setEstateTerrainTextureHeights(corner, (float)low, (float)high); | ||
3140 | } | ||
3141 | } | ||
3098 | } | 3142 | } |
3099 | } | 3143 | } |