Total clean up using the mod template (fixes #1)

This commit is contained in:
LNJ 2016-10-24 15:31:53 +02:00 committed by JBB
parent a3541be25c
commit ed0d545dc9
7 changed files with 158 additions and 115 deletions

36
LICENSE.txt Normal file
View File

@ -0,0 +1,36 @@
License of source code:
-----------------------
Copyright (C) 2015-2016 JBB <jbb.mail@gmx.de>
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
License of media (textures, sounds, meshes):
--------------------------------------------
(by Authors)
JBB <jbb.mail@gmx.de> (CC BY-SA 3.0):
fachwerk_beam_1.png
fachwerk_beam_2.png
fachwerk_blank.png
fachwerk_cross.png
Details of Licenses:
--------------------
CC BY-SA 3.0:
Attribution-ShareAlike 3.0 Unported
http://creativecommons.org/licenses/by-sa/3.0/

View File

@ -1,40 +1,28 @@
# fachwerk # Minetest Mod Timber-Frame [fachwerk]
version 0.4.9.1 Version 0.4.9.1 Alpha, License: WTFPL/CC BY-SA 3.0
copyright (C) 2015 - 2016 JBB
The fachwerk mod adds timber-framed blocks to Minetest.
It's using a simple API to add new timber-framed blocks
# contributors
License of source code
----------------------
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
License of media (textures)
--------------------------------------
License of textures
Copyright (C) 2015 JBB CC BY-SA 3.0
# TODO
- Make a TNG / AF8 special version
- add new blocks if requested by users
- clean up code
# Screenshots
![Screenshot 1](http://i.imgur.com/JMegjRt.jpg) ![Screenshot 1](http://i.imgur.com/JMegjRt.jpg)
![Screenshot 2](https://forum.minetest.net/download/file.php?mode=view&id=2575 "screenshot by sokomine")
## Description
The fachwerk mod adds timber-framed blocks to Minetest. It has a simple API for
adding new timber-framed nodes.
## Notes
This mod depends on:
* __`default`__ from Minetest Game or similar
It was tested with Minetest 0.4.14, but should run with the most older versions, too.
## More Screenshots
![Screenshot 2](https://forum.minetest.net/download/file.php?mode=view&id=2575 "Screenshot by sokomine")
## Bug reports and suggestions
You can report bugs, suggest ideas and ask questions on
[GitHub](http://github.com/jbbgameich/fachwerk/issues/new), in the
[Minetest Forum](https://forum.minetest.net/viewtopic.php?id=11036) or just
[email](mailto:jbb.mail@gmx.de) me.
## Links
* [GitHub](http://github.com/jbbgameich/fachwerk/)
* [Minetest Forum](https://forum.minetest.net/viewtopic.php?id=11036)

115
api.lua
View File

@ -1,90 +1,97 @@
fachwerk.register_fachwerk = function(basename, texture, description, craft_from) -- mods/fachwerk/api.lua
-- =====================
-- See README.md for licensing and other information.
local group_def = {choppy = 2, oddly_breakable_by_hand = 2, cracky = 3}; function fachwerk.register_fachwerk(basename, texture, description, craft_from)
local group_def = {choppy = 2, oddly_breakable_by_hand = 2, cracky = 3}
minetest.register_node("fachwerk:"..basename, { minetest.register_node("fachwerk:" .. basename, {
description = "Timber-framed "..description, description = "Timber-framed " .. description,
tile_images = { texture.."^fachwerk_blank.png"}, tiles = {texture .. "^fachwerk_blank.png"},
groups = group_def,
sounds = default.node_sound_stone_defaults(),
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = group_def,
sounds = default.node_sound_stone_defaults()
}) })
minetest.register_node("fachwerk:"..basename.."_1", { minetest.register_node("fachwerk:" .. basename .. "_1", {
description = "Timber-framed "..description.." oblique beam 1", description = "Timber-framed " .. description .. " Oblique Beam 1",
tile_images = { tile_images = {
texture.."^fachwerk_blank.png", -- top texture .. "^fachwerk_blank.png", -- top
texture.."^fachwerk_blank.png", -- bottom texture .. "^fachwerk_blank.png", -- bottom
texture.."^fachwerk_beam_1.png", texture .. "^fachwerk_beam_1.png",
texture.."^fachwerk_beam_1.png^[transformFX", texture .. "^fachwerk_beam_1.png^[transformFX",
texture.."^fachwerk_beam_1.png^[transformFX", texture .. "^fachwerk_beam_1.png^[transformFX",
texture.."^fachwerk_beam_1.png" }, texture .. "^fachwerk_beam_1.png"
groups = group_def, },
sounds = default.node_sound_stone_defaults(),
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = group_def,
sounds = default.node_sound_stone_defaults()
}) })
-- TODO: is this one really needed? the node above covers most of that already -- TODO: is this one really needed? the node above covers most of that already
minetest.register_node("fachwerk:"..basename.."_2", { minetest.register_node("fachwerk:" .. basename .. "_2", {
description = "Timber-framed "..description.." oblique beam 2", description = "Timber-framed " .. description .. " Oblique Beam 2",
tile_images = { tiles = {
texture.."^fachwerk_blank.png", -- top texture .. "^fachwerk_blank.png", -- top
texture.."^fachwerk_blank.png", -- bottom texture .. "^fachwerk_blank.png", -- bottom
texture.."^fachwerk_beam_2.png", texture .. "^fachwerk_beam_2.png",
texture.."^fachwerk_beam_2.png^[transformFX", texture .. "^fachwerk_beam_2.png^[transformFX",
texture.."^fachwerk_beam_2.png^[transformFX", texture .. "^fachwerk_beam_2.png^[transformFX",
texture.."^fachwerk_beam_2.png" }, texture .. "^fachwerk_beam_2.png"
groups = group_def, },
sounds = default.node_sound_stone_defaults(),
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
})
minetest.register_node("fachwerk:"..basename.."_cross", {
description = "Timber-framed "..description.." cross",
tile_images = {texture.."^fachwerk_cross.png"},
groups = group_def, groups = group_def,
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults()
}) })
--crafting-- minetest.register_node("fachwerk:" .. basename .. "_cross", {
description = "Timber-framed " .. description .. " Cross",
tiles = {texture .. "^fachwerk_cross.png"},
groups = group_def,
sounds = default.node_sound_stone_defaults()
})
-- yields 2; after all we did add a lot of wood --
-- Crafting
--
-- yields 8, after all we did add a lot of wood
minetest.register_craft({ minetest.register_craft({
output = "fachwerk:"..basename.." 8", output = "fachwerk:" .. basename .. " 8",
recipe = { recipe = {
{"group:wood", "group:wood", "group:wood"}, {"group:wood", "group:wood", "group:wood"},
{"group:wood", craft_from, "group:wood"}, {"group:wood", craft_from, "group:wood"},
{"group:wood", "group:wood", "group:wood"}, {"group:wood", "group:wood", "group:wood"}
} }
}); })
minetest.register_craft({ minetest.register_craft({
output = "fachwerk:"..basename.."_cross 8", output = "fachwerk:" .. basename .. "_cross 8",
recipe = { recipe = {
{"group:wood", craft_from, "group:wood"}, {"group:wood", craft_from, "group:wood"},
{craft_from, "group:wood", craft_from}, {craft_from, "group:wood", craft_from},
{"group:wood", craft_from, "group:wood"}, {"group:wood", craft_from, "group:wood"}
} }
}); })
minetest.register_craft({ minetest.register_craft({
output = "fachwerk:"..basename.."_1 8", output = "fachwerk:" .. basename .. "_1 8",
recipe = { recipe = {
{craft_from,"group:wood", craft_from}, {craft_from, "group:wood", craft_from},
{craft_from, craft_from, craft_from}, {craft_from, craft_from, craft_from},
{"group:wood", craft_from, craft_from}, {"group:wood", craft_from, craft_from}
} }
}); })
minetest.register_craft({ minetest.register_craft({
output = "fachwerk:"..basename.."_2 8", output = "fachwerk:" .. basename .. "_2 8",
recipe = { recipe = {
{craft_from, craft_from, "group:wood"}, {craft_from, craft_from, "group:wood"},
{craft_from, craft_from, craft_from }, {craft_from, craft_from, craft_from },
{craft_from, "group:wood", craft_from}, {craft_from, "group:wood", craft_from}
} }
}); })
end end

2
description.txt Normal file
View File

@ -0,0 +1,2 @@
This mod adds timber-framed clay, bricks, cobble, stone and stone bricks to the game.
There is a simple API for adding new timeber-framed nodes.

View File

@ -1,4 +1,10 @@
-- mods/fachwerk/init.lua
-- ======================
-- See README.md for licensing and other information.
fachwerk = {} fachwerk = {}
dofile(minetest.get_modpath("fachwerk").."/api.lua") local modpath = minetest.get_modpath("fachwerk")
dofile(minetest.get_modpath("fachwerk").."/nodes.lua")
dofile(modpath .."/api.lua")
dofile(modpath .. "/nodes.lua")

1
mod.conf Normal file
View File

@ -0,0 +1 @@
name = Timber-Frame

View File

@ -1,32 +1,35 @@
-- Node id texturedescription crafting recepie -- mods/fachwerk/nodes.lua
-- fachwerk_ Timber-framed ... -- =======================
-- See README.md for licensing and other information.
fachwerk.register_fachwerk( "clay", "default_clay.png", "clay", "default:clay" ); -- Optional fachwerk types you can enable if you like
fachwerk.register_fachwerk( "brick", "default_brick.png", "bricks", "default:brick" ); -- Registers desert stone, white, grey and yellow wool, wood and junglewood
fachwerk.register_fachwerk( "stone_brick", "default_stone_brick.png", "stone bricks", "default:stonebrick" ); local additional_fachwerk_types = false
fachwerk.register_fachwerk( "cobble", "default_cobble.png", "cobble", "default:cobble" ); -- fachwerk.register_fachwerk(basename, texture, description, craft_from)
fachwerk.register_fachwerk( "stone", "default_stone.png", "stone", "default:stone" ); fachwerk.register_fachwerk("clay", "default_clay.png", "Clay", "default:clay")
fachwerk.register_fachwerk("brick", "default_brick.png", "Bricks", "default:brick")
fachwerk.register_fachwerk("stone_brick", "default_stone_brick.png", "Stone Brick", "default:stonebrick")
fachwerk.register_fachwerk("cobble", "default_cobble.png", "Cobble", "default:cobble")
fachwerk.register_fachwerk("stone", "default_stone.png", "Stone", "default:stone")
fachwerk.register_fachwerk( "stone", "default_stone.png", "stone", "default:stone" ); if additional_fachwerk_types == true then
fachwerk.register_fachwerk("desert_stone", "default_desert_stone.png", "Desert Stone", "default:desert_stone")
fachwerk.register_fachwerk("white", "wool_white.png", "White Wool", "wool:white")
fachwerk.register_fachwerk("grey", "wool_grey.png", "Grey Wool", "wool:grey")
fachwerk.register_fachwerk("yellow", "wool_yellow.png", "Yellow Wool", "wool:yellow")
fachwerk.register_fachwerk("wood", "default_wood.png", "Wood", "default:wood")
fachwerk.register_fachwerk("junglewood", "default_junglewood.png", "Junglewood", "default:junglewood")
end
-- optional fachwerk types you can enable if you like --
--[[ -- Special Nodes (these are not supported by the API)
--
fachwerk.register_fachwerk( "desert_stone","default_desert_stone.png","desert stone", "default:desert_stone" );
fachwerk.register_fachwerk( "white", "wool_white.png", "white", "wool: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" );
]]
--nodes wich are not supported by the api
minetest.register_node("fachwerk:framed_glass", { minetest.register_node("fachwerk:framed_glass", {
description = "Timber-framed Glass", description = "Timber-framed Glass",
drawtype = "glasslike_framed_optional", drawtype = "glasslike_framed_optional",
tiles = {"fachwerk_blank.png", "fachwerk_blank.png^default_glass_detail.png"}, tiles = {"fachwerk_blank.png^default_glass_detail.png", "default_glass_detail.png"},
inventory_image = minetest.inventorycube("fachwerk_blank.png"), inventory_image = minetest.inventorycube("fachwerk_blank.png"),
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,