09:42 Elon_Satoshi> I'm trying to find a minetest mod that allowed a command that would
identify the ID of whatever object you were holding
09:47 sfan5> that's pretty trivial
09:47 sfan5> might be easier to just write your own
09:53 nore> sfan5: it is possible to get the ID from lua?
09:53 Elon_Satoshi> sfan5: Hmm
09:53 Elon_Satoshi> sfan5: It was something like /whatisthis
09:53 sfan5> nore: i'm assuming he means the "default:sandstonebrick" thing
09:55 calculon> you can just use F5, it shows the id of the object you are pointing
09:55 nore> calculon: yes, pointing but not holding
09:55 nore> that's the problem
09:56 calculon> sure, that depends on what you really want
09:56 calculon> that's what i do to identify an object, drop it and see what it says
09:57 sfan5> Elon_Satoshi:
minetest.register_chatcommand("whatisthis",{func=function(name) return
true,"You are holding:
"..minetest.get_player_by_name(name):get_wielded_item():get_name() end})
10:03 Elon_Satoshi> sfan5: What's the func=function(name) part for?
10:03 sfan5> it defines the function that runs when you call the command
10:07 Elon_Satoshi> Thanks sfan5, it works
10:08 sfan5> like i said: trivial
12:48 QwertyDragon> sfan5 Can I pass that on to people with LGPL 2.1 as "sfan5" as author?
...He said yes.
...well, his exact words were:
12:48 sfan5> use whatever license you want, i don't care
So to use this just go into /minetest/mods and create folder called "whatisthis".
Inside folder /minetest/mods/whatisthis create a file named init.lua
and paste this:
Code: Select all
minetest.register_chatcommand("whatisthis", {
func=function(name)
return true,"You are holding:"..
minetest.get_player_by_name(name):get_wielded_item():get_name()
end,
})
Code: Select all
whatisthis mod tells you what you are holding.
Author: sfan5
Licence: LGPL 2.1
If the world you are using is "something-else"
Then go into /minetest/worlds/something-else
and add this line in world.mt file
Code: Select all
load_mod_whatisthis = true
correct name of the item you are holding.
/whatisthis