minetest/src/script/common
Auke Kok e737b1c271 Nodebox: Allow nodeboxes to "connect"
We introduce a new nodebox type "connected", and allow these nodes to
have optional nodeboxes that connect it to other connecting nodeboxes.

This is all done at scenedraw time in the client. The client will
inspect the surrounding nodes and if they are to be connected to,
it will draw the appropriate connecting nodeboxes to make those
connections.

In the node_box definition, we have to specify separate nodeboxes for
each valid connection. This allows us to make nodes that connect only
horizontally (the common case) by providing optional nodeboxes for +x,
-x, +z, -z directions. Or this allows us to make wires that can connect
up and down, by providing nodeboxes that connect it up and down (+y,
-y) as well.

The optional nodeboxes can be arrays. They are named "connect_top,
"connect_bottom", "connect_front", "connect_left", "connect_back" and
"connect_right". Here, "front" means the south facing side of the node
that has facedir = 0.

Additionally, a "fixed" nodebox list present will always be drawn,
so one can make a central post, for instance. This "fixed" nodebox
can be omitted, or it can be an array of nodeboxes.

Collision boxes are also updated in exactly the same fashion, which
allows you to walk over the upper extremities of the individual
node boxes, or stand really close to them. You can also walk up
node noxes that are small in height, all as expected, and unlike the
NDT_FENCELIKE nodes.

I've posted a screenshot demonstrating the flexibility at
    http://i.imgur.com/zaJq8jo.png
In the screenshot, all connecting nodes are of this new subtype.

Transparent textures render incorrectly, Which I don't think is
related to this text, as other nodeboxes also have issues with this.

A protocol bump is performed in order to be able to send older clients
a nodeblock that is usable for them. In order to avoid abuse of users
we send older clients a "full-size" node, so that it's impossible for
them to try and walk through a fence or wall that's created in this
fashion. This was tested with a pre-bump client connected against a
server running the new protocol.

These nodes connect to other nodes, and you can select which ones
those are by specifying node names (or group names) in the
connects_to string array:
      connects_to = { "group:fence", "default:wood" }
By default, nodes do not connect to anything, allowing you to create
nodes that always have to be paired in order to connect. lua_api.txt
is updated to reflect the extension to the node_box API.

Example lua code needed to generate these nodes can be found here:
    https://gist.github.com/sofar/b381c8c192c8e53e6062
2016-03-12 12:08:17 -05:00
..
CMakeLists.txt Clean up and tweak build system 2015-03-27 15:00:48 -04:00
c_content.cpp Nodebox: Allow nodeboxes to "connect" 2016-03-12 12:08:17 -05:00
c_content.h Fix tiling issues for PLANTLIKE and FIRELIKE with FSAA 2015-08-05 22:52:32 +02:00
c_converter.cpp Add Lua interface to HTTPFetchRequest 2016-02-22 15:39:41 +01:00
c_converter.h Add Lua interface to HTTPFetchRequest 2016-02-22 15:39:41 +01:00
c_internal.cpp Fix crash regression when invsize formspec gets used 2015-10-17 01:29:05 +02:00
c_internal.h Push error handler afresh each time lua_pcall is used 2015-08-27 01:56:06 +02:00
c_types.cpp Remove lua_State parameter from LuaError::LuaError 2014-03-15 16:28:59 -04:00
c_types.h Fix server crashing on Lua errors 2015-10-31 13:28:58 -04:00