This commit is contained in:
33333-33333 2026-06-07 18:06:35 +09:00
commit b454ffbd40
21 changed files with 1349 additions and 712 deletions

View file

@ -1,4 +1,4 @@
import { STARTING_CASH, TURN_SECONDS, BUILD_COSTS, FACILITY_PRICES, GRID } from './config.js';
import { STARTING_CASH, TURN_SECONDS, FARM_SHUTDOWN_GRACE_SECONDS, BUILD_COSTS, FACILITY_PRICES, GRID } from './config.js';
import { randomBetween } from './utils.js';
export function newTurnStats() {
@ -16,6 +16,12 @@ export function newTurnStats() {
penalty: 0,
profit: 0,
pendingTruckRevenue: 0,
mixerRevenue: 0,
truckRevenue: 0,
fairiesFee: 0,
mixerPoopFine: 0,
truckPoopFine: 0,
maleTruckFine: 0,
explosionDamage: 0,
correct: 0,
mistakes: 0,
@ -40,6 +46,10 @@ export function newTotalStats() {
poopMixer: 0,
explosionDamage: 0,
contractBonus: 0,
fairiesFee: 0,
mixerPoopFine: 0,
truckPoopFine: 0,
maleTruckFine: 0,
contractSuccess: 0,
contractFailed: 0
};
@ -51,6 +61,8 @@ export function createGame() {
cash: STARTING_CASH,
turn: 1,
timeLeft: TURN_SECONDS,
shutdownTimeLeft: 0,
shutdownGraceSeconds: FARM_SHUTDOWN_GRACE_SECONDS,
lastTimestamp: 0,
nextId: 10,
buildTool: null,
@ -117,8 +129,8 @@ 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: 6 }, 'left'),
trash: facilityBodyForEntry('trash', { col: 16, row: 12 }, 'bottom'),
mixer: facilityBodyForEntry('mixer', { col: 0, row: 4 }, 'left'),
trash: facilityBodyForEntry('trash', { col: 10, row: 12 }, 'bottom'),
truck: facilityBodyForEntry('truck', { col: 21, row: 7 }, 'right')
};
}
@ -127,17 +139,18 @@ export function resetLayout(game) {
game.conveyorTiles.clear();
game.conveyorMeta.clear();
const initial = [
// Egg Farm -> S1 top input. The approach lane is long enough to read the flow.
[4, 1], [4, 2], [4, 3], [4, 4], [4, 5],
// Egg Farm -> S1 top input. Shorter starter approach lane.
[4, 1], [4, 2], [4, 3],
// S1 left output -> Mixer receiver on the left grid edge.
[3, 6], [2, 6], [1, 6], [0, 6],
// S1 right output -> S2 top input. This avoids touching S2's waste output lane.
[5, 6], [6, 6], [7, 6], [8, 6], [9, 6], [10, 6], [11, 6], [12, 6], [13, 6], [14, 6],
[14, 5], [15, 5], [16, 5], [17, 5], [17, 6],
[3, 4], [2, 4], [1, 4], [0, 4],
// S1 right output -> S2 top input.
[5, 4], [6, 4], [7, 4], [8, 4], [9, 4],
[9, 5], [10, 5], [11, 5], [11, 6],
// S2 left output -> Waste Shredder receiver on bottom grid edge.
[16, 7], [16, 8], [16, 9], [16, 10], [16, 11], [16, 12],
[10, 7], [10, 8], [10, 9], [10, 10], [10, 11], [10, 12],
// S2 right output -> Truck receiver on the right grid edge.
[18, 7], [19, 7], [20, 7], [21, 7]
// 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) {
const k = `${col},${row}`;
game.conveyorTiles.add(k);
@ -145,8 +158,8 @@ export function resetLayout(game) {
}
game.facilities = defaultFacilities();
game.scanners = [
{ type: 'scanner', id: 1, kind: 'manual', slot: 0, role: 0, col: 4, row: 6, level: 1, queue: [], cooldown: 0, price: BUILD_COSTS.manualScanner, builtSession: null, autoMode: 'standard' },
{ type: 'scanner', id: 2, kind: 'manual', slot: 1, role: 1, col: 17, 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: 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' }
];
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);