Add collectable fuel cans

This commit is contained in:
asraelite 2018-03-07 02:19:06 +00:00
parent 4f8fd6e1af
commit b27bd7bba2
9 changed files with 141 additions and 27 deletions

View file

@ -5,6 +5,7 @@ import * as inventory from './inventory.mjs';
import * as particle from '../world/particle.mjs';
import * as edit from './edit.mjs';
import * as audio from './audio.mjs';
import * as consts from '../consts.mjs';
export let shipLanded = false;
export let score = 0;
@ -105,9 +106,17 @@ export function tossItem() {
}
export function collectItem(type, id) {
inventory.addItem(type, id);
audio.play('itemPickup');
score += 20;
notify('Collected module: +20');
return true;
if (type === 'fuelcan') {
world.playerShip.addFuel(consts.FUEL_CAN_AMOUNT);
audio.play('fuelPickup');
score += 10;
notify('Collected fuel: +10');
return true;
} else {
inventory.addItem(type, id);
audio.play('itemPickup');
score += 20;
notify('Collected module: +20');
return true;
}
}