Adding crafting recipes

This commit is contained in:
orwell96 2016-09-12 21:06:00 +02:00
parent 1cffe6a9b6
commit f54d3b2e6c
4 changed files with 94 additions and 3 deletions

76
crafting.lua Normal file
View File

@ -0,0 +1,76 @@
--advtrains by orwell96, see readme.txt and license.txt
--crafting.lua
--registers crafting recipes
--tracks
minetest.register_craft({
output = 'advtrains:dtrack_placer 50',
recipe = {
{'default:steel_ingot', 'group:stick', 'default:steel_ingot'},
{'default:steel_ingot', 'group:stick', 'default:steel_ingot'},
{'default:steel_ingot', 'group:stick', 'default:steel_ingot'},
},
})
minetest.register_craft({
output = 'advtrains:dtrack_puffer 2',
recipe = {
{'default:wood', 'dye:red', ''},
{'default:steel_ingot', '', 'default:steel_ingot'},
{'advtrains:dtrack_placer', 'advtrains:dtrack_placer', ''},
},
})
--temporary, as long as puffers do not rotate
minetest.register_craft({
output = 'advtrains:dtrack_puffer_30',
recipe = {
{'advtrains:dtrack_puffer'},
},
})
minetest.register_craft({
output = 'advtrains:dtrack_puffer_45',
recipe = {
{'advtrains:dtrack_puffer_30'},
},
})
minetest.register_craft({
output = 'advtrains:dtrack_puffer_60',
recipe = {
{'advtrains:dtrack_puffer_45'},
},
})
minetest.register_craft({
output = 'advtrains:dtrack_puffer',
recipe = {
{'advtrains:dtrack_puffer_60'},
},
})
--wagons
minetest.register_craft({
output = 'advtrains:newlocomotive',
recipe = {
{'default:steelblock', 'default:steelblock', 'default:steelblock'},
{'default:steelblock', 'dye:black', 'default:steelblock'},
{'default:steelblock', 'default:steelblock', 'default:steelblock'},
},
})
minetest.register_craft({
output = 'advtrains:wagon_default',
recipe = {
{'default:steelblock', 'default:steelblock', 'default:steelblock'},
{'default:steelblock', 'dye:dark_green', 'default:steelblock'},
{'default:steelblock', 'default:steelblock', 'default:steelblock'},
},
})
minetest.register_craft({
output = 'advtrains:subway_wagon',
recipe = {
{'default:steelblock', 'default:steelblock', 'default:steelblock'},
{'default:steelblock', 'dye:yellow', 'default:steelblock'},
{'default:steelblock', 'default:steelblock', 'default:steelblock'},
},
})
--misc_nodes
--crafts for platforms see misc_nodes.lua

View File

@ -23,3 +23,4 @@ dofile(advtrains.modpath.."/couple.lua");
dofile(advtrains.modpath.."/damage.lua");
dofile(advtrains.modpath.."/misc_nodes.lua");
dofile(advtrains.modpath.."/crafting.lua");

View File

@ -47,6 +47,20 @@ function advtrains.register_platform(preset)
paramtype = "light",
sunlight_propagates = true,
})
minetest.register_craft({
type="shapeless",
output = "advtrains:platform_high_"..nodename.." 4",
recipe = {
"dye:yellow", preset, preset
},
})
minetest.register_craft({
type="shapeless",
output = "advtrains:platform_low_"..nodename.." 4",
recipe = {
"dye:yellow", preset
},
})
end
minetest.register_abm({

View File

@ -120,11 +120,11 @@ function wagon:on_punch(puncher, time_from_last_punch, tool_capabilities, direct
local inv = puncher:get_inventory()
if minetest.setting_getbool("creative_mode") then
if not inv:contains_item("main", "advtrains:locomotive") then
inv:add_item("main", "advtrains:locomotive")
if not inv:contains_item("main", self.name) then
inv:add_item("main", self.name)
end
else
inv:add_item("main", "advtrains:locomotive")
inv:add_item("main", self.name)
end
table.remove(self:train().trainparts, self.pos_in_trainparts)