426 lines
11 KiB
TypeScript
426 lines
11 KiB
TypeScript
import { CollectionConfig } from "payload";
|
|
import {
|
|
approvalStatusFieldAccess,
|
|
requireApprovalPermission,
|
|
requireLogisticsPermission,
|
|
} from "@/utils/access-control/divisionAccess";
|
|
|
|
const approvalStatusFieldAccessConfig = approvalStatusFieldAccess("vehicles");
|
|
|
|
export const Vehicles: CollectionConfig = {
|
|
slug: "vehicles",
|
|
admin: {
|
|
useAsTitle: "name",
|
|
group: "Logistics",
|
|
},
|
|
access: {
|
|
create: requireLogisticsPermission("vehicles:create"),
|
|
update: requireLogisticsPermission("vehicles:update"),
|
|
delete: requireLogisticsPermission("vehicles:delete"),
|
|
},
|
|
fields: [
|
|
{
|
|
label: "Identity",
|
|
type: "group",
|
|
fields: [
|
|
{
|
|
name: "name",
|
|
type: "text",
|
|
required: true,
|
|
},
|
|
{
|
|
name: "classname",
|
|
type: "text",
|
|
admin: {
|
|
description:
|
|
"If not provided, this vehicle will ONLY be available as a virtual asset (i.e., cannot be used in Arma.)",
|
|
},
|
|
},
|
|
{
|
|
name: "approvalStatus",
|
|
type: "select",
|
|
label: "Approval Status",
|
|
access: approvalStatusFieldAccessConfig,
|
|
options: [
|
|
{ label: "In Progress", value: "in_progress" },
|
|
{ label: "Ready for Review", value: "ready_for_review" },
|
|
{ label: "Approved", value: "approved" },
|
|
{ label: "Rejected", value: "rejected" },
|
|
{ label: "Revision Requested", value: "revision_requested" },
|
|
],
|
|
defaultValue: "in_progress",
|
|
required: true,
|
|
admin: {
|
|
description:
|
|
"Mark whether this vehicle is ready for developer approval and implementation into the live environment.",
|
|
},
|
|
},
|
|
{
|
|
name: "description",
|
|
type: "richText",
|
|
admin: {
|
|
description:
|
|
"A detailed description of the vehicle, including details like tactical usage, mechanical details, and/or world lore regarding this vehicle.",
|
|
},
|
|
},
|
|
{
|
|
name: "image",
|
|
type: "upload",
|
|
relationTo: "media",
|
|
},
|
|
{
|
|
name: "category",
|
|
type: "select",
|
|
hasMany: true,
|
|
options: [
|
|
{
|
|
label: "Civilian",
|
|
value: "civilian",
|
|
},
|
|
{
|
|
label: "Utility",
|
|
value: "utility",
|
|
},
|
|
{
|
|
label: "Transport",
|
|
value: "transport",
|
|
},
|
|
{
|
|
label: "Weaponized",
|
|
value: "weaponized",
|
|
},
|
|
{
|
|
label: "Military",
|
|
value: "military",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: "fuel",
|
|
type: "group",
|
|
admin: {
|
|
description:
|
|
"Fuel configuration for this vehicle. Defines what fuel type it uses, how much it can hold, and how fast it consumes fuel.",
|
|
},
|
|
fields: [
|
|
{
|
|
name: "fuelType",
|
|
type: "relationship",
|
|
relationTo: "resources",
|
|
required: true,
|
|
admin: {
|
|
description:
|
|
"The type of fuel this vehicle consumes (e.g., gasoline, diesel, jet fuel).",
|
|
},
|
|
},
|
|
{
|
|
name: "fuelCapacity",
|
|
type: "number",
|
|
required: true,
|
|
admin: {
|
|
description: "Maximum fuel units this vehicle's tank can hold.",
|
|
},
|
|
},
|
|
{
|
|
name: "fuelConsumptionRate",
|
|
type: "number",
|
|
required: true,
|
|
defaultValue: 1,
|
|
admin: {
|
|
description: "Fuel consumed per unit of distance traveled.",
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
|
|
{
|
|
label: "Construction",
|
|
type: "group",
|
|
fields: [
|
|
{
|
|
name: "materials",
|
|
type: "array",
|
|
fields: [
|
|
{
|
|
name: "resource",
|
|
type: "relationship",
|
|
required: true,
|
|
relationTo: "resources",
|
|
},
|
|
{
|
|
name: "amount",
|
|
type: "number",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: "constructionTime",
|
|
type: "number",
|
|
admin: {
|
|
description: "The number of ticks it takes to complete construction of this vehicle.",
|
|
},
|
|
},
|
|
{
|
|
name: "requiredTech",
|
|
type: "relationship",
|
|
relationTo: "technologies",
|
|
hasMany: true,
|
|
label: "Required Technologies",
|
|
admin: {
|
|
description: "What research must be done before this can be built.",
|
|
},
|
|
},
|
|
{
|
|
name: "requiredStructure",
|
|
type: "join",
|
|
collection: "structures",
|
|
on: "canProduce",
|
|
},
|
|
],
|
|
},
|
|
|
|
{
|
|
label: "Scrapping & Maintenance",
|
|
type: "group",
|
|
fields: [
|
|
{
|
|
name: "scrapReturns",
|
|
type: "array",
|
|
label: "Materials Returned when Scrapped",
|
|
fields: [
|
|
{
|
|
name: "resource",
|
|
type: "relationship",
|
|
required: true,
|
|
relationTo: "resources",
|
|
},
|
|
{
|
|
name: "amount",
|
|
type: "number",
|
|
defaultValue: 1,
|
|
},
|
|
{
|
|
name: "chance",
|
|
type: "number",
|
|
min: 0,
|
|
max: 100,
|
|
defaultValue: 100,
|
|
admin: {
|
|
description:
|
|
"An optional percent (%) chance to recover this specific resource (between 0 and 100).",
|
|
},
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: "upkeepCosts",
|
|
type: "array",
|
|
admin: {
|
|
description: "Recurring costs to keep this vehicle operational.",
|
|
},
|
|
fields: [
|
|
{
|
|
name: "resource",
|
|
type: "relationship",
|
|
required: true,
|
|
relationTo: "resources",
|
|
},
|
|
{
|
|
name: "amount",
|
|
type: "number",
|
|
defaultValue: 1,
|
|
admin: {
|
|
description: "How much of this resource is consumed per tick.",
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
|
|
{
|
|
label: "Logistics & Grid Storage",
|
|
type: "group",
|
|
fields: [
|
|
{
|
|
name: "transportMode",
|
|
type: "select",
|
|
required: true,
|
|
defaultValue: "ground",
|
|
options: [
|
|
{ label: "Ground", value: "ground" },
|
|
{ label: "Air", value: "air" },
|
|
{ label: "Sea", value: "sea" },
|
|
],
|
|
admin: {
|
|
description:
|
|
"Ground vehicles route over the road network and refuse shipments with no connected route. Air and sea vehicles travel straight-line.",
|
|
},
|
|
},
|
|
{
|
|
label: "Storage Grid Dimensions",
|
|
type: "group",
|
|
fields: [
|
|
{
|
|
name: "width",
|
|
type: "number",
|
|
},
|
|
{
|
|
name: "height",
|
|
type: "number",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
label: "Cargo Capacity",
|
|
type: "group",
|
|
fields: [
|
|
{
|
|
name: "maxMass",
|
|
label: "Max Weight (kg.)",
|
|
type: "number",
|
|
},
|
|
{
|
|
name: "aceCargoSlots",
|
|
type: "number",
|
|
label: "ACE Cargo Slots",
|
|
admin: {
|
|
description: "The number of ACE cargo slots this vehicle has by default.",
|
|
},
|
|
},
|
|
{
|
|
name: "allowedVirtualCargo",
|
|
type: "array",
|
|
admin: {
|
|
description:
|
|
"The cargo this vehicle is permitted to carry if used virtually (e.g., during deliveries, moving troops, etc.)",
|
|
},
|
|
fields: [
|
|
{
|
|
name: "item",
|
|
type: "relationship",
|
|
relationTo: ["assets", "vehicles", "resources"],
|
|
required: true,
|
|
},
|
|
{
|
|
name: "amount",
|
|
type: "number",
|
|
defaultValue: 1,
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
|
|
{
|
|
label: "Combat & Performance",
|
|
type: "group",
|
|
fields: [
|
|
{
|
|
label: "Durability",
|
|
type: "group",
|
|
admin: {
|
|
description:
|
|
"These attributes only apply to the virtual vehicle and are not required nor expected to match the in-game version's actual attributes.",
|
|
},
|
|
fields: [
|
|
{
|
|
name: "maxHealth",
|
|
type: "number",
|
|
},
|
|
{
|
|
name: "armorRating",
|
|
type: "select",
|
|
options: [
|
|
{
|
|
label: "None",
|
|
value: "none",
|
|
},
|
|
{
|
|
label: "Light",
|
|
value: "light",
|
|
},
|
|
{
|
|
label: "Medium",
|
|
value: "medium",
|
|
},
|
|
{
|
|
label: "Heavy",
|
|
value: "heavy",
|
|
},
|
|
{
|
|
label: "Composite",
|
|
value: "composite",
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
{
|
|
label: "Speed & Agility",
|
|
type: "group",
|
|
fields: [
|
|
{
|
|
name: "maxSpeedOnRoad",
|
|
type: "number",
|
|
},
|
|
{
|
|
name: "maxSpeedOffRoad",
|
|
type: "number",
|
|
},
|
|
{
|
|
name: "maxAirspeed",
|
|
type: "number",
|
|
},
|
|
{
|
|
name: "maxKnots",
|
|
type: "number",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: "pylons",
|
|
label: "Pylons & Mounted Weapons",
|
|
type: "array",
|
|
fields: [
|
|
{
|
|
name: "pylonName",
|
|
type: "text",
|
|
required: true,
|
|
},
|
|
{
|
|
name: "pylonType",
|
|
type: "select",
|
|
required: true,
|
|
defaultValue: "mountedWeapon",
|
|
options: [
|
|
{
|
|
label: "Mounted Weapon",
|
|
value: "mountedWeapon",
|
|
},
|
|
{
|
|
label: "Pylon",
|
|
value: "pylon",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: "amount",
|
|
type: "number",
|
|
defaultValue: 1,
|
|
},
|
|
{
|
|
name: "ammoType",
|
|
type: "relationship",
|
|
relationTo: "assets",
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
};
|