Compare commits
2 Commits
372e46070e
...
e20268de06
Author | SHA1 | Date | |
---|---|---|---|
|
e20268de06 | ||
|
0eafd454e2 |
3
.gitignore
vendored
@ -40,4 +40,5 @@ luac.out
|
|||||||
*.x86_64
|
*.x86_64
|
||||||
*.hex
|
*.hex
|
||||||
|
|
||||||
|
# Krita
|
||||||
|
*~
|
||||||
|
@ -3,6 +3,8 @@ allow_defined_top = true
|
|||||||
|
|
||||||
globals = {
|
globals = {
|
||||||
"minetest",
|
"minetest",
|
||||||
|
"ebiometrees",
|
||||||
|
"eaction"
|
||||||
}
|
}
|
||||||
|
|
||||||
read_globals = {
|
read_globals = {
|
||||||
|
2
mods/eaction/init.lua
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
eaction = {}
|
||||||
|
dofile(minetest.get_modpath("eaction") .. "/place.lua")
|
3
mods/eaction/place.lua
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
function eaction.place_handler(itemname, func)
|
||||||
|
return
|
||||||
|
end
|
@ -1,4 +1,4 @@
|
|||||||
local S = minetest.get_translator("eterrain")
|
local S = minetest.get_translator("ebiome")
|
||||||
minetest.register_biome({
|
minetest.register_biome({
|
||||||
name = "grasslands",
|
name = "grasslands",
|
||||||
node_top = "mapgen_topsoil",
|
node_top = "mapgen_topsoil",
|
||||||
@ -10,38 +10,9 @@ minetest.register_biome({
|
|||||||
heat_point = 50,
|
heat_point = 50,
|
||||||
humidity_point = 50,
|
humidity_point = 50,
|
||||||
})
|
})
|
||||||
minetest.register_node("ebiome:oak_trunk_normal", {
|
ebiometrees.register_tree("ebiome", "oak",{
|
||||||
description = S("Oak tree trunk"),
|
description = "Oak",
|
||||||
tiles = { "ebiome_oak_trunk_slice_normal.png", "ebiome_oak_trunk_slice_normal.png","ebiome_oak_trunk_normal.png"},
|
groups = {flammable = 2}
|
||||||
paramtype2 = "facedir",
|
|
||||||
is_ground_content = false,
|
|
||||||
groups = {tree = 1, choppy = 2, flammable = 2},
|
|
||||||
on_place = minetest.rotate_node
|
|
||||||
})
|
|
||||||
minetest.register_node("ebiome:oak_trunk_normal_corner", {
|
|
||||||
description = S("Oak tree trunk corner branch"),
|
|
||||||
tiles = {
|
|
||||||
"ebiome_oak_trunk_normal.png",
|
|
||||||
"ebiome_oak_trunk_slice_normal.png",
|
|
||||||
"ebiome_oak_trunk_corner_normal.png^[transformFX",
|
|
||||||
"ebiome_oak_trunk_corner_normal.png",
|
|
||||||
"ebiome_oak_trunk_normal.png",
|
|
||||||
"ebiome_oak_trunk_slice_normal.png",
|
|
||||||
},
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
is_ground_content = false,
|
|
||||||
groups = {tree = 1, choppy = 2, flammable = 2},
|
|
||||||
on_place = minetest.rotate_node
|
|
||||||
})
|
|
||||||
minetest.register_node("ebiome:oak_sapling", {
|
|
||||||
description = S("Oak tree sapling"),
|
|
||||||
drawtype = "plantlike",
|
|
||||||
tiles = { "ebiome_oak_sapling.png" },
|
|
||||||
paramtype = "light",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
walkable = false,
|
|
||||||
groups = {snappy = 2, dig_immediate = 3, flammable = 2,
|
|
||||||
attached_node = 1, sapling = 1}
|
|
||||||
})
|
})
|
||||||
minetest.register_node("ebiome:grass", {
|
minetest.register_node("ebiome:grass", {
|
||||||
description = S("Grass"),
|
description = S("Grass"),
|
||||||
|
3
mods/ebiome/mod.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
depends = ebiometrees
|
||||||
|
description = biome mod
|
||||||
|
name = ebiome
|
Before Width: | Height: | Size: 911 B |
Before Width: | Height: | Size: 686 B After Width: | Height: | Size: 661 B |
BIN
mods/ebiome/textures/ebiome_oak_sprout.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 758 B |
BIN
mods/ebiome/textures/ebiome_oak_trunk_growing_corner.png
Normal file
After Width: | Height: | Size: 929 B |
BIN
mods/ebiome/textures/ebiome_oak_trunk_growing_normal.png
Normal file
After Width: | Height: | Size: 841 B |
BIN
mods/ebiome/textures/ebiome_oak_trunk_growing_slice.png
Normal file
After Width: | Height: | Size: 745 B |
BIN
mods/ebiome/textures/ebiome_oak_trunk_growing_terminal.png
Normal file
After Width: | Height: | Size: 907 B |
BIN
mods/ebiome/textures/ebiome_oak_trunk_growing_tjunction.png
Normal file
After Width: | Height: | Size: 918 B |
BIN
mods/ebiome/textures/ebiome_oak_trunk_growing_xjunction.png
Normal file
After Width: | Height: | Size: 952 B |
Before Width: | Height: | Size: 673 B |
Before Width: | Height: | Size: 808 B After Width: | Height: | Size: 808 B |
Before Width: | Height: | Size: 699 B After Width: | Height: | Size: 699 B |
Before Width: | Height: | Size: 737 B After Width: | Height: | Size: 737 B |
BIN
mods/ebiome/textures/ebiome_oak_trunk_normal_terminal.png
Normal file
After Width: | Height: | Size: 753 B |
BIN
mods/ebiome/textures/ebiome_oak_trunk_normal_tjunction.png
Normal file
After Width: | Height: | Size: 797 B |
BIN
mods/ebiome/textures/ebiome_oak_trunk_normal_xjunction.png
Normal file
After Width: | Height: | Size: 847 B |
2
mods/ebiometrees/init.lua
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
dofile(minetest.get_modpath("ebiometrees").."/sapling.lua")
|
||||||
|
dofile(minetest.get_modpath("ebiometrees").."/tree.lua")
|
28
mods/ebiometrees/sapling.lua
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
ebiometrees = {}
|
||||||
|
|
||||||
|
function ebiometrees.get_sapling_grower(sprout_name)
|
||||||
|
local function rooter(pos)
|
||||||
|
minetest.set_node(pos, {name=sprout_name})
|
||||||
|
end
|
||||||
|
return rooter
|
||||||
|
end
|
||||||
|
|
||||||
|
function ebiometrees.get_sprout_grower(trunk_name, apex_name)
|
||||||
|
local function grower(pos)
|
||||||
|
minetest.set_node(pos, {name=trunk_name})
|
||||||
|
local upper = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||||
|
minetest.set_node(upper, {name=apex_name})
|
||||||
|
end
|
||||||
|
return grower
|
||||||
|
end
|
||||||
|
|
||||||
|
function ebiometrees.root_sapling(pos)
|
||||||
|
minetest.set_node(pos, {name="ebiome:oak_sprout"})
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function ebiometrees.set_rooting_sapling(itemstack, placer, pointed_thing)
|
||||||
|
itemstack = minetest.item_place(itemstack, placer, pointed_thing)
|
||||||
|
minetest.get_node_timer(pointed_thing.above):start(3)
|
||||||
|
return itemstack
|
||||||
|
end
|
128
mods/ebiometrees/tree.lua
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
local function growth_timer(pos)
|
||||||
|
minetest.get_node_timer(pos):start(3)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local S = minetest.get_translator("ebiometrees")
|
||||||
|
function ebiometrees.register_tree(modname, basename, data)
|
||||||
|
-- register saplings
|
||||||
|
local sapling_name = modname..":"..basename.."_sapling"
|
||||||
|
local sprout_name = modname..":"..basename.."_sprout"
|
||||||
|
|
||||||
|
local sapling_groups = table.copy(data.groups)
|
||||||
|
local sprout_groups = table.copy(data.groups)
|
||||||
|
sapling_groups.sapling = 1
|
||||||
|
sapling_groups.snappy = 2
|
||||||
|
sapling_groups.dig_immediate = 3
|
||||||
|
sprout_groups.sapling = 1
|
||||||
|
sprout_groups.snappy = 2
|
||||||
|
minetest.register_node(sapling_name, {
|
||||||
|
description = S(data.description.." sapling"),
|
||||||
|
drawtype = "plantlike",
|
||||||
|
tiles = { modname.."_"..basename.."_sapling.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
on_timer = ebiometrees.get_sapling_grower(sprout_name),
|
||||||
|
sunlight_propagates = true,
|
||||||
|
walkable = false,
|
||||||
|
groups = sapling_groups,
|
||||||
|
on_construct = growth_timer
|
||||||
|
})
|
||||||
|
minetest.register_node(sprout_name, {
|
||||||
|
description = S(data.description.." sprout"),
|
||||||
|
drawtype = "plantlike",
|
||||||
|
visual_scale = 1.4,
|
||||||
|
tiles = { modname.."_"..basename.."_sprout.png" },
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
walkable = false,
|
||||||
|
on_timer = ebiometrees.get_sprout_grower(
|
||||||
|
modname..":"..basename.."_trunk_growing_straight",
|
||||||
|
modname..":"..basename.."_trunk_growing_terminal"),
|
||||||
|
groups = sprout_groups,
|
||||||
|
on_construct = growth_timer
|
||||||
|
})
|
||||||
|
-- registers tree and corresponding nodes
|
||||||
|
local trunk_groups = table.copy(data.groups)
|
||||||
|
trunk_groups.choppy = 2 -- TODO: customizations
|
||||||
|
local trunk_types = {"growing", "normal"}
|
||||||
|
local trunk_subtypes = {"terminal", "straight", "corner",
|
||||||
|
"tjunction", "t2junction", "xjunction",
|
||||||
|
"xtjunction", "x2junction"}
|
||||||
|
|
||||||
|
for _, trunk_type in ipairs(trunk_types)
|
||||||
|
do
|
||||||
|
local texture_basename = modname.."_"..basename.."_trunk_"..trunk_type.."_"
|
||||||
|
local subtype_tiles = {
|
||||||
|
terminal = {
|
||||||
|
texture_basename.."terminal.png",
|
||||||
|
texture_basename.."slice.png",
|
||||||
|
texture_basename.."terminal.png"
|
||||||
|
},
|
||||||
|
straight = {
|
||||||
|
texture_basename.."slice.png",
|
||||||
|
texture_basename.."slice.png",
|
||||||
|
texture_basename.."normal.png"
|
||||||
|
},
|
||||||
|
corner = {
|
||||||
|
texture_basename.."normal.png",
|
||||||
|
texture_basename.."slice.png",
|
||||||
|
texture_basename.."corner.png^[transformFX",
|
||||||
|
texture_basename.."corner.png",
|
||||||
|
texture_basename.."normal.png",
|
||||||
|
texture_basename.."slice.png",
|
||||||
|
},
|
||||||
|
tjunction = {
|
||||||
|
texture_basename.."slice.png",
|
||||||
|
texture_basename.."slice.png",
|
||||||
|
texture_basename.."tjunction.png^[transformFX",
|
||||||
|
texture_basename.."tjunction.png",
|
||||||
|
texture_basename.."normal.png",
|
||||||
|
texture_basename.."slice.png",
|
||||||
|
},
|
||||||
|
t2junction = {
|
||||||
|
texture_basename.."slice.png",
|
||||||
|
texture_basename.."slice.png",
|
||||||
|
texture_basename.."tjunction.png^[transformFX",
|
||||||
|
texture_basename.."slice.png",
|
||||||
|
texture_basename.."tjunction.png",
|
||||||
|
texture_basename.."slice.png",
|
||||||
|
},
|
||||||
|
xjunction = {
|
||||||
|
texture_basename.."slice.png",
|
||||||
|
texture_basename.."slice.png",
|
||||||
|
texture_basename.."xjunction.png^[transformFX",
|
||||||
|
texture_basename.."xjunction.png",
|
||||||
|
texture_basename.."slice.png",
|
||||||
|
texture_basename.."slice.png",
|
||||||
|
},
|
||||||
|
xtjunction = {
|
||||||
|
texture_basename.."slice.png",
|
||||||
|
texture_basename.."slice.png",
|
||||||
|
texture_basename.."xjunction.png",
|
||||||
|
texture_basename.."slice.png",
|
||||||
|
texture_basename.."slice.png",
|
||||||
|
texture_basename.."slice.png",
|
||||||
|
},
|
||||||
|
x2junction = {
|
||||||
|
texture_basename.."slice.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, trunk_subtype in ipairs(trunk_subtypes)
|
||||||
|
do
|
||||||
|
minetest.register_node(
|
||||||
|
modname..":"..basename.."_trunk_"..trunk_type.."_"..trunk_subtype, {
|
||||||
|
description = S(data.description.." "..trunk_type.." "..trunk_subtype),
|
||||||
|
groups = trunk_groups,
|
||||||
|
tiles = subtype_tiles[trunk_subtype],
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
is_ground_content = false,
|
||||||
|
on_place = minetest.rotate_node,
|
||||||
|
on_timer = function(pos)
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
on_construct = growth_timer
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|