Merge pull request from fsih/perSpriteMonitors

Execute monitors on a given target ID when block is sprite-specific
This commit is contained in:
DD Liu 2017-11-21 10:23:53 -05:00 committed by GitHub
commit 58dd57fe48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 78 additions and 6 deletions
src/engine

View file

@ -80,8 +80,14 @@ const handleReport = function (
sequencer.runtime.visualReport(currentBlockId, resolvedValue);
}
if (thread.updateMonitor) {
const targetId = sequencer.runtime.monitorBlocks.getBlock(currentBlockId).targetId;
if (targetId && !sequencer.runtime.getTargetById(targetId)) {
// Target no longer exists
return;
}
sequencer.runtime.requestUpdateMonitor(Map({
id: currentBlockId,
spriteName: targetId ? sequencer.runtime.getTargetById(targetId).getName() : null,
value: String(resolvedValue)
}));
}