Maintenance: distance wear, broken-state burn ×1.5, repair action (ISS-069, v0.39.0)
CI / build + unit + e2e (pull_request) Successful in 9m34s
CI / build + unit + e2e (pull_request) Successful in 9m34s
This commit is contained in:
+11
-1
@@ -31,7 +31,9 @@ CREATE TABLE IF NOT EXISTS planes (
|
||||
lat REAL NOT NULL,
|
||||
lon REAL NOT NULL,
|
||||
departure_sim_time INTEGER,
|
||||
queue TEXT NOT NULL DEFAULT '[]'
|
||||
queue TEXT NOT NULL DEFAULT '[]',
|
||||
health REAL NOT NULL DEFAULT 100,
|
||||
repair_until_sim_time INTEGER
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS packages (
|
||||
id TEXT PRIMARY KEY NOT NULL,
|
||||
@@ -88,6 +90,14 @@ function migrateColumns(raw: RawSqlJsDatabase): void {
|
||||
if (!cols('packages').has('special')) {
|
||||
raw.exec('ALTER TABLE packages ADD COLUMN special TEXT');
|
||||
}
|
||||
// v0.39.0 (ISS-069): plane health — pre-existing rows backfill to full health.
|
||||
if (!cols('planes').has('health')) {
|
||||
raw.exec('ALTER TABLE planes ADD COLUMN health REAL NOT NULL DEFAULT 100');
|
||||
}
|
||||
// v0.39.0 (ISS-069): repair gate — nullable, no default; pre-existing rows stay NULL = not in repair.
|
||||
if (!cols('planes').has('repair_until_sim_time')) {
|
||||
raw.exec('ALTER TABLE planes ADD COLUMN repair_until_sim_time INTEGER');
|
||||
}
|
||||
// v0.30.0 (ISS-057): last-selected speed — pre-existing rows backfill to the row's OWN
|
||||
// current time_scale so a legacy DB resumes at the speed it was running, not the default.
|
||||
if (!cols('sim_state').has('last_selected_time_scale')) {
|
||||
|
||||
+9
-1
@@ -7,7 +7,9 @@ import { integer, real, sqliteTable, text } from 'drizzle-orm/sqlite-core';
|
||||
export const planes = sqliteTable('planes', {
|
||||
id: text('id').primaryKey().notNull(),
|
||||
model: text('model').notNull(),
|
||||
status: text('status', { enum: ['available', 'flying'] }).notNull(),
|
||||
// v0.39.0 (ISS-069): 'repairing' = grounded in the shop until repairUntilSimTime passes; the
|
||||
// engine flips it back to 'available' on a tick. All status guards key off 'available'.
|
||||
status: text('status', { enum: ['available', 'flying', 'repairing'] }).notNull(),
|
||||
fuel: real('fuel').notNull(),
|
||||
maxFuel: real('max_fuel').notNull(),
|
||||
locationIcao: text('location_icao').notNull(),
|
||||
@@ -24,6 +26,12 @@ export const planes = sqliteTable('planes', {
|
||||
// of ICAO strings ('[]' when empty). The ACTIVE leg stays destIcao +
|
||||
// departureSimTime; on landing the engine auto-chains queue[0] if fuel covers it.
|
||||
queue: text('queue').notNull().default('[]'),
|
||||
// Structural health in [0, 100] (v0.39.0, ISS-069) — wears down by WEAR_PER_KM per km of
|
||||
// landed legs; at 0 the plane is broken and burns BROKEN_BURN_MULTIPLIER × more fuel.
|
||||
health: real('health').notNull().default(100),
|
||||
// Sim-clock epoch ms when an active repair finishes (v0.39.0, ISS-069) — set with status
|
||||
// 'repairing', cleared by the engine's flip-back pass; NULL = not in repair.
|
||||
repairUntilSimTime: integer('repair_until_sim_time'),
|
||||
});
|
||||
|
||||
// Cargo packages (v0.12.0) replace the old contracts table end-to-end: a package
|
||||
|
||||
Reference in New Issue
Block a user