From ae984169adcea90728662dc057acd194f84f0750 Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Mon, 12 Dec 2016 22:58:12 +0100 Subject: [PATCH] Add llGetEnv to the partially computable functions. Includes all known settings up to 16.12.03.322072 so far. It will be updated as new settings are added. --- lslopt/lslextrafuncs.py | 16 ++++++++++++++-- testfuncs.py | 5 +++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lslopt/lslextrafuncs.py b/lslopt/lslextrafuncs.py index 9038919..c2450d6 100644 --- a/lslopt/lslextrafuncs.py +++ b/lslopt/lslextrafuncs.py @@ -19,13 +19,19 @@ from lslcommon import * from lslbasefuncs import ELSLCantCompute, isinteger, iskey, islist, \ - isvector, NULL_KEY, ZERO_VECTOR, ZERO_ROTATION -#isfloat, isstring, isrotation + isvector, isstring, NULL_KEY, ZERO_VECTOR, ZERO_ROTATION +#isfloat, isrotation TouchEvents = ('touch', 'touch_start', 'touch_end') DetectionEvents = ('touch', 'touch_start', 'touch_end', 'collision', 'collision_start', 'collision_end', 'sensor') +GetEnvSettings = ('agent_limit', 'dynamic_pathfinding', 'estate_id', + 'estate_name', 'frame_number', 'region_cpu_ratio', 'region_idle', + 'region_product_name', 'region_product_sku', 'region_start_time', + 'sim_channel', 'sim_version', 'simulator_hostname', + 'region_max_prims', # + 'region_object_bonus') # def llCloud(v): assert isvector(v) @@ -201,4 +207,10 @@ def llGetDisplayName(id): return u'' raise ELSLCantCompute +def llGetEnv(s): + assert isstring(s) + if s not in GetEnvSettings: + return u"" + raise ELSLCantCompute + # TODO: Add more predictable functions. diff --git a/testfuncs.py b/testfuncs.py index 37e0600..ba303db 100644 --- a/testfuncs.py +++ b/testfuncs.py @@ -1298,7 +1298,12 @@ def do_tests(): test('llListInsertList([], [1], -1)', [1]) test('llListInsertList([1,2,3,4,5],[9],-3)', [1,2,9,3,4,5]) + test('llGetEnv(u"")', u'') + test('llGetEnv(u"yadda")', u'') + shouldexcept('llGetEnv(u"agent_limit")', ELSLCantCompute) + # JSON tests - Here be dragons. + print("9 errors expected past here -------------------------------------------------") test('''llEscapeURL(llList2Json(JSON_OBJECT, [llUnescapeURL( u"%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F" u"%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F"