-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Everness sandstone compressor recipes #634
Add Everness sandstone compressor recipes #634
Conversation
…rness sandstone recipe
@@ -8,6 +8,15 @@ function technic.register_compressor_recipe(data) | |||
technic.register_recipe("compressing", data) | |||
end | |||
|
|||
function technic.clear_sand_to_sandstone_craft(sand_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make this function local. Any new technic API should be documented in doc/ and this one is not special enough to be part of the global technic namespace.
Suggestion: rename the function to what it does internally, such as clear_shaped_2x2_craft
.
EDIT: Or just remove the function. You could inline this minetest.clear_craft
into the loop below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed and inlined as suggested.
However, for the future, so I'll know, as I'm just getting to know Lua: how exactly do I make a function local? Just write it in front of it, like local function technic.clear_shaped_2x2_craft
or just leave away the technic
namespace, like function clear_shaped_2x2_craft
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local function mytable.myfunction() end
is not valid. mytable
is either local
or global (default).
function myfunction() end
is a function in the global namespace _G
. It might overwrite or be overwritten by accident by another mod.
Local variables and functions ( local function myfunction() end
) can only be seen and used within the current file. This is what I'd recommend for niche utility functions that are unlikely to be of much use outside the file.
Global variables can be shadowed by locals. luacheck
can partially check against that to avoid side-effects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. Thanks for the explanation. 👍
Looks good; the sand recipes are (still) removed as intended. Will merge in a few days unless anyone's got objections. |
Add Everness sandstone compressor recipes (minetest-mods#634)
Hi,
As previously, I wanted to use more Everness stuff with Technic and would like to contribute this too. This time, it's about sand to sandstone and vice versa, using the compressor and the grinder.
I also did a minor refactoring to prevent unnecessary file bloating and preserve overviewability.
Lastly, I needed to add everness as an optional dependency after all, as without it, the default everness mineral_sandstone to mineral_sand recipe could not be cleared. (This should be OK though, as Everness is a more fundamental, world builder mod, while Technic is more for later game, so it shouldn't need to depend on Technic.)