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

modular_aphelion/modules/cyborg_customization/code/codec.dm

CYBORG_CODEC_VERSIONThe compact save text for one character slot, kept as a string in cyborg_customization.json.
CYBORG_PART_PIXEL_XMask bit - the part's pixel_x follows
CYBORG_PART_PIXEL_YMask bit - the part's pixel_y follows
CYBORG_PART_ROTATIONMask bit - the part's rotation follows
CYBORG_PART_SCALEMask bit - the part's scale follows
CYBORG_PART_SPRITE_SIZEMask bit - the part's sprite size follows, when it isn't its slot's default
CYBORG_PART_NO_MIRRORNo value follows; the bit alone turns mirror_sides off.
CYBORG_PART_REUSE_SOUTHNo value follows; the bit alone turns reuse_south on.
CYBORG_PART_COLORSMask bit - the part's three colors follow, when they aren't all white
CYBORG_PART_GROUPSMask bit - the part's north, south and side placement group positions follow
CYBORG_PART_ADVANCEDMask bit - the part's encoded overrides follow
CYBORG_PART_SPRITEMask bit - the part's own sprite choice follows
/proc/cyborg_layout_override_fieldsOverride fields in header bit order, with what the editor fills a new override with.
/proc/cyborg_layout_codec_elementElement index of a decoded list, or null past its end.
/proc/cyborg_layout_codec_trimDrops unset trailing elements, which decoding reads as unset.
/proc/cyborg_layout_encodeThe save text for a character slot, built from the save text of each part.
/proc/cyborg_layout_codec_trim_textDrops unset trailing elements from a list of element texts, as cyborg_layout_codec_trim() does before encoding.
/proc/cyborg_layout_encode_entryA preset or model default as save text: its name or chassis, its layout, and its chassis or linked preset. A layout found in cached_parts keeps its text, and its parts' texts for copies of it; see cyborg_layout_encode(). Presets and defaults are only ever replaced whole, so most saves find all but one of them there.
/proc/cyborg_layout_encode_slotsA layout's parts as save text, in cyborg_layout_supported_slots() order. See cyborg_layout_encode() for the caches.
/proc/cyborg_layout_copy_encodedA deep copy of a layout whose parts keep the save text of the parts they copy. A part without text in encoded_parts is encoded here, once for it and its copy.
/proc/cyborg_layout_encode_partFields are read the way cyborg_layout_normalize_entry() reads them, so leaving one out decodes to the same value.
/proc/cyborg_layout_encode_advancedReturns a part's overrides as flat key index and override pairs, or null when it has none
/proc/cyborg_layout_encode_overrideAn arousal state writes every field it has: there each one overrides its pose, whatever the value.
/proc/cyborg_layout_codec_parseA save text's JSON, or null when the text is not a save of this format.
/proc/cyborg_layout_decodeThe normalized tree for a save text, or null when the text is not a save of this format.
/proc/cyborg_layout_decode_for_bodyWhat a body takes from a save text: its active layout and one model default, as cyborg_layout_decode() gives them, without decoding the rest. Null when the text is not a save of this format.
/proc/cyborg_layout_decode_slotsReturns an encoded layout's parts by slot. Untouched parts are left out, for normalizing to fill in
/proc/cyborg_layout_decode_partReturns a part's fields from its mask and values, or null for an untouched part
/proc/cyborg_layout_decode_advancedReturns a part's overrides by key from their flat pairs, skipping key indices we don't know
/proc/cyborg_layout_decode_overrideReturns an override from its header and values, with its arousal states unless it is one
/proc/cyborg_layout_text_is_futureWhether a save text comes from a newer format. Every format starts with its version, so this needs no decode.
/proc/cyborg_layout_from_storedThe editable tree for whatever a slot holds: save text, an older nested tree, or nothing.

Define Details

CYBORG_CODEC_VERSION

The compact save text for one character slot, kept as a string in cyborg_customization.json.

A slot is a JSON array of [format version, active layout, presets, model defaults, active model, active preset]. Presets are flat [name, layout, chassis] triples and model defaults flat [chassis, layout, linked preset] triples. A layout lists its parts in cyborg_layout_supported_slots() order, 0 for an untouched part. A part is [mask, values...]: each mask bit marks a field that differs from its default, and its value follows in bit order unless the bit says it all. Overrides are flat [key, override] pairs, the key an index into cyborg_layout_supported_advanced_keys(). An override is [header, values..., arousal states]: the header's low six bits say which fields it has, the next six which of those differ from what the editor fills a new override with, and only those values are written. Decoding rebuilds the nested tree and runs it through cyborg_layout_normalize(), so a reload matches the old format. Unset trailing fields are left out everywhere. Appending to these orders is fine; reordering breaks saved slots. Save text format version, the first value in every slot's text

CYBORG_PART_ADVANCED

Mask bit - the part's encoded overrides follow

CYBORG_PART_COLORS

Mask bit - the part's three colors follow, when they aren't all white

CYBORG_PART_GROUPS

Mask bit - the part's north, south and side placement group positions follow

CYBORG_PART_NO_MIRROR

No value follows; the bit alone turns mirror_sides off.

CYBORG_PART_PIXEL_X

Mask bit - the part's pixel_x follows

CYBORG_PART_PIXEL_Y

Mask bit - the part's pixel_y follows

CYBORG_PART_REUSE_SOUTH

No value follows; the bit alone turns reuse_south on.

CYBORG_PART_ROTATION

Mask bit - the part's rotation follows

CYBORG_PART_SCALE

Mask bit - the part's scale follows

CYBORG_PART_SPRITE

Mask bit - the part's own sprite choice follows

CYBORG_PART_SPRITE_SIZE

Mask bit - the part's sprite size follows, when it isn't its slot's default