New Node API registering system in my game Minetest TNG

User avatar
LNJ
Member
 
Posts: 200
Joined: Tue Sep 23, 2014 16:02
GitHub: LNJ2
IRC: LNJ2GO
In-game: LNJ

New Node API registering system in my game Minetest TNG

by LNJ » Sat Mar 26, 2016 11:13

I created a new way to register fences, walls, stairs, slabs, ... in my game Minetest TNG: viewtopic.php?f=15&t=14145!
I just want to present it and would like to hear what do you think about it! :)

Code in Minetest TNG:
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
default.register_node("default:wood", {
   description = "Wooden Planks",
   tiles = {"default_wood.png"},
   is_ground_content = false,
   groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, wood = 1, fuel = 8},
   sounds = default.node_sound_wood_defaults(),
   register = {stair = true, slab = true, table = true, fence = true, fencegate = true},
   stair = {
      legacy_alias = "stairs:stair_wood",
      description = "Wooden Stair", -- if I don't change this the description would be "Wooden Planks Stair"
   },
   slab = {
      legacy_alias = "stairs:slab_wood",
      description = "Wooden Slab",
   },
   fence = {
      description = "Wooden Fence",
   },
   fencegate = {
      description = "Wooden Fence Gate",
   },
   table = {
      description = "Wooden Table",
   },
})


The same code without this system:
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
minetest.register_node("default:wood", {
   description = "Wooden Planks",
   tiles = {"default_wood.png"},
   is_ground_content = false,
   groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, wood = 1, fuel = 8},
   sounds = default.node_sound_wood_defaults(),
})
-- I moved the stairs and slabs API to default
default.register_stair("default:stair_wood", {
   description = "Wooden Stair",
   tiles = {"default_wood.png"},
   material = "default:wood",
   groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, wood = 1, fuel = 8},
   sounds = default.node_sound_wood_defaults(),
})

default.register_slab("default:slab_wood", {
   description = "Wooden Slab",
   tiles = {"default_wood.png"},
   material = "default:wood",
   groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, wood = 1, fuel = 8},
   sounds = default.node_sound_wood_defaults(),
})

default.register_fence("default:fence_wood", {
   description = "Wooden Fence",
   tiles = {"default_wood.png"},
   material = "default:wood",
   groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, wood = 1, fuel = 4},
   sounds = default.node_sound_wood_defaults(),
})

default.register_fencegate("default:fencegate_wood", {
   description = "Wooden Fence Gate",
   tiles = {"default_wood.png"},
   material = "default:wood",
   groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, wood = 1, fuel = 4},
   sounds = default.node_sound_wood_defaults(),
})

default.register_table("default:table_wood", {
   description = "Wooden Table",
   tiles = {"default_wood.png"},
   material = "default:wood",
   groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, fuel = 4},
   sounds = default.node_sound_wood_defaults(),
})


It's GPLv3+. So it's not compatible with MTG. (But in certain circumstances I would relicense it)
My Minetest Modding Tutorials (German) | Minetest TNG - My survival subgame! (OUTDATED... :() | #ComeToTheDuckSide - we have privacy! | diaspora* - The free and decentralized alternative to facebook and twitter!
 

User avatar
jp
Member
 
Posts: 705
Joined: Wed Dec 18, 2013 09:03
GitHub: kilbith

Re: New Node API registering system in my game Minetest TNG

by jp » Sat Mar 26, 2016 11:33

Wow, so uncommon. I created a way for additioning a variable.

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
local function count(a, b)
     a = a + b
     return a
end

That's GPLv3+ and incompatible with minetest_game as well.
 

User avatar
LNJ
Member
 
Posts: 200
Joined: Tue Sep 23, 2014 16:02
GitHub: LNJ2
IRC: LNJ2GO
In-game: LNJ

Re: New Node API registering system in my game Minetest TNG

by LNJ » Sat Mar 26, 2016 14:00

jp wrote:Wow, so uncommon. I created a way for additioning a variable.

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
local function count(a, b)
     a = a + b
     return a
end

That's GPLv3+ and incompatible with minetest_game as well.

I just mean that my game is GPLv3+! :D
The code I wrote above is Idk, WTFPL.
My Minetest Modding Tutorials (German) | Minetest TNG - My survival subgame! (OUTDATED... :() | #ComeToTheDuckSide - we have privacy! | diaspora* - The free and decentralized alternative to facebook and twitter!
 


Return to Minetest General

Who is online

Users browsing this forum: No registered users and 12 guests

cron