Overriding on_generated function of the vacuum mod

Posts: 245
Joined: Sun Jun 16, 2019 20:17
Location: Earth

Overriding on_generated function of the vacuum mod

by Red_King_Cyclops » Sun Sep 15, 2019 13:40

I'm working on a mod that depends on vacuum. The vacuum mod has an on_generated function that simply replaces all air blocks with vacuum blocks above a certain y-height. For the mod I am making, there needs to be certain "y-levels" that contain air but are surrounded by vacuum "y-levels." To do this, should I override vacuum's on_generated function, or should I make a second on_generated function that replaces certain vacuum blocks with air blocks?
My mod space_travel is similar to Galacticraft, but for Minetest.

User avatar
Posts: 4376
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: Overriding on_generated function of the vacuum mod

by Krock » Sun Sep 15, 2019 17:37

Registering a new on_generated callback would be the sane solution here. Another option would be to hijack the already registered callbacks and calling them manually before yours depending on the Y value, but I'd not recommend to do that unless you're forced to use plain Lua (no JIT).
>> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 5 guests