diff --git a/README.md b/README.md deleted file mode 100644 index eb5b2e1..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -tulips -====== - -Find and farm tulips for dyes in minetest \ No newline at end of file diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..0049c0c --- /dev/null +++ b/depends.txt @@ -0,0 +1,3 @@ +unifieddyes +farming +plants_lib diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..823d2e4 --- /dev/null +++ b/init.lua @@ -0,0 +1,126 @@ +local mod = "tulips" +tulips_table = {} +img = "" +tulips_seed_diff = 420420 +minetest.register_node(mod..":plant", {--register wild plant + tile_images = {img}, + inventory_image = img, + description = hue2.." tulip", + drop = "", + drawtype = "plantlike", + paramtype = 'light', + sunlight_propagates = true, + walkable = false, + visual_scale = 1.3, + groups = { snappy = 3,flammable=2, floored=1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = { -0.25, -0.5, -0.25, 0.25, -3/16, 0.25 }, + }, +}) + + +for i = 1, 12 do + local hue = HUES[i] + local hue2 = HUES2[i] + local img = mod.."_"..hue..".png" + print(hue) + --farming + farming:add_plant(mod..":"..hue, {"tulips:"..hue.."_seeds",mod..":"..hue.."_sprout"}, 60, 2) + tulips_table[i] = mod..":"..hue + --node + --tulip + minetest.register_node(mod..":"..hue, {--register wild plant + tile_images = {img}, + inventory_image = img, + description = hue.." tulip", + drop = { + max_items = 3, + items = { + { items = {mod..":"..hue.."_seeds"} }, + { items = {mod..":"..hue.."_seeds"}, rarity = 2}, + { items = {mod..":"..hue.."_seeds"}, rarity = 5}, + } + }, + drawtype = "plantlike", + paramtype = 'light', + sunlight_propagates = true, + walkable = false, + visual_scale = 1.3, + groups = { snappy = 3,flammable=2, floored=1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = { -3/16, -8/16, -3/16, 3/16, 10/16, 3/16 }, + }, + }) + --sprout + img = "tulips_sprout.png" + minetest.register_node(mod..":"..hue.."_sprout", {--register wild plant + tile_images = {img}, + inventory_image = img, + description = hue2.." tulip", + drop = "", + drawtype = "plantlike", + paramtype = 'light', + sunlight_propagates = true, + walkable = false, + visual_scale = 1.3, + groups = { snappy = 3,flammable=2, floored=1, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = { -3/16, -8/16, -3/16, 3/16, 8/16, 3/16 }, + }, + }) + + --seed + img = mod.."_seeds.png" + minetest.register_node(mod..":"..hue.."_seeds", {--register wild plant + tile_images = {img}, + inventory_image = img, + description = hue.." tulip seeds", + drawtype = "nodebox", + paramtype = 'light', + sunlight_propagates = true, + walkable = false, + visual_scale = 1.3, + groups = { snappy = 3,flammable=2, floored=1, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.45, 0.5} + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.45, -0.5, 0.5, -0.5, 0.5} + }, + }, + + }) + + --craft + minetest.register_craft( { + type = "shapeless", + output = "unifieddyes:" .. hue, + recipe = { + mod..":" .. hue, + }, + }) +end + +--spawning +plantslib:spawn_on_surfaces({ + spawn_delay = 1800, + spawn_plants = tulips_table, + avoid_radius = 10, + spawn_chance = 30, + spawn_surfaces = {"default:dirt_with_grass"}, + avoid_nodes = {"group:flower"}, + seed_diff = tulips_seed_diff, + light_min = 9 +}) diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000..aac5042 --- /dev/null +++ b/readme.txt @@ -0,0 +1,21 @@ + _______ __ __ ___ ___ _______ _______ +| || | | || | | | | || | +|_ _|| | | || | | | | _ || _____| + | | | |_| || | | | | |_| || |_____ + | | | || |___ | | | ___||_____ | + | | | || || | | | _____| | + |___| |_______||_______||___| |___| |_______| + +BY: bas080 +DESCRIPTION: Obtain dyes more rapidly by farming them +VERSION: 0.1 +LICENSE: WTFPL +FORUM: http://forum.minetest.net/viewtopic.php?id=5332 + +Changelog +--------- +0.1 +* Spawn on abm and very rarely (plants_lib) +* Drops only seeds +* Can be crafted to dyes +* Seeds grow into tulips over time (farming) diff --git a/screenshots/forum_0.png b/screenshots/forum_0.png new file mode 100644 index 0000000..ce193b7 Binary files /dev/null and b/screenshots/forum_0.png differ diff --git a/screenshots/forum_1.png b/screenshots/forum_1.png new file mode 100644 index 0000000..fba26ff Binary files /dev/null and b/screenshots/forum_1.png differ diff --git a/screenshots/forum_2.png b/screenshots/forum_2.png new file mode 100644 index 0000000..0cd602d Binary files /dev/null and b/screenshots/forum_2.png differ diff --git a/textures/gentextures.sh b/textures/gentextures.sh new file mode 100755 index 0000000..c56c1b1 --- /dev/null +++ b/textures/gentextures.sh @@ -0,0 +1,157 @@ +#!/bin/bash + +if [ -z "`which convert`" ] ; then { + echo "Please install Imagemagick." + exit 1 +} fi + +if [ -z "`which bc`" ] ; then { + echo "Please install GNU bc." + exit 1 +} fi + +if [ $1 = "-t" ] ; then { + TINT_OVERLAY=$1 + BASE=$2 + COMPOSITE=$3 +} else { + TINT_OVERLAY="" + BASE=$1 + COMPOSITE=$2 +} fi + +if [ -z $1 ] || [ $1 == "--help" ] || [ $1 == "-h" ] || [[ $1 == "-t" && -z $3 ]] ; then { + + echo -e "\nUsage: +\ngentextures.sh basename [overlay_filename] +gentextures.sh -t basename overlay_filename +\nThis script requires up to three parameters which supply the base filename +of the textures, an optional overlay, and possibly the '-t' switch. The +'basename' is the first part of the filename that your textures will use when +your mod is done, which should almost always be the same as the one-word name +of your mod. For example, if you supply the word 'mymod', this script will +produce filenames like mymod_red.png or 'mymod_dark_blue_s50.png'. The +texture that this script will read and recolor is derived from this parameter, +and will be of the form 'basename_base.png', i.e. 'mymod_base.png'. +\nYou can also supply an optional overlay image filename. This image will be +composited onto the output files after they have been colorized, but without +being modified. This is useful when you have some part of your base image +that will either get changed undesirably (for example, the mortar among +several bricks, or the shading detail of a stone pattern). Simply draw two +images: one containing the whole image to be colored, and one containing the +parts that should not be changed, with either full or partial alpha +transparency where the re-colored base image should show through. Skilled use +of color and alpha on this overlay can lead to some interesting effects. +\nIf you add '-t' as the first parameter, the script will switch to 'tint +overlay' mode. For this mode to work, you must also supply the base name as +usual, and you must include an overlay image filename. Rather than re-color +the base texture, the script will alter the hue/saturation/value of the +overlay texture file instead, and leave the base texture unchanged. When +using this mode, the base texture should be drawn in some neutral color, but +any color is fine if it results in what you wanted.\n" + exit 1 +} fi + +if [[ ! -e $BASE"_base.png" ]]; then { + echo -e "\nThe basename '"$BASE"_base.png' was not found." + echo -e "\nAborting.\n" + exit 1 +} fi + +if [[ ! -z $COMPOSITE && ! -e $COMPOSITE ]]; then { + echo -e "\nThe requested composite file '"$COMPOSITE"' was not found." + echo -e "\nAborting.\n" + exit 1 +} fi + +convert $BASE"_base.png" -modulate 1,2,3 tempfile.png 1>/dev/null 2>/dev/null + +if (( $? )) ; then { + echo -e "\nImagemagick failed while testing the base texture file." + echo -e "\nEither the base file '"$BASE"_base.png' isn't an image," + echo "or it is broken, or Imagemagick itself just didn't work." + echo -e "\nPlease check and correct your base image and try again." + echo -e "\nAborting.\n" + exit 1 +} fi + +if [ ! -z $COMPOSITE ] ; then { + convert $BASE"_base.png" -modulate 1,2,3 $COMPOSITE -composite tempfile.png 1>/dev/null 2>/dev/null + + if (( $? )) ; then { + echo -e "\nImagemagick failed while testing the composite file." + echo -e "\nEither the composite file '"$COMPOSITE"' isn't an image" + echo "or it is broken, or Imagemagick itself just didn't work." + echo -e "\nPlease check and correct your composite image and try again." + echo -e "\nAborting.\n" + exit 1 + } fi +} fi + +rm tempfile.png + +base_colors="red orange yellow lime green aqua cyan skyblue blue violet magenta redviolet" + +echo -e -n "\nGenerating filenames based on "$BASE"_base.png" +if [ ! -z $COMPOSITE ] ; then { + echo "," + echo -n "using "$COMPOSITE" as an overlay" +} fi + +if [ ! -z $TINT_OVERLAY ] ; then { + echo "," + echo -n "and tinting the overlay instead of the base texture" +} fi + +echo -e "...\n" + +mkdir -p generated-textures + +function generate_texture () { + name=$1 + h=$2 + s=$3 + v=$4 + if [ -z $TINT_OVERLAY ]; then { + if [ -z $COMPOSITE ]; then { + convert $BASE"_base.png" -modulate $v,$s,$h "generated-textures/"$BASE"_"$name".png" + } else { + convert $BASE"_base.png" -modulate $v,$s,$h $COMPOSITE -composite "generated-textures/"$BASE"_"$name".png" + } fi + } else { + convert $COMPOSITE -modulate $v,$s,$h MIFF:- | composite MIFF:- $BASE"_base.png" "generated-textures/"$BASE"_"$name".png" + } fi +} + +hue=0 +for color_name in $base_colors ; do + hue2=`echo "scale=10; ("$hue"*200/360)+100" |bc` + echo $color_name "("$hue" degrees)" + echo " dark" + generate_texture "dark_"$color_name $hue2 100 33 + echo " medium" + generate_texture "medium_"$color_name $hue2 100 66 + echo " full" + generate_texture $color_name $hue2 100 100 + echo " light" + generate_texture "light_"$color_name $hue2 100 150 + echo " dark, 50% saturation" + generate_texture "dark_"$color_name"_s50" $hue2 50 33 + echo " medium, 50% saturation" + generate_texture "medium_"$color_name"_s50" $hue2 50 66 + echo " full, 50% saturation" + generate_texture $color_name"_s50" $hue2 50 100 + hue=$((hue+30)) +done + +echo "greyscales" +echo " black" +generate_texture black 0 0 15 +echo " dark grey" +generate_texture darkgrey 0 0 50 +echo " medium grey" +generate_texture grey 0 0 100 +echo " light grey" +generate_texture lightgrey 0 0 150 +echo " white" +generate_texture white 0 0 190 diff --git a/textures/listcolors.sh b/textures/listcolors.sh new file mode 100755 index 0000000..8038c05 --- /dev/null +++ b/textures/listcolors.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +pushd . >/dev/null + +cd textures + +echo -e "\n\nFull-saturation colors:" +echo -e "-----------------------\n" + +for i in `ls *dark*.png|grep -v _s50|grep -v paint|grep -v black` ; do + rgb=`convert $i -crop 1x1+8+11 -depth 8 txt: |grep "0,0: (" |cut -f 2- -d "(" |cut -f 1-3 -d ","` + color=`basename $i .png | sed 's/_/ /g; s/unifieddyes //; s/s50/50% saturation/'` + printf "%-32s %-12s %s\n" "$color" "$rgb" "$i" +done |sort + +for i in `ls *medium*.png|grep -v _s50|grep -v paint|grep -v black` ; do + rgb=`convert $i -crop 1x1+8+11 -depth 8 txt: |grep "0,0: (" |cut -f 2- -d "(" |cut -f 1-3 -d ","` + color=`basename $i .png | sed 's/_/ /g; s/unifieddyes //; s/s50/50% saturation/'` + printf "%-32s %-12s %s\n" "$color" "$rgb" "$i" +done |sort + +for i in `ls *.png|grep -v medium |grep -v dark|grep -v _s50|grep -v paint|grep -v black|grep -v titanium` ; do + rgb=`convert $i -crop 1x1+8+11 -depth 8 txt: |grep "0,0: (" |cut -f 2- -d "(" |cut -f 1-3 -d ","` + color=`basename $i .png | sed 's/_/ /g; s/unifieddyes //; s/s50/50% saturation/'` + printf "%-32s %-12s %s\n" "$color" "$rgb" "$i" +done |sort + + +echo -e "\nLow-saturation colors:" +echo -e "----------------------\n" + +for i in `ls *dark*_s50.png|grep -v paint|grep -v black` ; do + rgb=`convert $i -crop 1x1+8+11 -depth 8 txt: |grep "0,0: (" |cut -f 2- -d "(" |cut -f 1-3 -d ","` + color=`basename $i .png | sed 's/_/ /g; s/unifieddyes //; s/s50/50% saturation/'` + printf "%-32s %-12s %s\n" "$color" "$rgb" "$i" +done |sort + +for i in `ls *medium*_s50.png|grep -v paint|grep -v black` ; do + rgb=`convert $i -crop 1x1+8+11 -depth 8 txt: |grep "0,0: (" |cut -f 2- -d "(" |cut -f 1-3 -d ","` + color=`basename $i .png | sed 's/_/ /g; s/unifieddyes //; s/s50/50% saturation/'` + printf "%-32s %-12s %s\n" "$color" "$rgb" "$i" +done |sort + +for i in `ls *_s50.png|grep -v dark|grep -v medium|grep -v paint|grep -v black` ; do + rgb=`convert $i -crop 1x1+8+11 -depth 8 txt: |grep "0,0: (" |cut -f 2- -d "(" |cut -f 1-3 -d ","` + color=`basename $i .png | sed 's/_/ /g; s/unifieddyes //; s/s50/50% saturation/'` + printf "%-32s %-12s %s\n" "$color" "$rgb" "$i" +done |sort + +echo -e "\nGreyscale:" +echo -e "----------\n" + +printf "%-32s %-12s %s\n" "black" " 0, 0, 0" "unifieddyes_black.png" +printf "%-32s %-12s %s\n" "dark grey" " 64, 64, 64" "unifieddyes_darkgrey_paint.png" +printf "%-32s %-12s %s\n" "medium grey" "128,128,128" "unifieddyes_grey_paint.png" +printf "%-32s %-12s %s\n" "light grey" "192,192,192" "unifieddyes_lightgrey_paint.png" +printf "%-32s %-12s %s\n" "white" "255,255,255" "unifieddyes_white_paint.png" + +popd >/dev/null diff --git a/textures/overlay.png b/textures/overlay.png new file mode 100644 index 0000000..c0ea034 Binary files /dev/null and b/textures/overlay.png differ diff --git a/textures/tulips_aqua.png b/textures/tulips_aqua.png new file mode 100644 index 0000000..020e545 Binary files /dev/null and b/textures/tulips_aqua.png differ diff --git a/textures/tulips_base.png b/textures/tulips_base.png new file mode 100644 index 0000000..123b1f0 Binary files /dev/null and b/textures/tulips_base.png differ diff --git a/textures/tulips_blue.png b/textures/tulips_blue.png new file mode 100644 index 0000000..c14afdf Binary files /dev/null and b/textures/tulips_blue.png differ diff --git a/textures/tulips_cyan.png b/textures/tulips_cyan.png new file mode 100644 index 0000000..95e7484 Binary files /dev/null and b/textures/tulips_cyan.png differ diff --git a/textures/tulips_green.png b/textures/tulips_green.png new file mode 100644 index 0000000..d69e2f4 Binary files /dev/null and b/textures/tulips_green.png differ diff --git a/textures/tulips_lime.png b/textures/tulips_lime.png new file mode 100644 index 0000000..29f490c Binary files /dev/null and b/textures/tulips_lime.png differ diff --git a/textures/tulips_magenta.png b/textures/tulips_magenta.png new file mode 100644 index 0000000..7331009 Binary files /dev/null and b/textures/tulips_magenta.png differ diff --git a/textures/tulips_orange.png b/textures/tulips_orange.png new file mode 100644 index 0000000..3372740 Binary files /dev/null and b/textures/tulips_orange.png differ diff --git a/textures/tulips_red.png b/textures/tulips_red.png new file mode 100644 index 0000000..ef63951 Binary files /dev/null and b/textures/tulips_red.png differ diff --git a/textures/tulips_redviolet.png b/textures/tulips_redviolet.png new file mode 100644 index 0000000..b4e4f9b Binary files /dev/null and b/textures/tulips_redviolet.png differ diff --git a/textures/tulips_seeds.png b/textures/tulips_seeds.png new file mode 100644 index 0000000..97c897d Binary files /dev/null and b/textures/tulips_seeds.png differ diff --git a/textures/tulips_skyblue.png b/textures/tulips_skyblue.png new file mode 100644 index 0000000..8589a58 Binary files /dev/null and b/textures/tulips_skyblue.png differ diff --git a/textures/tulips_sprout.png b/textures/tulips_sprout.png new file mode 100644 index 0000000..5646d1e Binary files /dev/null and b/textures/tulips_sprout.png differ diff --git a/textures/tulips_violet.png b/textures/tulips_violet.png new file mode 100644 index 0000000..8d9be59 Binary files /dev/null and b/textures/tulips_violet.png differ diff --git a/textures/tulips_yellow.png b/textures/tulips_yellow.png new file mode 100644 index 0000000..6fd2be8 Binary files /dev/null and b/textures/tulips_yellow.png differ diff --git a/textures/tulips_yellow_s50.png b/textures/tulips_yellow_s50.png new file mode 100644 index 0000000..9a47ab9 Binary files /dev/null and b/textures/tulips_yellow_s50.png differ