ast+js: Compile sensing_of
This commit is contained in:
3 files changed
+8
-1
No files matched your search
@@ -614,6 +614,12 @@ class ScriptTreeGenerator {
|
||||
kind: 'constant',
|
||||
value: block.fields.OBJECT.value
|
||||
};
|
||||
case 'sensing_of':
|
||||
return {
|
||||
kind: 'sensing.of',
|
||||
property: block.fields.PROPERTY.value,
|
||||
object: this.descendInput(block, 'OBJECT')
|
||||
};
|
||||
case 'sensing_timer':
|
||||
return {
|
||||
kind: 'timer.get'
|
||||
|
||||
@@ -50,7 +50,6 @@ const inputs = [
|
||||
'sensing_current',
|
||||
'sensing_loud',
|
||||
'sensing_loudness',
|
||||
'sensing_of',
|
||||
'sound_volume',
|
||||
'translate_getTranslate',
|
||||
'translate_getViewerLanguage',
|
||||
|
||||
@@ -471,6 +471,8 @@ class JSGenerator {
|
||||
case 'sensing.distance':
|
||||
// TODO: on stages, this can be computed at compile time
|
||||
return new TypedInput(`distance(${this.descendInput(node.target).asString()})`, TYPE_NUMBER);
|
||||
case 'sensing.of':
|
||||
return new TypedInput(`runtime.ext_scratch3_sensing.getAttributeOf({OBJECT: ${this.descendInput(node.object).asString()}, PROPERTY: "${sanitize(node.property)}" })`, TYPE_UNKNOWN);
|
||||
case 'sensing.touching':
|
||||
return new TypedInput(`target.isTouchingObject(${this.descendInput(node.object).asUnknown()})`, TYPE_BOOLEAN);
|
||||
case 'sensing.touchingColor':
|
||||
|
||||
Reference in new issue
Block a user