kopia lustrzana https://github.com/backface/turtlestitch
run “When I start as clone” scripts when manually cloning a sprite
only position clone at hand pointer if no such scripts existupd4.1
rodzic
7f5a0b8272
commit
5efc59acab
9
gui.js
9
gui.js
|
@ -2147,10 +2147,15 @@ IDE_Morph.prototype.duplicateSprite = function (sprite) {
|
|||
};
|
||||
|
||||
IDE_Morph.prototype.instantiateSprite = function (sprite) {
|
||||
var instance = sprite.fullCopy(true);
|
||||
instance.setPosition(this.world().hand.position());
|
||||
var instance = sprite.fullCopy(true),
|
||||
hats = instance.allHatBlocksFor('__clone__init__');
|
||||
instance.appearIn(this);
|
||||
if (hats.length) {
|
||||
instance.initClone(hats);
|
||||
} else {
|
||||
instance.setPosition(this.world().hand.position());
|
||||
instance.keepWithin(this.stage);
|
||||
}
|
||||
this.selectSprite(instance);
|
||||
};
|
||||
|
||||
|
|
|
@ -3508,6 +3508,7 @@ Fixes:
|
|||
170707
|
||||
------
|
||||
* Objects, GUI, Store: tweak naming of instantiating to “clone”, enable inheritance by default
|
||||
* Objects, GUI: run “When I start as clone” scripts when manually cloning a sprite, only position at hand pointer if no such scripts exist
|
||||
|
||||
|
||||
Features:
|
||||
|
|
12
objects.js
12
objects.js
|
@ -3212,6 +3212,18 @@ SpriteMorph.prototype.clonify = function (stage, immediately) {
|
|||
this.endWarp();
|
||||
};
|
||||
|
||||
SpriteMorph.prototype.initClone = function (hats) {
|
||||
// used when manually instantiating a sprite in the IDE
|
||||
var stage = this.parentThatIsA(StageMorph),
|
||||
myself = this;
|
||||
if (stage) {
|
||||
hats.forEach(function (block) {
|
||||
stage.threads.startProcess(block, myself, stage.isThreadSafe);
|
||||
});
|
||||
this.endWarp();
|
||||
}
|
||||
};
|
||||
|
||||
SpriteMorph.prototype.removeClone = function () {
|
||||
if (this.isTemporary) {
|
||||
// this.stopTalking();
|
||||
|
|
Ładowanie…
Reference in New Issue