Commit graph

2122 commits

Author SHA1 Message Date
Florrie
1db4a2c7a7 Compatibility implementation 2018-03-22 18:55:36 -03:00
Eric Rosenbaum
4e3c5c7f2e
Merge pull request #991 from ericrosenbaum/bugfix/clones-share-activesoundplayers
Clones share their parent’s activeSoundPlayers object
2018-03-22 16:49:04 -04:00
Karishma Chadha
c4ad76eef1 Turns out ArrayBuffers are not views of themselves. 2018-03-22 16:19:36 -04:00
Karishma Chadha
3a4f620318 Check if loadProject input is any typed array using ArrayBuffer.isView. This allows us to pass a project's asset.data (from storage) directly instead of calling toString on it first. 2018-03-22 14:04:58 -04:00
Karishma Chadha
2c3e3472ed Add warning to 'fromJSON' function since it is now just a wrapper around loadProject. Change vm sb3_serialization test to use 'loadProject' function instead of 'fromJSON'. 2018-03-21 17:55:02 -04:00
Karishma Chadha
ce6ef92eb5 Clear runtime after validation success instead of before. 2018-03-21 17:46:39 -04:00
Karishma Chadha
ab863096cd Remove cruft and fix for..in loops. 2018-03-21 17:42:01 -04:00
Karishma Chadha
9d3a3fd12f When serializing md5+ext, the name should reflect that. Deserializing translates this name back to what vm and other components currently expect. 2018-03-21 16:51:40 -04:00
Karishma Chadha
24e248d4fb Removing cruft... 2018-03-21 14:46:21 -04:00
Christopher Willis-Ford
26bc7851bb Rename ReporterScope.SPRITE to TARGET & add JSDoc 2018-03-20 15:30:34 -07:00
Christopher Willis-Ford
d3352ac54d Add JSDoc tags for ArgumentType & BlockType 2018-03-20 15:26:27 -07:00
Christopher Willis-Ford
1049e90a8f Wrap extension menu function to provide context
When the extension system calls a function to retrieve extension menu
items, it now provides the ID of the current editing target. There's
also now a little bit of error-checking on the results.
2018-03-20 15:26:27 -07:00
Christopher Willis-Ford
2932f232c4 Improve developer feedback for missing block func 2018-03-20 15:26:12 -07:00
Christopher Willis-Ford
4201f212d3 Add JSDoc for extension metadata format
This is a first pass and is probably not 100% correct. It also contains
the new (experimental?) reporter scope field.
2018-03-20 15:05:21 -07:00
Christopher Willis-Ford
6a06984678 Add enum for reporter scope
Some reporters are sprite-specific, such as the costume name/number or
X position of the sprite. Others are global. This enum allows an
extension author to specify the scope of a reporter.
2018-03-20 15:05:21 -07:00
Paul Kaplan
140094a7ad Make "when clicked" blocks target dependent.
This involves adding a new opcode, event_whenstageclicked, and adding a
method to the blocks container to update the opcode pair depending on
whether the target is the stage. This method is then called in two
places: first after the sb2 import parses the blocks (not done in the
sb2 parsing itself because no other blocks are target specific) and then
again when blocks are shared between targets.

Also added tests for the block container method, and a fixture project
that tests the opcode splitting on sb2 import.
2018-03-20 10:41:50 -04:00
Eric Rosenbaum
2b985fa083
Merge pull request #975 from ericrosenbaum/bugfix/move-volume-to-rendered-target
Move volume to rendered target
2018-03-19 16:45:25 -04:00
Eric Rosenbaum
2527c804ea Clones get ref to parent’s activeSoundPlayers obj 2018-03-19 16:44:49 -04:00
Chris Willis-Ford
4c0e968bec
Merge pull request #978 from cwillisf/fix-saythink-and-wait
Fix say/think and wait
2018-03-19 10:36:01 -07:00
Paul Kaplan
979c8b05e0
Merge pull request #965 from bartljak/issue#960
fixed issue 960
2018-03-19 06:06:00 -07:00
Karishma Chadha
b4f6f24926 Fix up tests. 2018-03-16 11:43:27 -04:00
Eric Rosenbaum
ec0eca2b86
Merge pull request #981 from towerofnix/fix-key-pressed-import
Make "key pressed?" sensing block import correctly
2018-03-16 11:42:35 -04:00
Florrie
6517bd0974 Make 'key pressed?' block import correctly 2018-03-16 11:58:25 -03:00
Karishma Chadha
003ed01015 Update VM to use scratch-parser callback interface 2018-03-15 22:40:40 -04:00
Andrew Sliwinski
1d90c82fcf
Merge pull request #945 from picklesrus/translate-extension
Translate extension block
2018-03-15 08:36:39 -04:00
kchadha
a3ed4cad99 Remove todo 2018-03-14 22:52:00 -04:00
kchadha
0d55e4c74f Modifying apis to accomodate existing tests. 2018-03-14 22:52:00 -04:00
kchadha
22be2b15f3 Major refactor of project loading. Removed loadProjectLocal, in favor of going back to single API (loadProject). loadProject uses scratch-parser to unpack and validate project. Scratch-parser is getting updated to return validated project, with appended project metadata, and unpacked zip (JSZip object) if provided a buffer. 2018-03-14 22:52:00 -04:00
kchadha
2c551d1739 Some more cleanup. 2018-03-14 22:51:59 -04:00
kchadha
09c8110923 Always serialize parent and next on a block even if they're null. 2018-03-14 22:51:59 -04:00
kchadha
4f6ece9fa8 Be specific about what we're serializing. Flatten targets first by turning them into JSON strings and re-parsing them, and then only serialize the properties necessary for saving and loading. 2018-03-14 22:51:59 -04:00
Christopher Willis-Ford
4210c6dd4c Fix stack check in stepThread
The previous logic seemed to be expecting `peekStack` to return 0 when
the stack was empty, but its return type is `?string` and it returns
`undefined` when the stack is empty. The `!== 0` check would never pass,
then, leading to problems with (for example) the "say/think and wait"
blocks.
2018-03-14 16:17:29 -07:00
Christopher Willis-Ford
b5d7602f4f Add test for say/think and wait
This test currently fails due to a bug in the sequencer's `stepThread`
method. The bug affects real projects, too, but was not caught by any
test prior to this one.
2018-03-14 16:16:59 -07:00
Christopher Willis-Ford
b61c6a8f76 Don't render say/think bubbles during tests
This change makes say & think commands work during headless tests.
2018-03-14 16:07:05 -07:00
Eric Rosenbaum
a652156032 Sensing-of block gets target volume 2018-03-13 11:45:11 -04:00
Eric Rosenbaum
f8c2771776 Use target volume, not custom state 2018-03-13 11:43:53 -04:00
Eric Rosenbaum
a7c6c430b8 Add volume to rendered target 2018-03-13 11:43:33 -04:00
Andrew Sliwinski
2ae788ca28
Merge pull request #968 from gnarf/instanceof-fix
ensure this.workerClass exists before instanceof check
2018-03-12 12:45:09 -04:00
Andrew Sliwinski
6039f1b7e7
Merge pull request #969 from gnarf/fix-music-no-audio
Ensure music extension _decodeSound is promise
2018-03-12 12:44:16 -04:00
picklesrus
39d2559e37 Initial version of translate extension. 2018-03-11 12:18:21 -07:00
kchadha
adfbeddcab
Merge pull request #964 from kchadha/save-load
Preliminary Save and Load Work
2018-03-09 09:34:44 -05:00
Corey Frang
1d414dd5a0 Ensure music extension _decodeSound is promise
Currently if there is no audio engine detected this returns undefined,
which in turn causes the line above to fail trying to call `.then` on
it.
2018-03-08 12:32:01 -05:00
kchadha
d59a4ffd55 VM receives input buffer representing project to load and unpacks it as zip. This functionality will eventually move to storage. 2018-03-08 10:25:58 -05:00
Corey Frang
9b8a8647f0 ensure this.workerClass exists before instanceof check
This avoids an error I was running into in a node environment:

```
TypeError: Right-hand side of 'instanceof' is not an object
```
2018-03-07 18:13:15 -05:00
kchadha
cc2bf1dfc7
Merge pull request #957 from kchadha/mouse-up-drag-end
Use flag to selectively activate 'when this sprite clicked' hat on mouse up
2018-03-07 13:26:28 -05:00
Chris Willis-Ford
219f083a29
Merge pull request #934 from picklesrus/extensions-dynamic-menu
Extensions dynamic menu
2018-03-06 16:33:26 -05:00
Jake Bartles
11e12cca4f fixed issue 960 2018-03-05 20:15:49 -05:00
Karishma Chadha
d6e248aab8 VM should do the heavy lifting of saving project to a zip file, and return a promise of the zip to gui. 2018-03-05 17:20:36 -05:00
Florrie
00b151b9ff Add doForLoop to sb2 specmap 2018-03-05 17:36:17 -04:00
Florrie
a03f45d1d7 Add tests for forEach block 2018-03-05 16:18:09 -04:00