changed scripts and names

This commit is contained in:
elettrico 2018-11-07 00:13:15 -03:00
parent 86c2ee03eb
commit 1f82affb95
34 changed files with 76 additions and 151 deletions

View File

@ -5,7 +5,7 @@ Minetest mod for adding fancy bricks blocks
Simply copy inside mods directory and enable it
### files
* init.lua: ba
* init.lua: base file, load others
* functions.lua: collection of useful functions
* bricks.lua: nodes definitions
* test.lua: nodes definitions used during develpment for testing, normally unused
@ -21,6 +21,7 @@ If you wish to use generate_test.sh for testing other textures or in other mods,
* if the filename ends with "-sp", "-sp" is removed in node name and description, and the node is registered with stairsplus
* "-" will become space in description and _ in node name
* "test_" will be added to the node name
so "something-very-good.png" will become a node "something very good" identified by "bloqus_bricks:test_something_very_good", and "something-sloppy-sp.png" will become a node "something sloppy" identified by "bloqus_bricks:test_something_sloppy" and is registered with stairsplus so you can use it in saw and have slopes, etc
non-png files will be ignored

View File

@ -1,104 +1,33 @@
-- see LICENSE.txt
--
-- add nodes for basic materials
-- define simple nodes (no complex textures, light and facedir params)
local simple_nodes = {}
-- format: node description, node name, node side texture, node up and down texture
function get_simple_nodes()
simple_nodes = {
{"blue bricks" , "blue_bricks" , "bricks_blue" , ""},
{"chipped bricks" , "chipped_bricks", "bricks_chipped", ""},
{"dark green bricks", "dark_green_bricks", "bricks_dark_green", ""},
{"oblique bricks" , "oblique_bricks", "bricks_oblique", ""},
{"square bricks" , "square_bricks" , "bricks_square", ""},
{"vertical stone bricks" , "vertical_stone_bricks", "bricks_vertical_stone", ""},
{"natural bricks" , "natural_bricks", "bricks_natural", ""},
{"old bricks" , "old_bricks" , "bricks_old", ""},
{"blue square bricks","blue_square_bricks", "bricks_square_blue", ""},
{"tiled blocks" , "tiled_blocks" , "tiled_blocks" , ""},
{"rusty concrete", "rusty_concrete", "rusty_concrete_wall" , "concrete"},
{"klinker" , "klinker" , "klinker", ""},
{"path" , "path" , "path", ""},
{"little columns", "little_columns", "little_columns", ""}, -- need a top texture
{"blue cobble" , "blue_cobble", "cobble_blue", ""},
{"color cobble", "color_cobble", "cobble_color", ""},
{"stones cobble","stones_cobble","cobble_stones", ""},
{"copper plates" , "copper_plates", "plates_copper", ""},
{"hexagon plates", "hexagon_plates", "plates_hexagon", ""},
{"romboid plates", "romboid_plates", "plates_romboids", ""},
{"circular plates", "circular_plates", "plates_circular", ""},
{"irregular plates", "irregular_plates", "plates_irregular", ""},
{"rocks 1", "rocks_1", "rocks1", ""},
{"rocks 2", "rocks_2", "rocks2", ""},
{"rocks 3", "rocks_3", "rocks3", ""},
{"rocks 4", "rocks_4", "rocks4", ""},
{"rocks 5", "rocks_5", "rocks5", ""},
{"decorative circles" , "decorative_circles", "decorative_circles", ""},
{"decorative rectangles", "decorative_rectangles", "decorative_rectangles", ""},
{"brown marble" , "brown_marble", "marble_brown", ""},
{"white and brown marble", "wb_marble", "marble_white_brown", ""},
{"bolted metal" , "bolted_metal", "metal_bolted", ""},
{"metal rusted plate", "metal_rusted_plate", "metal_rusted_plate", ""},
{"rusty metal" , "rusty_metal", "metal_rusty", ""},
{"metal plates dark" , "metal_plates_dark", "metal_plates_dark", ""},
{"ventilation grid" , "ventilation_grid", "ventilation_grid", ""},
{"blue and white mosaic" , "mosaic_blue_white", "mosaic_blue_white", ""},
{"diamonds mosaic" , "diamonds_mosaic", "mosaic_diamonds", ""},
{"green squares mosaic" , "green_squares_mosaic", "mosaic_squares_green", ""},
{"sun mosaic" , "sun_mosaic", "mosaic_sun", ""},
{"black and white mosaic" , "bw_mosaic", "mosaic_bw", ""},
{"mossy damaged concrete", "mossy_damaged_concrete", "mossy_damaged_concrete", ""},
{"mossy tiles" , "mossy_tiles", "mossy_tiles", ""},
{"mossy bricks" , "mossy_bricks", "mossy_bricks", ""},
{"basalt stones" , "basalt_stones", "stone_basalt", ""},
{"damaged brown stone", "damaged_brown_stone", "stone_brown_damaged", ""},
{"brown stones" , "brown_stones", "stone_brown", ""},
{"colored stones" , "colored_stones", "stone_colored", ""},
{"composite stones" , "composite_stones", "stone_composite", ""},
{"grassy stones 1" , "grassy_stones_1", "stone_grassy_1", ""},
{"grassy stones 2" , "grassy_stones_2", "stone_grassy_2", ""},
{"circular stones" , "circular_stones", "stone_circular", ""},
{"tundra stone" , "tundra_stone", "stone_tundra", ""},
{"wall with plants", "wall_plants", "wall_plants", ""},
{"bricks 1h 3v linear red","br13li_red","br13li-red_1_bricks-1h-3v-linear-red","","1"},
{"bricks 2h 1v linear grey 2964b","br21li_grey","br21li-grey_1_bricks-2h-1v-linear-grey-2964b","","1"},
{"bricks 2h 2v linear blue c3023","br22li_blue","br22li-blue_0_bricks-2h-2v-linear-blue-c3023","","0"},
{"bricks 2h 2v linear dark c3033","br22li_dark","br22li-dark_1_bricks-2h-2v-linear-dark-c3033","","1"},
{"bricks 2h 2v","br22li_grey","br22li-grey_1_bricks-2h-2v_linear-grey-c2807-sp","","1"},
{"bricks 2h 4v linear blue","br24li_blue","br24li-blue_1_bricks-2h-4v-linear-blue","","1"},
{"bricks 2h 6v linear brown black c2441","br26li_brown","br26li-brown_0_bricks-2h-6v-linear-brown-black-c2441","","0"},
{"bricks 2h 6v linear white c2348","br26li_white","br26li-white_0_bricks-2h-6v-linear-white-c2348","","0"},
{"bricks 3h 10v decorative red blue c2852b","br310de_red","br310de-red_0_bricks-3h-10v-decorative-red-blue-c2852b","","0"},
{"bricks 3h 10v linear red blue c2852a","br310li_redblue","br310li-redblue_0_bricks-3h-10v-linear-red-blue-c2852a","","0"},
{"bricks 3h 1v linear grey","br31li_grey","br31li-grey_1_bricks-3h-1v-linear-grey","","1"},
{"bricks 3h 2v grey 2964","br32li_grey","br32li-grey_1_bricks-3h-2v-grey-2964","","1"},
{"bricks 3h 3v chipped red","br33ch_red","br33ch-red_0_bricks-3h-3v-chipped-red","","0"},
{"bricks 3h 3v composite c0238","br33co_multi","br33co-multi_1_bricks-3h-3v-composite-c0238","","1"},
{"bricks 3h 3v linear red old","br33li_red","br33li-red_1_bricks-3h-3v-linear-red-old","","1"},
{"bricks 3h 3v square red blue","br33sq_redblue","br33sq-redblue_1_bricks-3h-3v-square-red-blue","","1"},
{"bricks 3h 4v linear red c2377","br34li_red","br34li-red_1_bricks-3h-4v-linear-red-c2377","","1"},
{"bricks 3h 4v linear red blue c2399","br34li_redblue","br34li-redblue_0_bricks-3h-4v-linear-red-blue-c2399","","0"},
{"bricks 3h 7v linear red c2663","br37li_red","br37li-red_0_bricks-3h-7v-linear-red-c2663","","0"},
{"bricks 4h 4v chipped red","br44ch_red","br44ch-red_1_bricks-4h-4v-chipped-red","","1"},
{"bricks 4h 4v square blue","br44sq_blue","br44sq-blue_1_bricks-4h-4v-square-blue","","1"},
{"bricks 4h 4v square red c3028b","br44sq_red","br44sq-red_1_bricks-4h-4v-square-red-c3028b","","1"},
{"bricks 4h 8v linear blue c2710","br48li_blue","br48li-blue_1_bricks-4h-8v-linear-blue-c2710","","1"},
{"bricks 4h 8v linear red c0207","br48li_red","br48li-red_0_bricks-4h-8v-linear-red-c0207","","0"},
{"bricks 4h 8v linear red blue c2371","br48li_redblue","br48li-redblue_0_bricks-4h-8v-linear-red-blue-c2371","","0"},
{"bricks 5h 2v linear red","br52li_red","br52li-red_1_bricks-5h-2v-linear-red","","1"},
{"bricks 5v 5h chipped dark green","br55ch_green","br55ch-green_0_bricks-5v-5h-chipped-dark-green","","0"},
{"bricks 7h7v square red c3028","br77sq_red","br77sq-red_1_bricks-7h7v-square-red-c3028","","1"},
}
-- generate nodes
function add_simple_nodes(simple_nodes) {
for _, row in ipairs(simple_nodes) do
local desc = row[1]
local name = row[2]
local texture_side = row[3]
local texture_updown = row[4]
if texture_updown == "" then
texture_updown = texture_side
end
-- node
minetest.register_node(modname..":"..name, {
description = desc,
tiles = {
texture_updown..".png",
texture_updown..".png",
texture_side..".png",
texture_side..".png",
texture_side..".png",
texture_side..".png",
},
groups = {cracky=1},
paramtype = "light",
paramtype2 = "facedir",
})
end
return simple_nodes
end

View File

@ -33,6 +33,7 @@ function add_simple_nodes(simple_nodes)
},
groups = {cracky=1},
paramtype = "light",
paramtype2 = "facedir"
}
-- node name
local nodename = modname..":"..name

View File

@ -6,26 +6,53 @@
# create an array with all the .png files inside textures
arr=(./textures/*.png)
echo "function get_simple_nodes() " > test.lua
echo "simple_nodes = {" >> test.lua
# destination
DEST=bricks.lua
echo "function get_simple_nodes() " > $DEST
echo "simple_nodes = {" >> $DEST
# iterate through array using a counter
for f in "${arr[@]}"; do
BLOCK=""
SP=0
# take basename and split it at underscore, format is like this: register-name_spflag_block-description.png
FILE=`basename "$f" .png`
if [[ "$FILE" == *-sp ]]
IFS=_ read -ra arr <<< "$FILE"
REGISTERNAME=${arr[0]}
REGISTERSP=${arr[1]}
BLOCKDESC=${arr[2]}
# if the filename contains the sp flag, put up the flag for registering with stairs plus
if [[ "$REGISTERSP" -eq "1" ]]
then
BASE=${FILE//-sp/}
SP=1
else
BASE=$FILE
SP=0
fi
BLOCK=${BASE//-/_}
NAME=${BASE//-/ }
echo '{"'$NAME'","'test_$BLOCK'","'$FILE'","",'$SP'}, ' >> test.lua
echo '{"'$NAME'","'test_$BLOCK'","'$FILE'","",'$SP'}, '
# change "-" to "_" in registername
REGISTERNAME=${REGISTERNAME//-/_}
# si no tenemos nombre, usamos el base
if [[ -z "$BLOCKDESC" ]]
then
BLOCKDESC=${REGISTERNAME//-/ }
else
BLOCKDESC=${BLOCKDESC//-/ }
fi
echo
echo "registering '$f' as:"
echo " file basename...: $FILE"
echo " node description: $BLOCKDESC"
echo " node name.......: $REGISTERNAME"
echo " stairs plus.....: $REGISTERSP -> $SP"
LINE="{\"$BLOCKDESC\",\"$REGISTERNAME\",\"$FILE\",\"\",\"$SP\"}, "
echo " $LINE"
# -- 1: node description,
# -- 2: node name,
# -- 3: node side texture,
# -- 4: node up and down texture or "" (in this case side texture is used)
# -- 5: if 1, register node with stairsplus
echo $LINE >> $DEST
done
echo "}" >> test.lua
echo "return simple_nodes" >> test.lua
echo "end" >> test.lua
echo "}" >> $DEST
echo "return simple_nodes" >> $DEST
echo "end" >> $DEST

View File

@ -9,9 +9,9 @@ modpath = minetest.get_modpath(modname)
-- include basic nodes files
dofile(modpath.."/functions.lua")
-- load *test* nodes
dofile(modpath.."/test.lua")
-- dofile(modpath.."/test.lua")
-- load real nodes
-- dofile(modpath.."/bricks.lua")
dofile(modpath.."/bricks.lua")
-- register simple nodes

View File

@ -1,33 +0,0 @@
function get_simple_nodes()
simple_nodes = {
{"bricks chipped red","test_bricks_chipped_red","bricks-chipped-red-sp","",1},
{"bricks composite c0238","test_bricks_composite_c0238","bricks-composite-c0238","",0},
{"bricks composite dark green","test_bricks_composite_dark_green","bricks-composite-dark-green","",0},
{"bricks h10 red blue c2852a","test_bricks_h10_red_blue_c2852a","bricks-h10-red-blue-c2852a","",0},
{"bricks h10 red blue c2852b","test_bricks_h10_red_blue_c2852b","bricks-h10-red-blue-c2852b","",0},
{"bricks h2 blue c3023","test_bricks_h2_blue_c3023","bricks-h2-blue-c3023","",0},
{"bricks h2 dark c3033","test_bricks_h2_dark_c3033","bricks-h2-dark-c3033","",0},
{"bricks h2 grey c2807","test_bricks_h2_grey_c2807","bricks-h2-grey-c2807","",0},
{"bricks h3 red old","test_bricks_h3_red_old","bricks-h3-red-old","",0},
{"bricks h3 red","test_bricks_h3_red","bricks-h3-red","",0},
{"bricks h3v3 red c3028b","test_bricks_h3v3_red_c3028b","bricks-h3v3-red-c3028b","",0},
{"bricks h3v3 red c3028","test_bricks_h3v3_red_c3028","bricks-h3v3-red-c3028","",0},
{"bricks h3v3 square red blue","test_bricks_h3v3_square_red_blue","bricks-h3v3-square-red-blue","",0},
{"bricks h4 blue","test_bricks_h4_blue","bricks-h4-blue","",0},
{"bricks h4 red blue c2399","test_bricks_h4_red_blue_c2399","bricks-h4-red-blue-c2399","",0},
{"bricks h4 red c2377","test_bricks_h4_red_c2377","bricks-h4-red-c2377","",0},
{"bricks h4v4 square blue","test_bricks_h4v4_square_blue","bricks-h4v4-square-blue","",0},
{"bricks h6 brown black c2441","test_bricks_h6_brown_black_c2441","bricks-h6-brown-black-c2441","",0},
{"bricks h6 white c2348","test_bricks_h6_white_c2348","bricks-h6-white-c2348","",0},
{"bricks h7 red c2663","test_bricks_h7_red_c2663","bricks-h7-red-c2663","",0},
{"bricks h8 blue c2710","test_bricks_h8_blue_c2710","bricks-h8-blue-c2710","",0},
{"bricks h8 red c0207","test_bricks_h8_red_c0207","bricks-h8-red-c0207","",0},
{"bricks h8 red c2371","test_bricks_h8_red_c2371","bricks-h8-red-c2371","",0},
{"bricks oblique","test_bricks_oblique","bricks-oblique","",0},
{"bricks v2 grey 2964b","test_bricks_v2_grey_2964b","bricks-v2-grey-2964b","",0},
{"bricks v3 grey 2964","test_bricks_v3_grey_2964","bricks-v3-grey-2964","",0},
{"bricks v3 grey","test_bricks_v3_grey","bricks-v3-grey","",0},
{"bricks v5 red c3021","test_bricks_v5_red_c3021","bricks-v5-red-c3021","",0},
}
return simple_nodes
end

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB