diff --git a/src/data.ts b/src/data.ts index 176818f..ef2eb16 100644 --- a/src/data.ts +++ b/src/data.ts @@ -51,7 +51,7 @@ export const modules = { mass: 1, value: 1, connectivity: [true, false, true, false], - fuelCapacity: 5 + fuelCapacity: 8 }, large: { name: 'Large Fuel Tank', @@ -61,7 +61,7 @@ export const modules = { mass: 2, value: 3, connectivity: [true, false, true, false], - fuelCapacity: 15 + fuelCapacity: 25 }, advanced: { name: 'Advanced Fuel Tank', @@ -71,7 +71,7 @@ export const modules = { mass: 1, value: 15, connectivity: [true, false, true, false], - fuelCapacity: 12 + fuelCapacity: 15 } }, thruster: { diff --git a/src/game/events.ts b/src/game/events.ts index ab930e6..6c4977b 100644 --- a/src/game/events.ts +++ b/src/game/events.ts @@ -180,7 +180,8 @@ export function tossItem() { export function collectItem(type, id, name) { if (type === 'fuelcan') { - world.playerShip.addFuel(consts.FUEL_CAN_AMOUNT); + // world.playerShip.addFuel(consts.FUEL_CAN_AMOUNT); + world.playerShip.refillFuel(); audio.play('fuelPickup'); score += 10; notify('Collected fuel: +10'); diff --git a/src/world/ship.ts b/src/world/ship.ts index 871e1ee..145e226 100644 --- a/src/world/ship.ts +++ b/src/world/ship.ts @@ -8,6 +8,9 @@ import Tracer from './tracer'; import { state } from '../game/index'; export default class Ship extends Body { + fuel: number; + maxFuel: number; + constructor(x, y) { super(x, y, 0); @@ -91,6 +94,10 @@ export default class Ship extends Body { this.fuel = Math.min(this.fuel + amount, this.maxFuel); } + refillFuel() { + this.fuel = this.maxFuel; + } + addModule(x, y, properties, options) { let module = new Module(x, y, this, { ...properties, ...options }); this.modules.add(module);