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)
pull/3/merge
jmoenig 2014-01-08 12:18:04 +01:00
rodzic e9020b4ed3
commit 8646dfc35e
4 zmienionych plików z 22 dodań i 4 usunięć

Wyświetl plik

@ -155,7 +155,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph, Costume*/
// Global stuff ////////////////////////////////////////////////////////
modules.blocks = '2013-November-26';
modules.blocks = '2014-January-08';
var SyntaxElementMorph;
var BlockMorph;
@ -996,7 +996,6 @@ SyntaxElementMorph.prototype.labelPart = function (spec) {
'attributesMenu',
true
);
part.isStatic = true;
break;
case '%fun':
part = new InputSlotMorph(

Wyświetl plik

@ -2044,3 +2044,7 @@ ______
------
* Objects: stage watchers for „mouse x“ and „mouse y“ sensing reporters. Thanks, Michael!
* Store: fixed saving/loading/localisation of new mouse coordinate stage watchers
140108
------
* Threads, Blocks, Objects: The FOR reporters 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)

Wyświetl plik

@ -124,7 +124,7 @@ PrototypeHatBlockMorph*/
// Global stuff ////////////////////////////////////////////////////////
modules.objects = '2013-December-19';
modules.objects = '2014-January-08';
var SpriteMorph;
var StageMorph;

Wyświetl plik

@ -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) {