Reed/rush migration fixes

Instead of straight alias, register reeds as
duplicate rushes but in a "dormant" state so
they don't decay on mapgen, but need to be
"awoken" first before they're subject to rush
survival/spread mechanics.
This commit is contained in:
Aaron Suen 2021-09-06 10:00:02 -04:00
parent c938c42d42
commit 69225b1525
4 changed files with 52 additions and 7 deletions

View File

@ -21,11 +21,10 @@ so backup your world first, and test before committing.
- Bug fixes
- Bamboo lighting (may require recalc)
- Moss spreading reworked
- Reed/rush mesh shape consistency
## Known Bugs, Issues, TODO
- Try to find a way to prevent immediate rush decay on migration
- Detect and legacy nodes by param2 and exempt?
- Need to be able to get fibers/thatch from vanilla plants
- Merge spreading, decaying ABMs
- Review bamboo ABMs

View File

@ -1,18 +1,64 @@
-- LUALOCALS < ---------------------------------------------------------
local minetest
= minetest
local minetest, nodecore
= minetest, nodecore
-- LUALOCALS > ---------------------------------------------------------
local modname = minetest.get_current_modname()
------------------------------------------------------------------------
-- SIMPLE ALIASES
for i = 1, 5 do
minetest.register_alias(modname .. ":grass_" .. i, "nc_flora:sedge_" .. i)
end
minetest.register_alias(modname .. ":reeds", "nc_flora:rush")
minetest.register_alias(modname .. ":flower_red", "nc_flora:flower_1_2")
minetest.register_alias(modname .. ":flower_yellow", "nc_flora:flower_2_3")
minetest.register_alias(modname .. ":flower_white", "nc_flora:flower_3_4")
minetest.register_alias(modname .. ":flower_blue", "nc_flora:flower_4_5")
minetest.register_alias(modname .. ":flower_violet", "nc_flora:flower_5_6")
------------------------------------------------------------------------
-- REED->RUSH CONVERSION
-- Nature reeds generate on terrain that wouldn't sustain rushes, but we
-- don't want tons of rushes instantly dying on mapgen. Register reeds as
-- "dormant" rushes in these situations and keep them alive until either
-- disturbed, or given moisture to awaken them.
local rushname = "nc_flora:rush"
local reedname = modname .. ":reed"
local rushdef = minetest.registered_items[reedname] or {}
local reeddef = nodecore.underride({
description = "Dormant Rush",
drop = rushname,
tiles = {"nc_flora_rush_side.png^(nc_flora_rush_side_dry.png"
.. "^[mask:" .. modname .. "_checkermask.png"}
}, rushdef)
minetest.register_node(reedname, reeddef)
local function reedcheck(pos, node)
if #nodecore.find_nodes_around(pos, "group:moist", 2) > 0 then
return nodecore.set_loud(pos, {
name = rushname,
param2 = rushdef.place_param2
})
elseif node.param2 ~= reeddef.place_param2 then
return nodecore.set_node(pos, {
name = reedname,
param2 = rushdef.place_param2
})
end
end
minetest.register_lbm({
name = modname .. ":reedcheck",
run_at_every_load = true,
nodenames = {reedname},
action = reedcheck
})
minetest.register_abm({
label = modname .. ":reedcheck",
interval = 1,
chance = 50,
nodenames = {reedname},
action = reedcheck
})

View File

@ -1 +1 @@
depends = nc_api_all, nc_items, nc_terrain, nc_tree, nc_stonework, nc_concrete
depends = nc_api_all, nc_items, nc_terrain, nc_tree, nc_stonework, nc_concrete, nc_flora

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 B