lots of tweaks and updates

This commit is contained in:
33333-33333 2026-06-07 20:36:52 +09:00
commit 6d6fbe85a9
18 changed files with 762 additions and 528 deletions

View file

@ -1,4 +1,4 @@
import { STARTING_CASH, TURN_SECONDS, FARM_SHUTDOWN_GRACE_SECONDS, BUILD_COSTS, FACILITY_PRICES, GRID } from './config.js';
import { STARTING_CASH, TURN_SECONDS, FARM_SHUTDOWN_GRACE_SECONDS, BUILD_COSTS, FACILITY_DEFS, GRID } from './config.js';
import { randomBetween } from './utils.js';
export function newTurnStats() {
@ -18,7 +18,7 @@ export function newTurnStats() {
pendingTruckRevenue: 0,
mixerRevenue: 0,
truckRevenue: 0,
fairiesFee: 0,
zundaTax: 0,
mixerPoopFine: 0,
truckPoopFine: 0,
maleTruckFine: 0,
@ -46,7 +46,7 @@ export function newTotalStats() {
poopMixer: 0,
explosionDamage: 0,
contractBonus: 0,
fairiesFee: 0,
zundaTax: 0,
mixerPoopFine: 0,
truckPoopFine: 0,
maleTruckFine: 0,
@ -109,14 +109,10 @@ export function nextSpawnDelay(farm) {
}
function facilityBodyForEntry(id, entry, side) {
const sizes = {
mixer: { w: 164, h: 126, name: 'Mixer', price: FACILITY_PRICES.mixer },
trash: { w: 180, h: 100, name: 'Waste Shredder', price: FACILITY_PRICES.trash },
truck: { w: 176, h: 138, name: 'Truck', price: FACILITY_PRICES.truck }
};
const def = FACILITY_DEFS[id];
const spec = { ...def.body, name: def.name, price: def.price };
const g = { left: GRID.x, right: GRID.x + GRID.cols * GRID.cell, top: GRID.y, bottom: GRID.y + GRID.rows * GRID.cell };
const c = { x: GRID.x + entry.col * GRID.cell + GRID.cell / 2, y: GRID.y + entry.row * GRID.cell + GRID.cell / 2 };
const spec = sizes[id];
let x = c.x - spec.w / 2;
let y = c.y - spec.h / 2;
if (side === 'left') { x = g.left - spec.w - 18; y = c.y - spec.h / 2; }
@ -129,9 +125,9 @@ function facilityBodyForEntry(id, entry, side) {
export function defaultFacilities() {
return {
// Machine bodies sit outside the build grid. Only these receiver cells sit on the grid edge.
mixer: facilityBodyForEntry('mixer', { col: 0, row: 4 }, 'left'),
mixer: facilityBodyForEntry('mixer', { col: 0, row: 5 }, 'left'),
trash: facilityBodyForEntry('trash', { col: 10, row: 12 }, 'bottom'),
truck: facilityBodyForEntry('truck', { col: 21, row: 7 }, 'right')
truck: facilityBodyForEntry('truck', { col: 17, row: 12 }, 'bottom')
};
}
@ -139,27 +135,27 @@ export function resetLayout(game) {
game.conveyorTiles.clear();
game.conveyorMeta.clear();
const initial = [
// Egg Farm -> S1 top input. Shorter starter approach lane.
[4, 1], [4, 2], [4, 3],
// Egg Farm -> S1 top input. S1 starts lower so the farm is not pressed against it.
[4, 1], [4, 2], [4, 3], [4, 4],
// S1 left output -> Mixer receiver on the left grid edge.
[3, 4], [2, 4], [1, 4], [0, 4],
[3, 5], [2, 5], [1, 5], [0, 5],
// S1 right output -> S2 top input.
[5, 4], [6, 4], [7, 4], [8, 4], [9, 4],
[9, 5], [10, 5], [11, 5], [11, 6],
[5, 5], [6, 5], [7, 5], [8, 5], [9, 5], [10, 5], [11, 5],
[11, 6], [11, 7],
// S2 left output -> Waste Shredder receiver on bottom grid edge.
[10, 7], [10, 8], [10, 9], [10, 10], [10, 11], [10, 12],
// S2 right output -> Truck receiver on the right grid edge.
// Restored a longer lane so S2-to-truck transport is readable and less congested.
[12, 7], [13, 7], [14, 7], [15, 7], [16, 7], [17, 7], [18, 7], [19, 7], [20, 7], [21, 7]
]; for (const [col, row] of initial) {
[10, 8], [10, 9], [10, 10], [10, 11], [10, 12],
// S2 right output -> Truck receiver on the bottom grid edge.
[12, 8], [13, 8], [14, 8], [15, 8], [16, 8], [17, 8], [17, 9], [17, 10], [17, 11], [17, 12]
];
for (const [col, row] of initial) {
const k = `${col},${row}`;
game.conveyorTiles.add(k);
game.conveyorMeta.set(k, { price: BUILD_COSTS.conveyor, builtSession: null });
}
game.facilities = defaultFacilities();
game.scanners = [
{ type: 'scanner', id: 1, kind: 'manual', slot: 0, role: 0, col: 4, row: 4, level: 1, queue: [], cooldown: 0, price: BUILD_COSTS.manualScanner, builtSession: null, autoMode: 'standard' },
{ type: 'scanner', id: 2, kind: 'manual', slot: 1, role: 1, col: 11, row: 7, level: 1, queue: [], cooldown: 0, price: BUILD_COSTS.manualScanner, builtSession: null, autoMode: 'standard' }
{ type: 'scanner', id: 1, kind: 'manual', slot: 0, role: 0, col: 4, row: 5, level: 1, queue: [], cooldown: 0, price: BUILD_COSTS.manualScanner, builtSession: null, autoMode: 'standard' },
{ type: 'scanner', id: 2, kind: 'manual', slot: 1, role: 1, col: 11, row: 8, level: 1, queue: [], cooldown: 0, price: BUILD_COSTS.manualScanner, builtSession: null, autoMode: 'standard' }
];
const farm = { type: 'eggFarm', id: 1, col: 4, row: 0, level: 1, nextSpawn: 2, lastInterval: 2, spawnCounter: 0, price: BUILD_COSTS.eggFarm, builtSession: null };
farm.nextSpawn = nextSpawnDelay(farm);