From 8779bb85ef559086410aba45974932fcbd4f58e3 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 6 Mar 2015 07:50:27 +0100 Subject: [PATCH 1/4] Use connect_to_raillike for rail Used value: 2 --- mods/default/nodes.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index 49e0524e..ff9ff8ea 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -1433,7 +1433,7 @@ minetest.register_node("default:rail", { -- but how to specify the dimensions for curved and sideways rails? fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, }, - groups = {bendy=2,dig_immediate=2,attached_node=1}, + groups = {bendy=2,dig_immediate=2,attached_node=1,connect_to_raillike=2}, }) From feacdc4bffed6984e2e95a9214946cf6b0b52181 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 6 Mar 2015 12:07:48 +0100 Subject: [PATCH 2/4] Add connect_to_raillike info into game_api.txt --- game_api.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/game_api.txt b/game_api.txt index 4d4b579b..dd4b8f23 100644 --- a/game_api.txt +++ b/game_api.txt @@ -157,6 +157,25 @@ xpanes.register_pane(subname, def) ^ Recipe field only } +Raillike definitions +-------------------- +The following nodes use the group `connect_to_raillike` and will only connect to +raillike nodes within this group and the same group value: + +| Node type | Group value ++-----------------------+------------ +| default:rail | 2 + +This is an overview of currently used groups: +| Group value | Description ++---------------+------------ +| 2 | Rails + +Example: +If you want to add a new rail type and want it to connect with default:rail, +add `connect_to_raillike=2` into the `groups` table of your node. + + Default sounds -------------- Sounds inside the default table can be used within the sounds field of node definitions. From e399aaafc9a278124f6c3f00f378144fff21aab4 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 8 Mar 2015 10:46:38 +0100 Subject: [PATCH 3/4] Use different way to handle connect_to_raillike numbers --- game_api.txt | 13 +++++++------ mods/default/init.lua | 4 ++++ mods/default/nodes.lua | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/game_api.txt b/game_api.txt index dd4b8f23..96f44719 100644 --- a/game_api.txt +++ b/game_api.txt @@ -163,17 +163,18 @@ The following nodes use the group `connect_to_raillike` and will only connect to raillike nodes within this group and the same group value: | Node type | Group value -+-----------------------+------------ -| default:rail | 2 ++-----------------------+---------------------------------- +| default:rail | default.connect_to_raillike.rails This is an overview of currently used groups: -| Group value | Description -+---------------+------------ -| 2 | Rails +| Group value | Description ++---------------------------------------+------------ +| default.connect_to_raillike.rails | Rails Example: If you want to add a new rail type and want it to connect with default:rail, -add `connect_to_raillike=2` into the `groups` table of your node. +add `connect_to_raillike=default.connect_to_raillike.rails` into the `groups` table +of your node. Default sounds diff --git a/mods/default/init.lua b/mods/default/init.lua index 3f0efea9..fa015df4 100644 --- a/mods/default/init.lua +++ b/mods/default/init.lua @@ -13,6 +13,10 @@ default.gui_bg = "bgcolor[#080808BB;true]" default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]" default.gui_slots = "listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" +-- connect_to_raillike group values +default.connect_to_raillike = {} +default.connect_to_raillike.rails = 2 + function default.get_hotbar_bg(x,y) local out = "" for i=0,7,1 do diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index ff9ff8ea..54063525 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -1433,7 +1433,7 @@ minetest.register_node("default:rail", { -- but how to specify the dimensions for curved and sideways rails? fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, }, - groups = {bendy=2,dig_immediate=2,attached_node=1,connect_to_raillike=2}, + groups = {bendy=2,dig_immediate=2,attached_node=1,connect_to_raillike=default.connect_to_raillike.rails}, }) From 532e585e926fc6c8a64d0ad9e047d57386baa4fe Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 13 May 2015 02:42:06 +0200 Subject: [PATCH 4/4] Use builtin function for raillike group --- game_api.txt | 14 +++++--------- mods/default/init.lua | 4 ---- mods/default/nodes.lua | 2 +- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/game_api.txt b/game_api.txt index 96f44719..fe38fe19 100644 --- a/game_api.txt +++ b/game_api.txt @@ -160,20 +160,16 @@ xpanes.register_pane(subname, def) Raillike definitions -------------------- The following nodes use the group `connect_to_raillike` and will only connect to -raillike nodes within this group and the same group value: +raillike nodes within this group and the same group value. +Use `minetest.raillike_group()` to get the group value. -| Node type | Group value +| Node type | Raillike group name +-----------------------+---------------------------------- -| default:rail | default.connect_to_raillike.rails - -This is an overview of currently used groups: -| Group value | Description -+---------------------------------------+------------ -| default.connect_to_raillike.rails | Rails +| default:rail | "rail" Example: If you want to add a new rail type and want it to connect with default:rail, -add `connect_to_raillike=default.connect_to_raillike.rails` into the `groups` table +add `connect_to_raillike=minetest.raillike_group("rail")` into the `groups` table of your node. diff --git a/mods/default/init.lua b/mods/default/init.lua index fa015df4..3f0efea9 100644 --- a/mods/default/init.lua +++ b/mods/default/init.lua @@ -13,10 +13,6 @@ default.gui_bg = "bgcolor[#080808BB;true]" default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]" default.gui_slots = "listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" --- connect_to_raillike group values -default.connect_to_raillike = {} -default.connect_to_raillike.rails = 2 - function default.get_hotbar_bg(x,y) local out = "" for i=0,7,1 do diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index 54063525..40d6a8ff 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -1433,7 +1433,7 @@ minetest.register_node("default:rail", { -- but how to specify the dimensions for curved and sideways rails? fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, }, - groups = {bendy=2,dig_immediate=2,attached_node=1,connect_to_raillike=default.connect_to_raillike.rails}, + groups = {bendy=2,dig_immediate=2,attached_node=1,connect_to_raillike=minetest.raillike_group("rail")}, })