minetest / minetest

Minetest is an open source voxel game-creation platform with easy modding and game creation
https://www.minetest.net/
Other
10.65k stars 2.01k forks source link

A simple way to set the wieldhand texture in-game (as a player object property?) #8866

Open paramat opened 5 years ago

paramat commented 5 years ago

Before now i have suggested that the wieldhand automatically samples the player arm part of the player skin, but that makes it depend on a player model and UV wrapped texture (i think we should support nodebox and upright sprite players), is less flexible in terms of customising the appearence, and would be more complex to implement.

It seems to me that the wieldhand texture should be something that is grouped together with the player skin texture, and applied when a skin texture is applied.

///////////////////////////////////////////////////

EDIT: Rewritten request follows:

Problem:

Currently, the wieldhand appearance and capabilities are changeable in-game by creating a special single-slot inventory slot called "hand" and adding or changing the hand tool placed in that slot.

This implementation is perhaps fine for when you actually want to change the tool capabilities of the hand, but the large majority of desired usage is only altering the wieldhand texture to match the custom skin applied to a player.

For only altering the wieldhand texture, the inventory slot method is complex and awkward: it requires registering a hand tool for every wieldhand texture, you also need to create the "hand" slot before using it for some CSM cheating related reason: https://github.com/minetest/minetest/blob/787561b29afdbc78769f68c2f5c4f2cff1b32340/doc/lua_api.txt#L3019-L3020

Request:

I think there should be a simple way to set the wieldhand texture, similar to how the player object textures can be changed. I think the wieldhand texture should probably be a player object property, just like the 'textures' player object property, so that it can be simply set in 'player:set_properties()' alongside the skin textures. This seems the right place to set the wieldhand texture.

Related PRs:

2827

7312

ghost commented 5 years ago

It seems to me that the wieldhand texture should be something that is grouped together with the player skin texture, and applied when a skin texture is applied.

100% yes! 👍

HybridDog commented 5 years ago

I think if you want that the wieldhand looks like the player skin hand, you have to use the UV texture. The arm which swings around when the player holds the left mouse button is, as far as I know, a bone in the player model. If you automatically extract and transform this bone to have a wieldhand, the wieldhand would always look like the player's arm, even if the player uses a different model (the model should have the arm bone).

HybridDog commented 5 years ago

If you want to group the wieldhand and skin together and don't use the UV texture, you'd need to add an extra wieldhand texture for every skin, I think. Creating these textures for the existing skins is probably a lot of work.

paramat commented 5 years ago

~The current wieldhand texture could be the fallback if one isn't supplied. But good point, perhaps auto-sampling the skin could be done, but be an option (probably enabled by default), but i wouldn't want it to be the only way as that forces games to use a model for the player. Because player models can vary so much, a game would have to precisely specify what rectangular section of the skin texture to use, per-model, as the wieldhand. Perhaps we have a texture modifier that can already crop a texture to a particular subsection? I think we should support nodebox players (maybe sprite players too) as i disagree with the use of Blender being a requirement for creating a game, even though most games use an animated model for the player.~

GreenXenith commented 5 years ago

Solar Plains does this. https://github.com/Jordach/Solar_Plains/blob/master/mods/wardrobe/hands.lua

paramat commented 4 years ago

I rewrote and improved the issue title and first comment.