day 2023-03-05: tree sprout, fixes

* fixed .luacheckrc
* added growing trunk
* added sprout timer function
* removed and ignored Krita backup files
This commit is contained in:
Aleksey Chubukov 2023-03-15 22:50:35 +03:00
parent 372e46070e
commit 0eafd454e2
14 changed files with 87 additions and 11 deletions

3
.gitignore vendored
View File

@ -40,4 +40,5 @@ luac.out
*.x86_64 *.x86_64
*.hex *.hex
# Krita
*~

View File

@ -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
View File

@ -0,0 +1,2 @@
eaction = {}
dofile(minetest.get_modpath("eaction") .. "/place.lua")

3
mods/eaction/place.lua Normal file
View File

@ -0,0 +1,3 @@
function eaction.place_handler(itemname, func)
return
end

View File

@ -10,6 +10,52 @@ minetest.register_biome({
heat_point = 50, heat_point = 50,
humidity_point = 50, humidity_point = 50,
}) })
minetest.register_node("ebiome:oak_sapling", {
description = S("Oak tree sapling"),
drawtype = "plantlike",
tiles = { "ebiome_oak_sapling.png" },
paramtype = "light",
on_timer = ebiometrees.get_sapling_grower("ebiome:oak_sprout"),
sunlight_propagates = true,
walkable = false,
groups = {snappy = 2, dig_immediate = 3, flammable = 2,
attached_node = 1, sapling = 1},
on_construct = function(pos)
minetest.get_node_timer(pos):start(3)
end
})
minetest.register_node("ebiome:oak_sprout", {
description = S("Oak tree sprout"),
drawtype = "plantlike",
visual_scale = 1.4,
tiles = { "ebiome_oak_sprout.png" },
paramtype = "light",
sunlight_propagates = true,
walkable = false,
on_timer = ebiometrees.get_sprout_grower("ebiome:oak_trunk_normal", "ebiome:oak_trunk_growing"),
groups = {snappy = 3, dig_immediate = 3, flammable = 2,
attached_node = 1},
on_construct = function(pos)
minetest.get_node_timer(pos):start(3)
end
})
minetest.register_node("ebiome:oak_trunk_growing", {
description = S("Oak tree trunk"),
tiles = { "ebiome_oak_trunk_growing.png",
"ebiome_oak_trunk_slice_normal.png",
"ebiome_oak_trunk_growing.png"
},
paramtype2 = "facedir",
is_ground_content = false,
groups = {tree = 1, choppy = 2, flammable = 2},
on_place = minetest.rotate_node,
on_timer = function(pos)
return true
end,
on_construct = function(pos)
minetest.get_node_timer(pos):start(3)
end
})
minetest.register_node("ebiome:oak_trunk_normal", { minetest.register_node("ebiome:oak_trunk_normal", {
description = S("Oak tree trunk"), description = S("Oak tree trunk"),
tiles = { "ebiome_oak_trunk_slice_normal.png", "ebiome_oak_trunk_slice_normal.png","ebiome_oak_trunk_normal.png"}, tiles = { "ebiome_oak_trunk_slice_normal.png", "ebiome_oak_trunk_slice_normal.png","ebiome_oak_trunk_normal.png"},
@ -33,16 +79,6 @@ minetest.register_node("ebiome:oak_trunk_normal_corner", {
groups = {tree = 1, choppy = 2, flammable = 2}, groups = {tree = 1, choppy = 2, flammable = 2},
on_place = minetest.rotate_node 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"),
tiles = {"ebiome_grass.png"}, tiles = {"ebiome_grass.png"},

3
mods/ebiome/mod.conf Normal file
View File

@ -0,0 +1,3 @@
depends = ebiometrees
description = biome mod
name = ebiome

Binary file not shown.

Before

Width:  |  Height:  |  Size: 911 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 686 B

After

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 907 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 673 B

View File

@ -0,0 +1 @@
dofile(minetest.get_modpath("ebiometrees").."/sapling.lua")

View 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