Registering abs and functions

Post Reply
Wranglyph
Member
Posts: 11
Joined: Thu Jan 22, 2026 02:12
GitHub: Wranglyph
IRC: NA
In-game: Wranglyph

Registering abs and functions

by Wranglyph » Post

Hey guys, bit of a newb question here. I managed to follow some tutorials and make a block that does cool stuff when you punch it.

However, I'd like to use that abs function to make that block act on its own, like grass does.

Do I just register the abs in the same init file as the node registration?

And further, to clean up the file a bit, is there a way to call a function from another file? I mean, I know there is, but I've been looking at documentation for a week and I just can't seem to find it.

This is a proof of concept for a "wolf and rabbit" type simulation by the way, if you're curious.

User avatar
Desour
Member
Posts: 1581
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: Desour
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: Registering abs and functions

by Desour » Post

You mean abm, not abs. And yes, you can just call it before or after calling register_node for your node.

To call other files, use dofile, see <https://www.lua.org/manual/5.1/manual.html#pdf-dofile>.

(You might also want to look into at the source code of other mods, to take them as examples.)
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)

Wranglyph
Member
Posts: 11
Joined: Thu Jan 22, 2026 02:12
GitHub: Wranglyph
IRC: NA
In-game: Wranglyph

Re: Registering abs and functions

by Wranglyph » Post

Ok, thanks! I'll try it tomorrow and report back if I can get it working.

Wranglyph
Member
Posts: 11
Joined: Thu Jan 22, 2026 02:12
GitHub: Wranglyph
IRC: NA
In-game: Wranglyph

Re: Registering abs and functions

by Wranglyph » Post

Hey, future people! I did, in fact, *not* get it to work. Probably a missing comma or something, idk. But it doesn't matter that much, because I've actually transitioned to being the project manager, and will no longer be weighing down the devs with my sloppy coding.

If you'd like to be one of those devs, and help develop the technical features that will allow a full ecology and physics sim to be simulated in Luanti, then check out my post about it here: viewtopic.php?t=32325

Or, you can check out the actual dev call here: https://www.youtube.com/watch?v=ZJSYKODQsY4

Where I go over the key technical specs, the outline, gameplay, and a full roadmap from "just watched" to "just launched."

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests