summaryrefslogtreecommitdiff
path: root/src/mapnode.h
diff options
context:
space:
mode:
authorAuke Kok <sofar@foo-projects.org>2016-02-25 00:16:31 -0800
committerShadowNinja <shadowninja@minetest.net>2016-03-12 12:08:17 -0500
commite737b1c271c9d957651ef2201bb820e4465358bf (patch)
tree7779672fec61fe09df3fd5391d64ae84bd8e572a /src/mapnode.h
parent8c951cae5bcfa715e227d47d122cc2de45d70a63 (diff)
downloadminetest-e737b1c271c9d957651ef2201bb820e4465358bf.tar.gz
minetest-e737b1c271c9d957651ef2201bb820e4465358bf.tar.bz2
minetest-e737b1c271c9d957651ef2201bb820e4465358bf.zip
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
Diffstat (limited to 'src/mapnode.h')
-rw-r--r--src/mapnode.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mapnode.h b/src/mapnode.h
index 7cc25c60c..4db888616 100644
--- a/src/mapnode.h
+++ b/src/mapnode.h
@@ -240,17 +240,17 @@ struct MapNode
/*
Gets list of node boxes (used for rendering (NDT_NODEBOX))
*/
- std::vector<aabb3f> getNodeBoxes(INodeDefManager *nodemgr) const;
+ void getNodeBoxes(INodeDefManager *nodemgr, std::vector<aabb3f> *boxes, u8 neighbors = 0);
/*
Gets list of selection boxes
*/
- std::vector<aabb3f> getSelectionBoxes(INodeDefManager *nodemgr) const;
+ void getSelectionBoxes(INodeDefManager *nodemg, std::vector<aabb3f> *boxes);
/*
Gets list of collision boxes
*/
- std::vector<aabb3f> getCollisionBoxes(INodeDefManager *nodemgr) const;
+ void getCollisionBoxes(INodeDefManager *nodemgr, std::vector<aabb3f> *boxes, u8 neighbors = 0);
/*
Liquid helpers