Christopher Willis-Ford
3c28f714bb
respond to code review
2019-06-17 21:14:21 -07:00
Chris Willis-Ford
18b1551cdb
remove redundant check
...
Co-Authored-By: Karishma Chadha <kchadha@media.mit.edu>
2019-06-17 13:22:52 -07:00
Christopher Willis-Ford
3fbed88a95
switch from rejectReporters
flag to acceptReporters
...
Also add more extensive documentation around extension menu definitions,
including some considerations to think about before making a menu accept
reporters.
2019-06-14 12:29:32 -07:00
Christopher Willis-Ford
e7bf49c8df
support non-droppable menus in extensions
2019-06-14 12:29:32 -07:00
Michael "Z" Goddard
e1254bd8c7
elevate stack block id and frame info into thread
...
- Add pointer member to thread. This is the current executing block.
- Add stackFrame member to thread. This is the current frame
information like procedure parameters.
This is a step potentially towards stack-less threads. With further
modifications we could have stack and stackFrames be null if a script
does not call a procedure.
2019-06-03 18:13:01 -04:00
Michael "Z" Goddard
ffcd0e6518
remove empty procedure_definetion block
...
The engine supports blocks that do not have defined functions.
2019-06-03 15:49:11 -04:00
Paul Kaplan
5e626eb7e9
Initial prototype of configurable scratch link socket
2019-05-24 12:51:58 -04:00
Karishma Chadha
14d2820460
Merge pull request #1648 from mzgoddard/stop-all-next-tick
...
Stop all next tick
2019-05-15 11:25:15 -04:00
Karishma Chadha
39f15d3699
Update comment for new extension update event
2019-04-25 11:36:31 -04:00
Karishma Chadha
92a73fef55
Add a runtime event to track when the toolbox extension blocks need updating.
2019-04-24 11:28:02 -04:00
Christopher Willis-Ford
91f0d59be0
fix extension block color application
2019-04-23 12:31:31 -07:00
Karishma Chadha
297047a6b9
Fix serialization of blockInfo mutation property to XML
2019-04-23 11:44:45 -04:00
Christopher Willis-Ford
a27ea76d25
add "scratch_extension" only if a block has an icon
2019-04-22 17:47:31 -07:00
Christopher Willis-Ford
107e49245f
adjust getBlocksXML to return categories separately
...
before: getBlocksXML returns one big XML string
after: getBlocksXML returns an array of {id,xml}, one entry per category
2019-04-22 12:32:52 -07:00
Christopher Willis-Ford
0247447792
embed extension blockInfo into block XML
2019-04-22 09:53:05 -07:00
Christopher Willis-Ford
bd1aaecdf3
add category info to extension add & update events
2019-04-19 16:06:11 -07:00
Christopher Willis-Ford
833d33355c
retrieve blockInfo from args when isDynamic is set
2019-04-19 16:06:11 -07:00
Michael "Z" Goddard
ebdf3865d4
retire new threads if they have no block after the hat
2019-04-19 16:48:09 -04:00
Michael "Z" Goddard
548e28480a
add BlocksRuntimeCache; rewrite startHats
2019-04-19 13:22:22 -04:00
Michael "Z" Goddard
c3f9e0945b
determine _pushThread defaults without Object.assign
2019-04-19 13:22:20 -04:00
Christopher Willis-Ford
a308b1e02f
use xmlEscape instead of escape-html for extensions
2019-04-17 16:48:58 -07:00
Karishma Chadha
23136ad9c3
Revert "Cache hat block information for the runtime"
2019-04-17 16:05:24 -04:00
Karishma Chadha
a984d1ae9d
Merge pull request #1930 from mzgoddard/runtime-script-cache
...
Cache hat block information for the runtime
2019-04-17 15:55:47 -04:00
Michael "Z" Goddard
39b18fedde
stop all removes threads from future execution
...
Stop all does not **stop** all threads. It stops the active thread and
removes all other threads from executing in the future.
2019-04-11 14:42:10 -04:00
Christopher Willis-Ford
9eef05a7c5
Use new Scratch-specific callback keys for extension buttons
2019-04-02 22:47:26 -07:00
Christopher Willis-Ford
d59c6a0b73
Fix missing arg for extension block separators
2019-04-02 15:23:48 -07:00
Christopher Willis-Ford
bed54bae1f
Allow extensions to make buttons
2019-04-01 18:09:09 -07:00
Katie Broida
445ee46984
Merge pull request #1943 from ktbee/clock-timer-compat-fix
...
Start executing hats before other threads change values
2019-03-29 13:01:28 -04:00
Katie Broida
2a60391fb4
Make Scratch 3 project timer more compatible with Scratch 2 currentMSecs usage
...
These compatibility changes:
- Use runtime.currentMSecs for the Clock timer "now" value
- Start executing hats before other threads change values
- Update test and fixtures to work with earlier hat execution
- Add test for hat execution block order
2019-03-29 11:43:37 -04:00
Michael "Z" Goddard
96f3e3414e
add BlocksRuntimeCache; rewrite startHats
2019-03-12 17:09:59 -04:00
Paul Kaplan
2b53b8b647
Allow for situation where we get a move event to attach a shadow.
...
This happens after adding a custom procedure input to an existing custom procedure call block.
2019-03-11 14:52:40 -04:00
Katie Broida
cff1c2c0a4
Merge pull request #1959 from ktbee/declare-const-once
...
Declare const once to be reused in for loop
2019-02-25 15:57:52 -05:00
Michael "Z" Goddard
84de5cdc7e
determine _pushThread defaults without Object.assign
2019-02-22 15:56:34 -05:00
Paul Kaplan
3b203a2a9b
Merge pull request #1995 from paulkaplan/is-discrete
...
Support isDiscrete flag on monitors
2019-02-13 11:19:51 -05:00
Karishma Chadha
59f58b0284
Merge pull request #1933 from ErikMejerHansen/feature/field_type_support
...
Feature/field type support
2019-02-12 09:59:22 -05:00
Paul Kaplan
6754fa9334
Add isDiscrete to monitor record, update sb2,3 and conversion tests
2019-02-11 11:09:01 -05:00
picklesrus
b904f19c1d
Fix loading broadcast messages with special characters for projects that were converted from 2.0.
2019-02-06 16:58:46 -05:00
Karishma Chadha
4e924bf4b5
Merge pull request #1973 from kchadha/fix-variable-characters
...
Fix variable characters
2019-02-05 17:01:43 -05:00
Karishma Chadha
c796a8b1cc
Merge pull request #1962 from LLK/project-dirty-state-fixes
...
Project dirty state fixes
2019-02-05 16:38:30 -05:00
Karishma Chadha
d91c19434f
Rename util function to be more descriptive. Refactor parameters to remove unused code.
2019-02-04 19:05:28 -05:00
Karishma Chadha
7faddb6c8f
Replace xml-unsafe chars in sb3 variables.
2019-02-04 15:32:01 -05:00
Karishma Chadha
166bc37f6f
Merge pull request #1945 from yokobond/fix-message-variable-name-destruction
...
Escape variable name in XML
2019-02-04 10:10:13 -05:00
Karishma Chadha
13e69bad7b
Code cleanup -- move out duplicate .then
statements after the next .then
(at the higher level)
2019-01-30 16:45:38 -05:00
Karishma Chadha
94cc7e66b6
Remove superfluous runtime not optional warnings.
2019-01-30 15:57:56 -05:00
Karishma Chadha
dfcd09fedc
Stop emitting project changes within 'runtime._step()'. Emit project changes in scenarios that were previously taking advantage of runtime._step()
2019-01-30 10:59:25 -05:00
Karishma Chadha
e276bcc9fd
Emit project changes when actually editing blocks instead of whenever scratch-blocks events are fired.
2019-01-30 10:59:25 -05:00
Karishma Chadha
a9cf509a55
Merge pull request #1941 from kchadha/add-runtime-to-blocks
...
Add reference for `runtime` to blocks container
2019-01-30 10:57:45 -05:00
Katie Broida
356a4e7880
Declare const once to be resused in for loop
2019-01-29 10:47:54 -05:00
yokobond
8eee92d41a
Escape variable name in XML
2019-01-25 10:31:33 +09:00
Erik Mejer Hansen
c750957465
Convert lint breakage
2019-01-24 13:21:46 +01:00
Karishma Chadha
e5723e299a
Add runtime to blocks container since it was getting passed in everywhere where it was being referenced. Update calls to blocks constructor.
2019-01-23 18:18:38 -05:00
Karishma Chadha
98b92be2d7
Merge pull request #1928 from kchadha/timer-perf
...
Improve the performance of the timer utilitiy
2019-01-23 11:41:41 -05:00
Karishma Chadha
7588f08f3b
Use sequencer runtime directly instead of doing an extra lookup
2019-01-23 11:33:36 -05:00
Erik Mejer Hansen
ceaa3c7857
Add support extensions to define custom field types.
...
This is done by adding a new element "customFieldTypes" to the extension info structure. Ex:
```
customFieldTypes: {
angleField: {
implementation: { fromJson: options => new AngleField(options) },
output: 'number',
outputShape: 2,
}
}
```
Field types are defined by an implementation that has to match what is expected by ScratchBlocks.Field.register and its output and shape.
src/engine/runtime.js has been updated to handle the new "customFieldTypes"-field:
- Existing (global) field types cannot be overridden
- New fields are "namespaced" to the extension in the same way as opcodes are.
Once the custom field type has been picked up by scratch-vm a "EXTENSION_FIELD_ADDED" event is emitted.
It is then up to the hosting app to call ScratchBlocks.Field.register to register the field type with ScratchBlocks. Ex:
```
vm.addListener('EXTENSION_FIELD_ADDED', fieldInfo => {
this.ScratchBlocks.Field.register(fieldInfo.name, fieldInfo.implementation);
});
```
2019-01-20 21:24:32 +01:00
Eric Rosenbaum
0b251adace
Merge pull request #1763 from evhan55/extensions/disconnect-errors
...
Various fixes to extension disconnect errors
2019-01-18 16:58:45 -05:00
Evelyn Eastmond
7831256044
Change event names to be more descriptive. Fix some typos.
2019-01-16 20:17:19 -05:00
Evelyn Eastmond
7ec9494804
Making corrections based on discussion with ericr.
2019-01-16 15:54:38 -05:00
Evelyn Eastmond
156b1bc21a
Adding new runtime event for intentional peripheral disconnects.
2019-01-16 15:22:58 -05:00
Karishma Chadha
0fa5e9181a
Merge pull request #1839 from mzgoddard/fix-missing-no-param
...
fix: initialize stack frame params for all procedures
2019-01-16 14:06:38 -05:00
Karishma Chadha
325372233d
Improve the performance of the timer utilitiy so that it does not garbage collect multiple times per frame.
2019-01-16 10:09:19 -05:00
Katie Broida
8256b3d5c5
Add early exit for non-existent block
2019-01-15 11:15:23 -05:00
Karishma Chadha
59a865ef47
Create a new addTarget
function on the runtime which populates the targets list as well as the executable targets list.
2019-01-14 11:48:11 -05:00
Karishma Chadha
fbee37e915
Populate executable targets when runtime.targets is populated so that scripts don't run before they are supposed to (e.g. before targets are done getting installed).
2019-01-11 14:52:34 -05:00
Karishma Chadha
85843e5d6f
Fix cloud variable limit
2019-01-07 11:12:47 -05:00
picklesrus
178bdbd81b
Fix typo in comment
2018-12-18 11:01:53 -05:00
Michael "Z" Goddard
bdebfaf823
always pop the stack when the promised value is from the last op
2018-12-17 15:25:26 -05:00
Michael "Z" Goddard
20ff75b776
fix: initialize stack frame params for all procedures
...
A previous change fixed compatibility with Scratch 2 removing 3's
unintentional scope leaking. This furthers that change so that
procedures with no parameters will also not accidentally use values in
other procedure stacks.
2018-12-13 10:51:44 -05:00
Karishma Chadha
e5b00dfd95
Fix issues uncovered where clones were triggering automatically on create.
2018-12-12 13:25:19 -05:00
Karishma Chadha
6c4fb29523
Move tracking of edge activated hat values into target.
2018-12-12 12:05:55 -05:00
Karishma Chadha
19737d4e39
Fix issue where edge-activated hats only run on one sprite when sprite is duplicated or cloned.
2018-12-11 12:28:37 -05:00
picklesrus
ebe06a97d9
Merge pull request #1818 from picklesrus/monitor-vars-project-load
...
Clear out the blocks in dispose. Fixes #1758 where old monitored vari…
2018-12-07 15:08:09 -05:00
picklesrus
3f3c34b43a
Given the bug found with the old approach, fix this by going and deleting all of the monitor blocks for each sprite and the global variables.
2018-12-06 18:59:58 -05:00
Paul Kaplan
23d9c21a0e
Merge pull request #1822 from paulkaplan/fix-list-clones
...
Make duplicateVariable deep copy the array instead of keeping reference.
2018-12-06 09:21:41 -05:00
Paul Kaplan
9e57404222
Merge pull request #1821 from paulkaplan/fix-variable-monitor-switching
...
Fix an issue where the targetId of a monitor could be reassigned
2018-12-06 05:32:11 -05:00
Paul Kaplan
d50504e339
Make duplicateVariable deep copy the array instead of keeping reference.
2018-12-05 16:27:10 -05:00
Paul Kaplan
e0b314d3fb
Fix an issue where the targetId of a monitor could be reassigned
...
This caused a local variable monitor to try running its thread on a different sprite, causing a new local variable to be created with the same monitor id.
2018-12-05 15:02:27 -05:00
Paul Kaplan
ff3391718d
Merge pull request #1815 from paulkaplan/clear-pen-on-dispose
...
Clear the pen layer when runtime dispose happens.
2018-12-05 12:30:24 -05:00
picklesrus
cddcea652b
Clear out the blocks in dispose. Fixes #1758 where old monitored variables were getting kept across project loads
2018-12-05 12:09:12 -05:00
Paul Kaplan
6bd2307c99
Clear the pen layer when runtime dispose happens.
2018-12-04 16:43:31 -05:00
Katie Broida
967cab8f20
Make the wait block's logic and behavior more consistent with Scratch 2 ( #1759 )
2018-12-04 10:35:42 -05:00
Eric Rosenbaum
536305af1b
Remove vestigial device manager ( #1793 )
2018-12-03 15:52:23 -05:00
Karishma Chadha
5917ea571d
Serialize variable isCloud flag to xml.
2018-11-29 22:59:55 -05:00
DD Liu
122443a75f
Merge pull request #1754 from bocoup/handle-infinity
...
Make Scratch 3 comparisons with +/-Infinity match Scratch 2
2018-11-29 14:31:10 -05:00
Karishma Chadha
ff2566fec4
Merge pull request #1778 from kchadha/emit-cloud-data-update
...
Emit cloud data update
2018-11-28 17:23:29 -05:00
Karishma Chadha
6d033af61e
When clearing the runtime, emit has cloud data update.
2018-11-28 15:03:20 -05:00
Karishma Chadha
b828444ea8
Update comments for addCloudVariable and removeCloudVariable.
2018-11-28 15:03:20 -05:00
Karishma Chadha
86d61a4c20
Emit event tracking when the project's hasCloudData status changes. Cloud var creation now happens regardless of connectivity to the provider.
2018-11-28 15:03:19 -05:00
picklesrus
90b627982c
fix todo
2018-11-28 12:34:49 -05:00
picklesrus
eefe021425
add todo and remove a newline
2018-11-28 12:33:04 -05:00
picklesrus
4a542b455d
fix code review comments
2018-11-28 10:36:22 -05:00
picklesrus
f214d3a191
VM changes for the sensing_of block. This handles lists properly (by ignoring them like Scratch2 and makes the attribute menu update based on what was chosen in the target menu.
2018-11-28 10:35:35 -05:00
Paul Kaplan
421aac6340
Ensure setCompatibilityMode continues to restart if previously started.
...
This was previous behavior, but the previous commit which prevents restarts based on _steppingInterval truthiness broke it because clearInterval does not modify the value of _steppingInterval
2018-11-28 08:47:51 -05:00
Paul Kaplan
4378603d36
Prevent the runtime from spawning new stepping intervals
2018-11-28 08:34:22 -05:00
Paul Kaplan
ffb02c607d
Merge pull request #1783 from paulkaplan/emit-start-event
...
Emit a RUNTIME_STARTED event to track if the vm has been started
2018-11-27 16:38:27 -05:00
Paul Kaplan
cc4751228e
Emit a RUNTIME_STARTED event to track if the vm has been started
2018-11-27 11:37:01 -05:00
Ray Schamp
dd2023e2f3
Merge pull request #1779 from rschamp/project-dirty-signal
...
Add "project changed" event
2018-11-27 08:54:30 -05:00
Ray Schamp
5022227c15
Add "project changed" event
...
And emit it whenever we think the project has changed. Try to not emit it when a change has happened internally that shouldn't affect the serialized project.
This iteration fires the event too frequently, e.g., when switching sprites. This is meant as a simple initial implementation that can be improved.
2018-11-26 17:10:43 -05:00
Karishma Chadha
63c4b53b09
Replace reference to deleted variable with specific variable info needed.
2018-11-21 11:45:16 -05:00
Karishma Chadha
25ce08131a
Add rename and delete functionality for cloud variables. Refactor function name for cloud variable creation API.
2018-11-20 15:11:12 -05:00
Valerie R Young
dd81a261df
Remove Cast import
2018-11-16 16:49:27 -05:00