Merge pull request #99 from Simon-Mong/patch-22

enable 'goto random position" block
pull/97/head^2
Michael Aschauer 2021-08-28 12:35:05 +02:00 zatwierdzone przez GitHub
commit dd714b6a24
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 16 dodań i 0 usunięć

Wyświetl plik

@ -56,3 +56,19 @@ Process.prototype.reportPi = function (min, max) {
Process.prototype.reportProxiedURL = function (url) {
return this.reportURL(this.proxy + '/' + url);
};
Process.prototype.origDoGotoObject = Process.prototype.doGotoObject;
Process.prototype.doGotoObject = function (name) {
var thisObj = this.blockReceiver(),
stage;
if (thisObj && this.inputOption(name) === 'random position') {
stage = thisObj.parentThatIsA(StageMorph);
if (stage) {
thisObj.gotoXY(this.reportBasicRandom(stage.reportX(stage.left()), stage.reportX(stage.right())),
this.reportBasicRandom(stage.reportY(stage.top()), stage.reportY(stage.bottom())));
}
} else {
this.origDoGotoObject(name);
}
};