day 2023-03-05: tree sprout, fixes
* fixed .luacheckrc * added growing trunk * added sprout timer function * removed and ignored Krita backup files
3
.gitignore
vendored
@ -40,4 +40,5 @@ luac.out
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
|
||||
# Krita
|
||||
*~
|
||||
|
@ -3,6 +3,8 @@ allow_defined_top = true
|
||||
|
||||
globals = {
|
||||
"minetest",
|
||||
"ebiometrees",
|
||||
"eaction"
|
||||
}
|
||||
|
||||
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
|
@ -10,6 +10,52 @@ minetest.register_biome({
|
||||
heat_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", {
|
||||
description = S("Oak tree trunk"),
|
||||
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},
|
||||
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", {
|
||||
description = S("Grass"),
|
||||
tiles = {"ebiome_grass.png"},
|
||||
|
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.png
Normal file
After Width: | Height: | Size: 907 B |
Before Width: | Height: | Size: 673 B |
1
mods/ebiometrees/init.lua
Normal file
@ -0,0 +1 @@
|
||||
dofile(minetest.get_modpath("ebiometrees").."/sapling.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
|