clean up code, change names

This commit is contained in:
JBBgameich 2016-09-14 22:16:54 +02:00 committed by JBB
parent b746152f1f
commit 35e6ae5fec
4 changed files with 22 additions and 38 deletions

View File

@ -1,5 +1,5 @@
# fachwerk
version 0.9.1
version 0.4.9.1
The fachwerk mod adds timber-framed blocks to Minetest.
It's using a simple API to add new timber-framed blocks

39
api.lua
View File

@ -1,25 +1,9 @@
--[[
================================================================
** fachwerk **
By JBB
fachwerk.register_fachwerk = function(basename, texture, description, craft_from)
Copyright (c) 2015 JBB
(sites.google.com/site/jbbsblog)
The WTFPL applies to all code in this project.
http://www.wtfpl.net/txt/copying/
See README.txt
================================================================
--]]
fachwerk = {}
fachwerk.register_fachwerk = function( basename, texture, description, craft_from )
local group_def = {choppy=2,oddly_breakable_by_hand=2,cracky=3};
local group_def = {choppy = 2,oddly_breakable_by_hand = 2,cracky = 3};
minetest.register_node("fachwerk:"..basename, {
description = "Truss with "..description,
description = "Timber-framed "..description,
tile_images = { texture.."^fachwerk_blank.png"},
groups = group_def,
sounds = default.node_sound_stone_defaults(),
@ -28,7 +12,7 @@ fachwerk.register_fachwerk = function( basename, texture, description, craft_fro
})
minetest.register_node("fachwerk:"..basename.."_1", {
description = "truss with "..description.." oblique beam 1",
description = "Timber-framed "..description.." oblique beam 1",
tile_images = {
texture.."^fachwerk_blank.png", -- top
texture.."^fachwerk_blank.png", -- bottom
@ -44,7 +28,7 @@ fachwerk.register_fachwerk = function( basename, texture, description, craft_fro
-- TODO: is this one really needed? the node above covers most of that already
minetest.register_node("fachwerk:"..basename.."_2", {
description = "Truss with "..description.." oblique beam 2",
description = "Timber-framed "..description.." oblique beam 2",
tile_images = {
texture.."^fachwerk_blank.png", -- top
texture.."^fachwerk_blank.png", -- bottom
@ -59,7 +43,7 @@ fachwerk.register_fachwerk = function( basename, texture, description, craft_fro
})
minetest.register_node("fachwerk:"..basename.."_cross", {
description = "truss with "..description.." cross",
description = "Timber-framed "..description.." cross",
tile_images = {texture.."^fachwerk_cross.png"},
groups = group_def,
sounds = default.node_sound_stone_defaults(),
@ -97,7 +81,8 @@ fachwerk.register_fachwerk = function( basename, texture, description, craft_fro
} });
-- chain of craft receipes to convert nodes into each other
--[[minetest.register_craft({
--[[minetest.register_craft({
output = "fachwerk:"..basename.."_1",
recipe = { {"fachwerk:"..basename }} });
@ -111,11 +96,7 @@ fachwerk.register_fachwerk = function( basename, texture, description, craft_fro
minetest.register_craft({
output = "fachwerk:"..basename,
recipe = { {"fachwerk:"..basename.."_cross" }} });--]]
recipe = { {"fachwerk:"..basename.."_cross" }} });
]]
end
if minetest.setting_getbool("log_mods") then
minetest.log("action", "[fachwerk] loaded.")
end

View File

@ -1,2 +1,4 @@
fachwerk = {}
dofile(minetest.get_modpath("fachwerk").."/api.lua")
dofile(minetest.get_modpath("fachwerk").."/nodes.lua")
dofile(minetest.get_modpath("fachwerk").."/nodes.lua")

View File

@ -1,5 +1,5 @@
-- Blokck id textur description crafting recepie
-- fachwerk_ truss with ..
-- Node id texturedescription crafting recepie
-- fachwerk_ Timber-framed ...
fachwerk.register_fachwerk( 'clay', 'default_clay.png', 'clay', 'default:clay' );
fachwerk.register_fachwerk( 'brick', 'default_brick.png', 'bricks', 'default:brick' );
@ -8,7 +8,7 @@ fachwerk.register_fachwerk( 'stone_brick', 'default_stone_brick.png', 'stone bri
fachwerk.register_fachwerk( 'cobble', 'default_cobble.png', 'cobble', 'default:cobble' );
fachwerk.register_fachwerk( 'stone', 'default_stone.png', 'stone', 'default:stone' );
--optional fachwerk types you can enable if you like
-- optional fachwerk types you can enable if you like
--[[
fachwerk.register_fachwerk( 'desert_stone','default_desert_stone.png','desert stone', 'default:desert_stone' );
@ -16,18 +16,19 @@ fachwerk.register_fachwerk( 'white', 'wool_white.png', 'white',
fachwerk.register_fachwerk( 'grey', 'wool_grey.png', 'grey', 'wool:grey' );
fachwerk.register_fachwerk( 'yellow', 'wool_yellow.png', 'yellow', 'wool:yellow' );
fachwerk.register_fachwerk( 'wood', 'default_wood.png', 'wood', 'default:wood' );
fachwerk.register_fachwerk( 'junglewood', 'default_junglewood.png', 'junglewood', 'default:junglewood' );]]-- -- you can enable this to get more fachwerk blocks.
fachwerk.register_fachwerk( 'junglewood', 'default_junglewood.png', 'junglewood', 'default:junglewood' );
]]
--nodes wich are not supported by the api
minetest.register_node("fachwerk:framed_glass", {
description = "Fachwerk framed Glass",
description = "Timber-framed Glass",
drawtype = "glasslike_framed_optional",
tiles = {"fachwerk_blank.png", "fachwerk_blank.png^default_glass_detail.png"},
inventory_image = minetest.inventorycube("fachwerk_blank.png"),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
groups = {cracky=3,oddly_breakable_by_hand=3},
groups = {cracky = 3,oddly_breakable_by_hand = 3},
sounds = default.node_sound_glass_defaults(),
})
})