Adjust fuel quantities

This commit is contained in:
asraelite 2024-05-13 19:49:23 +02:00 committed by Markus Scully
parent 43a6ae8d60
commit e55f9cac3d
3 changed files with 12 additions and 4 deletions

View file

@ -51,7 +51,7 @@ export const modules = {
mass: 1, mass: 1,
value: 1, value: 1,
connectivity: [true, false, true, false], connectivity: [true, false, true, false],
fuelCapacity: 5 fuelCapacity: 8
}, },
large: { large: {
name: 'Large Fuel Tank', name: 'Large Fuel Tank',
@ -61,7 +61,7 @@ export const modules = {
mass: 2, mass: 2,
value: 3, value: 3,
connectivity: [true, false, true, false], connectivity: [true, false, true, false],
fuelCapacity: 15 fuelCapacity: 25
}, },
advanced: { advanced: {
name: 'Advanced Fuel Tank', name: 'Advanced Fuel Tank',
@ -71,7 +71,7 @@ export const modules = {
mass: 1, mass: 1,
value: 15, value: 15,
connectivity: [true, false, true, false], connectivity: [true, false, true, false],
fuelCapacity: 12 fuelCapacity: 15
} }
}, },
thruster: { thruster: {

View file

@ -180,7 +180,8 @@ export function tossItem() {
export function collectItem(type, id, name) { export function collectItem(type, id, name) {
if (type === 'fuelcan') { if (type === 'fuelcan') {
world.playerShip.addFuel(consts.FUEL_CAN_AMOUNT); // world.playerShip.addFuel(consts.FUEL_CAN_AMOUNT);
world.playerShip.refillFuel();
audio.play('fuelPickup'); audio.play('fuelPickup');
score += 10; score += 10;
notify('Collected fuel: +10'); notify('Collected fuel: +10');

View file

@ -8,6 +8,9 @@ import Tracer from './tracer';
import { state } from '../game/index'; import { state } from '../game/index';
export default class Ship extends Body { export default class Ship extends Body {
fuel: number;
maxFuel: number;
constructor(x, y) { constructor(x, y) {
super(x, y, 0); super(x, y, 0);
@ -91,6 +94,10 @@ export default class Ship extends Body {
this.fuel = Math.min(this.fuel + amount, this.maxFuel); this.fuel = Math.min(this.fuel + amount, this.maxFuel);
} }
refillFuel() {
this.fuel = this.maxFuel;
}
addModule(x, y, properties, options) { addModule(x, y, properties, options) {
let module = new Module(x, y, this, { ...properties, ...options }); let module = new Module(x, y, this, { ...properties, ...options });
this.modules.add(module); this.modules.add(module);