Change tool default range
- texmex
- Member
- Posts: 1753
- Joined: Mon Jul 11, 2016 21:08
- GitHub: tacotexmex
- In-game: tacotexmex
Change tool default range
I've managed to increase the range of the hand (":") by range = 12, but whenever another item is wielded the range falls back to something undefined, some default. How do I make it so that the player always has a minimum range of, say, 12?
- Desour
- Member
- Posts: 1472
- Joined: Thu Jun 19, 2014 19:49
- GitHub: Desour
- IRC: Desour
- In-game: DS
- Location: I'm scared that if this is too exact, I will be unable to use my keyboard.
Re: Change tool default range
Look how creative did it.
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)
- texmex
- Member
- Posts: 1753
- Joined: Mon Jul 11, 2016 21:08
- GitHub: tacotexmex
- In-game: tacotexmex
- Krock
- Developer
- Posts: 4650
- Joined: Thu Oct 03, 2013 07:48
- GitHub: SmallJoker
- Location: Switzerland
- Contact:
Re: Change tool default range
Add the wieldhand item to the player's "hand" slot. Otherwise it will fall back to 4m because Minetest doesn't know what to do in case an item without specified range is selected.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
- texmex
- Member
- Posts: 1753
- Joined: Mon Jul 11, 2016 21:08
- GitHub: tacotexmex
- In-game: tacotexmex
Re: Change tool default range
I don’t quite understand. I thought that was what I did. Are there extra steps past register_item(”:”)?Krock wrote:Add the wieldhand item to the player's "hand" slot. Otherwise it will fall back to 4m because Minetest doesn't know what to do in case an item without specified range is selected.
- Hybrid Dog
- Member
- Posts: 2834
- Joined: Thu Nov 01, 2012 12:46
- GitHub: HybridDog
Re: Change tool default range
If I understand that code correctly, it should set the range to the wielded item's range if available.
If the wielded item's range is unavailable, it sets the range to the hand's range,
except if both are inavailable, then it sets the range to 4.
I think that code does not do what it should do. Either all items have a range implicitly set to 4 at another place in code (except items which had range set during minetest.register_item), or the hand inventory list does not actually contain a hand?
If the wielded item's range is unavailable, it sets the range to the hand's range,
except if both are inavailable, then it sets the range to 4.
I think that code does not do what it should do. Either all items have a range implicitly set to 4 at another place in code (except items which had range set during minetest.register_item), or the hand inventory list does not actually contain a hand?
- Desour
- Member
- Posts: 1472
- Joined: Thu Jun 19, 2014 19:49
- GitHub: Desour
- IRC: Desour
- In-game: DS
- Location: I'm scared that if this is too exact, I will be unable to use my keyboard.
Re: Change tool default range
Of course I did.texmex wrote:What? Did you read my post? :P
I thought that creative does what you want.
I have questions for you:
Do you also use MTG?
What are you trying to do exactly? Do you want that items which have their range set to eg. 3 have a bigger range (probably not)?
(hand invlist in lua_api.txt)
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)
Who is online
Users browsing this forum: No registered users and 8 guests