FIXED ANVIL, added flowers for more dye colours
This commit is contained in:
parent
93294a7ee6
commit
9de917ed39
@ -21,7 +21,7 @@ function realtest.register_anvil_recipe(RecipeDef)
|
|||||||
if recipe.level < 0 then
|
if recipe.level < 0 then
|
||||||
recipe.level = 0
|
recipe.level = 0
|
||||||
end
|
end
|
||||||
if recipe.output ~= "" and recipe.item1 ~= "" and (recipe.type == "forge" or recipe.type == "weld") then
|
if recipe.output ~= "" and recipe.item1 ~= "" and recipe.type == "forge" then
|
||||||
table.insert(realtest.registered_anvil_recipes, recipe)
|
table.insert(realtest.registered_anvil_recipes, recipe)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -57,14 +57,13 @@ for i, metal in ipairs(metals.list) do
|
|||||||
instrument = "chisel"
|
instrument = "chisel"
|
||||||
})
|
})
|
||||||
realtest.register_anvil_recipe({
|
realtest.register_anvil_recipe({
|
||||||
type = "weld",
|
|
||||||
item1 = "metals:"..metal.."_ingot",
|
item1 = "metals:"..metal.."_ingot",
|
||||||
item2 = "metals:"..metal.."_ingot",
|
item2 = "metals:"..metal.."_ingot",
|
||||||
output = "metals:"..metal.."_doubleingot",
|
output = "metals:"..metal.."_doubleingot",
|
||||||
level = metals.levels[i] - 1,
|
level = metals.levels[i] - 1,
|
||||||
})
|
})
|
||||||
realtest.register_anvil_recipe({
|
realtest.register_anvil_recipe({
|
||||||
type = "weld",
|
|
||||||
item1 = "metals:"..metal.."_sheet",
|
item1 = "metals:"..metal.."_sheet",
|
||||||
item2 = "metals:"..metal.."_sheet",
|
item2 = "metals:"..metal.."_sheet",
|
||||||
output = "metals:"..metal.."_doublesheet",
|
output = "metals:"..metal.."_doublesheet",
|
||||||
@ -200,16 +199,15 @@ for _, anvil in ipairs(anvils) do
|
|||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec", "size[8,7]"..
|
meta:set_string("formspec", "size[8,7]"..
|
||||||
"button[0.5,0.25;1.35,1;buttonForge;Forge]"..
|
"image[6,0;2,2;anvil_"..anvil[1].."_side.png]"..
|
||||||
"button[1.6,0.25;0.9,1;buttonForge10;x10]"..
|
"button[0.5,0.25;1.35,0.5;buttonForge;Forge]"..
|
||||||
|
"button[1.6,0.25;0.9,0.5;buttonForge10;x10]"..
|
||||||
"list[current_name;src1;2.9,0.25;1,1;]"..
|
"list[current_name;src1;2.9,0.25;1,1;]"..
|
||||||
"image[3.69,0.22;0.54,1.5;anvil_arrow.png]"..
|
"image[3.69,0.22;0.54,1.5;anvil_arrow.png]"..
|
||||||
"list[current_name;src2;4.1,0.25;1,1;]"..
|
"list[current_name;src2;4.1,0.25;1,1;]"..
|
||||||
"button[5.5,0.25;1.35,1;buttonWeld;Weld]"..
|
"list[current_name;hammer;0.5,1;1,1;]"..
|
||||||
"button[6.6,0.25;0.9,1;buttonWeld10;x10]"..
|
|
||||||
"list[current_name;hammer;1,1.5;1,1;]"..
|
|
||||||
"list[current_name;output;3.5,1.5;1,1;]"..
|
"list[current_name;output;3.5,1.5;1,1;]"..
|
||||||
"list[current_name;flux;6,1.5;1,1;]"..
|
"list[current_name;flux;1.5,1;1,1;]"..
|
||||||
"list[current_player;main;0,3;8,4;]")
|
"list[current_player;main;0,3;8,4;]")
|
||||||
meta:set_string("infotext", anvil[2].." Anvil")
|
meta:set_string("infotext", anvil[2].." Anvil")
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -294,3 +292,4 @@ for _, anvil in ipairs(anvils) do
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -137,4 +137,46 @@ minetest.register_craft({
|
|||||||
recipe = {"default:cactus"},
|
recipe = {"default:cactus"},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "dye:black 4",
|
||||||
|
recipe = {"minerals:charcoal"},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "dye:yellow 4",
|
||||||
|
recipe = {"flowers:dandelion_yellow"},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "dye:white 4",
|
||||||
|
recipe = {"flowers:dandelion_white"},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "dye:blue 4",
|
||||||
|
recipe = {"flowers:geranium"},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "dye:red 4",
|
||||||
|
recipe = {"flowers:rose"},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "dye:orange 4",
|
||||||
|
recipe = {"flowers:tulip"},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "dye:violet 4",
|
||||||
|
recipe = {"flowers:viola"},
|
||||||
|
})
|
||||||
|
|
||||||
-- EOF
|
-- EOF
|
||||||
|
16
mods/flowers/README.txt
Normal file
16
mods/flowers/README.txt
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
Minetest 0.4 mod: flowers
|
||||||
|
=========================
|
||||||
|
|
||||||
|
License of source code:
|
||||||
|
-----------------------
|
||||||
|
Copyright (C) 2012-2013 Ironzorg, VanessaE
|
||||||
|
|
||||||
|
This program is free software. It comes without any warranty, to
|
||||||
|
the extent permitted by applicable law. You can redistribute it
|
||||||
|
and/or modify it under the terms of the Do What The Fuck You Want
|
||||||
|
To Public License, Version 2, as published by Sam Hocevar. See
|
||||||
|
http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||||
|
|
||||||
|
License of media (textures and sounds)
|
||||||
|
--------------------------------------
|
||||||
|
WTFPL
|
1
mods/flowers/depends.txt
Normal file
1
mods/flowers/depends.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
default
|
167
mods/flowers/init.lua
Normal file
167
mods/flowers/init.lua
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
-- Minetest 0.4 mod: default
|
||||||
|
-- See README.txt for licensing and other information.
|
||||||
|
|
||||||
|
-- Map Generation
|
||||||
|
dofile(minetest.get_modpath("flowers").."/mapgen.lua")
|
||||||
|
|
||||||
|
-- Aliases for original flowers mod
|
||||||
|
minetest.register_alias("flowers:flower_dandelion_white", "flowers:dandelion_white")
|
||||||
|
minetest.register_alias("flowers:flower_dandelion_yellow", "flowers:dandelion_yellow")
|
||||||
|
minetest.register_alias("flowers:flower_geranium", "flowers:geranium")
|
||||||
|
minetest.register_alias("flowers:flower_rose", "flowers:rose")
|
||||||
|
minetest.register_alias("flowers:flower_tulip", "flowers:tulip")
|
||||||
|
minetest.register_alias("flowers:flower_viola", "flowers:viola")
|
||||||
|
|
||||||
|
minetest.register_node("flowers:dandelion_white", {
|
||||||
|
description = "White Dandelion",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
tiles = { "flowers_dandelion_white.png" },
|
||||||
|
inventory_image = "flowers_dandelion_white.png",
|
||||||
|
wield_image = "flowers_dandelion_white.png",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,color_white=1},
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15 },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("flowers:dandelion_yellow", {
|
||||||
|
description = "Yellow Dandelion",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
tiles = { "flowers_dandelion_yellow.png" },
|
||||||
|
inventory_image = "flowers_dandelion_yellow.png",
|
||||||
|
wield_image = "flowers_dandelion_yellow.png",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,color_yellow=1},
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15 },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("flowers:geranium", {
|
||||||
|
description = "Blue Geranium",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
tiles = { "flowers_geranium.png" },
|
||||||
|
inventory_image = "flowers_geranium.png",
|
||||||
|
wield_image = "flowers_geranium.png",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,color_blue=1},
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15 },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("flowers:rose", {
|
||||||
|
description = "Rose",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
tiles = { "flowers_rose.png" },
|
||||||
|
inventory_image = "flowers_rose.png",
|
||||||
|
wield_image = "flowers_rose.png",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,color_red=1},
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15 },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("flowers:tulip", {
|
||||||
|
description = "Tulip",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
tiles = { "flowers_tulip.png" },
|
||||||
|
inventory_image = "flowers_tulip.png",
|
||||||
|
wield_image = "flowers_tulip.png",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,color_orange=1},
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15 },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("flowers:viola", {
|
||||||
|
description = "Viola",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
tiles = { "flowers_viola.png" },
|
||||||
|
inventory_image = "flowers_viola.png",
|
||||||
|
wield_image = "flowers_viola.png",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1,color_violet=1},
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15 },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"group:flora"},
|
||||||
|
neighbors = {"default:dirt_with_grass", "default:desert_sand"},
|
||||||
|
interval = 50,
|
||||||
|
chance = 25,
|
||||||
|
action = function(pos, node)
|
||||||
|
pos.y = pos.y - 1
|
||||||
|
local under = minetest.get_node(pos)
|
||||||
|
pos.y = pos.y + 1
|
||||||
|
if under.name == "default:desert_sand" then
|
||||||
|
minetest.set_node(pos, {name="default:dry_shrub"})
|
||||||
|
elseif under.name ~= "default:dirt_with_grass" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local light = minetest.get_node_light(pos)
|
||||||
|
if not light or light < 13 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local pos0 = {x=pos.x-4,y=pos.y-4,z=pos.z-4}
|
||||||
|
local pos1 = {x=pos.x+4,y=pos.y+4,z=pos.z+4}
|
||||||
|
if #minetest.find_nodes_in_area(pos0, pos1, "group:flora_block") > 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local flowers = minetest.find_nodes_in_area(pos0, pos1, "group:flora")
|
||||||
|
if #flowers > 3 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local seedling = minetest.find_nodes_in_area(pos0, pos1, "default:dirt_with_grass")
|
||||||
|
if #seedling > 0 then
|
||||||
|
seedling = seedling[math.random(#seedling)]
|
||||||
|
seedling.y = seedling.y + 1
|
||||||
|
light = minetest.get_node_light(seedling)
|
||||||
|
if not light or light < 13 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if minetest.get_node(seedling).name == "air" then
|
||||||
|
minetest.set_node(seedling, {name=node.name})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
62
mods/flowers/mapgen.lua
Normal file
62
mods/flowers/mapgen.lua
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
|
if maxp.y >= 2 and minp.y <= 0 then
|
||||||
|
-- Generate flowers
|
||||||
|
local perlin1 = minetest.get_perlin(436, 3, 0.6, 100)
|
||||||
|
-- Assume X and Z lengths are equal
|
||||||
|
local divlen = 16
|
||||||
|
local divs = (maxp.x-minp.x)/divlen+1;
|
||||||
|
for divx=0,divs-1 do
|
||||||
|
for divz=0,divs-1 do
|
||||||
|
local x0 = minp.x + math.floor((divx+0)*divlen)
|
||||||
|
local z0 = minp.z + math.floor((divz+0)*divlen)
|
||||||
|
local x1 = minp.x + math.floor((divx+1)*divlen)
|
||||||
|
local z1 = minp.z + math.floor((divz+1)*divlen)
|
||||||
|
-- Determine flowers amount from perlin noise
|
||||||
|
local grass_amount = math.floor(perlin1:get2d({x=x0, y=z0}) ^ 3 * 9)
|
||||||
|
-- Find random positions for flowers based on this random
|
||||||
|
local pr = PseudoRandom(seed+456)
|
||||||
|
for i=0,grass_amount do
|
||||||
|
local x = pr:next(x0, x1)
|
||||||
|
local z = pr:next(z0, z1)
|
||||||
|
-- Find ground level (0...15)
|
||||||
|
local ground_y = nil
|
||||||
|
for y=30,0,-1 do
|
||||||
|
if minetest.get_node({x=x,y=y,z=z}).name ~= "air" then
|
||||||
|
ground_y = y
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if ground_y then
|
||||||
|
local p = {x=x,y=ground_y+1,z=z}
|
||||||
|
local nn = minetest.get_node(p).name
|
||||||
|
-- Check if the node can be replaced
|
||||||
|
if minetest.registered_nodes[nn] and
|
||||||
|
minetest.registered_nodes[nn].buildable_to then
|
||||||
|
nn = minetest.get_node({x=x,y=ground_y,z=z}).name
|
||||||
|
if nn == "default:dirt_with_grass" then
|
||||||
|
local flower_choice = pr:next(1, 6)
|
||||||
|
local flower
|
||||||
|
if flower_choice == 1 then
|
||||||
|
flower = "flowers:tulip"
|
||||||
|
elseif flower_choice == 2 then
|
||||||
|
flower = "flowers:rose"
|
||||||
|
elseif flower_choice == 3 then
|
||||||
|
flower = "flowers:dandelion_yellow"
|
||||||
|
elseif flower_choice == 4 then
|
||||||
|
flower = "flowers:dandelion_white"
|
||||||
|
elseif flower_choice == 5 then
|
||||||
|
flower = "flowers:geranium"
|
||||||
|
elseif flower_choice == 6 then
|
||||||
|
flower = "flowers:viola"
|
||||||
|
end
|
||||||
|
minetest.set_node(p, {name=flower})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
BIN
mods/flowers/textures/flowers_dandelion_white.png
Normal file
BIN
mods/flowers/textures/flowers_dandelion_white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 132 B |
BIN
mods/flowers/textures/flowers_dandelion_yellow.png
Normal file
BIN
mods/flowers/textures/flowers_dandelion_yellow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 131 B |
BIN
mods/flowers/textures/flowers_geranium.png
Normal file
BIN
mods/flowers/textures/flowers_geranium.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 312 B |
BIN
mods/flowers/textures/flowers_rose.png
Normal file
BIN
mods/flowers/textures/flowers_rose.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 137 B |
BIN
mods/flowers/textures/flowers_tulip.png
Normal file
BIN
mods/flowers/textures/flowers_tulip.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 138 B |
BIN
mods/flowers/textures/flowers_viola.png
Normal file
BIN
mods/flowers/textures/flowers_viola.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 125 B |
Loading…
x
Reference in New Issue
Block a user