diff options
| author | jmoenig <jens@moenig.org> | 2014-01-08 12:18:04 +0100 |
|---|---|---|
| committer | jmoenig <jens@moenig.org> | 2014-01-08 12:18:04 +0100 |
| commit | 8646dfc35ed3d11a2e23ecd545ecef47ef53f8b2 (patch) | |
| tree | 83f36ca780aabafc7571179356ec830ac3347cd8 /threads.js | |
| parent | e9020b4ed3f7190dc78e622fbe3b2665e227c30f (diff) | |
| download | snap-8646dfc35ed3d11a2e23ecd545ecef47ef53f8b2.tar.gz snap-8646dfc35ed3d11a2e23ecd545ecef47ef53f8b2.zip | |
support for TELL and ASK
The FOR reporter’s first input now also accepts blocks and scripts
(„rings“), and reports a copy that is bound to the sprite indicated by
the second input. This lets you „zombify“ (or remote-control) sprites
(and create custom TELL and ASK blocks)
Diffstat (limited to 'threads.js')
| -rw-r--r-- | threads.js | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/ // Global stuff //////////////////////////////////////////////////////// -modules.threads = '2013-December-11'; +modules.threads = '2014-January-08'; var ThreadManager; var Process; @@ -2377,6 +2377,9 @@ Process.prototype.reportAttributeOf = function (attribute, name) { thatObj = this.getOtherObject(name, thisObj, stage); } if (thatObj) { + if (attribute instanceof Context) { + return this.reportContextFor(attribute, thatObj); + } if (isString(attribute)) { return thatObj.variables.getVar(attribute); } @@ -2401,6 +2404,18 @@ Process.prototype.reportAttributeOf = function (attribute, name) { return ''; }; +Process.prototype.reportContextFor = function (context, otherObj) { + // Private - return a copy of the context + // and bind it to another receiver + var result = copy(context); + result.receiver = otherObj; + if (result.outerContext) { + result.outerContext = copy(result.outerContext); + result.outerContext.receiver = otherObj; + } + return result; +}; + Process.prototype.reportMouseX = function () { var stage, world; if (this.homeContext.receiver) { |
