minetest-mods / anvil

Minetest mod providing an anvil with which to repair worn tools
GNU General Public License v3.0
14 stars 18 forks source link

Make item displacement variable global #6

Closed tacotexmex closed 7 years ago

tacotexmex commented 7 years ago

So that it's configureable by other mods. Adding "anvil_" to make it unique.

FaceDeer commented 7 years ago

I'm not sure what this would be used for. The item displacement value was picked to make the item appear to rest on the upper surface of the anvil nodebox model, I suppose you'd want to change that if you modified the anvil's nodebox but if you're doing that then wouldn't you be able to change the value at the same time?

I'll probably go ahead and merge this, I don't see a reason not to, I'm just a bit puzzled. :)

tacotexmex commented 7 years ago

Hehe, I should've been less cryptic as of why. Your are correct by guessing it's for changing the nodebox. However, I'm doing this by using overrides from another mod in order to be able to get updates from the original repo, so if I could set that displacement value from outside, I'm good. 😊

tacotexmex commented 7 years ago

No merge?

Since it's still open I wanna state that I've seen other mods do global variables in this style:

anvil = {
  setting = {
    item_displacement = 10,
  }
}

Should I change?

FaceDeer commented 7 years ago

Oh, sorry, I got a bit distracted with real life over the past week or two.

Yeah, I was going to suggest using global variables of that style instead. The anvil mod also uses a global "tmp" variable (though only as an ephemeral hack to allow information to be passed between function calls that normally wouldn't pass information) and I was going to move that into an "anvil" global table member as well.

Thanks for the kick in the pants, I need to get back to this. If you change your PR that would simplify things a bit, so by all means please do. :)