Commit graph

114 commits

Author SHA1 Message Date
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
trans_soup
f4d8c7597d improve sapling/root growth.
trees will now create a living root node at their bottom when they grow
for the first time.
2023-10-17 16:13:54 +02:00
trans_soup
f31940ffa5 make unsupported leaves die & fall.
leaves that aren't in contact with living logs, or are not in contact
with any supported leaves, or are too far away from living logs, will
now die and fall down.
2023-10-17 16:00:36 +02:00
trans_soup
3459e94de8 improve flood_fill api function.
make `flood_fill` able to be interrupted if its callback returns false;
the meaning that was previously indicated by this return value is now
indicated by nil instead.

update code that uses this function to account for this change.
2023-10-17 15:48:57 +02:00
trans_soup
00829dbce9 cleanup node registration.
separate tree and leaves registrations into own files.
2023-10-17 15:43:18 +02:00
trans_soup
aae1beea64 refactor grass spreading and related api function. 2023-10-17 15:40:49 +02:00
trans_soup
afc58d0b97 replace leaves decoration with saplings.
will replace with actual trees later.
2023-10-17 15:16:11 +02:00
trans_soup
c5d51e9fe5 make nuts sometimes drop from leaves.
give living & growing leaves a chance of dropping nuts, finally making
trees actually farmable.
2023-10-17 15:14:02 +02:00
trans_soup
d9523dc015 remove unused mod bg_funnel. 2023-10-17 15:07:04 +02:00
trans_soup
d0a481334a refactor stoneworking recipe code. 2023-10-17 15:05:40 +02:00
trans_soup
d197e1f1e3 move item_matches into api.
move function `item_matches` from `bg_crafting` into `bg_api`, since
it'll be useful in many other places.
2023-10-17 15:02:39 +02:00
trans_soup
7df5d33d02 refactor: extract repeated code into api function.
move function `starts_with`, which was declared twice in separate files,
to the api, and make those files use that function instead.
2023-10-17 14:58:15 +02:00
trans_soup
c31d6cf5d0 improve pummeling.
pummeling definition tables now has lists of item id:s and groups, the
same way e.g. ABM:s do, that determine what items are involved in a
recipe.

update existing (in-use) pummel recipes to make use of this.
2023-10-17 14:53:08 +02:00
trans_soup
45f59f5e03 minor refactor of recipe code.
just separated different recipe types into different files.
2023-10-17 14:28:08 +02:00
trans_soup
5305cc526d minor fix & refactors of recipe code. 2023-10-17 14:23:44 +02:00
trans_soup
17636dbf87 improve leaves decomposition.
leaves will now decompose faster depending on their surroundings.
touching dirty nodes or other decomposing leaves will make them decay
quicker.
2023-10-17 13:41:30 +02:00
trans_soup
cca53e76b3 add flood fill utility to api.
add api function for walking through the nodes surrounding a given
position.
2023-10-17 13:40:04 +02:00
trans_soup
6e205f15b7 slightly change readme. 2023-10-17 12:01:37 +02:00
trans_soup
31b2242c38 make leaves fall down when unsupported.
also refactor leaves registration code.
2023-10-17 11:25:13 +02:00
trans_soup
d884e75a24 fix: account for moved api function.
change something that should've been changed before, when the api
function in question was moved.
2023-10-17 11:24:18 +02:00
trans_soup
19d63efcf5 refactor log registration.
rename log and sapling textures to be more clear. rewrite node
registration code to account for this, and to be overall cleaner.
2023-10-17 11:23:32 +02:00
trans_soup
5a3d81787c add several utility functions related to tables.
create api functions `any`, `every`, and `underride`.

`any` and `every` checks if a condition is true for any and every item
in a table, respectively.
`underride` returns a table that defaults to a provided table, for
items that aren't specified in the other provided table.
2023-10-17 11:19:55 +02:00
trans_soup
33fbd7c35e move get_neighbors from util_node to util_vector. 2023-10-17 11:19:03 +02:00
trans_soup
d753612f0b separate falling node and loose node handling. 2023-10-17 11:18:14 +02:00
trans_soup
548d33d146 fix minor error. 2023-10-17 10:33:48 +02:00
trans_soup
18117daade make living logs have same texture as dead logs. 2023-10-17 10:30:12 +02:00
trans_soup
aaeef448f0 make decomposing leaves sometimes not create dirt.
add a 1/2 chance for decomposing leaves to disappear instead of becoming
dirt.
2023-10-17 10:27:41 +02:00
trans_soup
5d98c3dadc add growing_leaves node.
create node representing growing leaves, and use it where previously
living leaves was used. this allows for a distinction between leaves
that will try to create more leaves, leaves that can provide nutrients
to other leaves, and leaves that are dead, whereas previously the first
2 of those couldn't be distinguished.
2023-10-17 10:26:15 +02:00
trans_soup
0ff0c9274f tweak leaves spread chance. 2023-10-17 10:19:27 +02:00
trans_soup
790e00ef5c rework sapling growth.
saplings now grow straight up and attempt to grow leaves on their sides.
2023-10-17 10:17:13 +02:00
trans_soup
5879ecbd67 add get_sides_of utility to api. 2023-10-17 10:16:12 +02:00
trans_soup
1ef3759ae6 tweak to leaves decomposition.
leaves will now start decomposing if they're touching either a dirty
node, or already decomposing leaves.
2023-10-17 10:15:13 +02:00