Formatting, exports

This commit is contained in:
Aslan 2025-11-22 12:03:35 -05:00
parent e09210f3e0
commit 0a4e8c9014
14 changed files with 66 additions and 34 deletions

View file

@ -12,4 +12,12 @@ router.get("/player", (req: Request, res: Response) => {
res.json(state.player); res.json(state.player);
}); });
router.get("/car", (req: Request, res: Response) => {
res.json(state.car);
});
router.get("/home", (req: Request, res: Response) => {
res.json(state.home);
});
export default router; export default router;

View file

@ -1,10 +1,12 @@
import type { AllInventories } from "../../helpers.js";
interface MoveParams { interface MoveParams {
id: number; id: number;
} }
interface MoveRequest { interface MoveRequest {
source: "player" | "car" | "home"; source: AllInventories;
destination: "player" | "car" | "home" | "workbench"; destination: AllInventories;
} }
export { type MoveParams, type MoveRequest }; export { type MoveParams, type MoveRequest };

View file

@ -7,6 +7,24 @@ import config from "../../config.json" with { type: "json" };
const router = Router(); const router = Router();
router.get("/stop", (req: Request, res: Response) => {
writeFile(config.savepath, JSON.stringify(game.state), "utf8", (err) => {
if (err) {
res.json({
message: "error",
error: err.message,
});
return;
}
res.json({
message: "ok",
});
process.exit(0);
});
});
router.get("/load", (req: Request, res: Response) => { router.get("/load", (req: Request, res: Response) => {
readFile(config.savepath, "utf8", (err, data) => { readFile(config.savepath, "utf8", (err, data) => {
if (err) { if (err) {
@ -41,22 +59,4 @@ router.get("/save", (req: Request, res: Response) => {
}); });
}); });
router.get("/stop", (req: Request, res: Response) => {
writeFile(config.savepath, JSON.stringify(game.state), "utf8", (err) => {
if (err) {
res.json({
message: "error",
error: err.message,
});
return;
}
res.json({
message: "ok",
});
process.exit(0);
});
});
export default router; export default router;

View file

@ -12,6 +12,10 @@ import {
const router = Router(); const router = Router();
router.get("/", (req: Request, res: Response) => {
res.json(state.home.workbench);
});
router.get("/devices", (req: Request, res: Response) => { router.get("/devices", (req: Request, res: Response) => {
res.json(state.home.workbench.devices); res.json(state.home.workbench.devices);
}); });

View file

@ -3,7 +3,6 @@ import {
GetItemContainerOfType, GetItemContainerOfType,
GetItemOfType, GetItemOfType,
GetItemsAsInventory, GetItemsAsInventory,
GetItemsOfType,
GetWorkbenchAsInventory, GetWorkbenchAsInventory,
} from "../../helpers.js"; } from "../../helpers.js";
import { ItemType, type ICase, type IMotherboard } from "../../state/item.js"; import { ItemType, type ICase, type IMotherboard } from "../../state/item.js";

View file

@ -1,4 +1,4 @@
export enum Company { enum Company {
Intel, Intel,
AMD, AMD,
Nvidia, Nvidia,
@ -55,3 +55,5 @@ export enum Company {
Fairphone, Fairphone,
Razer, Razer,
} }
export { Company };

View file

@ -1,4 +1,4 @@
export enum ConnectorType { enum ConnectorType {
USB1, USB1,
USB2, USB2,
USB3, USB3,
@ -27,3 +27,5 @@ export enum ConnectorType {
PCIE8, PCIE8,
PCIE9, PCIE9,
} }
export { ConnectorType };

View file

@ -1,4 +1,4 @@
export enum CPUArchitecture { enum CPUArchitecture {
M_6502, M_6502,
M_6800, M_6800,
M_6809, M_6809,
@ -19,14 +19,16 @@ export enum CPUArchitecture {
LoongArch, LoongArch,
} }
export enum CPUFeatures { enum CPUFeatures {
AVX, AVX,
AVX2, AVX2,
AVX512, AVX512,
} }
export enum SocketType { enum SocketType {
INTEL_LGA_1155, INTEL_LGA_1155,
INTEL_LGA_1156, INTEL_LGA_1156,
INTEL_LGA_2011, INTEL_LGA_2011,
} }
export { CPUArchitecture, CPUFeatures, SocketType };

View file

@ -1,4 +1,4 @@
export enum GPUArchitecture { enum GPUArchitecture {
Fahrenheit, Fahrenheit,
Celsius, Celsius,
Kelvin, Kelvin,
@ -35,3 +35,5 @@ export enum GPUArchitecture {
CDNA3, CDNA3,
UDNA, UDNA,
} }
export { GPUArchitecture };

View file

@ -5,7 +5,7 @@ import type { MemoryType } from "./memory.js";
import type { DiscType, DiskType, IStorage } from "./storage.js"; import type { DiscType, DiskType, IStorage } from "./storage.js";
import type { INet } from "./types.js"; import type { INet } from "./types.js";
export enum ItemType { enum ItemType {
SCREWDRIVER, SCREWDRIVER,
CPU, CPU,
GRAPHIC_CARD, GRAPHIC_CARD,
@ -41,7 +41,7 @@ export enum ItemType {
SECURITY_KEY, SECURITY_KEY,
} }
export enum FormFactorType { enum FormFactorType {
M_ATX, M_ATX,
ATX, ATX,
E_ATX, E_ATX,
@ -196,6 +196,8 @@ interface IModem extends IItem {
} }
export { export {
ItemType,
FormFactorType,
type IItem, type IItem,
type IConnectedDevice, type IConnectedDevice,
type IScrewdriver, type IScrewdriver,

View file

@ -1,4 +1,7 @@
export enum Location { enum Location {
PLAYER_HOME, PLAYER_HOME,
PLAYER_CAR,
LOCAL_STORE, LOCAL_STORE,
} }
export { Location };

View file

@ -1,4 +1,4 @@
export enum MemoryType { enum MemoryType {
DDR, DDR,
LPDDR, LPDDR,
LPDDRX, LPDDRX,
@ -49,3 +49,5 @@ export enum MemoryType {
HBM3, HBM3,
HBM4, HBM4,
} }
export { MemoryType };

View file

@ -1,4 +1,6 @@
export enum MotherboardFeatures { enum MotherboardFeatures {
BIOS, BIOS,
UEFI, UEFI,
} }
export { MotherboardFeatures };

View file

@ -1,11 +1,13 @@
export enum SoftwareType { enum SoftwareType {
OS, OS,
} }
export interface ISoftware { interface ISoftware {
type: SoftwareType; type: SoftwareType;
name: string; name: string;
cpuUsage: number; cpuUsage: number;
memoryUsage: number; memoryUsage: number;
storageUsage: number; storageUsage: number;
} }
export { SoftwareType, type ISoftware };