/tg/ Station 13 - Modules - Types

modular_aphelion/modules/dirt/code/surface.dm

/datum/dirt_surfaceOne direction of a body's dirt surface. Dirt lies on limbs, not on the screen: every pixel of the body and of a margin round it maps to a limb, an angle round that limb (theta) and a height along it (h), so a mark keeps its place on the body as the mob turns.
/datum/dirt_templateA body's dirt template: its surface in each direction and the pixels each zone shows, built once from the sprites it's drawn from and shared by every body drawn from the same ones.
/datum/dirt_template_jobBuilds a dirt template one direction at a time, in the reference generator's order (south, north, east, west), so SSdirt can spread the work over ticks. A body whose limb names a state its sheet lacks gets no template: the job fails on its first piece.
/proc/dirt_build_template_nowBuilds a dirt template at once, for tests and for anything that can't wait for a subsystem.
/proc/dirt_zone_sources_drawableReturns whether every limb sprite zone sources name is in its sheet. The eyes aren't checked: a missing eye state draws no eye, so the face is left unguarded as the body shows it.
/proc/dirt_zone_draw_orderReturns the zones a body's limb sprites come from, in the order the body draws them: get_all_limbs() order, which for every carbon is its species' bodypart_overrides sorted by body_part (/datum/species/New()), so the chest, the head, the legs and the arms, each hand straight after its arm. Zone sources are alists, which keep no order, so they're always read in this one.
/proc/dirt_zone_limbsReturns the limb each zone's pixels lie on: list(zone = DIRT_LIMB_* define). An arm runs on into its hand. You should NEVER modify it.
/proc/dirt_pixel_zonesReturns the zones a template pixel's flags name (DIRT_PIXEL_ZONE()), each keyed to its own place: zones[place] is a zone and zones[zone] its place. They're the zones dirt_zone_owners() gives pixels, those of dirt_zone_draw_order(). A pixel holds its zone in 4 bits, 0 for none, so there are 15 at most. You should NEVER modify it.
/proc/dirt_zone_sourcesReturns the sprites a body's dirt template is built from, as get_limb_icon() draws them: alist(zone = list(icon file, icon state)) for each drawn limb and each hand, "eyes" = list(icon file, left state, right state) when the head draws eyes, and "human_head" = whether the head is a human's. Stumps, invisible limbs and a taur's hidden legs draw no sprite of their own, so they're left out.
/proc/dirt_zone_sources_matchReturns whether a body draws the sprites zone sources name, as dirt_zone_sources() reads them, without building them: the sheet and state of each limb in some zones and of its hand, the eyes, and whether the head is a human's. Skin mess asks it only when what a limb is drawn from has changed since it last matched (skin_reads); a worn garment's mess, a taur body's or taur suit's pools and the vulva's ring of skin ask it on every draw.
/proc/dirt_template_keyReturns the key of the template zone sources build: an MD5 of every sprite they name, in draw order, the eyes and whether the head is a human's. Bodies drawn from the same sprites share it.
/proc/dirt_zone_pixelsReturns each drawn zone's sprite pixels in one direction: list(zone = indexes from dirt_sprite_pixels()), zones in draw order.
/proc/dirt_sprite_pixelsReturns the pixels a sprite covers in one direction, any opacity counting, as indexes in row-major order on a canvas width across and 32 tall: none for a sprite of another size. Templates and outfits share sprites (every human head, its eyes, a jumpsuit), so each sprite's direction is read once and kept in SSdirt.sprite_reads, the least lately read dropped first. You should NEVER modify the list it returns.
/proc/dirt_sprite_read_keyReturns the key dirt_sprite_pixels() keeps a sprite's direction under.
/proc/dirt_sprite_facingsReturns the directions a sprite has pixels in, any opacity counting, as SOUTH, NORTH, EAST and WEST flags: none for a sprite that isn't 32x32. A direction dirt_sprite_pixels() holds is taken from it; any other is read only as far as its first pixel. Parts' layers are worked out from these whenever a body with mess is drawn, so they're kept for far more sprites than whole reads are, in SSdirt.sprite_facings.
/proc/dirt_sprite_showsReturns whether a 32x32 sprite has a pixel in one direction, any opacity counting, reading only as far as its first. Rows go from the middle down, then up from it: parts lie in the canvas's middle and lower rows.
/proc/dirt_sprite_keyReturns text naming a sprite's icon: a file's path, or the reference of an icon made at run time, whose text is empty or its type.
/proc/dirt_zone_ownersReturns the zone each pixel shows in one direction, as the body draws its limb images: a list of one zone or null per pixel. The images draw the lowest layer first and in draw order within a layer, and the last one drawn over a pixel owns it: the legs' lower halves (BODYPARTS_LOW_LAYER), then the limbs and the legs' upper halves (BODYPARTS_LAYER), then the hands (BODYPARTS_HIGH_LAYER). handle_masking() splits each leg between its halves with leg_masks.dmi, so the far leg goes under everything in profile.
/proc/dirt_metricReturns how far one pixel reaches on a limb: list(degrees round it, h along it). It's measured once, as the reference generator measures it, and serves every body, so marks keep one size whatever the body and the direction.
/proc/dirt_metric_sourcesReturns the plain human template's sprites, which dirt_metric() is measured from: no eyes, no mouth guard. You should NEVER modify it.
/proc/dirt_metric_directionsReturns the directions dirt_measure_metrics() reads, the only ones its template needs. You should NEVER modify it.
/proc/dirt_measure_metricsReturns alist(limb = list(degrees per pixel, h per pixel)), measured from the plain human template facing south, then facing east for a limb the south view lacks. A limb's diameter is its median row width; its length, its rows.