Pine trees, pine saplings. Pine wood, slabs, stairs. Bucket of fresh water
This commit is contained in:
parent
8ee8c4f0b0
commit
d57058549a
@ -1 +1,3 @@
|
|||||||
default
|
default
|
||||||
|
stairs
|
||||||
|
bucket
|
||||||
|
@ -33,6 +33,53 @@ function riverdev_appletree(x, y, z, area, data)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function riverdev_pinetree(x, y, z, area, data)
|
||||||
|
local c_pinetree = minetest.get_content_id("riverdev:pinetree")
|
||||||
|
local c_needles = minetest.get_content_id("riverdev:needles")
|
||||||
|
for j = -4, 14 do
|
||||||
|
if j == 3 or j == 6 or j == 9 or j == 12 then
|
||||||
|
for i = -2, 2 do
|
||||||
|
for k = -2, 2 do
|
||||||
|
if math.abs(i) == 2 or math.abs(k) == 2 then
|
||||||
|
if math.random(7) ~= 2 then
|
||||||
|
local vil = area:index(x + i, y + j, z + k)
|
||||||
|
data[vil] = c_needles
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif j == 4 or j == 7 or j == 10 then
|
||||||
|
for i = -1, 1 do
|
||||||
|
for k = -1, 1 do
|
||||||
|
if not (i == 0 and j == 0) then
|
||||||
|
if math.random(11) ~= 2 then
|
||||||
|
local vil = area:index(x + i, y + j, z + k)
|
||||||
|
data[vil] = c_needles
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif j == 13 then
|
||||||
|
for i = -1, 1 do
|
||||||
|
for k = -1, 1 do
|
||||||
|
if not (i == 0 and j == 0) then
|
||||||
|
local vil = area:index(x + i, y + j, z + k)
|
||||||
|
data[vil] = c_needles
|
||||||
|
local vila = area:index(x + i, y + j + 1, z + k)
|
||||||
|
data[vila] = c_needles
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local vit = area:index(x, y + j, z)
|
||||||
|
data[vit] = c_pinetree
|
||||||
|
end
|
||||||
|
local vil = area:index(x, y + 15, z)
|
||||||
|
local vila = area:index(x, y + 16, z)
|
||||||
|
data[vil] = c_needles
|
||||||
|
data[vila] = c_needles
|
||||||
|
end
|
||||||
|
|
||||||
function riverdev_flower(data, vi)
|
function riverdev_flower(data, vi)
|
||||||
local c_danwhi = minetest.get_content_id("flowers:dandelion_white")
|
local c_danwhi = minetest.get_content_id("flowers:dandelion_white")
|
||||||
local c_danyel = minetest.get_content_id("flowers:dandelion_yellow")
|
local c_danyel = minetest.get_content_id("flowers:dandelion_yellow")
|
||||||
@ -83,6 +130,31 @@ minetest.register_abm({
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Pinetree sapling
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"riverdev:pineling"},
|
||||||
|
interval = 29,
|
||||||
|
chance = 5,
|
||||||
|
action = function(pos, node)
|
||||||
|
local x = pos.x
|
||||||
|
local y = pos.y
|
||||||
|
local z = pos.z
|
||||||
|
local vm = minetest.get_voxel_manip()
|
||||||
|
local pos1 = {x=x-2, y=y-4, z=z-2}
|
||||||
|
local pos2 = {x=x+2, y=y+16, z=z+2}
|
||||||
|
local emin, emax = vm:read_from_map(pos1, pos2)
|
||||||
|
local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
|
||||||
|
local data = vm:get_data()
|
||||||
|
|
||||||
|
riverdev_pinetree(x, y, z, area, data)
|
||||||
|
|
||||||
|
vm:set_data(data)
|
||||||
|
vm:write_to_map()
|
||||||
|
vm:update_map()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- Spawn flat facing south
|
-- Spawn flat facing south
|
||||||
|
|
||||||
function riverdev_flatsouth(pos)
|
function riverdev_flatsouth(pos)
|
||||||
|
12
init.lua
12
init.lua
@ -3,6 +3,11 @@
|
|||||||
-- Depends default
|
-- Depends default
|
||||||
-- License: code WTFPL
|
-- License: code WTFPL
|
||||||
|
|
||||||
|
-- Pines, pine sapling. pine wood, slabs, stairs. Bucket fresh water
|
||||||
|
-- TODO
|
||||||
|
-- autumn forest, red/orange/yellow leaves, falling leaf particls, also on ground around tree
|
||||||
|
-- cubeworld style boulders
|
||||||
|
|
||||||
-- Parameters
|
-- Parameters
|
||||||
|
|
||||||
local YMIN = -33000
|
local YMIN = -33000
|
||||||
@ -20,7 +25,8 @@ local TRIVER = -0.018
|
|||||||
local TRSAND = -0.02
|
local TRSAND = -0.02
|
||||||
local TPFLO = 0.03 -- Width of flora clearing around paths
|
local TPFLO = 0.03 -- Width of flora clearing around paths
|
||||||
|
|
||||||
local APPCHA = 1 / 4 ^ 2 -- Appletree maximum chance per grass node. 1 / n ^ 2 where n = average minimum distance between flora
|
local APPCHA = 1 / 5 ^ 2 -- Appletree maximum chance per grass node. 1 / n ^ 2 where n = average minimum distance between flora
|
||||||
|
local PINCHA = 1 / 6 ^ 2 -- Pinetree maximum chance per grass node
|
||||||
local GRACHA = 1 / 4 ^ 2 -- Grasses maximum chance per grass node
|
local GRACHA = 1 / 4 ^ 2 -- Grasses maximum chance per grass node
|
||||||
|
|
||||||
-- 3D noise for highland terrain
|
-- 3D noise for highland terrain
|
||||||
@ -202,7 +208,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
local densitymid = n_absmid * MIDAMP + densitybase
|
local densitymid = n_absmid * MIDAMP + densitybase
|
||||||
local density = n_terrain * n_invbase * n_absmid * n_abspatha ^ 1.5 * n_abspathb ^ 1.5 + densitymid
|
local density = n_terrain * n_invbase * n_absmid * n_abspatha ^ 1.5 * n_abspathb ^ 1.5 + densitymid
|
||||||
|
|
||||||
local tstone = TSTONE * (1 + grad * 3)
|
local tstone = TSTONE * (1 + grad * 2)
|
||||||
local triver = TRIVER * n_absbase
|
local triver = TRIVER * n_absbase
|
||||||
local trsand = TRSAND * n_absbase
|
local trsand = TRSAND * n_absbase
|
||||||
|
|
||||||
@ -286,7 +292,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
and nodid ~= c_wood and nodidu ~= c_wood then
|
and nodid ~= c_wood and nodidu ~= c_wood then
|
||||||
if math.random() < APPCHA * n_tree and tstone > 0.005
|
if math.random() < APPCHA * n_tree and tstone > 0.005
|
||||||
and n_abspatha > TPFLO and n_abspathb > TPFLO then
|
and n_abspatha > TPFLO and n_abspathb > TPFLO then
|
||||||
riverdev_appletree(x, y, z, area, data)
|
riverdev_pinetree(x, y, z, area, data)
|
||||||
else
|
else
|
||||||
data[viu] = c_grass
|
data[viu] = c_grass
|
||||||
if math.random() < GRACHA * n_grass then -- grasses
|
if math.random() < GRACHA * n_grass then -- grasses
|
||||||
|
80
nodes.lua
80
nodes.lua
@ -70,6 +70,59 @@ minetest.register_node("riverdev:appling", {
|
|||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_node("riverdev:pinetree", {
|
||||||
|
description = "Pine tree",
|
||||||
|
tiles = {"riverdev_pinetreetop.png", "riverdev_pinetreetop.png", "riverdev_pinetree.png"},
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
on_place = minetest.rotate_node
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("riverdev:needles", {
|
||||||
|
description = "Pine needles",
|
||||||
|
drawtype = "allfaces_optional",
|
||||||
|
visual_scale = 1.3,
|
||||||
|
tiles = {"riverdev_needles.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {snappy=3},
|
||||||
|
drop = {
|
||||||
|
max_items = 1,
|
||||||
|
items = {
|
||||||
|
{items = {"rivedev:pineling"},rarity = 20},
|
||||||
|
{items = {"riverdev:needles"}}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("riverdev:pineling", {
|
||||||
|
description = "Pine sapling",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
visual_scale = 1.0,
|
||||||
|
tiles = {"riverdev_pineling.png"},
|
||||||
|
inventory_image = "riverdev_pineling.png",
|
||||||
|
wield_image = "riverdev_pineling.png",
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
is_ground_content = false,
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
||||||
|
},
|
||||||
|
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1},
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("riverdev:pinewood", {
|
||||||
|
description = "Pine wood planks",
|
||||||
|
tiles = {"riverdev_pinewood.png"},
|
||||||
|
groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_node("riverdev:freshwater", {
|
minetest.register_node("riverdev:freshwater", {
|
||||||
description = "Fresh Water Source",
|
description = "Fresh Water Source",
|
||||||
inventory_image = minetest.inventorycube("riverdev_freshwater.png"),
|
inventory_image = minetest.inventorycube("riverdev_freshwater.png"),
|
||||||
@ -220,3 +273,30 @@ minetest.register_node("riverdev:mixwaterflow", {
|
|||||||
groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1},
|
groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Crafting
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "riverdev:pinewood 4",
|
||||||
|
recipe = {
|
||||||
|
{"riverdev:pinetree"},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Register stairs and slabs
|
||||||
|
|
||||||
|
stairs.register_stair_and_slab("pinewood", "riverdev:pinewood",
|
||||||
|
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
|
||||||
|
{"riverdev_pinewood.png"},
|
||||||
|
"Pinewood stair",
|
||||||
|
"Pinewood slab",
|
||||||
|
default.node_sound_wood_defaults())
|
||||||
|
|
||||||
|
-- Buckets
|
||||||
|
|
||||||
|
bucket.register_liquid(
|
||||||
|
"riverdev:freshwater",
|
||||||
|
"riverdev:freshwaterflow",
|
||||||
|
"riverdev:bucket_freshwater",
|
||||||
|
"riverdev_bucketfreshwater.png",
|
||||||
|
"Fresh Water Bucket"
|
||||||
|
)
|
||||||
|
BIN
textures/riverdev_bucketfreshwater.png
Normal file
BIN
textures/riverdev_bucketfreshwater.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 330 B |
BIN
textures/riverdev_needles.png
Normal file
BIN
textures/riverdev_needles.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 860 B |
BIN
textures/riverdev_pineling.png
Normal file
BIN
textures/riverdev_pineling.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 406 B |
BIN
textures/riverdev_pinetree.png
Normal file
BIN
textures/riverdev_pinetree.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 693 B |
BIN
textures/riverdev_pinetreetop.png
Normal file
BIN
textures/riverdev_pinetreetop.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 802 B |
BIN
textures/riverdev_pinewood.png
Normal file
BIN
textures/riverdev_pinewood.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 366 B |
Loading…
x
Reference in New Issue
Block a user