mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-28 22:30:40 -04:00
Fix issues uncovered where clones were triggering automatically on create.
This commit is contained in:
parent
6c4fb29523
commit
e5b00dfd95
3 changed files with 10 additions and 2 deletions
|
@ -63,11 +63,13 @@ const handleReport = function (resolvedValue, sequencer, thread, blockCached, la
|
|||
// true and used to be false, or the stack was activated explicitly
|
||||
// via stack click
|
||||
if (!thread.stackClick) {
|
||||
const hasOldEdgeValue = thread.target.hasEdgeActivatedValue(currentBlockId);
|
||||
const oldEdgeValue = thread.target.updateEdgeActivatedValue(
|
||||
currentBlockId,
|
||||
resolvedValue
|
||||
);
|
||||
const edgeWasActivated = !oldEdgeValue && resolvedValue;
|
||||
|
||||
const edgeWasActivated = hasOldEdgeValue ? (!oldEdgeValue && resolvedValue) : resolvedValue;
|
||||
if (!edgeWasActivated) {
|
||||
sequencer.retireThread(thread);
|
||||
}
|
||||
|
|
|
@ -103,6 +103,10 @@ class Target extends EventEmitter {
|
|||
return oldValue;
|
||||
}
|
||||
|
||||
hasEdgeActivatedValue (blockId) {
|
||||
return this._edgeActivatedHatValues.hasOwnProperty(blockId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all edge-activaed hat values.
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
const log = require('../util/log');
|
||||
const MathUtil = require('../util/math-util');
|
||||
const StringUtil = require('../util/string-util');
|
||||
const Clone = require('../util/clone');
|
||||
const Target = require('../engine/target');
|
||||
const StageLayering = require('../engine/stage-layering');
|
||||
|
||||
|
@ -1015,8 +1016,9 @@ class RenderedTarget extends Target {
|
|||
newClone.size = this.size;
|
||||
newClone.currentCostume = this.currentCostume;
|
||||
newClone.rotationStyle = this.rotationStyle;
|
||||
newClone.effects = JSON.parse(JSON.stringify(this.effects));
|
||||
newClone.effects = Clone.simple(this.effects);
|
||||
newClone.variables = this.duplicateVariables();
|
||||
newClone._edgeActivatedHatValues = Clone.simple(this._edgeActivatedHatValues);
|
||||
newClone.initDrawable(StageLayering.SPRITE_LAYER);
|
||||
newClone.updateAllDrawableProperties();
|
||||
// Place behind the current target.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue