/tg/ Station 13 - Modules - Types — Define Details

modular_aphelion/modules/fitness/code/garment_fitting.dm

FIT_INDEXIndex of a pixel of a 32x32 view in the fitting's pixel lists, from x and y counted from the view's top left from 0, as the templates give them.
PEC_PANEL_MAX_MOVEThe furthest a top's chest panel moves out over pecs drawn under it, in pixels.
SLEEVE_MIN_PIXELSSleeve modes (garment_sleeve_mode()): fewer sleeve pixels than this over the arms is no sleeve at all.
SLEEVE_LIT_MINA sleeve colour is lit, and counts, when its brightest channel is at least this; darker ones are outlines and shadows.
SLEEVE_GREY_PERCENTA lit colour is grey when its channels spread less than this percentage of its brightest one.
SLEEVE_MAX_COLOURSThe most lit colours, greys or hued ones, plain sleeves have.
SLEEVE_MAX_HUE_SPREADThe widest arc of hues, in degrees, plain sleeves span.
SLEEVE_MAX_GREYS_WITH_HUEThe most greys plain sleeves of a hue have beside it.
/proc/garment_fit_templatesReturns the limb templates garments are fitted with, read from fitting/fit_templates.json the first time they're asked for: SSgarment_fitting reads them as the server starts. The file is compiled into the resource file, so a server has it wherever it runs.
/proc/garment_fit_upper_coreReturns the upper third, by rows, of a limb template's baseline pixels: on an arm, what a sleeve covers and a strap over the shoulder doesn't. The sleeve test reads it (/datum/garment_fit_view/proc/apply_bands(), garment_front_sleeves()).
/proc/garment_pec_templatesReturns the templates tops are fitted to pecs with, read from fitting/pec_templates.json and fitting/pec_flex_templates.json the first time they're asked for, as the limb templates are.
/proc/garment_pec_flexReturns a pec flex's templates, as garment_pec_templates() holds them under flexes: its frame delays, and its shapes, each shape's templates by view on each of its frames. Null for a sheet that isn't a pec flex's, like a jiggle's, or none.
/datum/garment_fitWhat a garment is fitted to: the muscle size of each limb it fits, and pecs drawn under it. Each is made once and shared (get_garment_fit()): a body keeps its own (/mob/living/carbon/human/var/garment_fit), and fitted sprites are cached by it.
/proc/get_garment_fitReturns the garment fit to these muscle sizes and pecs, made the first time it's asked for.
/proc/fit_garment_framesFits a garment's state in place: each direction, and each animation frame, is fitted on its own (fit_garment_view()), the front views last (GARMENT_FIT_PIECE_VIEW()).
/proc/fit_garment_viewFits one view of a garment's state in place, one direction's animation frame (/datum/garment_fit_view), and draws it back over the state's own when the fit changes it. A state's views are numbered direction by direction (S, N, E, W), and frame by frame within each. Its arms' sleeves are judged from its frame's front view (garment_front_sleeves()), which must still be the garment's own: fit the front views last.
/proc/garment_front_sleevesReturns which of a garment's fitted arms it has a sleeve over, judged from its front view, where the arms show whole: fitted arm -> whether the garment covers at least half of the upper third of the arm's baseline pixels there. A short sleeve covers the upper arm and counts, where a strap over the shoulder covers a pixel or two of it. Every view's fit uses it (/datum/garment_fit_view/proc/apply_bands()). Null when no arm is fitted.
/proc/garment_sheet_metadataReturns what garment fitting knows of a sheet without reading its pixels, from fitting/garment_metadata.json: sleeves, its states whose own sleeves pick shaded sleeves -> TRUE, and colours, for each state whose fits read whole views, those views' colours as fit_garment_view() takes them, or null for a view read from its pixels. Null for a sheet it doesn't know, like a generated icon, or one that changed after the file was written: those are read from their pixels.
/proc/garment_metadataReturns fitting/garment_metadata.json's sheets, by path, read the first time they're asked for: SSgarment_fitting reads them as the server starts. See garment_sheet_metadata().
/proc/unpack_garment_coloursReturns a view's colours, colour -> how many of its pixels have it, from the "rrggbb:count,..." form garment_sheet_metadata() holds them in.
/proc/garment_frame_countReturns how many animation frames a garment's state has, counted from its front view, up to GARMENT_FIT_MAX_FRAMES.
/proc/garment_sleeve_modeReturns the mode a worn garment is fitted in when it doesn't set its own, picked from its sleeves in its front view.
/proc/garment_colour_hueReturns a colour's hue as the sleeve modes judge it (garment_sleeve_mode()), in whole degrees from 0 to 359, or -1 for a grey: one whose channels spread less than percent percent of its brightest one, black included.
/proc/garment_near_greyWhether a colour is a near-grey: its channels spread less than twice SLEEVE_GREY_PERCENT percent of its brightest one, black included. A greyscale garment's own faintly blue shading falls either side of the grey line, but is near-grey.
/proc/garment_colours_kinWhether a shaded sleeve may step a pixel from colour source to the darker colour, keeping to source's family. A colour is lit when its brightest channel is at least SLEEVE_LIT_MIN, and dark otherwise. It may when:
/datum/garment_fit_viewOne view of a garment being fitted: its frame, the pixels read from it, and the pixels the fitting writes over them.

Define Details

FIT_INDEX

Index of a pixel of a 32x32 view in the fitting's pixel lists, from x and y counted from the view's top left from 0, as the templates give them.

PEC_PANEL_MAX_MOVE

The furthest a top's chest panel moves out over pecs drawn under it, in pixels.

SLEEVE_GREY_PERCENT

A lit colour is grey when its channels spread less than this percentage of its brightest one.

SLEEVE_LIT_MIN

A sleeve colour is lit, and counts, when its brightest channel is at least this; darker ones are outlines and shadows.

SLEEVE_MAX_COLOURS

The most lit colours, greys or hued ones, plain sleeves have.

SLEEVE_MAX_GREYS_WITH_HUE

The most greys plain sleeves of a hue have beside it.

SLEEVE_MAX_HUE_SPREAD

The widest arc of hues, in degrees, plain sleeves span.

SLEEVE_MIN_PIXELS

Sleeve modes (garment_sleeve_mode()): fewer sleeve pixels than this over the arms is no sleeve at all.