Page 1 of 1

Forbidding building next to a node

PostPosted: Sat Jul 12, 2014 23:18
by Wuzzy
Hi! I have a suggestion for the core node definitions:

Add a new field to the node definition table and call it “attachable_sides”.
It takes a table of the format
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
{ +Y, -Y, +X, -X, +Z, -Z }

(pseudocode)

where each of the arguments is a boolean. The argument names denote the side of the node. This definition is similar to that of “tiles”; the same sides are meant with that.

If a field is true, it is possible to place a node ONTO that corresponding side (default). If it is false, it is not possible. Additionally, any node which has the group “attached_node = 1” can not attach itselves towards a “false” side of a neighbor node. It either can not be built to it or it will fall down if it was already there, but the node to which the attached node was attached changed.

By default, it is possible to build next to all sides of a node.

Possible use cases:
  • Better ladder building behaviour. In current minetest_game it is possible to place a ladder or almost every node in FRONT of another ladder, which kinda looks awkward. For ladders, the “attachable sides” can be changed to false for every side except up and down. In Lua code: “attachable_sides = { false, false, true, true, true, true }”
  • Hanging chains. Again, you wouldn’t expect you can build to the (mostly empty) sides of a hanging chain, so again everything except up and down is unattachable.
  • Book nodeboxes, yeah, nodeboxes that have the shape of books. I suppose you wouldn’t expect to build anything next to it, no matter the side.
  • Nodeboxes. There are probably many use cases for this.
  • Nodes to which you can’t build anything next to. That might have interesting gameplay implications.

Please note that my proposal is different from the existing buildable_to = true. With this one, nodes get replaced when you try to place something on them. If buildable_to is true, the property “attachable_sides” is to be ignored by the engine.

That’s the proposal. I hope it is realistic and understandable while still being formal enough.

Re: Forbidding building next to a node

PostPosted: Sun Jul 13, 2014 07:31
by Krock
It's a nice idea but your pseudocode wouldn't work on rotated nodes. X, Y and Z are static, better would be Front, Back, Top, Bottom, Left, Right.

Re: Forbidding building next to a node

PostPosted: Sun Jul 13, 2014 09:40
by rubenwardy
Krock, the engine defines tiles in the same way. It is the face direction if the node is not rotated.

Re: Forbidding building next to a node

PostPosted: Sun Jul 13, 2014 18:20
by Wuzzy
Oh, yes. Of course everything should be rotated accordingly when facedir is used. Not static, that would be useless.
I totally forgot facedir.
Thanks for reminding me of facedir.