Any way to get current texture pack used inside a mod

Post Reply
User avatar
sirrobzeroone
Member
Posts: 146
Joined: Mon Jul 16, 2018 07:56

Any way to get current texture pack used inside a mod

by sirrobzeroone » Post

Might be easier if I give the problem then what i thought might work but happy to take any suggestions. I'm trying to avoid having to go insecure, although even using insecure I cant workout how to tell what texturepack is being used.

With Comboblock the problem I have is when I overlay textures from one mod over another I don't know what size they will be and overlaying 16px over a 32px image has some interesting outcomes (I'd guess bigger difference will produce even more intresting outcomes).

I don't even seem to be able to tell if the user is using a texture pack or not. Something like minetest.get_texturepack_name or minetest.get_texturepack_res would be great but I can't find any sort of get like that inside the API. I can't find very much at all about texture pack identification inside the API, possibly I'm looking in the wrong place?

I'm fairly sure if I could establish the above I could fairly easily resize all the slab images to be the same by using the existing texture functions on node definition/override they are very powerful. But if I can't establish what size textures are being used nominally as the "default size" I have no clue what size to either try and down/up sample them to on the fly.

Anyways appreciate any pointers or suggestions in the correct direction or another way to do this I'm not seeing. Even if the answer at the moment is go raise an enhancement against MT engine at least I can stop hunting around/through the API and forum boards :).

User avatar
Linuxdirk
Member
Posts: 2501
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: Any way to get current texture pack used inside a mod

by Linuxdirk » Post

sirrobzeroone wrote:
Fri May 22, 2020 05:25
or minetest.get_texturepack_res would be great
This would be quite awesome, yes. But it needs to be tone on a texture base because textures in a texture pack can have different sizes, so minetest.get_texture_dimensions('texture_name.png') would be a great idea, returning a table like { w = 16, h = 16 } for example.

Unfortunately nothing like this is currently implemented in Minetest.

User avatar
sfan5
Moderator
Posts: 3890
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

Re: Any way to get current texture pack used inside a mod

by sfan5 » Post

The ^ modifier will upscale the smaller texture to the size of the bigger one before overlaying.
Unfortunately other modifiers such as [mask do not have this, which makes them quite broken with texturepacks.

It's impossible to solve this with an API like minetest.get_texturepack_res, since on a server each client can have a different texture pack selected (or none at all).
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
sirrobzeroone
Member
Posts: 146
Joined: Mon Jul 16, 2018 07:56

Re: Any way to get current texture pack used inside a mod

by sirrobzeroone » Post

Thanks both, really appreciate the help

Hmm looks like I'm better to get the user to tell me by adding a config a setting, make the default value to align with base texture pack but user can override the value to whatever res/px the texture pack is they are using as a base.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest