Overriding The Hand

User avatar
LocaL_ALchemisT
Member
 
Posts: 56
Joined: Thu Jul 19, 2012 16:21
Location: Asia Tenggara

Overriding The Hand

by LocaL_ALchemisT » Mon Dec 01, 2014 10:01

":" from default mod
how to override this item to give action when user left-clicked while empty-handed?
 

User avatar
TG-MyinaWD
Member
 
Posts: 356
Joined: Thu May 08, 2014 21:22
Location: Far Eden
GitHub: Maddie-Myina
IRC: Maddie-Myina
In-game: .

Re: Overriding The Hand

by TG-MyinaWD » Mon Dec 01, 2014 17:03

I think its Hardcoded in the Source. Since I tried making the hand a nodebox but it gives me a warning. So it somewhere in the Source.
I'm a Transgender no shame about it.
I prefer to be considered as a "Girl/Lady/Miss/Madam/Female" for now on.
 

User avatar
rubenwardy
Moderator
 
Posts: 5965
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Overriding The Hand

by rubenwardy » Mon Dec 01, 2014 17:27

Code: Select all
minetest.register_item(":", {
   type = "none",
   wield_image = "wieldhand.png",
   wield_scale = {x=1,y=1,z=2.5},
   tool_capabilities = {
      full_punch_interval = 0.9,
      max_drop_level = 0,
      groupcaps = {
         crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1},
         snappy = {times={[3]=0.40}, uses=0, maxlevel=1},
         oddly_breakable_by_hand = {times={[1]=3.50,[2]=2.00,[3]=0.70}, uses=0}
      },
      damage_groups = {fleshy=1},
   }
})


https://github.com/minetest/minetest_ga ... ols.lua#L4
Last edited by rubenwardy on Mon Dec 01, 2014 19:51, edited 1 time in total.
 

User avatar
pandaro
Member
 
Posts: 320
Joined: Sun Jan 08, 2012 21:34
Location: behind
GitHub: pandaro

Re: Overriding The Hand

by pandaro » Mon Dec 01, 2014 17:47

This is a good question.
I tried using "minetest.override_item ()"
This raises an error:
18:42:59: ERROR[main]: ...est/0.49.5/bin/../games/blockrole/mods/tradeoff/init.lua:2: Attempt to redefine type of : to "none"
So the only solution I see is to change the definition of the hand in default.
If some core developper could implement a more elegant solution would be useful.
 

User avatar
rubenwardy
Moderator
 
Posts: 5965
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Overriding The Hand

by rubenwardy » Mon Dec 01, 2014 19:51

pandaro wrote:This is a good question.
I tried using "minetest.override_item ()"
This raises an error:
18:42:59: ERROR[main]: ...est/0.49.5/bin/../games/blockrole/mods/tradeoff/init.lua:2: Attempt to redefine type of : to "none"
So the only solution I see is to change the definition of the hand in default.
If some core developper could implement a more elegant solution would be useful.


Override item is supposed to be used to override properties, not the whole thing.
The name of the hand is "", not ":" (":" is used to allow the item name to be "", it is the override character).

Suggestion: minetest.registered_items[""].on_punch = ...
 

User avatar
pandaro
Member
 
Posts: 320
Joined: Sun Jan 08, 2012 21:34
Location: behind
GitHub: pandaro

Re: Overriding The Hand

by pandaro » Mon Dec 01, 2014 20:31

sorry rubenwardy
i try with your subgestion like:
minetest.registered_items[""].on_use=function(itemstack,placer,pointed_thing)
print(tostring("hell"))
end
there is somethings wrong?
 

User avatar
Hybrid Dog
Member
 
Posts: 2728
Joined: Thu Nov 01, 2012 12:46

Re: Overriding The Hand

by Hybrid Dog » Tue Dec 16, 2014 19:03

I've got a question about hand:
When I played with an old tnt mod, a hand spawned. And it was an entity, l think. How can l let my hand spawn somewhere outside my inventory without writing a special code for it?

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪
 


Return to Modding Discussion



Who is online

Users browsing this forum: zicmama and 1 guest