summaryrefslogtreecommitdiff
path: root/objects.js
diff options
context:
space:
mode:
Diffstat (limited to 'objects.js')
-rw-r--r--objects.js112
1 files changed, 112 insertions, 0 deletions
diff --git a/objects.js b/objects.js
index a15aec4..cf7a191 100644
--- a/objects.js
+++ b/objects.js
@@ -415,6 +415,11 @@ SpriteMorph.prototype.initBlocks = function () {
spec: 'go back %n layers',
defaults: [1]
},
+ doNotify: {
+ type: 'command',
+ category: 'looks',
+ spec: 'notification with title %s and content %s'
+ },
doScreenshot: {
type: 'command',
category: 'looks',
@@ -905,6 +910,71 @@ SpriteMorph.prototype.initBlocks = function () {
category: 'sensing',
spec: 'current %dates'
},
+ reportFileOrDirectoryContent: {
+ type: 'reporter',
+ category: 'sensing',
+ spec: 'content of the %fileOrDir %s'
+ },
+ doSetFileContent: {
+ type: 'command',
+ category: 'sensing',
+ spec: 'write %s to the file %s'
+ },
+ doCreateFileOrDirectory: {
+ type: 'command',
+ category: 'sensing',
+ spec: 'create %fileOrDir %s'
+ },
+ reportFileOrDirectoryExists: {
+ type: 'predicate',
+ category: 'sensing',
+ spec: '%fileOrDir %s exists'
+ },
+ doDeleteFileOrDirectory: {
+ type: 'command',
+ category: 'sensing',
+ spec: 'delete the %fileOrDir %s'
+ },
+ reportHomeDirectory: {
+ type: 'reporter',
+ category: 'sensing',
+ spec: 'home directory'
+ },
+ doVibrate: {
+ type: 'command',
+ category: 'sensing',
+ spec: 'vibrate %n seconds'
+ },
+ reportCompassHeading: {
+ type: 'reporter',
+ category: 'sensing',
+ spec: 'current compass heading'
+ },
+ reportAccelerationX: {
+ type: 'reporter',
+ category: 'sensing',
+ spec: 'current acceleration along the x axes'
+ },
+ reportAccelerationY: {
+ type: 'reporter',
+ category: 'sensing',
+ spec: 'current acceleration along the y axes'
+ },
+ reportAccelerationZ: {
+ type: 'reporter',
+ category: 'sensing',
+ spec: 'current acceleration along the z axes'
+ },
+ reportLanguage: {
+ type: 'reporter',
+ category: 'sensing',
+ spec: 'language'
+ },
+ reportLocation: {
+ type: 'reporter',
+ category: 'sensing',
+ spec: 'location %locations'
+ },
// Operators
reifyScript: {
@@ -1754,6 +1824,8 @@ SpriteMorph.prototype.blockTemplates = function (category) {
blocks.push('-');
blocks.push(block('comeToFront'));
blocks.push(block('goBack'));
+ blocks.push('-');
+ blocks.push(block('doNotify'));
// for debugging: ///////////////
@@ -1915,6 +1987,24 @@ SpriteMorph.prototype.blockTemplates = function (category) {
blocks.push(block('doSetFastTracking'));
blocks.push('-');
blocks.push(block('reportDate'));
+ blocks.push('-');
+ blocks.push(block('reportFileOrDirectoryContent'));
+ blocks.push(block('doSetFileContent'));
+ blocks.push(block('doCreateFileOrDirectory'));
+ blocks.push(block('reportFileOrDirectoryExists'));
+ blocks.push(block('doDeleteFileOrDirectory'));
+ blocks.push(block('reportHomeDirectory'));
+ blocks.push('-');
+ blocks.push(block('reportLanguage'));
+ blocks.push(block('reportLocation'));
+ blocks.push('-');
+ blocks.push(block('doVibrate'));
+ blocks.push('-');
+ blocks.push(block('reportCompassHeading'));
+ blocks.push('-');
+ blocks.push(block('reportAccelerationX'));
+ blocks.push(block('reportAccelerationY'));
+ blocks.push(block('reportAccelerationZ'));
// for debugging: ///////////////
@@ -4289,6 +4379,8 @@ StageMorph.prototype.init = function (globals) {
this.paletteCache = {}; // not to be serialized (!)
this.lastAnswer = ''; // last user input, do not persist
this.activeSounds = []; // do not persist
+ this.acceleration = null; // do not persist
+ this.compassHeading = null; // do not persist
this.streamingCamera = false;
this.lastCameraCanvas = null;
this.lastCameraMotion = new Point(0, 0);
@@ -4891,6 +4983,8 @@ StageMorph.prototype.blockTemplates = function (category) {
blocks.push('-');
blocks.push(block('show'));
blocks.push(block('hide'));
+ blocks.push('-');
+ blocks.push(block('doNotify'));
// for debugging: ///////////////
@@ -5030,6 +5124,24 @@ StageMorph.prototype.blockTemplates = function (category) {
blocks.push(block('doSetFastTracking'));
blocks.push('-');
blocks.push(block('reportDate'));
+ blocks.push('-');
+ blocks.push(block('reportFileOrDirectoryContent'));
+ blocks.push(block('doSetFileContent'));
+ blocks.push(block('doCreateFileOrDirectory'));
+ blocks.push(block('reportFileOrDirectoryExists'));
+ blocks.push(block('doDeleteFileOrDirectory'));
+ blocks.push(block('reportHomeDirectory'));
+ blocks.push('-');
+ blocks.push(block('reportLanguage'));
+ blocks.push(block('reportLocation'));
+ blocks.push('-');
+ blocks.push(block('doVibrate'));
+ blocks.push('-');
+ blocks.push(block('reportCompassHeading'));
+ blocks.push('-');
+ blocks.push(block('reportAccelerationX'));
+ blocks.push(block('reportAccelerationY'));
+ blocks.push(block('reportAccelerationZ'));
// for debugging: ///////////////