1
0
mirror of https://github.com/mt-mods/signs_lib.git synced 2024-11-05 09:30:19 +01:00
Go to file
Vanessa Dannenberg 3836215268 API changes to allow for more mounting styles
NODE NAMES:

The base name of a node can be whatever you want.  The basic wall sign
will keep the node name you give, while its hanging, on-pole, and yard
variants will, where applicable, use the same name, with "_onpole",
"_hanging", or "_yard" appended.

One exception:

If your node has "_wall" in its name, that bit will be stripped-out when
generating the above node variations.  For example:

"default:sign_wall_wood"

...will become...

"default:sign_wood_onpole"
"default:sign_wood_hanging"
"default:sign_wood_yard"

MODELS:

The base sign model and entity files must now be named:

sign:   mymod_foosign_wall.obj
        mymod_foosign_facedir_wall.obj

entity: mymod_foosign_entity_wall.obj

their other variants, where applicable, must be:

mymod_foosign_onpole.obj
mymod_foosign_hanging.obj
mymod_foosign_yard.obj

mymod_foosign_entity_onpole.obj
mymod_foosign_entity_hanging.obj
mymod_foosign_entity_yard.obj

For `facedir` signs, the "_facedir" in the base sign model filename is
automatically stripped from the name when generating the entity model
filename, as entities don't have a concept of wallmounted/facedir/etc.
For example:

"mymod_foosign_facedir_wall.obj"

...will become...

"mymod_foosign_entity_wall.obj"

* allow passing custom onpole, hanging, and yard sign models, for
situations where the filename(s) thereof can't be derived from the base
sign model filename.

* allow passing a custom pole mount, hanging, and yard sign stick
textures as the third, fourth, and fifth tiles{} entries, respectively
(independent of the above model file option)

* fine-tuned the pole mount on the standard sign models to eliminate
overlapping faces (so it looks better with basic_signs' glass sign.

* Move basic_signs wooden yard sign back to signs_lib.
2019-09-26 00:48:53 -04:00
locale Merge pull request #29 from codexp/german-translation 2018-05-11 09:00:28 -04:00
models API changes to allow for more mounting styles 2019-09-26 00:48:53 -04:00
textures Add necessary bits to allow signs to be placed onto horizontal poles 2019-09-21 15:45:48 -04:00
.gitignore First commit. 2016-03-14 19:03:44 -03:00
api.lua API changes to allow for more mounting styles 2019-09-26 00:48:53 -04:00
API.md API changes to allow for more mounting styles 2019-09-26 00:48:53 -04:00
compat.lua fix bad selection box for prefab concrete rail 2019-09-25 16:06:12 -04:00
copyright.txt license fixups: use LGPL 3.0 for code, 2018-11-08 19:02:48 -05:00
depends.txt treat cottages:table and prefab_redo:concrete_railing as vertical posts 2019-09-23 17:02:19 -04:00
description.txt Adding standard mod files 2016-03-27 21:35:38 -07:00
encoding.lua Re-built onto the new API formerly part of my street_signs mod 2019-09-11 12:03:04 -04:00
init.lua allow mods to pass a function or just true 2019-09-22 03:19:31 -04:00
intllib.lua updated intllib method (po/pot files) 2017-07-31 18:55:35 +02:00
LICENSE license fixups: use LGPL 3.0 for code, 2018-11-08 19:02:48 -05:00
mod.conf Adding standard mod files 2016-03-27 21:35:38 -07:00
MODELS.md API changes to allow for more mounting styles 2019-09-26 00:48:53 -04:00
README.md API changes to allow for more mounting styles 2019-09-26 00:48:53 -04:00
standard_signs.lua API changes to allow for more mounting styles 2019-09-26 00:48:53 -04:00

signs_lib

This is kaeza's and my signs library mod, originally forked from PilzAdam's version and rewritten mostly by kaeza to include a number of new features, then rewritten again a couple more times (finding its way into my street_signs mod for a while, where it developed nicely 🙂).

The purpose of PilzAdam's original mod was to just provide a no-frills way make default signs show their text, via an entity placed right in front. It was hacky, but it worked!

While still hacky, this library is a modernized, feature-enhanced version of his code, which not only has visible text, but which allows that text to be colored, and displayed at any reasonable size, with any reasonable amount of text (as configured in a given node definition), with two font resolutions available. Plus, almost any sign can be attached to almost any kind of suitable pole or fencepost. Most signs that use the standard wall sign model can also be hung from a ceiling, or placed upright as a yard sign, in addition to being flat on a wall or floor. Unlike previous incarnations of this code, signs' text is visible when the sign is flat on the floor or ceiling, as well as all other supported orientations/mounting styles.

Without any other add-ons, this mod upgrades only the default wooden and steel signs.

Text formatting

In general, text is rendered exactly as-written, left-to-right, top to bottom, without any translations or modifications. The standard fonts support 7-bit ASCII as well as Cyrllic.

That said, there are some basic text formatting options:

  • Line breaks may be inserted by simply hitting Enter twice.

  • Eight arrow symbols are available, occupying positions 0x81 through 0x88 in the character set. These are produced by writing a ^ followed by a number 1-8:

    ^1 = , ^2 = , ^3 = , ^4 = , ^5 = , ^6 = , ^7 = , ^8 =

    Writing ^ followed by a letter a-h will produce double-wide versions of these arrows, in the same order. These wide arrows occupy 0x89 to 0x91 in the character set.

  • A color may be specified in the sign text by using # followed by a single hexadcimal digit (0-9 or a-f). These colors come from the standard Linux/IRC/CGA color set, and are shown in the sign's formspec. Any color change will remain in effect until changed again, or until the next line break. Any number of color changes in any arbitrary arrangement is allowed.

Sign placement and rotation notes

  • Pointing at a wall while placing will, of course, place the sign on the wall.

  • For most signs, pointing at the ground while placing puts the sign flat on the ground.

    Exception: if you have basic_signs installed, placing a default wooden sign on the ground will instead create a "yard" sign (basically a regular wooden sign mounted upright on a small stick).

  • For most signs, pointing at the ceiling while placing will put the sign flat against the ceiling.

    Exception: default wood and steel signs will instead be hung from the ceiling by a pair of chains. If you have basic_signs, all standard signs created by it will do the same.

  • Pointing at an X or Z side of something that's detected as a pole/post will mount the sign onto that pole. Note that the sign actually occupies the node space in front of the pole, since they're still separate nodes. But, I figure, no one's going to want to use the space in front of the sign anyway, because doing so would of course obscure the sign, so it doesn't matter if the sign logically occupies that node space.

  • If a sign is on the wall or flat on the ground, the screwdriver will spin it from one wall to the next, in clockwise order, whether there's a wall to attach to or not, followed by putting it flat on the ground, then flat against the ceiling, then back to wall orientation.

  • If a sign is hanging from the ceiling (not flat against it), the screwdriver will just rotate it around its Y axis.

  • If a sign is on a vertical pole/post, the screwdriver will rotate it around the pole, but only if there's nothing in the way.

  • If a sign is on a horizontal pole/post, the screwdriver will flip it from one side to the other as long as there's nothing in the way.

Chat commands

At present, only one command is defined:

  • /regen_signs

This will read through the list of currently-loaded blocks known to contain one or more signs, delete all entities found in each sign's node space, and respawn and re-render each from scratch.

The list of loaded, sign-bearing blocks is created/populated by an LBM (and trimmed by this command if any listed blocks are found to have been unloaded).