Signs formspec as separate formspecs (instead of dwelling in nodes metadata)

This commit is contained in:
Zughy
2021-01-03 18:39:29 +00:00
committed by Vanessa Dannenberg
parent 1a6b9f38ff
commit e7ab3e66a7
3 changed files with 102 additions and 89 deletions

26
API.md
View File

@ -78,17 +78,11 @@ In this text, common terms such as `pos`, `node`, or `placer`/`digger` will not
Default: `signs_lib.after_place_node`
* `on_rightclick = function(pos)`
* `on_rightclick = function(pos, node, player, itemstack, pointed_thing)`
See below under "Main functions".
Default: `signs_lib.construct_sign`
* `on_construct = function(pos)`
See below under "Main functions".
Default: `signs_lib.construct_sign`
Default: `signs_lib.rightclick_sign`
* `on_destruct = function(pos)`
@ -96,12 +90,6 @@ In this text, common terms such as `pos`, `node`, or `placer`/`digger` will not
Default: `signs_lib.destruct_sign`
* `on_receive_fields = function(pos, formname, fields, sender)`
See below under "Main functions".
Default: `signs_lib.receive_fields`
* `on_punch = function(pos)`
See below under "Main functions".
@ -258,18 +246,14 @@ signs_lib.register_sign("basic_signs:sign_wall_glass", {
* `locked`: if set to **true**, the sign's meta will be tweaked to indicate its ownership by the `placer`.
* `signs_lib.construct_sign(pos)`
* `signs_lib.rightclick_sign(pos, node, player, itemstack, pointed_thing)`
Sets up the sign's formspec and infotext overlay.
Open the default sign formspec, if the player has the `signslib_edit` privilege.
* `signs_lib.destruct_sign(pos)`
Deletes the sign's entity, if any, when the sign is dug.
* `signs_lib.receive_fields(pos, formname, fields, sender)`
This handles the text input and wide font on/off switch, logging any actions the user takes. Bails-out silently if the user is not allowed to edit the sign. See the standard Minetest lua_api.txt for details.
* `signs_lib.update_sign(pos, fields)`
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.
@ -352,7 +336,7 @@ Supplying one or both of the following in the pole/post node's definition will c
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.
* `def`: the placed sign's node defintion
* `pole_pos`: the target node's position
* `pole_pos`: the target node's position
* `pole_node`: the target node itself
* `pole_def`: its node definition