Add a station

This commit is contained in:
Aaron Fischer 2015-08-25 16:29:37 +02:00
parent a58b3b42b9
commit 3185ec340a

View file

@ -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(() => {