Skip to content

[no squash] Minor fixes to DigtronLayout:write_layout_image and node_callbacks - #132

Merged
SmallJoker merged 3 commits into
minetest-mods:masterfrom
j-r:node_callback_order
Aug 28, 2026
Merged

[no squash] Minor fixes to DigtronLayout:write_layout_image and node_callbacks#132
SmallJoker merged 3 commits into
minetest-mods:masterfrom
j-r:node_callback_order

Conversation

@j-r

@j-r j-r commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

I don't know of any issue this is fixing, but it still seems like a good idea to correct sometime:

  • invoke after_dig_node and after_place_node before calling the registered on_dignode/on_placenode callbacks (like builtin core.node_dig and core.item_place_node are doing - as well as digtron's builder code); AFAICT this only affects the digtron nodes themselves and isn't likely to make any difference at all

  • reset static dug_nodes_count and placed_nodes_count at the beginning of write_layout_image to be safe even in the case of an aborted earlier write; AFAICT such an abort doesn't ever happen and if it did still would not really cause much problems (in comparison to the broken half written digtron left by the aborted write) due to the additional node callbacks

I also standardized the variable names in node_callbacks (in a separate commit, so that the individual diffs are easier to read).

j-r added 3 commits August 22, 2026 17:55
core.node_dig calls node's after_dig_node before registered_on_dignodes
and core.item_place_node calls node's after_place_node before
registered_on_place_nodes.
Reset dug_nodes_count and placed_nodes_count to zero even in  the case of
an aborted writ (which never happens, AFAICT).
@SmallJoker SmallJoker changed the title Minor fixes to DigtronLayout:write_layout_image and node_callbacks [no squash] Minor fixes to DigtronLayout:write_layout_image and node_callbacks Aug 22, 2026
@SmallJoker

Copy link
Copy Markdown
Member

Odd how the "after" callbacks are called before the main one. Well. It can't hurt to have it the same way as in builtin.

Seems fine by me. Thanks. Will merge in a few days unless there are objections.

@SmallJoker
SmallJoker merged commit dcaf48a into minetest-mods:master Aug 28, 2026
1 check passed
@j-r
j-r deleted the node_callback_order branch August 28, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants