diff --git a/src/payload-generated-schema.ts b/src/payload-generated-schema.ts index c63914c1..7ca47b32 100644 --- a/src/payload-generated-schema.ts +++ b/src/payload-generated-schema.ts @@ -59,6 +59,10 @@ export const enum_game_structures_construction_status = pgEnum( "enum_game_structures_construction_status", ["awaiting_materials", "building", "complete"], ); +export const enum_game_structures_storage_access_mode = pgEnum( + "enum_game_structures_storage_access_mode", + ["anyone", "roles", "users"], +); export const enum_game_vehicles_status = pgEnum("enum_game_vehicles_status", [ "idle", "assigned", @@ -1413,6 +1417,65 @@ export const game_structures_void_storage = pgTable( ], ); +export const game_structures_stored_assets_equipment_attachments = pgTable( + "game_structures_stored_assets_equipment_attachments", + { + _order: integer("_order").notNull(), + _parentID: varchar("_parent_id").notNull(), + id: varchar("id").primaryKey(), + asset: integer("asset_id") + .notNull() + .references(() => assets.id, { + onDelete: "set null", + }), + }, + (columns) => [ + index("game_structures_stored_assets_equipment_attachments_order_idx").on(columns._order), + index("game_structures_stored_assets_equipment_attachments_parent_id_idx").on( + columns._parentID, + ), + index("game_structures_stored_assets_equipment_attachments_asse_idx").on(columns.asset), + foreignKey({ + columns: [columns["_parentID"]], + foreignColumns: [game_structures_stored_assets.id], + name: "game_structures_stored_assets_equipment_attachments_parent_id_fk", + }).onDelete("cascade"), + ], +); + +export const game_structures_stored_assets = pgTable( + "game_structures_stored_assets", + { + _order: integer("_order").notNull(), + _parentID: integer("_parent_id").notNull(), + id: varchar("id").primaryKey(), + asset: integer("asset_id") + .notNull() + .references(() => assets.id, { + onDelete: "set null", + }), + quantity: numeric("quantity", { mode: "number" }).notNull().default(1), + gridX: numeric("grid_x", { mode: "number" }).notNull().default(0), + gridY: numeric("grid_y", { mode: "number" }).notNull().default(0), + rotated: boolean("rotated").default(false), + equipment_skin: integer("equipment_skin_id").references(() => assets.id, { + onDelete: "set null", + }), + equipment_customName: varchar("equipment_custom_name"), + }, + (columns) => [ + index("game_structures_stored_assets_order_idx").on(columns._order), + index("game_structures_stored_assets_parent_id_idx").on(columns._parentID), + index("game_structures_stored_assets_asset_idx").on(columns.asset), + index("game_structures_stored_assets_equipment_equipment_skin_idx").on(columns.equipment_skin), + foreignKey({ + columns: [columns["_parentID"]], + foreignColumns: [game_structures.id], + name: "game_structures_stored_assets_parent_id_fk", + }).onDelete("cascade"), + ], +); + export const game_structures = pgTable( "game_structures", { @@ -1458,6 +1521,10 @@ export const game_structures = pgTable( onDelete: "set null", }, ), + storageSlug: varchar("storage_slug"), + storageAccess_mode: + enum_game_structures_storage_access_mode("storage_access_mode").default("anyone"), + storedAssetCount: numeric("stored_asset_count", { mode: "number" }), updatedAt: timestamp("updated_at", { mode: "string", withTimezone: true, precision: 3 }) .defaultNow() .notNull(), @@ -1470,11 +1537,46 @@ export const game_structures = pgTable( index("game_structures_faction_idx").on(columns.faction), index("game_structures_map_idx").on(columns.map), index("game_structures_parent_structure_idx").on(columns.parentStructure), + uniqueIndex("game_structures_storage_slug_idx").on(columns.storageSlug), index("game_structures_updated_at_idx").on(columns.updatedAt), index("game_structures_created_at_idx").on(columns.createdAt), ], ); +export const game_structures_rels = pgTable( + "game_structures_rels", + { + id: serial("id").primaryKey(), + order: integer("order"), + parent: integer("parent_id").notNull(), + path: varchar("path").notNull(), + rolesID: integer("roles_id"), + usersID: integer("users_id"), + }, + (columns) => [ + index("game_structures_rels_order_idx").on(columns.order), + index("game_structures_rels_parent_idx").on(columns.parent), + index("game_structures_rels_path_idx").on(columns.path), + index("game_structures_rels_roles_id_idx").on(columns.rolesID), + index("game_structures_rels_users_id_idx").on(columns.usersID), + foreignKey({ + columns: [columns["parent"]], + foreignColumns: [game_structures.id], + name: "game_structures_rels_parent_fk", + }).onDelete("cascade"), + foreignKey({ + columns: [columns["rolesID"]], + foreignColumns: [roles.id], + name: "game_structures_rels_roles_fk", + }).onDelete("cascade"), + foreignKey({ + columns: [columns["usersID"]], + foreignColumns: [users.id], + name: "game_structures_rels_users_fk", + }).onDelete("cascade"), + ], +); + export const game_vehicles_stored_resources = pgTable( "game_vehicles_stored_resources", { @@ -1571,6 +1673,9 @@ export const game_npcs = pgTable( { id: serial("id").primaryKey(), name: varchar("name").notNull(), + image: integer("image_id").references(() => media.id, { + onDelete: "set null", + }), occupation: varchar("occupation"), location: integer("location_id").references(() => game_structures.id, { onDelete: "set null", @@ -1578,7 +1683,7 @@ export const game_npcs = pgTable( faction: integer("faction_id").references(() => factions.id, { onDelete: "set null", }), - bio: varchar("bio"), + bio: jsonb("bio"), isGenerated: boolean("is_generated").default(false), isInGame: boolean("is_in_game").default(true), vendor_enabled: boolean("vendor_enabled").default(false), @@ -1591,6 +1696,7 @@ export const game_npcs = pgTable( .notNull(), }, (columns) => [ + index("game_npcs_image_idx").on(columns.image), index("game_npcs_location_idx").on(columns.location), index("game_npcs_faction_idx").on(columns.faction), index("game_npcs_updated_at_idx").on(columns.updatedAt), @@ -5498,6 +5604,14 @@ export const maps = pgTable( defaultCenterX: numeric("default_center_x", { mode: "number" }), defaultCenterY: numeric("default_center_y", { mode: "number" }), defaultZoom: numeric("default_zoom", { mode: "number" }).default(2), + gridEnabled: boolean("grid_enabled").default(false), + gridOriginEasting: numeric("grid_origin_easting", { mode: "number" }).default(0), + gridOriginNorthing: numeric("grid_origin_northing", { mode: "number" }).default(0), + gridStartEasting: numeric("grid_start_easting", { mode: "number" }).default(0), + gridStartNorthing: numeric("grid_start_northing", { mode: "number" }).default(0), + gridSpacingMeters: numeric("grid_spacing_meters", { mode: "number" }).default(1000), + gridLabelDigits: numeric("grid_label_digits", { mode: "number" }).default(2), + gridNumbersOverLines: boolean("grid_numbers_over_lines").default(false), updatedAt: timestamp("updated_at", { mode: "string", withTimezone: true, precision: 3 }) .defaultNow() .notNull(), @@ -8365,6 +8479,61 @@ export const relations_game_structures_void_storage = relations( }), }), ); +export const relations_game_structures_stored_assets_equipment_attachments = relations( + game_structures_stored_assets_equipment_attachments, + ({ one }) => ({ + _parentID: one(game_structures_stored_assets, { + fields: [game_structures_stored_assets_equipment_attachments._parentID], + references: [game_structures_stored_assets.id], + relationName: "equipment_attachments", + }), + asset: one(assets, { + fields: [game_structures_stored_assets_equipment_attachments.asset], + references: [assets.id], + relationName: "asset", + }), + }), +); +export const relations_game_structures_stored_assets = relations( + game_structures_stored_assets, + ({ one, many }) => ({ + _parentID: one(game_structures, { + fields: [game_structures_stored_assets._parentID], + references: [game_structures.id], + relationName: "storedAssets", + }), + asset: one(assets, { + fields: [game_structures_stored_assets.asset], + references: [assets.id], + relationName: "asset", + }), + equipment_attachments: many(game_structures_stored_assets_equipment_attachments, { + relationName: "equipment_attachments", + }), + equipment_skin: one(assets, { + fields: [game_structures_stored_assets.equipment_skin], + references: [assets.id], + relationName: "equipment_skin", + }), + }), +); +export const relations_game_structures_rels = relations(game_structures_rels, ({ one }) => ({ + parent: one(game_structures, { + fields: [game_structures_rels.parent], + references: [game_structures.id], + relationName: "_rels", + }), + rolesID: one(roles, { + fields: [game_structures_rels.rolesID], + references: [roles.id], + relationName: "roles", + }), + usersID: one(users, { + fields: [game_structures_rels.usersID], + references: [users.id], + relationName: "users", + }), +})); export const relations_game_structures = relations(game_structures, ({ one, many }) => ({ type: one(structures, { fields: [game_structures.type], @@ -8407,6 +8576,12 @@ export const relations_game_structures = relations(game_structures, ({ one, many voidStorage: many(game_structures_void_storage, { relationName: "voidStorage", }), + storedAssets: many(game_structures_stored_assets, { + relationName: "storedAssets", + }), + _rels: many(game_structures_rels, { + relationName: "_rels", + }), })); export const relations_game_vehicles_stored_resources = relations( game_vehicles_stored_resources, @@ -8474,6 +8649,11 @@ export const relations_game_npcs_rels = relations(game_npcs_rels, ({ one }) => ( }), })); export const relations_game_npcs = relations(game_npcs, ({ one, many }) => ({ + image: one(media, { + fields: [game_npcs.image], + references: [media.id], + relationName: "image", + }), location: one(game_structures, { fields: [game_npcs.location], references: [game_structures.id], @@ -11246,6 +11426,7 @@ type DatabaseSchema = { enum_announcements_paths_match_type: typeof enum_announcements_paths_match_type; enum_game_structures_staff_positions_position_type: typeof enum_game_structures_staff_positions_position_type; enum_game_structures_construction_status: typeof enum_game_structures_construction_status; + enum_game_structures_storage_access_mode: typeof enum_game_structures_storage_access_mode; enum_game_vehicles_status: typeof enum_game_vehicles_status; enum_npc_staffing_position_type: typeof enum_npc_staffing_position_type; enum_npc_staffing_status: typeof enum_npc_staffing_status; @@ -11373,7 +11554,10 @@ type DatabaseSchema = { game_structures_installed_modules: typeof game_structures_installed_modules; game_structures_stored_resources: typeof game_structures_stored_resources; game_structures_void_storage: typeof game_structures_void_storage; + game_structures_stored_assets_equipment_attachments: typeof game_structures_stored_assets_equipment_attachments; + game_structures_stored_assets: typeof game_structures_stored_assets; game_structures: typeof game_structures; + game_structures_rels: typeof game_structures_rels; game_vehicles_stored_resources: typeof game_vehicles_stored_resources; game_vehicles_void_storage: typeof game_vehicles_void_storage; game_vehicles: typeof game_vehicles; @@ -11566,6 +11750,9 @@ type DatabaseSchema = { relations_game_structures_installed_modules: typeof relations_game_structures_installed_modules; relations_game_structures_stored_resources: typeof relations_game_structures_stored_resources; relations_game_structures_void_storage: typeof relations_game_structures_void_storage; + relations_game_structures_stored_assets_equipment_attachments: typeof relations_game_structures_stored_assets_equipment_attachments; + relations_game_structures_stored_assets: typeof relations_game_structures_stored_assets; + relations_game_structures_rels: typeof relations_game_structures_rels; relations_game_structures: typeof relations_game_structures; relations_game_vehicles_stored_resources: typeof relations_game_vehicles_stored_resources; relations_game_vehicles_void_storage: typeof relations_game_vehicles_void_storage; diff --git a/src/payload-types.ts b/src/payload-types.ts index 484ac287..d47c35da 100644 --- a/src/payload-types.ts +++ b/src/payload-types.ts @@ -1113,6 +1113,63 @@ export interface GameStructure { id?: string | null; }[] | null; + /** + * Slug identifying this structure's item storage to the game bridge (e.g. 'superstructure'). The in-game arsenal module binds to structure:. Empty = no item storage. + */ + storageSlug?: string | null; + /** + * Who can see and edit this structure's item storage in the member UI. Bridge (game) sync is unaffected by these rules. + */ + storageAccess?: { + mode?: ('anyone' | 'roles' | 'users') | null; + /** + * Members holding any of these roles (Role Assignments) can access the storage. + */ + roles?: (number | Role)[] | null; + /** + * Only these members can access the storage. + */ + users?: (number | User)[] | null; + }; + /** + * Arma item storage (limited-arsenal stock). Synced with the game via locker.sync / locker.apply; grid position and equipment are managed from the member UI and preserved by sync merges. + */ + storedAssets?: + | { + asset: number | Asset; + quantity: number; + /** + * Column position in the storage grid (0-indexed). + */ + gridX: number; + /** + * Row position in the storage grid (0-indexed). + */ + gridY: number; + /** + * Whether this item is rotated 90 degrees (swaps width and height). + */ + rotated?: boolean | null; + /** + * Per-instance customization for this item: installed attachments, applied skin, and a custom name. Managed from the member storage UI. + */ + equipment?: { + attachments?: + | { + asset: number | Asset; + id?: string | null; + }[] + | null; + skin?: (number | null) | Asset; + customName?: string | null; + }; + id?: string | null; + }[] + | null; + /** + * Total number of distinct entries currently in item storage. + */ + storedAssetCount?: number | null; updatedAt: string; createdAt: string; } @@ -2205,6 +2262,38 @@ export interface Map { */ defaultCenterY?: number | null; defaultZoom?: number | null; + /** + * Show a coordinate grid on the world map and mission planning maps, and use it for grid reference readouts. + */ + gridEnabled?: boolean | null; + /** + * Meters from the west edge (in-game X) to the grid's zero line. Vanilla terrains use 0 (zero line on the west edge). + */ + gridOriginEasting?: number | null; + /** + * Meters from the south edge (in-game Y) to the grid's zero line. Vanilla terrains use 0 (zero line on the south edge). + */ + gridOriginNorthing?: number | null; + /** + * Number shown on the first easting line (at the origin). Applies at the base spacing and finer subdivisions. + */ + gridStartEasting?: number | null; + /** + * Number shown on the first northing line (at the origin). Applies at the base spacing and finer subdivisions. + */ + gridStartNorthing?: number | null; + /** + * Base grid cell size in meters. The map subdivides 10x automatically as you zoom in, like the in-game map. + */ + gridSpacingMeters?: number | null; + /** + * Digits shown per axis at the base spacing (Arma shows 2 at 1 km, 3 at 100 m). Numbers wrap at the digit width. + */ + gridLabelDigits?: number | null; + /** + * Draw labels on the grid lines instead of centered in the cells (Tanoa style). + */ + gridNumbersOverLines?: boolean | null; updatedAt: string; createdAt: string; } @@ -2275,6 +2364,10 @@ export interface GameNpc { * The NPC's name as shown in-game and on the frontend. */ name: string; + /** + * Portrait/photo for this contact. Shown on the contacts directory and profile when set. + */ + image?: (number | null) | Media; /** * What this NPC does (e.g. 'Weapons Dealer', 'Field Medic'). */ @@ -2290,7 +2383,21 @@ export interface GameNpc { /** * A short background/profile for this NPC. */ - bio?: string | null; + bio?: { + root: { + type: string; + children: { + type: any; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; /** * True for NPCs auto-created by the market tick to cover unstocked goods. They are placeholders until included in the game. */ @@ -7426,6 +7533,37 @@ export interface GameStructuresSelect { rotated?: T; id?: T; }; + storageSlug?: T; + storageAccess?: + | T + | { + mode?: T; + roles?: T; + users?: T; + }; + storedAssets?: + | T + | { + asset?: T; + quantity?: T; + gridX?: T; + gridY?: T; + rotated?: T; + equipment?: + | T + | { + attachments?: + | T + | { + asset?: T; + id?: T; + }; + skin?: T; + customName?: T; + }; + id?: T; + }; + storedAssetCount?: T; updatedAt?: T; createdAt?: T; } @@ -7470,6 +7608,7 @@ export interface GameVehiclesSelect { */ export interface GameNpcsSelect { name?: T; + image?: T; occupation?: T; location?: T; faction?: T; @@ -9023,6 +9162,14 @@ export interface MapsSelect { defaultCenterX?: T; defaultCenterY?: T; defaultZoom?: T; + gridEnabled?: T; + gridOriginEasting?: T; + gridOriginNorthing?: T; + gridStartEasting?: T; + gridStartNorthing?: T; + gridSpacingMeters?: T; + gridLabelDigits?: T; + gridNumbersOverLines?: T; updatedAt?: T; createdAt?: T; }