Page 1 of 1

Lua function to customize wielded hand

PostPosted: Sat Jun 14, 2014 01:22
by MirceaKitsune
Thread for issue #1368:

Please consider adding a Lua function to allow customizing hand appearance per player. This would custom player models / skins to set an appropriate hand for the player to see in 1st person view when no item is selected. Currently it doesn't seem like wieldhand.png can be changed from Lua, which is very limiting with some mods.

This is one of the things my Creatures mod could really use, and not only it. Most servers now allow customizing player appearance from the inventory menu, and the hand matching to that appearance would be very useful. With Lua being so flexible and complete already, I actually consider this a must.

Re: Lua function to customize wielded hand

PostPosted: Sat Jun 14, 2014 06:53
by Krock
Or like here, some quote out of a topic. Maybe it's already possible this way? I don't know.

viewtopic.php?id=7846#p139019
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
player:hud_set_flags({crosshair = false})
   player:hud_remove(name)
   shooter_hud = player:hud_add({
   hud_elem_type = "image",
   position = {x=0.5,y=0.5},
   scale = {x=1.0,y=1.0},
   name = "Shooter Crosshair",
   text = "shooter_crosshair.png",
   })

Re: Lua function to customize wielded hand

PostPosted: Sat Jun 14, 2014 11:21
by MirceaKitsune
Krock wrote:Or like here, some quote out of a topic. Maybe it's already possible this way? I don't know.

viewtopic.php?id=7846#p139019


Looks like code to set a textured crosshair, which is indeed possible with the Lua HUD. Something similar for the hand doesn't exist yet, but would be very welcome.

I wouldn't advice using a HUD property however. Since the wielded item is only one, and it represents either the hand or the selected hotbar item... so there isn't much else to configure. A simple player property to change the appearance (drawtype and texture) of the hand per player is all I think is needed.

Re: Lua function to customize wielded hand

PostPosted: Sat Jun 14, 2014 11:27
by Krock
Why not use the player skin and take the hand from there?
That one wouldn't require a lua function.

Re: Lua function to customize wielded hand

PostPosted: Sat Jun 14, 2014 11:33
by MirceaKitsune
Krock wrote:Why not use the player skin and take the hand from there?
That one wouldn't require a lua function.


Considering player appearance can use any drawtype and texture (including different UV mapping), I don't think that would be a good idea, since detecting it properly would be impossible. This would also offer less flexibility.