mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-02 08:08:20 +00:00
Fix return value for some detection functions.
When the index is good, on non-touch functions: - llDetectedTouchFace returns -1. - llDetectedTouchST and llDetectedTouchUV return TOUCH_INVALID_TEXCOORD. We were returning 0 and ZERO_VECTOR respectively.
This commit is contained in:
parent
62eebb8bef
commit
b97b2a78e8
2 changed files with 8 additions and 4 deletions
|
@ -19,7 +19,8 @@
|
|||
|
||||
from lslcommon import Key, Vector #, Quaternion
|
||||
from lslbasefuncs import ELSLCantCompute, isinteger, iskey, islist, \
|
||||
isvector, isstring, NULL_KEY, ZERO_VECTOR, ZERO_ROTATION, cond
|
||||
isvector, isstring, NULL_KEY, ZERO_VECTOR, ZERO_ROTATION, \
|
||||
TOUCH_INVALID_TEXCOORD, cond
|
||||
#isfloat, isrotation
|
||||
|
||||
TouchEvents = ('touch', 'touch_start', 'touch_end')
|
||||
|
@ -101,7 +102,7 @@ def llDetectedTouchFace(idx, event=None):
|
|||
assert isinteger(idx)
|
||||
if 0 <= idx <= 15 and (event in TouchEvents or event is None):
|
||||
raise ELSLCantCompute
|
||||
return 0
|
||||
return -1 if event in DetectionEvents and 0 <= idx <= 15 else 0
|
||||
|
||||
def llDetectedTouchNormal(idx, event=None):
|
||||
assert isinteger(idx)
|
||||
|
@ -119,13 +120,15 @@ def llDetectedTouchST(idx, event=None):
|
|||
assert isinteger(idx)
|
||||
if 0 <= idx <= 15 and (event in TouchEvents or event is None):
|
||||
raise ELSLCantCompute
|
||||
return ZERO_VECTOR
|
||||
return TOUCH_INVALID_TEXCOORD if event in DetectionEvents \
|
||||
and 0 <= idx <= 15 else ZERO_VECTOR
|
||||
|
||||
def llDetectedTouchUV(idx, event=None):
|
||||
assert isinteger(idx)
|
||||
if 0 <= idx <= 15 and (event in TouchEvents or event is None):
|
||||
raise ELSLCantCompute
|
||||
return ZERO_VECTOR
|
||||
return TOUCH_INVALID_TEXCOORD if event in DetectionEvents \
|
||||
and 0 <= idx <= 15 else ZERO_VECTOR
|
||||
|
||||
def llDetectedType(idx, event=None):
|
||||
assert isinteger(idx)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue