From 35e6ae5fec772229dd08ba39e0e58359eef7ac3d Mon Sep 17 00:00:00 2001 From: JBBgameich Date: Wed, 14 Sep 2016 22:16:54 +0200 Subject: [PATCH] clean up code, change names --- README.md | 2 +- api.lua | 39 ++++++++++----------------------------- init.lua | 4 +++- nodes.lua | 15 ++++++++------- 4 files changed, 22 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index b291e51..a7ce87f 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/api.lua b/api.lua index 5898afa..76d9272 100644 --- a/api.lua +++ b/api.lua @@ -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 diff --git a/init.lua b/init.lua index 8c9b2a1..fedfe42 100644 --- a/init.lua +++ b/init.lua @@ -1,2 +1,4 @@ +fachwerk = {} + dofile(minetest.get_modpath("fachwerk").."/api.lua") -dofile(minetest.get_modpath("fachwerk").."/nodes.lua") \ No newline at end of file +dofile(minetest.get_modpath("fachwerk").."/nodes.lua") diff --git a/nodes.lua b/nodes.lua index d610185..b6cfdf2 100644 --- a/nodes.lua +++ b/nodes.lua @@ -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(), -}) \ No newline at end of file +})