Commit Graph
1017 Commits
Author SHA1 Message Date
Thomas Weber 925f113400 Don't start monitors if there are no targets
Fixes https://github.com/TurboWarp/sb3fix/issues/125 in the safest way that
hopefully has no unforseen breakages on weird behaviors
2026-05-16 01:42:59 -05:00
Thomas Weber 52f4369e63 Fix spork compatibility issue with mutation-less control_stop
Our editor relies on the mutation for control_stop to know if there is a connection below.
Spork does not export that mutation anymore.
Instead, we will just generate the mutation to fix errors on loading.
2026-05-03 10:27:39 -05:00
7b521ff000 Force shadow property for procedure blocks during deserialization (#335)
Co-authored-by: Cubester <78769806+CubesterYT@users.noreply.github.com>
Co-authored-by: Thomas Weber <muffin@muffin.ink>
2026-04-18 22:18:21 -05:00
Thomas Weber 9f2106a290 Remove variable value safe stringification
I thought this may have been part of fixing a sb2 -> sb3 corruption issue.
But from commit log, it seems this was added to prevent extensions from making mistakes.
With the scratch-parser change, those mistakes are now considered features.
Seems safe to just do remove these checks all the time.
Closes https://github.com/TurboWarp/scratch-vm/pull/332
2026-03-02 22:43:29 -06:00
Thomas Weber 1ea395fe97 Don't allow reading video motion when external communication is possible (#331) 2026-02-08 11:22:19 -06:00
Thomas Weber d825b5017f add sensing_online 2026-01-24 14:01:42 -06:00
Thomas Weber 464a9c68dd Support JS Map in externalDeltaToJS for extension compatibility
Nothing in Scratch uses this
2026-01-13 19:09:49 -06:00
Thomas Weber 6abc33d787 Remove immutable.js (#329)
Why:
* We use immutable.js 3.8.2 which is ancient and not getting updates
* immutable.js adds 55KB to the bundle, of which we use almost nothing
* immutable.js's treatment of 0 and -0 is nonsensical and would require weird workarounds like https://github.com/TurboWarp/scratch-vm/pull/320
* We don't benefit from the whole immutability thing

What we're doing instead:
* We have our own MonitorState and MonitorRecord classes
* We track dirty-ness at modification time instead of equality checking every tick
* scratch-gui and packager can continue to think we use immutable.js without causing issues in either direction
  * our objects have enough stubs that immutable.js-expecting consumers are ok
  * when receiving an object, we check if it looks like an immutable.js one and ask for the plain JS version so that works okay too
2026-01-09 22:30:18 -06:00
Thomas Weber 553a2a434d Use safe stringify from -gui for visual reports
Fixes stringifying -0, objects, arrays
2026-01-09 22:23:46 -06:00
Thomas Weber 7fefa6f666 Check for either input never being numbers first in OP_EQUALS
Fixes https://github.com/TurboWarp/scratch-vm/issues/311
2025-12-29 20:06:36 -06:00
Thomas Weber 0e5043d4dc Fix missing boolean cast in control_repeat_until
Fixes https://github.com/TurboWarp/scratch-vm/issues/317
2025-12-29 19:50:15 -06:00
Thomas Weber 7aa8930802 Fix incorrect types for sensing_of
They can return 0 if the sprite does not exist
Fixes https://github.com/TurboWarp/scratch-vm/issues/262
Closes https://github.com/TurboWarp/scratch-vm/pull/325
(this one uses a different fix and has tests)

There are broader issues about compiled sensing_of not handling dynamic
sprite create/delete. We should tackle that later. The other PR wouldn't
really fix this either.
2025-12-29 18:58:44 -06:00
8to16 36bf998aee Fix evalAndReturn with comments at the bottom of a script (#322)
This is because beepbox's script:
https://cdn.jsdelivr.net/npm/beepbox@4.2.0/global/beepbox_synth.min.js
has a sourceMappingURL comment at the bottom for whatever
reason, causing it to become
//# sourceMappingURL=beepbox_synth.min.js.map;return beepbox;
This is obviously going to break and might also be the case with
other libraries too, hot just beepbox.

Ported from AmpMod:
https://codeberg.org/ampmod/ampmod/commit/0daf1021bdc8e67a1f0d08b91ce500605fcaa711
2025-12-15 18:51:13 -06:00
Thomas Weber 9624ea5456 Compile looks_say and looks_think without compatibility layer 2025-12-04 21:38:16 -06:00
Thomas Weber 6f6845ba3c Fix all remaining negative zero bugs 2025-12-04 21:32:19 -06:00
Thomas Weber fd1b85589e Merge pull request #301 from TurboWarp/more-unnecessary-casts
Remove more unnecessary casts
2025-12-04 21:29:22 -06:00
Thomas Weber d8c26ad156 Merge pull request #307 from TurboWarp/optimize-repeat-better
Improve repeat block analysis
2025-12-04 21:28:50 -06:00
Thomas Weber 4187f550a0 Record which keys the project has used
Related to https://github.com/TurboWarp/scratch-gui/issues/1106
2025-11-15 19:00:15 -06:00
Thomas Weber 92adc762d9 Merge pull request #313 from TurboWarp/update-languages
Update scratch-translate-extension-languages to 1.0.7
2025-11-01 20:36:39 -05:00
Thomas Weber 475ffd0cb4 Update scratch-translate-extension-languages to 1.0.7 2025-11-01 19:18:12 -05:00
Thomas Weber 55674f82ee Implement Scratch.external - VM part (#308) 2025-10-18 23:43:22 -05:00
Thomas Weber 8860e2d602 Fix repeat block iteration count not being optimizable in yielding loops 2025-10-12 11:16:25 -05:00
Thomas Weber eb0d678068 Only analyze repeat block inputs at the start of the loop 2025-10-12 11:12:05 -05:00
Thomas Weber 3b947da95e Remove unnecessary number index casts 2025-10-08 18:43:50 -05:00
Thomas Weber 67cb7cfc5d Remove unnecessary string casts 2025-10-08 18:42:43 -05:00
Thomas Weber 07309b6ebf Use more specific type for string length 2025-10-08 17:15:44 -05:00
Thomas Weber d09f82a2fe Add new test case that does some simple string operations 2025-10-08 17:15:24 -05:00
Thomas Weber 2ac7095947 Optimize loops with provably-integer iteration counts 2025-10-04 20:05:31 -05:00
Tacodiva 8fe321c357 Make types for blocks which returns ints more spercific 2025-09-28 12:30:32 +10:00
Thomas Weber 2244b26773 Discard old state after calling yielding procedure 2025-09-24 16:48:01 -05:00
Thomas Weber 4a8a5ad901 Add test case for 7ed29f5801 2025-09-22 19:30:23 -05:00
Thomas Weber 214b86a063 Add test case for d8c73c71d2 2025-09-22 19:29:06 -05:00
Thomas Weber 445a129939 Add test case for 7cc8f580b3 2025-09-22 19:28:17 -05:00
Thomas Weber c372e925a5 Add test case for 6a37fee386 2025-09-22 19:27:08 -05:00
Thomas Weber 5a90e13981 Fix TypeState#after setting variable types to undefined
If a variable existed in `this` but not in `other`, its resulting type
would be set to undefined. Changing it to use the type from `this`
seems to fix https://github.com/TurboWarp/scratch-vm/issues/273.
2025-09-22 18:41:48 -05:00
Thomas Weber 40715dc259 Add test case for https://github.com/TurboWarp/scratch-vm/issues/276 2025-09-22 18:41:48 -05:00
Thomas Weber 2639653647 Revert "Fix #273"
This reverts commit c16be25178.

Caused https://github.com/TurboWarp/scratch-vm/issues/276
2025-09-22 18:41:38 -05:00
Thomas Weber 44e2589e65 Fix https://github.com/TurboWarp/scratch-vm/issues/277
Need to clear the state before analyzing the condition as the condition
may be re-evaluated after yielding.
2025-09-22 18:40:34 -05:00
Tacodiva 749e923378 Fix #272 (thanks @Geotale) 2025-09-21 23:10:50 +10:00
Tacodiva c16be25178 Fix #273 2025-09-21 22:59:56 +10:00
Tacodiva cc96ee8c70 Fix -0 being turned into 0 in the type matrix test 2025-09-21 22:59:06 +10:00
Thomas Weber cd353ca31e Merge pull request #268 from TurboWarp/fix-analyzeLoopedBlock-infinite-loop
Give up analyzing looped stack after 10000 iterations
2025-09-20 13:57:52 -05:00
Thomas Weber fa035541da Give up analyzing looped stack after 10000 iterations
Temporary fix for an infinite loop, to be properly fixed later
2025-09-20 13:53:41 -05:00
Thomas Weber 5b027b995e Fix motion_turnleft and motion_turnright missing type casts 2025-09-15 18:01:45 -05:00
Tacodiva 7cc8f580b3 Fix yielding loop arguments not re-analyzing 2025-09-08 17:08:23 +10:00
Tacodiva d8c73c71d2 Account for stop this script in type analysis and add test 2025-09-08 15:28:11 +10:00
Tacodiva fbca1bf49b Fixed NaN = 0 wrongly reporting true, and add a test 2025-09-08 11:48:55 +10:00
Tacodiva b8defadedb Merge remote-tracking branch 'origin/develop' into HEAD 2025-09-07 11:56:25 +10:00
ghost 5bc497aabb Add blockShape option to extensions (#210) 2025-05-20 21:48:52 -05:00
Thomas Weber f957e1c6c1 Fix Mouse.postData error if called before project loads 2025-05-20 13:29:44 -05:00