How could i get the armor list in 3darmor not in inventory?

User avatar
linushsao
Member
 
Posts: 331
Joined: Mon Jan 27, 2014 12:56
IRC: linushsao
In-game: linus

How could i get the armor list in 3darmor not in inventory?

by linushsao » Sat Jun 07, 2014 04:19

hi all,

i try to make a simple mod offers me a helmet with light,so i could equip that light_helmet and mining(because we can hold only one tools or weapon at the same time). i read Echo's mod "walkinglight",and made a helmet wih light(Tkx Echo).But the function"get_wielded_item()" seems only retuen items in inventory,NOT the Equipment IN 3DARMOR's screen .so i can hold my light_helmet,i got walkinglight.But when i equip my light_helmet in 3darmro,i got not walkinglight.

i have read the page LuaEntitySAO, have there any function could retuen my equiped item in 3darmor?
 

User avatar
JPRuehmann
Member
 
Posts: 334
Joined: Fri Mar 21, 2014 21:40

Re: How could i get the armor list in 3darmor not in invent

by JPRuehmann » Sat Jun 07, 2014 15:09

Hello
God Idea.
Hope you get it work.
Thanks,
JPR
 

User avatar
stu
Member
 
Posts: 737
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11

Re: How could i get the armor list in 3darmor not in invent

by stu » Sat Jun 07, 2014 15:55

linushsao wrote:hi all,

i try to make a simple mod offers me a helmet with light,so i could equip that light_helmet and mining(because we can hold only one tools or weapon at the same time). i read Echo's mod "walkinglight",and made a helmet wih light(Tkx Echo).But the function"get_wielded_item()" seems only retuen items in inventory,NOT the Equipment IN 3DARMOR's screen .so i can hold my light_helmet,i got walkinglight.But when i equip my light_helmet in 3darmro,i got not walkinglight.

i have read the page LuaEntitySAO, have there any function could retuen my equiped item in 3darmor?


Not tested but I think this should work (or something similar)
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
local inv = player:get_inventory()
if inv:contains_item("armor", "modname:light_helmet")

That is for the current git master of 3d_armor, for older versions you need to use
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
if inv:contains_item("armor_head", "modname:light_helmet")
 

User avatar
linushsao
Member
 
Posts: 331
Joined: Mon Jan 27, 2014 12:56
IRC: linushsao
In-game: linus

Re: How could i get the armor list in 3darmor not in invent

by linushsao » Sun Jun 08, 2014 03:16

still some problem,but still thank you stu. i believe it's the way to figure out.

may i ask a question,for examaple, the code like"local inv = player:get_inventory()",for debugging i have to know the value of inv, how could i do in modding? i mean in other language like C,we have IDE tools to run my code and check the value,But our minetest mod is call by minetest,how could i know the value's in mod?

minetest develope wiki suggest us to use eclipse+koneki for modding,can it bring minetest up for modding? or what IDE do you have for modding & debugging?

Tks..
 

User avatar
linushsao
Member
 
Posts: 331
Joined: Mon Jan 27, 2014 12:56
IRC: linushsao
In-game: linus

Re: How could i get the armor list in 3darmor not in invent

by linushsao » Thu Jun 12, 2014 14:12

finally,it works. download linke is http://goo.gl/KC8pc6 .I added some codes about "Light_Helmet" into Walking-Light MOD .But i'm a new user for LUA,if you find some code looks stupid ,it is mine.

Tkx Echo's mod ,and stu's suggestion.

pls use "/giveme walking_light:light_halmet" to test this light_helmet or following the recipe.

Image
 

User avatar
LanceJZ
New member
 
Posts: 5
Joined: Thu Sep 11, 2014 08:54
GitHub: Lancejz
In-game: Purple

Re: How could i get the armor list in 3darmor not in invent

by LanceJZ » Thu Sep 18, 2014 09:35

That looks awesome! I was just going to look into how to do that myself. Thank you!
 


Return to WIP Mods

Who is online

Users browsing this forum: Google [Bot] and 7 guests

cron