Documentation
¶
Overview ¶
Package fitting computes ship-module fitting against the game's catalog data. It answers two questions offline: how many of a module fit on a hull, and which hulls can fit a given count of a module. Slots, CPU, power, capacity- adding modules, and the Engineering skill are all accounted for.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
Catalog holds the loaded ships, modules, and Engineering efficiency values.
func LoadCatalog ¶
LoadCatalog reads catalog_ships.json, catalog_items.json, and catalog_skills.json from dir and returns a populated Catalog. Items without a "slot" field are not modules and are skipped. Engineering efficiency defaults to 1%/level if the skill or its bonus keys are absent.
func (*Catalog) Engineering ¶
func (c *Catalog) Engineering(level int) Engineering
Engineering returns an Engineering at the given level using the catalog's efficiency-per-level values.
type Engineering ¶
Engineering carries the assumed Engineering skill level and the data-driven per-level efficiency values read from the skills catalog (both 1 by default).
func DefaultEngineering ¶
func DefaultEngineering(level int) Engineering
DefaultEngineering returns an Engineering at the given level using the default 1%-per-level efficiency for both CPU and power. Used when no catalog skill data overrides it.
type FitResult ¶
type FitResult struct {
Fits bool
MaxCount int // populated by MaxFit: how many copies fit
SlotType string // module slot type ("" or "mixed" for multi-slot loadouts)
SlotsUsed int
SlotsAvail int
CPUUsed int
CPUAvail int
PowerUsed int
PowerAvail int
BindingConstraint string // "weapon slots" | "defense slots" | "utility slots" | "CPU" | "power" | ""
SkillWarnings []string
}
FitResult reports the outcome of a fit calculation.
func CheckFit ¶
func CheckFit(s Ship, loadout []ModuleCount, eng Engineering) FitResult
CheckFit reports whether an arbitrary loadout fits on ship s at the given Engineering level. It checks slot counts per type plus aggregate CPU and power, accounting for capacity-adding modules. The first violated constraint is reported in BindingConstraint.
func MaxFit ¶
func MaxFit(s Ship, m Module, eng Engineering) FitResult
MaxFit reports how many copies of module m fit on ship s at the given Engineering level. It adds copies one at a time so that capacity-adding modules (cpu_bonus / power_bonus) correctly raise the budget as they are fitted. Iteration is bounded by the relevant slot count.
type Module ¶
type Module struct {
ID string
Name string
Type string // "weapon" | "defense" | "mining" | "utility"
Slot string // "weapon" | "defense" | "utility"
CPUUsage int
PowerUsage int
CPUBonus int // adds to CPU capacity (e.g. tow rig)
PowerBonus int // adds to power capacity (e.g. reactor)
RequiredSkills map[string]int // informational only
}
Module is the fitting-relevant subset of a catalog module.
type ModuleCount ¶
ModuleCount pairs a module with how many copies are being fitted.
type Ship ¶
type Ship struct {
ID string
Name string
CPUCapacity int
PowerCapacity int
WeaponSlots int
DefenseSlots int
UtilitySlots int
Tier int
DefaultModules []string // parsed but ignored by the fit math (bare-hull assumption)
}
Ship is the fitting-relevant subset of a catalog hull.
type ShipFit ¶
ShipFit pairs a ship with its MaxFit result for the queried module.
func ShipsThatFit ¶
func ShipsThatFit(ships []Ship, m Module, count int, eng Engineering) []ShipFit
ShipsThatFit returns every ship that can fit at least `count` copies of module m, sorted by tier ascending then name. Each entry carries the per-ship MaxFit result.