Lua function to customize wielded hand

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

Lua function to customize wielded hand

by MirceaKitsune » Sat Jun 14, 2014 01:22

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.
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: Lua function to customize wielded hand

by Krock » Sat Jun 14, 2014 06:53

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",
   })
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

Re: Lua function to customize wielded hand

by MirceaKitsune » Sat Jun 14, 2014 11:21

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.
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: Lua function to customize wielded hand

by Krock » Sat Jun 14, 2014 11:27

Why not use the player skin and take the hand from there?
That one wouldn't require a lua function.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

Re: Lua function to customize wielded hand

by MirceaKitsune » Sat Jun 14, 2014 11:33

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.
 


Return to Minetest Features

Who is online

Users browsing this forum: No registered users and 7 guests

cron