1
0
Fork 0
polaris-task-force/src/collections/game/GameRules.ts
Z8MB1E 6bc295b630 feat(interior): station recipes unlock gating and flagged asset outputs
Produce starts now honor presence-based unlocks_recipe/unlocks_station effects (station marker is its authored name) and reject unknown or gated recipes with recipe_locked, locked stations with station_locked. Asset outputs credit game-structures.storedAssets behind a new Game Rules interior.assetOutputsEnabled switch (default off), prechecked before any deposit so a disabled switch parks the job untouched; storageBridge.depositAssetsToStructure merges quantities by asset without duplicate rows.
2026-10-20 16:01:35 -04:00

343 lines
10 KiB
TypeScript

import { GlobalConfig } from "payload";
import { requirePermission } from "@/utils/access-control/hasPermission";
export const GameRules: GlobalConfig = {
slug: "game-rules",
access: {
read: requirePermission("game-rules:read"),
update: requirePermission("game-rules:update"),
},
fields: [
{
name: "mainCurrency",
type: "relationship",
relationTo: "resources",
required: true,
admin: {
description:
'The base currency ("gold standard") used by all factions to pay for goods and services.',
},
},
{
label: "Universal Currency",
type: "collapsible",
admin: {
initCollapsed: true,
description:
"Display names used throughout the app. These do not change the accounting resource selected above.",
},
fields: [
{
name: "currencyName",
type: "text",
admin: {
description:
'General display name for the currency, e.g. "credit". Used when singular or plural names are not set.',
},
},
{
name: "currencySymbol",
type: "upload",
relationTo: "media",
admin: {
description:
"Optional emblem shown inline before amounts. It renders scaled to the surrounding text height (unlike a text symbol).",
},
},
{
name: "currencySingular",
type: "text",
admin: {
description: 'Singular amount label, e.g. "credit".',
},
},
{
name: "currencyPlural",
type: "text",
admin: {
description: 'Plural amount label, e.g. "credits".',
},
},
{
name: "currencyDenomination",
type: "text",
admin: {
description:
'Optional subunit name for future fractional displays, e.g. "cent". This does not affect stored values.',
},
},
],
},
{
name: "commandAssignments",
type: "relationship",
relationTo: "assignments",
hasMany: true,
admin: {
description:
"Assignment(s) considered unit command. Members and leaders of these assignments get elevated access to draft missions and other restricted content.",
},
},
{
name: "intelAssignments",
type: "relationship",
relationTo: "assignments",
hasMany: true,
admin: {
description:
"Assignment(s) considered the intelligence division. Members and leaders of these assignments get elevated access to draft missions and intelligence content.",
},
},
{
name: "infantryAssignment",
type: "relationship",
relationTo: "assignments",
hasMany: false,
admin: {
description:
"Assignment that members are moved to when a division leader removes them from their division (the default destination for leadership-initiated transfers).",
},
},
{
name: "proximityThreshold",
type: "number",
defaultValue: 1000,
admin: {
description:
"Distance threshold in real meters for instant transfers. Structures within this distance can transfer resources instantly. Beyond this, shipments are required.",
},
},
{
name: "gameTickIntervalMinutes",
type: "number",
defaultValue: 10,
admin: {
description:
"How often the game tick runs, in minutes. This processes shipment movement, fuel consumption, and arrivals.",
},
},
{
name: "lockerGridWidth",
type: "number",
defaultValue: 10,
min: 4,
admin: {
description:
"Width of each member's personal locker grid, in cells. Applies to newly provisioned lockers.",
},
},
{
name: "lockerGridHeight",
type: "number",
defaultValue: 6,
min: 4,
admin: {
description:
"Height of each member's personal locker grid, in cells. Applies to newly provisioned lockers.",
},
},
{
name: "staffHiringEnabled",
type: "checkbox",
defaultValue: false,
admin: {
description:
"When off, logistics officers cannot hire staff anywhere (both labor crews and named NPC staff). Back-office labor headcount edits in the admin panel are not affected.",
},
},
{
name: "staffHiringDisabledMessage",
type: "text",
admin: {
description:
"Message shown to logistics officers when hiring is disabled, e.g. explaining the in-universe reason.",
},
},
{
name: "economy",
type: "group",
label: "Market Economy",
admin: {
description:
"Global knobs for the supply-and-demand market simulation run by the economy tick (docs/economy/supply-demand-design.md).",
},
fields: [
{
name: "enabled",
type: "checkbox",
defaultValue: false,
admin: {
description:
"Master gate for the market economy simulation. When off, the economy tick leaves all prices at their resting values.",
},
},
{
name: "defaultPriceBand",
type: "number",
min: 0,
max: 1,
defaultValue: 0.5,
admin: {
description:
"Default price band as a fraction of base price (e.g. 0.5 = price can move ±50%). Used when an item does not set its own band.",
},
},
{
name: "realDemandWindowTicks",
type: "number",
min: 1,
defaultValue: 24,
admin: {
description:
"How many economy ticks of completed-purchase history feed the real-demand signal.",
},
},
{
name: "realDemandDecay",
type: "number",
min: 0,
max: 1,
defaultValue: 0.5,
admin: {
description:
"Fraction of accumulated real demand that survives each tick (0.5 halves it every tick).",
},
},
{
name: "artificialDemandDrift",
type: "number",
min: 0,
max: 1,
defaultValue: 0.05,
admin: {
description:
"How far the NPC (artificial) demand random walk may move per tick, as a fraction of the GM baseline.",
},
},
{
name: "coldStartObservations",
type: "number",
min: 0,
defaultValue: 5,
admin: {
description:
"Completed purchases needed before an item's price starts moving. Until then items stay at their resting price (modifier 1).",
},
},
{
name: "tickIntervalHintMinutes",
type: "number",
min: 1,
defaultValue: 60,
admin: {
description:
"Suggested economy tick cadence in minutes, for cron documentation only. The tick itself is triggered externally.",
},
},
],
},
{
name: "research",
type: "group",
label: "Technology Research",
admin: {
description:
"Global knobs for the member-facing tech research engine run by the tech tick (ballots, facility speed, researcher bonus).",
},
fields: [
{
name: "enabled",
type: "checkbox",
defaultValue: false,
admin: {
description:
"Master gate for the research engine. When off, the tech tick does nothing: no ballots open, no research progresses.",
},
},
{
name: "ballotDurationTicks",
type: "number",
min: 1,
defaultValue: 288,
admin: {
description:
"How long a research ballot stays open, in game ticks (default 288 ticks = 48h at a 10-minute tick).",
},
},
{
name: "researcherSpeedPerHead",
type: "number",
min: 0,
defaultValue: 0.0001,
admin: {
description:
"Research time reduction each researcher adds, as a fraction (0.0001 = 0.01% faster per head). Researchers are active labor staff in the 'researcher' labor classification at operational research facilities.",
},
},
],
},
{
name: "interior",
type: "group",
label: "Superstructure Interior",
admin: {
description: "Global knobs for the Superstructure interior system (interior-tick).",
},
fields: [
{
name: "decayEnabled",
type: "checkbox",
defaultValue: false,
admin: {
description:
"Master gate for interior condition/junk decay. When off, the interior-tick skips decay.",
},
},
{
name: "decayMultiplier",
type: "number",
min: 0,
defaultValue: 1,
admin: {
description: "Multiplier applied to per-room decay while the master gate is on.",
},
},
{
name: "assetOutputsEnabled",
type: "checkbox",
defaultValue: false,
admin: {
description:
"Master switch for crediting asset (Arma item) outputs from interior jobs into structure locker storage. Keep off until locker.apply is verified on a live server.",
},
},
],
},
{
name: "zonePressureEnabled",
type: "checkbox",
defaultValue: true,
admin: {
description:
"When off, the Zone Pressure feature is hidden from the Operations feed (the overview card and the AAR section).",
},
},
{
name: "statisticsEnabled",
type: "checkbox",
defaultValue: true,
admin: {
description:
"When off, the Personnel > Statistics page and its navigation entry are hidden.",
},
},
{
name: "helpdeskEnabled",
type: "checkbox",
defaultValue: true,
admin: {
description: "When off, the Helpdesk page and its navigation entry are hidden.",
},
},
],
};