Compare commits
7 Commits
c1bc0d18a5
...
0bdbc5539a
Author | SHA1 | Date |
---|---|---|
trans_soup | 0bdbc5539a | |
trans_soup | f3d46e4d71 | |
trans_soup | 4c21d9a015 | |
trans_soup | 27288f4a84 | |
trans_soup | 20a85bd7b1 | |
trans_soup | 54267faa88 | |
trans_soup | 0f1452ca06 |
|
@ -5,5 +5,8 @@ blockgame.register_on_joinplayer(function(player)
|
||||||
data.properties.pointable = false
|
data.properties.pointable = false
|
||||||
data.properties.zoom_fov = 15
|
data.properties.zoom_fov = 15
|
||||||
data.properties.eye_height = 1.7
|
data.properties.eye_height = 1.7
|
||||||
|
player:set_armor_groups({
|
||||||
|
fall_damage_add_percent = -100,
|
||||||
|
})
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -44,7 +44,12 @@ local start_decompose_cost = 4000
|
||||||
blockgame.register_increasing_abm({
|
blockgame.register_increasing_abm({
|
||||||
id = modname .. ":begin_decompose",
|
id = modname .. ":begin_decompose",
|
||||||
label = "decompose leaves",
|
label = "decompose leaves",
|
||||||
nodenames = {leaves},
|
nodenames = {
|
||||||
|
leaves .. "_1",
|
||||||
|
leaves .. "_2",
|
||||||
|
leaves .. "_3",
|
||||||
|
leaves .. "_4",
|
||||||
|
},
|
||||||
neighbors = {"group:dirty", leaves_decomposing},
|
neighbors = {"group:dirty", leaves_decomposing},
|
||||||
interval = 15,
|
interval = 15,
|
||||||
chance = 8,
|
chance = 8,
|
||||||
|
@ -59,9 +64,8 @@ blockgame.register_increasing_abm({
|
||||||
return data.value >= start_decompose_cost
|
return data.value >= start_decompose_cost
|
||||||
end,
|
end,
|
||||||
action = function (pos, node, data)
|
action = function (pos, node, data)
|
||||||
-- NOTE: might wanna access the 4 from somewhere, instead of directly knowing it.
|
local def = minetest.registered_nodes[node.name]
|
||||||
-- that way this won't have to change if decomposing leaves max levels change.
|
local level = def.level
|
||||||
local level = math.random(1, 4)
|
|
||||||
minetest.set_node(pos, {name = leaves_decomposing .. "_" .. level})
|
minetest.set_node(pos, {name = leaves_decomposing .. "_" .. level})
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
local modname = minetest.get_current_modname()
|
local modname = minetest.get_current_modname()
|
||||||
|
|
||||||
|
local level_max = minetest.registered_items[modname .. ":leaves"].level_max
|
||||||
|
|
||||||
blockgame.register_abm({
|
blockgame.register_abm({
|
||||||
label = "make unsupported leaves fall",
|
label = "make unsupported leaves fall",
|
||||||
nodenames = {
|
nodenames = {
|
||||||
|
@ -25,8 +27,8 @@ blockgame.register_abm({
|
||||||
end, 3)
|
end, 3)
|
||||||
|
|
||||||
if not is_supported then
|
if not is_supported then
|
||||||
-- TODO: become randomly-sized leaves pile when layered leaves is added.
|
local level = math.random(1, level_max)
|
||||||
minetest.set_node(pos, {name = modname .. ":leaves"})
|
minetest.set_node(pos, {name = modname .. ":leaves_" .. level})
|
||||||
minetest.check_for_falling(pos)
|
minetest.check_for_falling(pos)
|
||||||
-- TODO: send out event here that makes nearby leaves check if they're unsupported as well?
|
-- TODO: send out event here that makes nearby leaves check if they're unsupported as well?
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
local modname = minetest.get_current_modname()
|
local modname = minetest.get_current_modname()
|
||||||
|
|
||||||
|
local leaves_level_max = 4
|
||||||
|
|
||||||
local base_def = {
|
local base_def = {
|
||||||
drawtype = "allfaces_optional",
|
drawtype = "allfaces_optional",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
@ -9,6 +11,7 @@ local base_def = {
|
||||||
extends_leaves_support = 1,
|
extends_leaves_support = 1,
|
||||||
air_flowable = 1,
|
air_flowable = 1,
|
||||||
falling_node = 1,
|
falling_node = 1,
|
||||||
|
leafy = 1,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,11 +46,17 @@ local nutty_drops = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
reg_leaves("leaves", {
|
blockgame.register_leveled_node(modname .. ":leaves", blockgame.underride({
|
||||||
description = "Leaves",
|
description = "Leaves",
|
||||||
|
level_max = leaves_level_max,
|
||||||
|
tiles = {
|
||||||
|
modname .. "_leaves.png",
|
||||||
|
},
|
||||||
walkable = false,
|
walkable = false,
|
||||||
supports_falling = true,
|
supports_falling = true,
|
||||||
})
|
level_max = leaves_level_max,
|
||||||
|
}, base_def))
|
||||||
|
|
||||||
reg_leaves("leaves_growing", {
|
reg_leaves("leaves_growing", {
|
||||||
description = "Growing Leaves",
|
description = "Growing Leaves",
|
||||||
texture = "leaves_alive",
|
texture = "leaves_alive",
|
||||||
|
@ -64,82 +73,16 @@ reg_leaves("leaves_alive", {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
--[[
|
|
||||||
local function check_decompose (pos)
|
|
||||||
local node = minetest.get_node(pos)
|
|
||||||
return blockgame.item_matches(node.name, {"group:leaves_decomposing"})
|
|
||||||
end
|
|
||||||
]]--
|
|
||||||
|
|
||||||
-- TODO: generalize stacking node registration and put into API.
|
|
||||||
local decomposing_leaves_layers = 4
|
|
||||||
|
|
||||||
--[[
|
|
||||||
local function after_place_stack (pos)
|
|
||||||
if not check_decompose(pos) then return end
|
|
||||||
|
|
||||||
local below = pos + blockgame.vector.dirs.down
|
|
||||||
if check_decompose(below) then
|
|
||||||
local node = minetest.get_node(pos)
|
|
||||||
local below_node = minetest.get_node(below)
|
|
||||||
|
|
||||||
local def = minetest.registered_nodes[node.name]
|
|
||||||
local below_def = minetest.registered_nodes[below_node.name]
|
|
||||||
|
|
||||||
if below_def.level ~= decomposing_leaves_layers then
|
|
||||||
local max_diff = decomposing_leaves_layers - below_def.level
|
|
||||||
local diff = math.min(max_diff, def.level)
|
|
||||||
|
|
||||||
minetest.swap_node(below, {name = modname .. ":leaves_decomposing_" .. (below_def.level + diff)})
|
|
||||||
if diff == def.level then
|
|
||||||
minetest.remove_node(pos)
|
|
||||||
else
|
|
||||||
minetest.swap_node(pos, {name = modname .. ":leaves_decomposing_" .. (def.level - diff)})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local above = pos:offset(0, 1, 0)
|
|
||||||
if check_decompose(above) then
|
|
||||||
after_place_stack(above)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function reg_decomposing (level)
|
|
||||||
local height = level / decomposing_leaves_layers
|
|
||||||
|
|
||||||
local description = "Decomposing Leaves (" .. level .. "/" .. decomposing_leaves_layers .. ")"
|
|
||||||
if level == decomposing_leaves_layers then description = "Decomposing Leaves" end
|
|
||||||
|
|
||||||
local drawtype = "nodebox"
|
|
||||||
local node_box = {
|
|
||||||
["type"] = "fixed",
|
|
||||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.5 + height, 0.5 },
|
|
||||||
}
|
|
||||||
if level == decomposing_leaves_layers then
|
|
||||||
drawtype = "allfaces_optional"
|
|
||||||
node_box = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
reg_leaves("leaves_decomposing_" .. level, )
|
|
||||||
end
|
|
||||||
for level=1, decomposing_leaves_layers do
|
|
||||||
reg_decomposing(level)
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_alias(modname .. ":leaves_decomposing", modname .. ":leaves_decomposing_" .. decomposing_leaves_layers)
|
|
||||||
]]--
|
|
||||||
|
|
||||||
blockgame.register_leveled_node("leaves_decomposing", blockgame.underride({
|
blockgame.register_leveled_node("leaves_decomposing", blockgame.underride({
|
||||||
description = "Decomposing Leaves",
|
description = "Decomposing Leaves",
|
||||||
level_max = decomposing_leaves_layers,
|
level_max = leaves_level_max,
|
||||||
tiles = {
|
tiles = {
|
||||||
modname .. "_leaves_decomposing.png",
|
modname .. "_leaves_decomposing.png",
|
||||||
},
|
},
|
||||||
groups = {
|
groups = {
|
||||||
leaves_decomposing = decomposing_leaves_layers,
|
leaves_decomposing = leaves_level_max,
|
||||||
},
|
},
|
||||||
walkable = false,
|
walkable = false,
|
||||||
supports_falling = true,
|
supports_falling = true,
|
||||||
level_max = decomposing_leaves_layers,
|
level_max = leaves_level_max,
|
||||||
}, base_def))
|
}, base_def))
|
||||||
|
|
Loading…
Reference in New Issue