Improve inventory

This commit is contained in:
asraelite 2018-03-07 00:03:53 +00:00
parent ee5ab45cfb
commit 27c6a8bcd0
12 changed files with 99 additions and 17 deletions

View file

@ -73,6 +73,7 @@ export function endEditing() {
if (valid) {
audio.play('endEdit');
particle.createEndEditBurst(world.playerShip);
graphics.changePerspective('universe');
game.state.editing = false;
game.state.inventory = false;

View file

@ -65,9 +65,26 @@ class Tile {
this.mapId = toId(type, id);
this.quantity = q;
this.image = assets.modules[type][id];
this.data = modules[type][id];
if (type === 'thruster') this.image = this.image.off;
}
get textInfo() {
let text = this.data.name + '\n\n' + this.data.tooltip + '\n\n';
text += 'Mass: ' + this.data.mass + '\n';
if (this.type === 'thruster')
text += 'Power: ' + this.data.thrust + '\n';
if (this.type === 'fuel')
text += 'Fuel capacity: ' + this.data.fuelCapacity + '\n';
if (this.type === 'capsule') {
text += 'Rotational power: ' + this.data.rotation + '\n';
text += 'Cargo space: ' + this.data.capacity + '\n';
}
return text;
}
get ident() {
return [this.type, this.id];
}