This commit is contained in:
Bastian Wagner 2025-04-26 23:39:32 +02:00
parent 3dd86fa224
commit 01153a1db3
7 changed files with 46 additions and 29 deletions

View File

@ -38,7 +38,7 @@
</div> </div>
<div class="ui-section"> <div class="ui-section">
<div>📦 Verbrauch:</div> <div>🍽️ Verbrauch:</div>
<ul> <ul>
@for (item of consumedItems; track $index) { @for (item of consumedItems; track $index) {
<li>{{ item.type }}: {{ item.demandRate * planet.population | number:'0.0-1' }}/s</li> <li>{{ item.type }}: {{ item.demandRate * planet.population | number:'0.0-1' }}/s</li>
@ -57,7 +57,7 @@
@if (goodsInTransit.length > 0) { @if (goodsInTransit.length > 0) {
<div class="ui-section"> <div class="ui-section">
<div>📦 In Lieferung:</div> <div>⏱️ In Lieferung:</div>
<ul> <ul>
@for (item of goodsInTransit; track $index) { @for (item of goodsInTransit; track $index) {
<li>{{ item.type }}: {{ item.amount | number:'0.0-1' }}</li> <li>{{ item.type }}: {{ item.amount | number:'0.0-1' }}</li>

View File

@ -63,8 +63,20 @@ export class PlanetDialogComponent {
this.gameService.showPlanetInfo = undefined; this.gameService.showPlanetInfo = undefined;
} }
get goodsInTransit(): TradeInstance[] { get goodsInTransit(): { type: GoodType, amount: number}[] {
return this.planet.goodsInTransit; const res: { type: GoodType, amount: number}[] = [];
this.planet.goodsInTransit.forEach(item => {
const ex = res.find(r => r.type == item.type);
if (ex) {
ex.amount += item.amount;
} else {
res.push({
type: item.type,
amount: item.amount
})
}
});
return res;
} }
upgradeHarbour() { upgradeHarbour() {

View File

@ -19,39 +19,39 @@ export class BuyComponent {
selectedPlanets: Planet[] = []; selectedPlanets: Planet[] = [];
config: ShipConfig = { config: ShipConfig = {
name: 'Pioneer-01', name: 'Pioneer-01',
acceleration: 500, acceleration: 428,
cargoSize: 20, cargoSize: 25,
cost: 0.6, cost: 0.6,
loadingSpeed: 15, loadingSpeed: 15,
maxSpeed: 300, maxSpeed: 300,
planetRoute: [], planetRoute: [],
buyCost: 2000, buyCost: 3000,
desciption: 'Ein kleines, schnelles Schiff. Es hat wenig Platz für Ladung, lädt aber schnell und ist sehr wendig.', desciption: 'Ein kleines, schnelles Schiff. Es hat wenig Platz für Ladung, lädt aber schnell und ist sehr wendig.',
texture: 'swift-hauler' texture: 'swift-hauler'
} }
config2: ShipConfig = { config2: ShipConfig = {
name: 'Colony Carrier', name: 'Colony Carrier',
acceleration: 200, acceleration: 63,
cargoSize: 50, cargoSize: 70,
cost: 1.6, cost: 1.6,
loadingSpeed: 20, loadingSpeed: 20,
maxSpeed: 200, maxSpeed: 200,
planetRoute: [], planetRoute: [],
buyCost: 4000, buyCost: 8000,
desciption: 'Eine größere Version von der Pioneer-01. Der größere Frachtraum geht zu Lasten der Beschleunigung und Maximalgeschwindigkeit.', desciption: 'Eine größere Version von der Pioneer-01. Der größere Frachtraum geht zu Lasten der Beschleunigung und Maximalgeschwindigkeit.',
texture: 'colony-carrier' texture: 'colony-carrier'
} }
config3: ShipConfig = { config3: ShipConfig = {
name: 'Industrial Tanker', name: 'Industrial Tanker',
acceleration: 5, acceleration: 8,
cargoSize: 300, cargoSize: 300,
cost: 3.8, cost: 3.8,
loadingSpeed: 5, loadingSpeed: 11,
maxSpeed: 600, maxSpeed: 600,
planetRoute: [], planetRoute: [],
buyCost: 8000, buyCost: 14000,
desciption: 'Ein großes behäbiges Schiff. Es wird durchaus schnell, beschleunigt aber sehr langsam und erreicht die Spitzengeschwindigkeit nur selten.', desciption: 'Ein großes behäbiges Schiff. Es wird durchaus schnell, beschleunigt aber sehr langsam und erreicht die Spitzengeschwindigkeit nur selten.',
texture: 'industrial-tanker' texture: 'industrial-tanker'
} }

View File

@ -10,7 +10,7 @@ export const PLANETCONFIGS: { x: number, y: number, texture: string, config: Pla
name: 'Terra Nova', name: 'Terra Nova',
initialGoods: [ initialGoods: [
{ type: GoodType.Wasser, amount: 10 }, { type: GoodType.Wasser, amount: 10 },
{ type: GoodType.Nahrung, amount: 10, productionBonus: 1.3 }, { type: GoodType.Nahrung, amount: 10, productionBonus: 2.6 },
] ]
} }
}, },
@ -23,7 +23,7 @@ export const PLANETCONFIGS: { x: number, y: number, texture: string, config: Pla
initialGoods: [ initialGoods: [
{ type: GoodType.Wasser, amount: 10 }, { type: GoodType.Wasser, amount: 10 },
{ type: GoodType.Nahrung, amount: 10 }, { type: GoodType.Nahrung, amount: 10 },
{ type: GoodType.Metall, amount: 10, productionBonus: 1.5 }, { type: GoodType.Metall, amount: 10, productionBonus: 3 },
{ type: GoodType.Bauteile, amount: 10, productionBonus: 1.3 }, { type: GoodType.Bauteile, amount: 10, productionBonus: 1.3 },
{ type: GoodType.Elektronik, amount: 10 } { type: GoodType.Elektronik, amount: 10 }
] ]
@ -36,7 +36,7 @@ export const PLANETCONFIGS: { x: number, y: number, texture: string, config: Pla
config: { config: {
name: 'Aqualis', name: 'Aqualis',
initialGoods: [ initialGoods: [
{ type: GoodType.Wasser, amount: 200, productionBonus: 2.0 }, { type: GoodType.Wasser, amount: 200, productionBonus: 4 },
{ type: GoodType.Nahrung, amount: 10 }, { type: GoodType.Nahrung, amount: 10 },
{ type: GoodType.Treibstoff, amount: 10 } { type: GoodType.Treibstoff, amount: 10 }
] ]
@ -79,7 +79,7 @@ export const PLANETCONFIGS: { x: number, y: number, texture: string, config: Pla
name: 'Volaris', name: 'Volaris',
initialGoods: [ initialGoods: [
{ type: GoodType.Nahrung, amount: 10 }, { type: GoodType.Nahrung, amount: 10 },
{ type: GoodType.Wasser, amount: 10, productionBonus: 1.1 }, { type: GoodType.Wasser, amount: 10, productionBonus: 1.9 },
{ type: GoodType.Bauteile, amount: 10 } { type: GoodType.Bauteile, amount: 10 }
] ]
} }

View File

@ -8,11 +8,11 @@ export interface GoodConfig {
} }
export const GOODS_DATA: Record<GoodType, GoodConfig> = { export const GOODS_DATA: Record<GoodType, GoodConfig> = {
[GoodType.Erz]: { baseProduction: 1.0, baseDemand: 0.001, storageLimit: 500, isRawResource: true }, [GoodType.Erz]: { baseProduction: 1.0, baseDemand: 0.005, storageLimit: 200, isRawResource: true },
[GoodType.Wasser]: { baseProduction: 1, baseDemand: 0.0015, storageLimit: 300, isRawResource: true }, [GoodType.Wasser]: { baseProduction: 1, baseDemand: 0.0075, storageLimit: 500, isRawResource: true },
[GoodType.Nahrung]: { baseProduction: 1, baseDemand: 0.001, storageLimit: 200, isRawResource: true }, [GoodType.Nahrung]: { baseProduction: 1, baseDemand: 0.005, storageLimit: 300, isRawResource: true },
[GoodType.Metall]: { baseProduction: 1, baseDemand: 0.001, storageLimit: 300, isRawResource: false }, [GoodType.Metall]: { baseProduction: 1, baseDemand: 0.005, storageLimit: 300, isRawResource: false },
[GoodType.Treibstoff]: { baseProduction: 1, baseDemand: 0, storageLimit: 150, isRawResource: false }, [GoodType.Treibstoff]: { baseProduction: 1, baseDemand: 0.002, storageLimit: 150, isRawResource: false },
[GoodType.Elektronik]: { baseProduction: 1, baseDemand: 0.001, storageLimit: 100, isRawResource: false }, [GoodType.Elektronik]: { baseProduction: 1, baseDemand: 0.005, storageLimit: 100, isRawResource: false },
[GoodType.Bauteile]: { baseProduction: 1, baseDemand: 0.001, storageLimit: 100, isRawResource: false } [GoodType.Bauteile]: { baseProduction: 1, baseDemand: 0.005, storageLimit: 100, isRawResource: false }
}; };

View File

@ -16,7 +16,7 @@ export class Planet {
public isGrowing: boolean = false; public isGrowing: boolean = false;
private populationGrowthRate = 0.002; // Basiswachstum pro Tick (%) private populationGrowthRate = 0.002; // Basiswachstum pro Tick (%)
private populationDeclineRate = 0.005; // Basisrückgang bei Mangel (%) private populationDeclineRate = 0.005; // Basisrückgang bei Mangel (%)
public demandSecondsBuffer = 150; // Anfrage immer mindestens 30 Sekunden überleben public demandSecondsBuffer = 160; // Anfrage immer mindestens 30 Sekunden überleben
private productionLevel: Map<GoodType, number> = new Map(); private productionLevel: Map<GoodType, number> = new Map();
private dockedShips: Ship[] = []; private dockedShips: Ship[] = [];
@ -204,11 +204,13 @@ export class Planet {
private updatePopulation(seconds: number): void { private updatePopulation(seconds: number): void {
const demands = this.calculateNaturalDemand(seconds); const demands = this.calculateNaturalDemand(seconds);
let allSupplied = true; let allSupplied = true;
let notSupplied = 0;
demands.forEach((amountNeeded, goodType) => { demands.forEach((amountNeeded, goodType) => {
const available = this.goods.get(goodType)?.amount ?? 0; const available = this.goods.get(goodType)?.amount ?? 0;
if (available < amountNeeded) { if (available < amountNeeded) {
allSupplied = false; allSupplied = false;
notSupplied++;
} }
}); });
@ -217,10 +219,13 @@ export class Planet {
this.isGrowing = true; this.isGrowing = true;
} else { } else {
this.isGrowing = false; this.isGrowing = false;
if (notSupplied > 1) {
this.population -= this.population * this.populationDeclineRate * seconds; this.population -= this.population * this.populationDeclineRate * seconds;
this.population = Math.max(this.population, 100); this.population = Math.max(this.population, 100);
} }
}
// if (this.isGrowing) { // if (this.isGrowing) {
// console.log(`[${this.name}] Growing population: ${this.population.toFixed(2)}`); // console.log(`[${this.name}] Growing population: ${this.population.toFixed(2)}`);
// } else { // } else {
@ -328,7 +333,7 @@ export class Planet {
buildHarbour() { buildHarbour() {
this.hasHarbour = true; this.hasHarbour = true;
this.gameService.money -= 3000; this.gameService.money -= 30000;
} }
upgradeProduction() { upgradeProduction() {

View File

@ -15,7 +15,7 @@ export class GameService {
showTutorial = true; showTutorial = true;
public money = 12500; public money = 100000;
onShipCreate: EventEmitter<Ship> = new EventEmitter(); onShipCreate: EventEmitter<Ship> = new EventEmitter();
onShipDestroy: EventEmitter<Ship> = new EventEmitter(); onShipDestroy: EventEmitter<Ship> = new EventEmitter();