This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
dev:core:funref:register_platform [2019-10-02 14:48] 82.67.173.193 created example |
dev:core:funref:register_platform [2020-01-22 09:53] (current) admin ↷ Page moved from reference:advtrains:register_platform to dev:core:funref:register_platform |
||
---|---|---|---|
Line 39: | Line 39: | ||
<file lua register_platforms.lua> | <file lua register_platforms.lua> | ||
function advtrains.register_platform(modprefix, | function advtrains.register_platform(modprefix, | ||
- | local ndef=minetest.registered_nodes[preset] | + | |
- | if not ndef then | + | if not ndef then |
- | minetest.log(" | + | minetest.log(" |
- | return | + | return |
- | end | + | end |
- | local btex=ndef.tiles | + | local btex=ndef.tiles |
- | if type(btex)==" | + | if type(btex)==" |
- | btex=btex[1] | + | btex=btex[1] |
- | end | + | end |
- | local desc=ndef.description or "" | + | local desc=ndef.description or "" |
- | local nodename=string.match(preset, | + | local nodename=string.match(preset, |
- | minetest.register_node(modprefix .. ": | + | minetest.register_node(modprefix .. ": |
- | description = attrans(" | + | description = attrans(" |
- | tiles = {btex.." | + | tiles = {btex.." |
- | groups = {cracky = 1, not_blocking_trains = 1, platform=1}, | + | groups = {cracky = 1, not_blocking_trains = 1, platform=1}, |
- | sounds = default.node_sound_stone_defaults(), | + | sounds = default.node_sound_stone_defaults(), |
- | drawtype = " | + | drawtype = " |
- | node_box = { | + | node_box = { |
- | type = " | + | type = " |
- | fixed = { | + | fixed = { |
- | {-0.5, -0.1, -0.1, 0.5, 0 , 0.5}, | + | {-0.5, -0.1, -0.1, 0.5, 0 , 0.5}, |
- | {-0.5, -0.5, 0 , 0.5, -0.1, 0.5} | + | {-0.5, -0.5, 0 , 0.5, -0.1, 0.5} |
- | }, | + | }, |
- | }, | + | }, |
- | paramtype2=" | + | paramtype2=" |
- | paramtype = " | + | paramtype = " |
- | sunlight_propagates = true, | + | sunlight_propagates = true, |
- | }) | + | }) |
- | minetest.register_node(modprefix .. ": | + | minetest.register_node(modprefix .. ": |
- | description = attrans(" | + | description = attrans(" |
- | tiles = {btex.." | + | tiles = {btex.." |
- | groups = {cracky = 1, not_blocking_trains = 1, platform=2}, | + | groups = {cracky = 1, not_blocking_trains = 1, platform=2}, |
- | sounds = default.node_sound_stone_defaults(), | + | sounds = default.node_sound_stone_defaults(), |
- | drawtype = " | + | drawtype = " |
- | node_box = { | + | node_box = { |
- | type = " | + | type = " |
- | fixed = { | + | fixed = { |
- | {-0.5, | + | {-0.5, |
- | {-0.5, -0.5, 0 , 0.5, 0.3, 0.5} | + | {-0.5, -0.5, 0 , 0.5, 0.3, 0.5} |
- | }, | + | }, |
- | }, | + | }, |
- | paramtype2=" | + | paramtype2=" |
- | paramtype = " | + | paramtype = " |
- | sunlight_propagates = true, | + | sunlight_propagates = true, |
- | }) | + | }) |
- | minetest.register_craft({ | + | minetest.register_craft({ |
- | type=" | + | type=" |
- | output = modprefix .. ": | + | output = modprefix .. ": |
- | recipe = { | + | recipe = { |
- | " | + | " |
- | }, | + | }, |
- | }) | + | }) |
- | minetest.register_craft({ | + | minetest.register_craft({ |
- | type=" | + | type=" |
- | output = modprefix .. ": | + | output = modprefix .. ": |
- | recipe = { | + | recipe = { |
- | " | + | " |
- | }, | + | }, |
- | }) | + | }) |
end | end | ||
</ | </ |