Commit graph

145 commits

Author SHA1 Message Date
trans_soup
37d192798e fix: decomposing leaves now check for falling.
leaves now call `minetest.check_for_falling` at their position when
decomposing into air. this fixes an error where falling nodes would be
left floating above decomposing leaves once said leaves disappeared.
2023-10-19 17:05:49 +02:00
trans_soup
123d3329cd increase decomposition temporal resolution.
make decomposition ABM:s happen more often. also decrease their chance
of happening, so that the overall balance isn't affected.
2023-10-19 16:51:14 +02:00
trans_soup
e42407978d add time control for decomposition.
add chat command that changes the rate at which decomposition happens.
2023-10-19 16:49:36 +02:00
trans_soup
400c27c021 tweak decomposition.
leaves will now start decomposing faster if touching certain nodes.
they'll also take longer overall to start decomposing.
2023-10-19 16:18:24 +02:00
trans_soup
ae26cfad42 refactor: make decomposition use new API function.
make leaves decomposition use the `blockgame.score_nearby_nodes` API
function (which was created largely from previous decomposition code).
2023-10-19 16:10:23 +02:00
trans_soup
a3537b5dda add blockgame.score_nearby_nodes utility to API.
expose public function that walks through nodes near a given position,
counting up a score based on their groups.
2023-10-19 16:08:25 +02:00
trans_soup
292358a3db balance: make decomposition more expensive.
decomposing leaves are now less likely to turn into dirt.
2023-10-19 16:00:43 +02:00
trans_soup
737afdfcc9 make leaves get a random level when they start decomposing. 2023-10-19 15:59:11 +02:00
trans_soup
7493d9771c balance: make it take longer for leaves to start decomposing. 2023-10-19 15:56:37 +02:00
trans_soup
87a88a88a6 fix sapling growth replacing certain nodes.
saplings can now replace alive leaves when growing (and other nodes can
easily be added in the future).

previously, instead of saplings, it was accidentally the case that
alive leaves growth worked like this when growing out of sapling,
instead of actual sapling growth.
2023-10-19 15:52:01 +02:00
trans_soup
717cbf91e2 fix leaves growth error.
make growing leaves turn into alive leaves if they should do so.
previously, this didn't happen for leaves that exceeded their max
distance from supporting node.
2023-10-19 15:39:04 +02:00
trans_soup
584187957a balance: tweak decomposition rate.
make leaves decompose bonuses from nearby nodes less powerful, and
increase decomposition cost.
2023-10-19 15:32:24 +02:00
trans_soup
c3bff227aa growing saplings can now replace living leaves. 2023-10-19 15:28:26 +02:00
trans_soup
3316dcba15 improve blockgame.attempt_place utility.
it now takes an optional argument that specifies what nodes may be
replaced (besides air).
2023-10-19 15:27:38 +02:00
trans_soup
477afad09e balance: tweak sapling growth rate. 2023-10-19 15:23:42 +02:00
trans_soup
1282fda837 make leaves growth use an increasing ABM.
this also means that leaves now grow slower.
2023-10-19 15:23:07 +02:00
trans_soup
0dffde9363 balance: make base decomposition rate slower.
(negligible when the decomposing leaves are touching several nodes that
make them decompose faster.)
2023-10-19 15:17:05 +02:00
trans_soup
f134082112 make nuts drop from leaves less often. 2023-10-19 15:14:02 +02:00
trans_soup
bdfb9f5fda make leaves only grow sideways.
previously, living leaves grew into more living leaves in all 6
directions. now, they only grow in the 4 horizontal directions.
2023-10-19 15:12:36 +02:00
trans_soup
19e392d1f3 make leaves grow at new sapling position.
make leaves grow out of the new (upper) sapling position instead of the
old (lower) position when saplings grow.
2023-10-19 15:09:53 +02:00
trans_soup
68e005814f refactor sapling support checking.
saplings now only check for groups, not specific nodes, when determining
whether they are supported. the previously checked nodes are now in the
new group that's being checked.
2023-10-19 15:08:53 +02:00
trans_soup
dd796c549e make unsupported roots die.
make `root_alive` nodes turn into `root` nodes if they're not touching
any of these nodes: `root_alive`, `log_alive`, `sapling`.
2023-10-19 14:53:15 +02:00
trans_soup
9e43abb69a make living roots drop dead roots. 2023-10-19 14:45:24 +02:00
trans_soup
9c28941a6a fix error in decomposing leaves placement code.
make sure that the node at the placed position is actually a decomposing
leaves variant before doing anything else. (this may not be the case,
since a node may start falling immediately after being placed.)
2023-10-19 14:15:17 +02:00
trans_soup
a4f121ac24 make some leaves non-walkable.
make leaves and decomposing_leaves non-walkable, and make them support
falling nodes.
2023-10-19 14:14:05 +02:00
trans_soup
6bb71aa341 add opt-in falling_node collision for non-walkable nodes.
make falling_node entities land on nodes with `supports_falling = true`
in their definitions.
2023-10-19 14:07:47 +02:00
trans_soup
c0ef9c3677 tweak grass growth rate.
it now grows twice as slowly.
2023-10-19 13:20:36 +02:00
trans_soup
b22827952c add a comment. 2023-10-19 13:14:50 +02:00
trans_soup
c4a70e45ce decomposition fix.
make decomposing leaves no longer traverse nodes that don't affect their
decomposition rate, when determining said rate. this means that they're
only affected by nodes that either touch them directly, or touch nodes
that affect them.
2023-10-19 13:12:10 +02:00
trans_soup
a3319cf9ea decomposition tweak.
make leaves that have started to decompose continue to do so regardless
of their surrounding nodes.
2023-10-19 13:11:41 +02:00
trans_soup
72a8666a86 leaves decomposition tweaks.
make decomposing leaves account for the pile size of nearby decomposing
leaves when determining their decomposition rate.
2023-10-19 13:10:49 +02:00
trans_soup
5014254c91 tweak decomposition rng.
leaves now have a higher chance of turning into dirt, the higher they're
piled within the node. full stacks (taking up an entire node) always
turn into dirt.
2023-10-19 12:58:31 +02:00
trans_soup
4b408d9943 make decomposing leaves have layers.
decomposing leaves now stack in layers, each one 1/4 of a node in
height.

currently this doesn't affect their behaviour, beyond making them stack
when placed or landing.
2023-10-19 12:54:09 +02:00
trans_soup
8d94fb9c70 minor rename.
look for `after_land` instead of `after_landing` in node defs when
handling falling nodes landing.
2023-10-19 12:46:38 +02:00
trans_soup
87fba22f3b add temporary "crushing" recipe variants.
using the new falling node hooks provided by `bg_api`, add alternative
versions of existing stoneworking recipes, where instead of pummeling, a
stoney node must fall onto the input nodes with sufficient force.

note that since the only currently existing stoney node that can fall,
loose cobblestone, is unobtainable without cheats, so are these recipes.
2023-10-19 11:30:45 +02:00
trans_soup
96ebbe8e0e improve fall_fix.
make the position passed to callbacks be the position where the
falling_node entity landed, rather than the position it tries to land
on/in.

note that if the node it lands on has its `paramtype2` set to
`"leveled"` then this new position might be empty after a landing.
2023-10-19 11:25:12 +02:00
trans_soup
a09dc62101 add hook for falling_node stepping.
and use this to keep track of their falling velocity.
2023-10-19 11:21:27 +02:00
trans_soup
becfb37402 provide more data to landing node callbacks.
specifically, give them the falling_node entity that landed as third
argument.
2023-10-19 11:19:32 +02:00
trans_soup
e1103a07e4 create fall_fix.
modify the builtin `falling_node` entity to make it possible for mods to
register callbacks to be called when they land and turn into a node.

also register such a callback that checks if the landed node has an
entry `after_landing`, and if so calls that.
2023-10-18 23:30:00 +02:00
trans_soup
07781855ad make loose node settling use an increasing ABM.
loose nodes will now take some time to settle, instead of doing so
completely randomly.
2023-10-17 21:03:34 +02:00
trans_soup
5df44d2b24 rework loose node registration.
loose nodes are now automatically registrered when their settled
counterparts are. also rewrite a small amount of wrapper code and node
registration to work with this.
2023-10-17 20:52:06 +02:00
trans_soup
968ae04b3a make blockgame.register_node wrapper emit events.
the api function `blockgame.register_node` will now emit events before
and after registering a node, allowing for other code to react to and
affect node registration.
2023-10-17 20:39:13 +02:00
trans_soup
09bcf2260b integrate bg_api_event into bg_api. 2023-10-17 20:38:43 +02:00
trans_soup
75e66075d0 simplify node registration.
make the wrapper `blockgame.register_node` make reasonable assumptions
that make node registration more convenient.

change other code to take advantage of that change.

also remove the `blockgame.reg_simple_node` utility since it's now
redundant.
2023-10-17 20:20:42 +02:00
trans_soup
c6157df12c remove loose variants.
rewrite some node registration code, removing the so far unused loose
nodes, and putting in place some data that outlines how they might be
implemented in the future.
2023-10-17 20:08:36 +02:00
trans_soup
bab59828f8 tweak leaves decomposition gains.
make it twice as expensive to turn leaves into dirt.
2023-10-17 19:21:16 +02:00
trans_soup
47e7e4fb0b remove bg_api_fall again.
as it turns out that minetest already handles falling nodes.
2023-10-17 19:19:35 +02:00
trans_soup
4ea8050c67 simplify leaves falling from trees.
by using minetest builtin support for nodes that fall when they're not
supported.
2023-10-17 19:15:52 +02:00
trans_soup
0c9f6a7119 move falling node code to own mod.
create `bg_api_fall` mod, and move files `falling_node.lua` and `loose_node.lua` to there from `bg_api`.

update dependencies in other mods to account for this change.
2023-10-17 18:54:23 +02:00
trans_soup
060ff030ea remove old tree growth.
this also removes old root growth; as a result, roots no longer spread.
2023-10-17 16:28:58 +02:00