From d1e37d8fec86adb3d4f80bef7fe36ef91fd8c567 Mon Sep 17 00:00:00 2001 From: Oliver Akins Date: Mon, 7 Mar 2022 23:35:56 -0600 Subject: [PATCH] Add ship design constants in the shared module --- common/src/data/colours.ts | 17 +++++++++++++++++ common/src/data/spaceships.ts | 22 ++++++++++++++++++++++ common/src/index.ts | 4 ++++ 3 files changed, 43 insertions(+) create mode 100644 common/src/data/colours.ts create mode 100644 common/src/data/spaceships.ts diff --git a/common/src/data/colours.ts b/common/src/data/colours.ts new file mode 100644 index 0000000..9cd33c8 --- /dev/null +++ b/common/src/data/colours.ts @@ -0,0 +1,17 @@ +import { IColour } from "../types/Colour"; + +/** + * The colours that can be used by the user to make their ship unique. Each + * player is assigned a random, unused, colour when they join the lobby. + */ +export const colours: IColour[] = [ + { name: "Green", hex: "#00aa00" }, + { name: "Blue", hex: "#0077b6" }, + { name: "Red", hex: "#cb0b0a" }, + { name: "Purple", hex: "#7400b8" }, + { name: "Orange", hex: "#faa307" }, + { name: "Light Green", hex: "#9ef01a" }, + { name: "Magenta", hex: "#b7094c" }, + { name: "Pink", hex: "#f72585" }, + { name: "Yellow", hex: "#f9c80e" }, +]; \ No newline at end of file diff --git a/common/src/data/spaceships.ts b/common/src/data/spaceships.ts new file mode 100644 index 0000000..07e0c81 --- /dev/null +++ b/common/src/data/spaceships.ts @@ -0,0 +1,22 @@ +import { ISpaceship } from "../types/Spaceship"; + +/** + * The spaceships that are supported in the system, the "id" property **must** + * exist in the spaceship.svelte file as an icon, otherwise the "space-shuttle" + * icon will be used. The first icon in this list will be used by the server to + * assign new players' ship icon. + */ +export const spaceships: ISpaceship[] = [ + { + name: "Space Shuttle", + id: "space-shuttle" + }, + { + name: "Rocket", + id: "rocket" + }, + { + name: "Sailboat", + id: "sailboat" + }, +]; \ No newline at end of file diff --git a/common/src/index.ts b/common/src/index.ts index 25b9573..b30d2cf 100644 --- a/common/src/index.ts +++ b/common/src/index.ts @@ -4,6 +4,10 @@ // Algorithms export * from "./algorithms/movementDirection"; +// Data + export * from "./data/colours"; + export * from "./data/spaceships"; + // Data Structures export * from "./types/Colour"; export * from "./types/Spaceship";