Add a station
This commit is contained in:
parent
a58b3b42b9
commit
3185ec340a
1 changed files with 21 additions and 0 deletions
21
src/main.js
21
src/main.js
|
@ -1,4 +1,5 @@
|
||||||
// Theme: Reversed
|
// Theme: Reversed
|
||||||
|
// https://en.wikipedia.org/wiki/Asteroid_mining
|
||||||
|
|
||||||
class Engine {
|
class Engine {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -31,6 +32,7 @@ class Engine {
|
||||||
class Player {
|
class Player {
|
||||||
constructor(engine) {
|
constructor(engine) {
|
||||||
this.engine = engine;
|
this.engine = engine;
|
||||||
|
this.equipment = ['probe'];
|
||||||
}
|
}
|
||||||
|
|
||||||
mine() {
|
mine() {
|
||||||
|
@ -61,8 +63,27 @@ class Asteroid {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Station {
|
||||||
|
constructor() {
|
||||||
|
this.inventory = [
|
||||||
|
'probe', // take probes from the asteroid
|
||||||
|
'conveyor', // mine on surface
|
||||||
|
'pipe-drill', // shaft mining into the asteroid
|
||||||
|
'magnet', // pick up loose grains with magnet, x-class asteroids only
|
||||||
|
'vaporizer' // melt the matrix
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
buy(player, item) {
|
||||||
|
if (this.inventory.indexOf(item) !== -1 &&
|
||||||
|
player.equipment.indexOf(item) === -1)
|
||||||
|
player.equipment.push(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var engine = new Engine();
|
var engine = new Engine();
|
||||||
var player = new Player(engine);
|
var player = new Player(engine);
|
||||||
|
var station = new Station();
|
||||||
|
|
||||||
var bootstrap = function() {
|
var bootstrap = function() {
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
|
|
Loading…
Reference in a new issue