Change minerals texture
This commit is contained in:
parent
6f737fae58
commit
c66618fd45
@ -1,15 +1,17 @@
|
|||||||
local function generate_tree(pos)
|
local function generate_tree(pos)
|
||||||
local nu = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
local nu = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z}).name
|
||||||
local is_soil = minetest.get_item_group(nu, "soil")
|
local is_soil = minetest.get_item_group(nu, "soil")
|
||||||
if is_soil == 0 then
|
if is_soil == 0 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local vm = minetest.get_voxel_manip()
|
local vm = minetest.get_voxel_manip()
|
||||||
local minp, maxp = vm:read_from_map({x=pos.x-16, y=pos.y, z=pos.z-16}, {x=pos.x+16, y=pos.y+16, z=pos.z+16})
|
local minp, maxp = vm:read_from_map(
|
||||||
local a = VoxelArea:new{MinEdge=minp, MaxEdge=maxp}
|
{x = pos.x - 16, y = pos.y, z = pos.z - 16},
|
||||||
|
{x = pos.x + 16, y = pos.y + 16, z = pos.z + 16})
|
||||||
|
local a = VoxelArea:new{MinEdge = minp, MaxEdge = maxp}
|
||||||
local data = vm:get_data()
|
local data = vm:get_data()
|
||||||
default.grow_tree(data, a, pos, math.random(1, 4) == 1, math.random(1,100000))
|
default.grow_tree(data, a, pos, math.random(1, 4) == 1, math.random(1, 100000))
|
||||||
vm:set_data(data)
|
vm:set_data(data)
|
||||||
vm:write_to_map(data)
|
vm:write_to_map(data)
|
||||||
vm:update_map()
|
vm:update_map()
|
||||||
@ -25,18 +27,18 @@ minetest.after(0.5, function()
|
|||||||
plant_tab[4] = "default:grass_4"
|
plant_tab[4] = "default:grass_4"
|
||||||
plant_tab[5] = "default:grass_5"
|
plant_tab[5] = "default:grass_5"
|
||||||
|
|
||||||
if minetest.get_modpath("flowers") ~= nil then
|
if minetest.get_modpath("flowers") ~= nil then
|
||||||
rnd_max = 11
|
rnd_max = 11
|
||||||
plant_tab[6] = "flowers:dandelion_white"
|
plant_tab[6] = "flowers:dandelion_white"
|
||||||
plant_tab[7] = "flowers:dandelion_yellow"
|
plant_tab[7] = "flowers:dandelion_yellow"
|
||||||
plant_tab[8] = "flowers:geranium"
|
plant_tab[8] = "flowers:geranium"
|
||||||
plant_tab[9] = "flowers:rose"
|
plant_tab[9] = "flowers:rose"
|
||||||
plant_tab[10] = "flowers:tulip"
|
plant_tab[10] = "flowers:tulip"
|
||||||
plant_tab[11] = "flowers:viola"
|
plant_tab[11] = "flowers:viola"
|
||||||
end
|
end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
local function duengen(pointed_thing)
|
local function duengen(pointed_thing)
|
||||||
local pos = pointed_thing.under
|
local pos = pointed_thing.under
|
||||||
local n = minetest.get_node_or_nil(pos)
|
local n = minetest.get_node_or_nil(pos)
|
||||||
@ -45,28 +47,26 @@ local function duengen(pointed_thing)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--print(n.name)
|
||||||
print(n.name)
|
|
||||||
|
|
||||||
local stage = ""
|
local stage = ""
|
||||||
if n.name == "default:sapling" and minetest.get_node_light(pos) then
|
if n.name == "default:sapling" and minetest.get_node_light(pos) then
|
||||||
if math.random(1,20) < 5 then
|
if math.random(1, 20) < 5 then
|
||||||
minetest.set_node(pos, {name="air"})
|
minetest.set_node(pos, {name = "air"})
|
||||||
generate_tree(pos)
|
generate_tree(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif string.find(n.name, "farming:wheat_") ~= nil then
|
elseif string.find(n.name, "farming:wheat_") ~= nil then
|
||||||
stage = tonumber(string.sub(n.name, 15))
|
stage = tonumber(string.sub(n.name, 15))
|
||||||
if math.random(1,7) < stage/3 then
|
if math.random(1, 7) < stage / 3 then
|
||||||
minetest.set_node(pos, {name="farming:wheat_8"})
|
minetest.set_node(pos, {name="farming:wheat_8"})
|
||||||
elseif stage < 7 then
|
elseif stage < 7 then
|
||||||
minetest.set_node(pos, {name="farming:wheat_"..stage+math.random(1,2)})
|
minetest.set_node(pos, {name="farming:wheat_" .. stage + math.random(1, 2)})
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif string.find(n.name, "farming:cotton_") ~= nil then
|
elseif string.find(n.name, "farming:cotton_") ~= nil then
|
||||||
stage = tonumber(string.sub(n.name, 16))
|
stage = tonumber(string.sub(n.name, 16))
|
||||||
if stage == 1 then
|
if stage == 1 then
|
||||||
minetest.set_node(pos, {name="farming:cotton_"..math.random(stage,2)})
|
minetest.set_node(pos, {name="farming:cotton_" .. math.random(stage, 2)})
|
||||||
else
|
else
|
||||||
minetest.set_node(pos, {name="farming:cotton"})
|
minetest.set_node(pos, {name="farming:cotton"})
|
||||||
end
|
end
|
||||||
@ -74,24 +74,24 @@ local function duengen(pointed_thing)
|
|||||||
elseif string.find(n.name, "farming:pumpkin_") ~= nil then
|
elseif string.find(n.name, "farming:pumpkin_") ~= nil then
|
||||||
stage = tonumber(string.sub(n.name, 17))
|
stage = tonumber(string.sub(n.name, 17))
|
||||||
if stage == 1 then
|
if stage == 1 then
|
||||||
minetest.set_node(pos, {name="farming:pumpkin_"..math.random(stage,2)})
|
minetest.set_node(pos, {name = "farming:pumpkin_" .. math.random(stage, 2)})
|
||||||
else
|
else
|
||||||
minetest.set_node(pos, {name="farming:pumpkin"})
|
minetest.set_node(pos, {name = "farming:pumpkin"})
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif n.name == "default:dry_dirt" then
|
elseif n.name == "default:dry_dirt" then
|
||||||
for i = -2, 3, 1 do
|
for i = -2, 3, 1 do
|
||||||
for j = -3, 2, 1 do
|
for j = -3, 2, 1 do
|
||||||
local p = {x=pos.x+i, y=pos.y, z=pos.z+j}
|
local p = {x = pos.x + i, y = pos.y, z = pos.z + j}
|
||||||
--pos =
|
--pos =
|
||||||
local n2 = minetest.get_node_or_nil(p)
|
local n2 = minetest.get_node_or_nil(p)
|
||||||
|
|
||||||
if n2 and n2.name and n2.name == "default:dry_dirt" and minetest.find_node_near(p, 6, {"group:water"}) then
|
if n2 and n2.name and n2.name == "default:dry_dirt" and minetest.find_node_near(p, 6, {"group:water"}) then
|
||||||
if math.random(1,6) > 3 then
|
if math.random(1, 6) > 3 then
|
||||||
--minetest.env:set_node(p, {name=plant_tab[math.random(0, rnd_max)]})
|
--minetest.env:set_node(p, {name = plant_tab[math.random(0, rnd_max)]})
|
||||||
minetest.set_node(pointed_thing.under, {name="default:grass"})
|
minetest.set_node(pointed_thing.under, {name = "default:grass"})
|
||||||
else
|
else
|
||||||
minetest.set_node(p, {name="default:grass"})
|
minetest.set_node(p, {name = "default:grass"})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -104,18 +104,15 @@ end
|
|||||||
|
|
||||||
minetest.register_craftitem("default:minerals", {
|
minetest.register_craftitem("default:minerals", {
|
||||||
description = "Minerals",
|
description = "Minerals",
|
||||||
inventory_image = "default_minerals.png",
|
inventory_image = "default_bone_meal.png", --"default_minerals.png",
|
||||||
liquids_pointable = false,
|
liquids_pointable = false,
|
||||||
stack_max = 60,
|
stack_max = 60,
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
if pointed_thing.type == "node" then
|
if pointed_thing.type == "node" then
|
||||||
duengen(pointed_thing)
|
duengen(pointed_thing)
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
return itemstack:take_item()
|
||||||
itemstack:take_item()
|
|
||||||
end
|
|
||||||
return itemstack
|
|
||||||
end
|
end
|
||||||
end,
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("default:bone_meal", {
|
minetest.register_craftitem("default:bone_meal", {
|
||||||
@ -126,10 +123,7 @@ minetest.register_craftitem("default:bone_meal", {
|
|||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
if pointed_thing.type == "node" then
|
if pointed_thing.type == "node" then
|
||||||
duengen(pointed_thing)
|
duengen(pointed_thing)
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
return itemstack:take_item()
|
||||||
itemstack:take_item()
|
|
||||||
end
|
|
||||||
return itemstack
|
|
||||||
end
|
end
|
||||||
end,
|
end
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user