In this text, common terms such as `pos`, `node`, or `placer`/`digger` will not be explained unless they have a different meaning than what's usually used in Minetest mods. See [minetest/doc/lua_api.txt](https://github.com/minetest/minetest/blob/master/doc/lua_api.txt) for details on these and other common terms, if necessary. Similarly, common shorthand such as `int`, `float`, etc. should require no explanation.
## Registering a sign
*`signs_lib.register_sign(nodename, def)`
To put it simply, where you'd have used `minetest.register_node()` before, just replace it with this call. The syntax is identical, and in general, all settings/items allowed there are allowed here as well. Anything that `signs_lib` doesn't need to override or alter will be passed straight through to `register_node()`, unchanged (such as `description`, `tiles`, or `inventory_image`).
Many items have default settings applied when omitted, most of which would produce something equivalent to "default:sign_wall_wood" if enough other node defintion settings were to be included.
Since this is a sign-specific library, this parameter behaves rather different from what you would normally use in `minetest.register_node()`. The first two entries are mandatory. The third, fourth and fifth entries are optional, depending on which mounting styles are enabled for a given node.
* entry 1: the front and back of the sign.
* entry 2: the sides/edges
* entry 3: texture for the pole mount. If unspecified, the standard pole mount image is used, if needed.
* entry 4: texture for the hanging part. If unspecified, the standard hanging chains image is used, if needed.
* entry 5: texture for the yard sign stick. If unspecified, "default_wood.png" is used, if needed.
As with any other node, this determines how param2 is interpreted. Since these are signs, only two modes make sense: "wallmounted" and "facedir". Any other string is the same as "facedir".
Sets the sign's groups, as usual. In addition to whatever arbitrary groups you may have in mind, there are two presets available (both of which have `attached_node` removed, and `sign = 1` added):
If your node needs a custom model for its on-pole, hanging, and/or yard variants, specify them here, as needed. The materials and textures behave the same on these as on other sign models. All sign model filenames are still derived from the base sign model, when not overridden here (so these can be totally arbitrary filenames).
Defaults: the normal "_onpole", "_hanging", or "_yard" version of the model specified by `mesh`.
*`selection_box = {table}`
*`node_box = {table}`
As usual, the former sets the sign's selection box, while the latter sets its collision information (since signs use model meshes). At the very least, you'll want to specify `selection_box`. If the sign node is in "wallmounted" mode, this must contain proper `wall_top`, `wall_side`, and `wall_bottom` entries, as one normally uses with such nodes. Signs that use "facedir" mode just need the usual `fixed` setting.
Defaults: `selection_box` is a box that fits the standard wall sign, if not specified. `node_box` takes on the value given to `selection_box`, if not specified (or the standard wall sign setting, if neither is present).
If your node needs special handling for its onpole-, hanging-, or yard-mode selection boxes or for their collision info (which `signs_lib` always uses the node's `node_box` item for), you can specify them here. Same syntax as the regular `selection_box` setting.
Sets the default text color for this sign, in hexadecimal (one digit, lowercase), from the standard Linux/IRC/CGA color palette. Same as the colors shown in the sign's formspec.
Scaling factor applied to the entity texture horizontal or vertical resolution. Larger values increase the resolution. Since a given sign's entity is always displayed at a fixed visual scale, increasing these squeezes more pixels into the same space, making the text appear narrower or shorter. Increasing `vert_scaling` also increases the number of lines of text the sign will hold.
Approximate number of characters that should fit on a line. This, the selected font's average character width, and the `horiz_scaling` together set the horizontal resolution of the text entity's texture.
Default: 35
*`entity_info = something`
Describes the entity model and yaw table to use. May be one of:
* a string reading "standard", which tells `signs_lib` to use the standard wood/steel sign model, in wallmounted mode. Equivalent to the example above.
* nothing at all: if omitted, the sign will not have a formspec, basically all text-related settings will be ignored and/or omitted entirely, and no entity will be spawned for this sign, thus the sign will not be writable. This is the default, and is of course what one would want for any sign that's just an image wrapped around a model, as in most of the signs in [my street signs mod](https://forum.minetest.net/viewtopic.php?t=20866).
If **true**, these allow the registration function to create versions of the initial, base sign node that either hang from the ceiling, are mounted on a vertical pole/post, are mounted on a horizontal pole, or are free-standing, on a small stick. Their node names will be the same as the base wall sign node, except with "_hanging", "_onpole", "_onpole_horiz", or "_yard", respectively, appended to the end of the node name. If the base node name has "_wall" in it, that bit is deleted before appending the above.
If the sign's writable, this deletes any sign-related entities in the sign's node space, spawns a new one, and renders whatever text is in the sign's meta.
Just what it says on the tin. Limits the sign's rotation as needed (for example, a sign on a horizontal pole can only flip from one side to the other).
*`mode`: the screwdriver's mode, as passed from the screwdriver mod.
*`x_size`/`y_size`: dimensions in inches. One node is 39.37 inches on a side. This function uses inches instead of metric because it started out as a selection box maker for [MUTCD-2009](https://mutcd.fhwa.dot.gov/pdfs/2009r1r2/mutcd2009r1r2edition.pdf)-compliant signs, which are measured in inches.
*`is_facedir`: if unset, the selection boxes will be created with the assumption that `paramtype2 = "wallmounted"` mode is set on the node the box will be used on. Any other value creates a selection box for "facedir" mode.
Cooks the supplied `text` as needed and passes it to the entity rendering code. Essentially, this is where rendering text into an image starts.
## Options for pole/post nodes
Occasionally, you'll run into a node that either looks like a pole/post, or has one in the middle of its node space (with room to fit a sign in there), but which isn't detected as a pole/post by the standard sign placement code. In these situations, some kind of special check is needed.
Supplying one or both of the following in the pole/post node's definition will cause `signs_lib` to skip its usual pole/post detection code, in favor of the supplied function(s).
If supplied, this function will be run when the mod is looking for a normal vertical pole/post. Useful if the target node's orientation and/or shape determine what sides a sign can attach to. For example, [Pipeworks](https://forum.minetest.net/viewtopic.php?pid=27794) uses this to figure out if a sign can be attached to a tube or pipe, depending on the tube's/pipe's number of junctions, and on its orientation and that of the placed sign.
If desired, this entry may simply be set to `check_for_pole = true` if a sign can always attach to this node regardless of facing direction (for example, [Home Decor](https://forum.minetest.net/viewtopic.php?pid=26061) has a round brass pole/post, which always stands vertical, and [Cottages](https://forum.minetest.net/viewtopic.php?id=5120) has a simple table that's basically a fencepost with a platform on top).