Drew Short
7 years ago
commit
6362f73551
8 changed files with 1106 additions and 0 deletions
-
5.gitignore
-
83.gitlab-ci.yml
-
65gruntfile.js
-
827package-lock.json
-
19package.json
-
0src/license
-
0src/license.min
-
107src/reactor_control/main.lua
@ -0,0 +1,5 @@ |
|||
/dist |
|||
/node_modules |
|||
/.idea |
|||
|
|||
*.iml |
@ -0,0 +1,83 @@ |
|||
image: node:latest |
|||
|
|||
stages: |
|||
- build |
|||
- test |
|||
- deploy |
|||
|
|||
compile: |
|||
stage: build |
|||
script: |
|||
- npm install |
|||
- npm run grunt |
|||
artifacts: |
|||
expire_in: 6 hours |
|||
paths: |
|||
- dist/**/*.lua |
|||
only: |
|||
- master |
|||
- develop |
|||
tags: |
|||
- docker |
|||
|
|||
test: |
|||
stage: test |
|||
script: |
|||
- echo "Testing happening here" |
|||
only: |
|||
- master |
|||
- develop |
|||
tags: |
|||
- docker |
|||
|
|||
development: |
|||
image: panubo/sshd:latest |
|||
stage: deploy |
|||
variables: |
|||
DEPLOY_USER: "deploy" |
|||
DEPLOY_HOST: "sothr.com" |
|||
DEPLOY_PORT: "9140" |
|||
ENVIRONMENT: "Development" |
|||
TARGET_DIRECTORY: "~/download_dir/open_computers/development" |
|||
DOWNLOAD_URL_BASE: "https://sothr.com/download/oc/development/" |
|||
script: |
|||
- echo "Deployment To Development Starting..." |
|||
- eval `ssh-agent -s` |
|||
- ssh-add <(echo "$SSH_DEPLOY_KEY") |
|||
- pushd ./dist |
|||
- find * -type f -exec sed -i -e 's/{ENVIRONMENT}/'"$ENVIRONMENT"'/g' {} \; |
|||
- find * -type f -exec sed -i -e 's@{URL_BASE}@'"$DOWNLOAD_URL_BASE"'@g' {} \; |
|||
- find * -type f -exec sed -i -e 's@{FILE_PATH}@'"{}"'@g' {} \; |
|||
- popd |
|||
- rsync -avz --delete-delay -e "ssh -p $DEPLOY_PORT -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress dist/* $DEPLOY_USER@$DEPLOY_HOST:$TARGET_DIRECTORY |
|||
only: |
|||
- develop |
|||
tags: |
|||
- docker |
|||
environment: development |
|||
|
|||
production: |
|||
image: macropin/sshd:latest |
|||
stage: deploy |
|||
variables: |
|||
DEPLOY_USER: "deploy" |
|||
DEPLOY_HOST: "sothr.com" |
|||
DEPLOY_PORT: "9140" |
|||
ENVIRONMENT: "Release" |
|||
TARGET_DIRECTORY: "~/download_dir/oc/release" |
|||
DOWNLOAD_URL_BASE: "https://sothr.com/download/oc/release/" |
|||
script: |
|||
- echo "Deployment To Production Starting..." |
|||
- eval `ssh-agent -s` |
|||
- ssh-add <(echo "$SSH_DEPLOY_KEY") |
|||
- pushd ./dist |
|||
- find * -type f -exec sed -i -e 's/{ENVIRONMENT}/'"$ENVIRONMENT"'/g' {} \; |
|||
- find * -type f -exec sed -i -e 's@{URL_BASE}@'"$DOWNLOAD_URL_BASE"'@g' {} \; |
|||
- find * -type f -exec sed -i -e 's@{FILE_PATH}@'"{}"'@g' {} \; |
|||
- popd |
|||
- rsync -avz --delete-delay -e "ssh -p $DEPLOY_PORT -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress dist/* $DEPLOY_USER@$DEPLOY_HOST:$TARGET_DIRECTORY |
|||
only: |
|||
- master |
|||
tags: |
|||
- docker |
|||
environment: production |
@ -0,0 +1,65 @@ |
|||
module.exports = function (grunt) { |
|||
"use strict"; |
|||
|
|||
grunt.initConfig({ |
|||
clean: ["./dist", "./tmp"], |
|||
copy: { |
|||
build: { |
|||
files: [{ |
|||
expand: true, |
|||
cwd: "./src", |
|||
src: ["**/license*"], |
|||
dest: "dist/", |
|||
filter: 'isFile' |
|||
}] |
|||
} |
|||
} |
|||
}); |
|||
|
|||
grunt.loadNpmTasks('grunt-contrib-clean'); |
|||
grunt.loadNpmTasks("grunt-contrib-copy"); |
|||
grunt.loadNpmTasks('grunt-file-append'); |
|||
|
|||
grunt.registerTask("add-rename-lua-module-tasks", "Finds and adds tasks to rename all main.lua to match their parent directory", function () { |
|||
grunt.file.expand({filter: 'isDirectory'}, "src/*").forEach(function (dir) { |
|||
var module_name = dir.substr(dir.lastIndexOf('/') + 1); |
|||
if (module_name !== 'lib') { |
|||
var copy_task = {}; |
|||
try { |
|||
copy_task = grunt.config.get('copy'); |
|||
} catch (exception) { |
|||
console.log("No copy config exists, generating empty one."); |
|||
} |
|||
copy_task[module_name] = { |
|||
src: [dir + '/**/main.lua'], |
|||
dest: 'dist/' + module_name + '/' + module_name + '.lua' |
|||
}; |
|||
console.log("Added copy task for module [" + module_name + "]"); |
|||
grunt.config.set('copy', copy_task); |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
grunt.registerTask("minify-lua-modules", "minifies lua modules", function () { |
|||
var fs = require('fs'); |
|||
var luamin = require('luamin'); |
|||
grunt.file.expand({filter: 'isDirectory'}, "dist/*").forEach(function (dir) { |
|||
grunt.file.expand({filter: 'isFile'}, dir + "/*.lua").forEach(function (file) { |
|||
var directory = file.substr(0, file.lastIndexOf('/')); |
|||
var file_name = file.substr(file.lastIndexOf('/') + 1, file.lastIndexOf('.')); |
|||
var lua = fs.readFileSync(file, 'utf8'); |
|||
var minified = luamin.minify(lua); |
|||
var minified_file_name = file_name + '.min.lua'; |
|||
fs.writeFileSync(directory + '/' + minified_file_name, minified); |
|||
console.log("Minified: " + file_name + ' -> ' + minified_file_name); |
|||
}); |
|||
}); |
|||
}); |
|||
|
|||
grunt.registerTask("default", [ |
|||
"clean", |
|||
"add-rename-lua-module-tasks", |
|||
"copy", |
|||
"minify-lua-modules" |
|||
]); |
|||
}; |
@ -0,0 +1,827 @@ |
|||
{ |
|||
"name": "OpenComputers", |
|||
"version": "1.0.0", |
|||
"lockfileVersion": 1, |
|||
"requires": true, |
|||
"dependencies": { |
|||
"abbrev": { |
|||
"version": "1.1.1", |
|||
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", |
|||
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", |
|||
"dev": true |
|||
}, |
|||
"ansi-regex": { |
|||
"version": "2.1.1", |
|||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", |
|||
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", |
|||
"dev": true |
|||
}, |
|||
"ansi-styles": { |
|||
"version": "2.2.1", |
|||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", |
|||
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", |
|||
"dev": true |
|||
}, |
|||
"argparse": { |
|||
"version": "1.0.9", |
|||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", |
|||
"integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", |
|||
"dev": true, |
|||
"requires": { |
|||
"sprintf-js": "1.0.3" |
|||
} |
|||
}, |
|||
"array-find-index": { |
|||
"version": "1.0.2", |
|||
"resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", |
|||
"integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", |
|||
"dev": true |
|||
}, |
|||
"async": { |
|||
"version": "1.5.2", |
|||
"resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", |
|||
"integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", |
|||
"dev": true |
|||
}, |
|||
"balanced-match": { |
|||
"version": "1.0.0", |
|||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", |
|||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", |
|||
"dev": true |
|||
}, |
|||
"brace-expansion": { |
|||
"version": "1.1.8", |
|||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", |
|||
"integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", |
|||
"dev": true, |
|||
"requires": { |
|||
"balanced-match": "1.0.0", |
|||
"concat-map": "0.0.1" |
|||
} |
|||
}, |
|||
"builtin-modules": { |
|||
"version": "1.1.1", |
|||
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", |
|||
"integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", |
|||
"dev": true |
|||
}, |
|||
"camelcase": { |
|||
"version": "2.1.1", |
|||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", |
|||
"integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", |
|||
"dev": true |
|||
}, |
|||
"camelcase-keys": { |
|||
"version": "2.1.0", |
|||
"resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", |
|||
"integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", |
|||
"dev": true, |
|||
"requires": { |
|||
"camelcase": "2.1.1", |
|||
"map-obj": "1.0.1" |
|||
} |
|||
}, |
|||
"chalk": { |
|||
"version": "1.1.3", |
|||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", |
|||
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", |
|||
"dev": true, |
|||
"requires": { |
|||
"ansi-styles": "2.2.1", |
|||
"escape-string-regexp": "1.0.5", |
|||
"has-ansi": "2.0.0", |
|||
"strip-ansi": "3.0.1", |
|||
"supports-color": "2.0.0" |
|||
} |
|||
}, |
|||
"coffee-script": { |
|||
"version": "1.10.0", |
|||
"resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.10.0.tgz", |
|||
"integrity": "sha1-EpOLz5vhlI+gBvkuDEyegXBRCMA=", |
|||
"dev": true |
|||
}, |
|||
"colors": { |
|||
"version": "1.1.2", |
|||
"resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", |
|||
"integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", |
|||
"dev": true |
|||
}, |
|||
"concat-map": { |
|||
"version": "0.0.1", |
|||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", |
|||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", |
|||
"dev": true |
|||
}, |
|||
"currently-unhandled": { |
|||
"version": "0.4.1", |
|||
"resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", |
|||
"integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", |
|||
"dev": true, |
|||
"requires": { |
|||
"array-find-index": "1.0.2" |
|||
} |
|||
}, |
|||
"dateformat": { |
|||
"version": "1.0.12", |
|||
"resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.12.tgz", |
|||
"integrity": "sha1-nxJLZ1lMk3/3BpMuSmQsyo27/uk=", |
|||
"dev": true, |
|||
"requires": { |
|||
"get-stdin": "4.0.1", |
|||
"meow": "3.7.0" |
|||
} |
|||
}, |
|||
"decamelize": { |
|||
"version": "1.2.0", |
|||
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", |
|||
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", |
|||
"dev": true |
|||
}, |
|||
"error-ex": { |
|||
"version": "1.3.1", |
|||
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", |
|||
"integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", |
|||
"dev": true, |
|||
"requires": { |
|||
"is-arrayish": "0.2.1" |
|||
} |
|||
}, |
|||
"escape-string-regexp": { |
|||
"version": "1.0.5", |
|||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", |
|||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", |
|||
"dev": true |
|||
}, |
|||
"esprima": { |
|||
"version": "2.7.3", |
|||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", |
|||
"integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", |
|||
"dev": true |
|||
}, |
|||
"eventemitter2": { |
|||
"version": "0.4.14", |
|||
"resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz", |
|||
"integrity": "sha1-j2G3XN4BKy6esoTUVFWDtWQ7Yas=", |
|||
"dev": true |
|||
}, |
|||
"exit": { |
|||
"version": "0.1.2", |
|||
"resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", |
|||
"integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", |
|||
"dev": true |
|||
}, |
|||
"file-sync-cmp": { |
|||
"version": "0.1.1", |
|||
"resolved": "https://registry.npmjs.org/file-sync-cmp/-/file-sync-cmp-0.1.1.tgz", |
|||
"integrity": "sha1-peeo/7+kk7Q7kju9TKiaU7Y7YSs=", |
|||
"dev": true |
|||
}, |
|||
"find-up": { |
|||
"version": "1.1.2", |
|||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", |
|||
"integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", |
|||
"dev": true, |
|||
"requires": { |
|||
"path-exists": "2.1.0", |
|||
"pinkie-promise": "2.0.1" |
|||
} |
|||
}, |
|||
"findup-sync": { |
|||
"version": "0.3.0", |
|||
"resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz", |
|||
"integrity": "sha1-N5MKpdgWt3fANEXhlmzGeQpMCxY=", |
|||
"dev": true, |
|||
"requires": { |
|||
"glob": "5.0.15" |
|||
}, |
|||
"dependencies": { |
|||
"glob": { |
|||
"version": "5.0.15", |
|||
"resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", |
|||
"integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", |
|||
"dev": true, |
|||
"requires": { |
|||
"inflight": "1.0.6", |
|||
"inherits": "2.0.3", |
|||
"minimatch": "3.0.4", |
|||
"once": "1.4.0", |
|||
"path-is-absolute": "1.0.1" |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
"fs.realpath": { |
|||
"version": "1.0.0", |
|||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", |
|||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", |
|||
"dev": true |
|||
}, |
|||
"get-stdin": { |
|||
"version": "4.0.1", |
|||
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", |
|||
"integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", |
|||
"dev": true |
|||
}, |
|||
"getobject": { |
|||
"version": "0.1.0", |
|||
"resolved": "https://registry.npmjs.org/getobject/-/getobject-0.1.0.tgz", |
|||
"integrity": "sha1-BHpEl4n6Fg0Bj1SG7ZEyC27HiFw=", |
|||
"dev": true |
|||
}, |
|||
"glob": { |
|||
"version": "7.0.6", |
|||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.0.6.tgz", |
|||
"integrity": "sha1-IRuvr0nlJbjNkyYNFKsTYVKz9Xo=", |
|||
"dev": true, |
|||
"requires": { |
|||
"fs.realpath": "1.0.0", |
|||
"inflight": "1.0.6", |
|||
"inherits": "2.0.3", |
|||
"minimatch": "3.0.4", |
|||
"once": "1.4.0", |
|||
"path-is-absolute": "1.0.1" |
|||
} |
|||
}, |
|||
"graceful-fs": { |
|||
"version": "4.1.11", |
|||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", |
|||
"integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", |
|||
"dev": true |
|||
}, |
|||
"grunt": { |
|||
"version": "1.0.1", |
|||
"resolved": "https://registry.npmjs.org/grunt/-/grunt-1.0.1.tgz", |
|||
"integrity": "sha1-6HeHZOlEsY8yuw8QuQeEdcnftWs=", |
|||
"dev": true, |
|||
"requires": { |
|||
"coffee-script": "1.10.0", |
|||
"dateformat": "1.0.12", |
|||
"eventemitter2": "0.4.14", |
|||
"exit": "0.1.2", |
|||
"findup-sync": "0.3.0", |
|||
"glob": "7.0.6", |
|||
"grunt-cli": "1.2.0", |
|||
"grunt-known-options": "1.1.0", |
|||
"grunt-legacy-log": "1.0.0", |
|||
"grunt-legacy-util": "1.0.0", |
|||
"iconv-lite": "0.4.19", |
|||
"js-yaml": "3.5.5", |
|||
"minimatch": "3.0.4", |
|||
"nopt": "3.0.6", |
|||
"path-is-absolute": "1.0.1", |
|||
"rimraf": "2.2.8" |
|||
}, |
|||
"dependencies": { |
|||
"grunt-cli": { |
|||
"version": "1.2.0", |
|||
"resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.2.0.tgz", |
|||
"integrity": "sha1-VisRnrsGndtGSs4oRVAb6Xs1tqg=", |
|||
"dev": true, |
|||
"requires": { |
|||
"findup-sync": "0.3.0", |
|||
"grunt-known-options": "1.1.0", |
|||
"nopt": "3.0.6", |
|||
"resolve": "1.1.7" |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
"grunt-contrib-clean": { |
|||
"version": "1.1.0", |
|||
"resolved": "https://registry.npmjs.org/grunt-contrib-clean/-/grunt-contrib-clean-1.1.0.tgz", |
|||
"integrity": "sha1-Vkq/LQN4qYOhW54/MO51tzjEBjg=", |
|||
"dev": true, |
|||
"requires": { |
|||
"async": "1.5.2", |
|||
"rimraf": "2.6.2" |
|||
}, |
|||
"dependencies": { |
|||
"rimraf": { |
|||
"version": "2.6.2", |
|||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", |
|||
"integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", |
|||
"dev": true, |
|||
"requires": { |
|||
"glob": "7.0.6" |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
"grunt-contrib-copy": { |
|||
"version": "1.0.0", |
|||
"resolved": "https://registry.npmjs.org/grunt-contrib-copy/-/grunt-contrib-copy-1.0.0.tgz", |
|||
"integrity": "sha1-cGDGWB6QS4qw0A8HbgqPbj58NXM=", |
|||
"dev": true, |
|||
"requires": { |
|||
"chalk": "1.1.3", |
|||
"file-sync-cmp": "0.1.1" |
|||
} |
|||
}, |
|||
"grunt-file-append": { |
|||
"version": "0.0.7", |
|||
"resolved": "https://registry.npmjs.org/grunt-file-append/-/grunt-file-append-0.0.7.tgz", |
|||
"integrity": "sha1-P376M2lvoFdwsoCU9EUIyvxdLto=", |
|||
"dev": true |
|||
}, |
|||
"grunt-known-options": { |
|||
"version": "1.1.0", |
|||
"resolved": "https://registry.npmjs.org/grunt-known-options/-/grunt-known-options-1.1.0.tgz", |
|||
"integrity": "sha1-pCdO6zL6dl2lp6OxcSYXzjsUQUk=", |
|||
"dev": true |
|||
}, |
|||
"grunt-legacy-log": { |
|||
"version": "1.0.0", |
|||
"resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-1.0.0.tgz", |
|||
"integrity": "sha1-+4bxgJhHvAfcR4Q/ns1srLYt8tU=", |
|||
"dev": true, |
|||
"requires": { |
|||
"colors": "1.1.2", |
|||
"grunt-legacy-log-utils": "1.0.0", |
|||
"hooker": "0.2.3", |
|||
"lodash": "3.10.1", |
|||
"underscore.string": "3.2.3" |
|||
} |
|||
}, |
|||
"grunt-legacy-log-utils": { |
|||
"version": "1.0.0", |
|||
"resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-1.0.0.tgz", |
|||
"integrity": "sha1-p7ji0Ps1taUPSvmG/BEnSevJbz0=", |
|||
"dev": true, |
|||
"requires": { |
|||
"chalk": "1.1.3", |
|||
"lodash": "4.3.0" |
|||
}, |
|||
"dependencies": { |
|||
"lodash": { |
|||
"version": "4.3.0", |
|||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.3.0.tgz", |
|||
"integrity": "sha1-79nEpuxT87BUEkKZFcPkgk5NJaQ=", |
|||
"dev": true |
|||
} |
|||
} |
|||
}, |
|||
"grunt-legacy-util": { |
|||
"version": "1.0.0", |
|||
"resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-1.0.0.tgz", |
|||
"integrity": "sha1-OGqnjcbtUJhsKxiVcmWxtIq7m4Y=", |
|||
"dev": true, |
|||
"requires": { |
|||
"async": "1.5.2", |
|||
"exit": "0.1.2", |
|||
"getobject": "0.1.0", |
|||
"hooker": "0.2.3", |
|||
"lodash": "4.3.0", |
|||
"underscore.string": "3.2.3", |
|||
"which": "1.2.14" |
|||
}, |
|||
"dependencies": { |
|||
"lodash": { |
|||
"version": "4.3.0", |
|||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.3.0.tgz", |
|||
"integrity": "sha1-79nEpuxT87BUEkKZFcPkgk5NJaQ=", |
|||
"dev": true |
|||
} |
|||
} |
|||
}, |
|||
"has-ansi": { |
|||
"version": "2.0.0", |
|||
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", |
|||
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", |
|||
"dev": true, |
|||
"requires": { |
|||
"ansi-regex": "2.1.1" |
|||
} |
|||
}, |
|||
"hooker": { |
|||
"version": "0.2.3", |
|||
"resolved": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz", |
|||
"integrity": "sha1-uDT3I8xKJCqmWWNFnfbZhMXT2Vk=", |
|||
"dev": true |
|||
}, |
|||
"hosted-git-info": { |
|||
"version": "2.5.0", |
|||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", |
|||
"integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", |
|||
"dev": true |
|||
}, |
|||
"iconv-lite": { |
|||
"version": "0.4.19", |
|||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", |
|||
"integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", |
|||
"dev": true |
|||
}, |
|||
"indent-string": { |
|||
"version": "2.1.0", |
|||
"resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", |
|||
"integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", |
|||
"dev": true, |
|||
"requires": { |
|||
"repeating": "2.0.1" |
|||
} |
|||
}, |
|||
"inflight": { |
|||
"version": "1.0.6", |
|||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", |
|||
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", |
|||
"dev": true, |
|||
"requires": { |
|||
"once": "1.4.0", |
|||
"wrappy": "1.0.2" |
|||
} |
|||
}, |
|||
"inherits": { |
|||
"version": "2.0.3", |
|||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", |
|||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", |
|||
"dev": true |
|||
}, |
|||
"is-arrayish": { |
|||
"version": "0.2.1", |
|||
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", |
|||
"integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", |
|||
"dev": true |
|||
}, |
|||
"is-builtin-module": { |
|||
"version": "1.0.0", |
|||
"resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", |
|||
"integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", |
|||
"dev": true, |
|||
"requires": { |
|||
"builtin-modules": "1.1.1" |
|||
} |
|||
}, |
|||
"is-finite": { |
|||
"version": "1.0.2", |
|||
"resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", |
|||
"integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", |
|||
"dev": true, |
|||
"requires": { |
|||
"number-is-nan": "1.0.1" |
|||
} |
|||
}, |
|||
"is-utf8": { |
|||
"version": "0.2.1", |
|||
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", |
|||
"integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", |
|||
"dev": true |
|||
}, |
|||
"isexe": { |
|||
"version": "2.0.0", |
|||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", |
|||
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", |
|||
"dev": true |
|||
}, |
|||
"js-yaml": { |
|||
"version": "3.5.5", |
|||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.5.5.tgz", |
|||
"integrity": "sha1-A3fDgBfKvHMisNH7zSWkkWQfL74=", |
|||
"dev": true, |
|||
"requires": { |
|||
"argparse": "1.0.9", |
|||
"esprima": "2.7.3" |
|||
} |
|||
}, |
|||
"load-json-file": { |
|||
"version": "1.1.0", |
|||
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", |
|||
"integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", |
|||
"dev": true, |
|||
"requires": { |
|||
"graceful-fs": "4.1.11", |
|||
"parse-json": "2.2.0", |
|||
"pify": "2.3.0", |
|||
"pinkie-promise": "2.0.1", |
|||
"strip-bom": "2.0.0" |
|||
} |
|||
}, |
|||
"lodash": { |
|||
"version": "3.10.1", |
|||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", |
|||
"integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", |
|||
"dev": true |
|||
}, |
|||
"loud-rejection": { |
|||
"version": "1.6.0", |
|||
"resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", |
|||
"integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", |
|||
"dev": true, |
|||
"requires": { |
|||
"currently-unhandled": "0.4.1", |
|||
"signal-exit": "3.0.2" |
|||
} |
|||
}, |
|||
"luamin": { |
|||
"version": "1.0.4", |
|||
"resolved": "https://registry.npmjs.org/luamin/-/luamin-1.0.4.tgz", |
|||
"integrity": "sha1-lEUptY/G+k0x6s4uA1PUEhDw49M=", |
|||
"dev": true, |
|||
"requires": { |
|||
"luaparse": "0.2.1" |
|||
} |
|||
}, |
|||
"luaparse": { |
|||
"version": "0.2.1", |
|||
"resolved": "https://registry.npmjs.org/luaparse/-/luaparse-0.2.1.tgz", |
|||
"integrity": "sha1-qo9WEysN6X0388mRqd9C4OF/ZWw=", |
|||
"dev": true |
|||
}, |
|||
"map-obj": { |
|||
"version": "1.0.1", |
|||
"resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", |
|||
"integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", |
|||
"dev": true |
|||
}, |
|||
"meow": { |
|||
"version": "3.7.0", |
|||
"resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", |
|||
"integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", |
|||
"dev": true, |
|||
"requires": { |
|||
"camelcase-keys": "2.1.0", |
|||
"decamelize": "1.2.0", |
|||
"loud-rejection": "1.6.0", |
|||
"map-obj": "1.0.1", |
|||
"minimist": "1.2.0", |
|||
"normalize-package-data": "2.4.0", |
|||
"object-assign": "4.1.1", |
|||
"read-pkg-up": "1.0.1", |
|||
"redent": "1.0.0", |
|||
"trim-newlines": "1.0.0" |
|||
} |
|||
}, |
|||
"minimatch": { |
|||
"version": "3.0.4", |
|||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", |
|||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", |
|||
"dev": true, |
|||
"requires": { |
|||
"brace-expansion": "1.1.8" |
|||
} |
|||
}, |
|||
"minimist": { |
|||
"version": "1.2.0", |
|||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", |
|||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", |
|||
"dev": true |
|||
}, |
|||
"nopt": { |
|||
"version": "3.0.6", |
|||
"resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", |
|||
"integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", |
|||
"dev": true, |
|||
"requires": { |
|||
"abbrev": "1.1.1" |
|||
} |
|||
}, |
|||
"normalize-package-data": { |
|||
"version": "2.4.0", |
|||
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", |
|||
"integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", |
|||
"dev": true, |
|||
"requires": { |
|||
"hosted-git-info": "2.5.0", |
|||
"is-builtin-module": "1.0.0", |
|||
"semver": "5.4.1", |
|||
"validate-npm-package-license": "3.0.1" |
|||
} |
|||
}, |
|||
"number-is-nan": { |
|||
"version": "1.0.1", |
|||
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", |
|||
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", |
|||
"dev": true |
|||
}, |
|||
"object-assign": { |
|||
"version": "4.1.1", |
|||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", |
|||
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", |
|||
"dev": true |
|||
}, |
|||
"once": { |
|||
"version": "1.4.0", |
|||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", |
|||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", |
|||
"dev": true, |
|||
"requires": { |
|||
"wrappy": "1.0.2" |
|||
} |
|||
}, |
|||
"parse-json": { |
|||
"version": "2.2.0", |
|||
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", |
|||
"integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", |
|||
"dev": true, |
|||
"requires": { |
|||
"error-ex": "1.3.1" |
|||
} |
|||
}, |
|||
"path-exists": { |
|||
"version": "2.1.0", |
|||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", |
|||
"integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", |
|||
"dev": true, |
|||
"requires": { |
|||
"pinkie-promise": "2.0.1" |
|||
} |
|||
}, |
|||
"path-is-absolute": { |
|||
"version": "1.0.1", |
|||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", |
|||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", |
|||
"dev": true |
|||
}, |
|||
"path-type": { |
|||
"version": "1.1.0", |
|||
"resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", |
|||
"integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", |
|||
"dev": true, |
|||
"requires": { |
|||
"graceful-fs": "4.1.11", |
|||
"pify": "2.3.0", |
|||
"pinkie-promise": "2.0.1" |
|||
} |
|||
}, |
|||
"pify": { |
|||
"version": "2.3.0", |
|||
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", |
|||
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", |
|||
"dev": true |
|||
}, |
|||
"pinkie": { |
|||
"version": "2.0.4", |
|||
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", |
|||
"integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", |
|||
"dev": true |
|||
}, |
|||
"pinkie-promise": { |
|||
"version": "2.0.1", |
|||
"resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", |
|||
"integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", |
|||
"dev": true, |
|||
"requires": { |
|||
"pinkie": "2.0.4" |
|||
} |
|||
}, |
|||
"read-pkg": { |
|||
"version": "1.1.0", |
|||
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", |
|||
"integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", |
|||
"dev": true, |
|||
"requires": { |
|||
"load-json-file": "1.1.0", |
|||
"normalize-package-data": "2.4.0", |
|||
"path-type": "1.1.0" |
|||
} |
|||
}, |
|||
"read-pkg-up": { |
|||
"version": "1.0.1", |
|||
"resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", |
|||
"integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", |
|||
"dev": true, |
|||
"requires": { |
|||
"find-up": "1.1.2", |
|||
"read-pkg": "1.1.0" |
|||
} |
|||
}, |
|||
"redent": { |
|||
"version": "1.0.0", |
|||
"resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", |
|||
"integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", |
|||
"dev": true, |
|||
"requires": { |
|||
"indent-string": "2.1.0", |
|||
"strip-indent": "1.0.1" |
|||
} |
|||
}, |
|||
"repeating": { |
|||
"version": "2.0.1", |
|||
"resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", |
|||
"integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", |
|||
"dev": true, |
|||
"requires": { |
|||
"is-finite": "1.0.2" |
|||
} |
|||
}, |
|||
"resolve": { |
|||
"version": "1.1.7", |
|||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", |
|||
"integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", |
|||
"dev": true |
|||
}, |
|||
"rimraf": { |
|||
"version": "2.2.8", |
|||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", |
|||
"integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=", |
|||
"dev": true |
|||
}, |
|||
"semver": { |
|||
"version": "5.4.1", |
|||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", |
|||
"integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", |
|||
"dev": true |
|||
}, |
|||
"signal-exit": { |
|||
"version": "3.0.2", |
|||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", |
|||
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", |
|||
"dev": true |
|||
}, |
|||
"spdx-correct": { |
|||
"version": "1.0.2", |
|||
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", |
|||
"integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", |
|||
"dev": true, |
|||
"requires": { |
|||
"spdx-license-ids": "1.2.2" |
|||
} |
|||
}, |
|||
"spdx-expression-parse": { |
|||
"version": "1.0.4", |
|||
"resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", |
|||
"integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=", |
|||
"dev": true |
|||
}, |
|||
"spdx-license-ids": { |
|||
"version": "1.2.2", |
|||
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", |
|||
"integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", |
|||
"dev": true |
|||
}, |
|||
"sprintf-js": { |
|||
"version": "1.0.3", |
|||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", |
|||
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", |
|||
"dev": true |
|||
}, |
|||
"strip-ansi": { |
|||
"version": "3.0.1", |
|||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", |
|||
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", |
|||
"dev": true, |
|||
"requires": { |
|||
"ansi-regex": "2.1.1" |
|||
} |
|||
}, |
|||
"strip-bom": { |
|||
"version": "2.0.0", |
|||
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", |
|||
"integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", |
|||
"dev": true, |
|||
"requires": { |
|||
"is-utf8": "0.2.1" |
|||
} |
|||
}, |
|||
"strip-indent": { |
|||
"version": "1.0.1", |
|||
"resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", |
|||
"integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", |
|||
"dev": true, |
|||
"requires": { |
|||
"get-stdin": "4.0.1" |
|||
} |
|||
}, |
|||
"supports-color": { |
|||
"version": "2.0.0", |
|||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", |
|||
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", |
|||
"dev": true |
|||
}, |
|||
"trim-newlines": { |
|||
"version": "1.0.0", |
|||
"resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", |
|||
"integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", |
|||
"dev": true |
|||
}, |
|||
"underscore.string": { |
|||
"version": "3.2.3", |
|||
"resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.2.3.tgz", |
|||
"integrity": "sha1-gGmSYzZl1eX8tNsfs6hi62jp5to=", |
|||
"dev": true |
|||
}, |
|||
"validate-npm-package-license": { |
|||
"version": "3.0.1", |
|||
"resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", |
|||
"integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", |
|||
"dev": true, |
|||
"requires": { |
|||
"spdx-correct": "1.0.2", |
|||
"spdx-expression-parse": "1.0.4" |
|||
} |
|||
}, |
|||
"which": { |
|||
"version": "1.2.14", |
|||
"resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz", |
|||
"integrity": "sha1-mofEN48D6CfOyvGs31bHNsAcFOU=", |
|||
"dev": true, |
|||
"requires": { |
|||
"isexe": "2.0.0" |
|||
} |
|||
}, |
|||
"wrappy": { |
|||
"version": "1.0.2", |
|||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", |
|||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", |
|||
"dev": true |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,19 @@ |
|||
{ |
|||
"name": "OpenComputers", |
|||
"version": "1.0.0", |
|||
"description": "FTB OpenComputers Packaging", |
|||
"main": "index.js", |
|||
"scripts": { |
|||
"test": "echo \"Error: no test specified\" && exit 1", |
|||
"grunt": "grunt" |
|||
}, |
|||
"author": "Drew Short <warrick@sothr.com>", |
|||
"license": "MIT", |
|||
"devDependencies": { |
|||
"grunt": "^1.0.1", |
|||
"grunt-contrib-clean": "^1.0.0", |
|||
"grunt-contrib-copy": "^1.0.0", |
|||
"grunt-file-append": "^0.0.7", |
|||
"luamin": "^1.0.4" |
|||
} |
|||
} |
@ -0,0 +1,107 @@ |
|||
-- Reactor Control v0.2.4 (C) WarrickSothr |
|||
local component = require("component") |
|||
local term = require("term") |
|||
local event = require("event") |
|||
local keyboard = require("keyboard") |
|||
local side = require("sides") |
|||
|
|||
local gpu = component.gpu |
|||
local br = component.br_reactor |
|||
local transposer = component.transposer |
|||
|
|||
local tickCount = 0 |
|||
local tickMinuteDivisor = 20 |
|||
|
|||
local minute = 0 |
|||
local hour = 0 |
|||
|
|||
local fuelInputSide = side.left |
|||
|
|||
local currentEnergyStorageTrendState = "" |
|||
local currentEnergyStorageTrend = 0 |
|||
local currentEnergyStored = 9999999 |
|||
local maxEnergyStored = 9990000 |
|||
|
|||
local running = true |
|||
|
|||
local maxScreenWidth, maxScreenHeight = gpu.maxResolution() |
|||
local displayDivisor = 2 |
|||
gpu.setResolution(maxScreenWidth/displayDivisor, maxScreenHeight/displayDivisor) |
|||
|
|||
term.clear() |
|||
term.setCursorBlink(false) |
|||
|
|||
local function keepTime() |
|||
tickCount = tickCount + 1 |
|||
|
|||
if tickCount >= tickMinuteDivisor then |
|||
minute = minute + 1 |
|||
tickCount = 0 |
|||
end |
|||
|
|||
if minute >= 60 then |
|||
hour = hour + 1 |
|||
minute = 0 |
|||
end |
|||
end |
|||
|
|||
local function populateLoopVariables() |
|||
local energyStorageTrend = br.getEnergyStored() - currentEnergyStored |
|||
if energyStorageTrend == 0 or currentEnergyStored >= maxEnergyStored then |
|||
currentEnergyStorageTrend = 0 |
|||
currentEnergyStorageTrendState = "Stable" |
|||
elseif energyStorageTrend > 0 then |
|||
currentEnergyStorageTrend = 1 |
|||
currentEnergyStorageTrendState = "Filling" |
|||
elseif energyStorageTrend < 0 then |
|||
currentEnergyStorageTrend = -1 |
|||
currentEnergyStorageTrendState = "Draining" |
|||
else |
|||
currentEnergyStorageTrend = 0 |
|||
currentEnergyStorageTrendState = "UNKNOWN" |
|||
end |
|||
|
|||
currentEnergyStored = br.getEnergyStored() |
|||
end |
|||
|
|||
local function printLine(s, ...) |
|||
term.clearLine() |
|||
term.write(s:format(...)) |
|||
term.write("\n") |
|||
end |
|||
|
|||
local function drawScreen() |
|||
term.setCursor(1,1) |
|||
printLine("Current Runtime: %d:%d", hour, minute) |
|||
printLine("Current Energy Output: %04.2f RF", br.getEnergyProducedLastTick()) |
|||
printLine("Current Fuel Level: %d mB", br.getFuelAmount()) |
|||
printLine("Total Energy Stored: %d RF", currentEnergyStored) |
|||
printLine("Current Energy Storage Trend: %s", currentEnergyStorageTrendState) |
|||
term.clearLine() |
|||
print() |
|||
end |
|||
|
|||
local function onKeyDown(key) |
|||
if key == keyboard.keys.q then |
|||
running = false |
|||
end |
|||
end |
|||
|
|||
while running do |
|||
keepTime() |
|||
populateLoopVariables() |
|||
drawScreen() |
|||
|
|||
if tickCount %5 == 0 and currentEnergyStorageTrend < 0 then |
|||
transposer.transferItem(fuelInputSide, side.down, 1, 1) |
|||
end |
|||
|
|||
local event, address, arg1, arg2, arg3 = event.pull(1) |
|||
if event== "key_down" then |
|||
onKeyDown(arg2) |
|||
end |
|||
end |
|||
|
|||
term.clear() |
|||
term.setCursorBlink(true) |
|||
gpu.setResolution(maxScreenWidth, maxScreenHeight) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue