MrRar / edit_skin

Advanced skin editor mod for Minetest
MIT License
7 stars 5 forks source link

Question about the API. #11

Closed BlockAndPixelAge closed 5 months ago

BlockAndPixelAge commented 5 months ago

Greetings,

I have a question about the API, I mean I know how to add things like top, hair, shoes directly into the mod, but I don't really understand the API. Is it possible to add more parts, like shirt, from outside the mod with the API, while the mod depends on edit_skin?

For me the API looks complicated, for now because I don't understand it.

MrRar commented 5 months ago

Yes.

Here is an example of adding a new top to the mod:

edit_skin.register_item({
    type = "top",
    texture = "mymod_top_1.png",
    mask = "mymod_top_1_mask.png"
})

This code registers a new top that uses mymod_top_1.png as the main texture and mymod_top_1_mask.png as the color mask.

Any other questions?

BlockAndPixelAge commented 5 months ago

Tested it, and it's working.

I comment again, if I have any more questions.

Thank you.

BlockAndPixelAge commented 5 months ago

Question again.

Let's say I accidentally disabled the Mod that depends on edit_skin, while having the skin parts from that Mod in use, is there a code, that turns the Skin automatically back to the default male or female skin from edit_skin, when I disabled it?

Like "if ("mymod") is disable then" or something like that.

MrRar commented 5 months ago

Question again.

Let's say I accidentally disabled the Mod that depends on edit_skin, while having the skin parts from that Mod in use, is there a code, that turns the Skin automatically back to the default male or female skin from edit_skin, when I disabled it?

Like "if ("mymod") is disable then" or something like that.

There is no mechanizem for that currently. If a texture is applied to a player, and the file does not exist, you will get "Could not load" errors.

I'm not sure it would be a good idea to set missing textures to the default texture. If someone axodentally disabled a mod, they probably dont want their skin set back to default.

BlockAndPixelAge commented 5 months ago

Thank you.

For now, one last question. I read that Minetest having a hardcoded node limit. Does registering more Skin options count to this limit as well, even though the Skin options count as items(?) and not nodes?

MrRar commented 5 months ago

Thank you.

For now, one last question. I read that Minetest having a hardcoded node limit. Does registering more Skin options count to this limit as well, even though the Skin options count as items(?) and not nodes?

Skin items do not count against the Minetest node limit. Skin items aren't registered as Minerest craft items. You cant have them in your inventory or anything like that. I think the limit would be RAM. I think Lua JIT is limited to 2GB so that might be the limit.

BlockAndPixelAge commented 5 months ago

So 2GB in total, for everything that counts as an Item, like 1GB Skin items and the other 1GB Minetest craft items. Good to know.

Hope that I don't mix it up, that the 2GB RAM limit doesn't equal 2GB file sizes.