diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 45 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 55 |
2 files changed, 80 insertions, 20 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2f61b70..23158b9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -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: |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 0dc2aa2..2899774 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -3095,5 +3095,60 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3095 | 3095 | ||
3096 | return ScriptBaseClass.TRUE; | 3096 | return ScriptBaseClass.TRUE; |
3097 | } | 3097 | } |
3098 | |||
3099 | /// <summary> | ||
3100 | /// Sets terrain estate texture | ||
3101 | /// </summary> | ||
3102 | /// <param name="level"></param> | ||
3103 | /// <param name="texture"></param> | ||
3104 | /// <returns></returns> | ||
3105 | public void osSetTerrainTexture(int level, LSL_Key texture) | ||
3106 | { | ||
3107 | CheckThreatLevel(ThreatLevel.High, "osSetTerrainTexture"); | ||
3108 | |||
3109 | m_host.AddScriptLPS(1); | ||
3110 | //Check to make sure that the script's owner is the estate manager/master | ||
3111 | //World.Permissions.GenericEstatePermission( | ||
3112 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
3113 | { | ||
3114 | if (level < 0 || level > 3) | ||
3115 | return; | ||
3116 | |||
3117 | UUID textureID = new UUID(); | ||
3118 | if (!UUID.TryParse(texture, out textureID)) | ||
3119 | return; | ||
3120 | |||
3121 | // estate module is required | ||
3122 | IEstateModule estate = World.RequestModuleInterface<IEstateModule>(); | ||
3123 | if (estate != null) | ||
3124 | estate.setEstateTerrainBaseTexture(level, textureID); | ||
3125 | } | ||
3126 | } | ||
3127 | |||
3128 | /// <summary> | ||
3129 | /// Sets terrain heights of estate | ||
3130 | /// </summary> | ||
3131 | /// <param name="corner"></param> | ||
3132 | /// <param name="low"></param> | ||
3133 | /// <param name="high"></param> | ||
3134 | /// <returns></returns> | ||
3135 | public void osSetTerrainTextureHeight(int corner, double low, double high) | ||
3136 | { | ||
3137 | CheckThreatLevel(ThreatLevel.High, "osSetTerrainTextureHeight"); | ||
3138 | |||
3139 | m_host.AddScriptLPS(1); | ||
3140 | //Check to make sure that the script's owner is the estate manager/master | ||
3141 | //World.Permissions.GenericEstatePermission( | ||
3142 | if (World.Permissions.IsGod(m_host.OwnerID)) | ||
3143 | { | ||
3144 | if (corner < 0 || corner > 3) | ||
3145 | return; | ||
3146 | |||
3147 | // estate module is required | ||
3148 | IEstateModule estate = World.RequestModuleInterface<IEstateModule>(); | ||
3149 | if (estate != null) | ||
3150 | estate.setEstateTerrainTextureHeights(corner, (float)low, (float)high); | ||
3151 | } | ||
3152 | } | ||
3098 | } | 3153 | } |
3099 | } | 3154 | } |