How to…
How to…
How to get information about node player destroyed?
How to get information about near/adjacent nodes around destroyed node?
How to put item(s) into my inventory?
How to remove item(s) from my inventory?
How to manipulate durability bar of using tool (e.g. pickaxe)?
How to get information about near/adjacent nodes around destroyed node?
How to put item(s) into my inventory?
How to remove item(s) from my inventory?
How to manipulate durability bar of using tool (e.g. pickaxe)?
- azekill_DIABLO
- Member
- Posts: 7507
- Joined: Wed Oct 29, 2014 20:05
- GitHub: azekillDIABLO
- In-game: azekill_DIABLO
- Location: OMICRON
- Contact:
Re: How to…
check lua_api.txtSergey wrote:How to get information about node player destroyed?
How to get information about near/adjacent nodes around destroyed node?
How to put item(s) into my inventory?
How to remove item(s) from my inventory?
How to manipulate durability bar of using tool (e.g. pickaxe)?
> minetest.after_dig_node
> no idea sir... after_dig_node + radius test?
> hah.
> *bis*
> Probably not possible.
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!
DMs are always open if you want to get in touch!
Re: How to…
Well, I figured out something
1) To get info about destroyed node I can use on_destruct method
while registering new node (minetest.register_node) or overriding existing one (minetest.override_item)
2) To get info about adjacent nodes around destroyed node
3) But how to work with inventory is a problem for me at the moment.
I am learning modding. So I need help.
1) To get info about destroyed node I can use on_destruct method
Code: Select all
on_destruct = function(pos)
local node = minetest.get_node( pos )
end
2) To get info about adjacent nodes around destroyed node
Code: Select all
on_destruct = function(pos)
...
local node2 = minetest.get_node( { x = pos.x + 1, y = pos.y, z = pos.z } )
...
local node2 = minetest.get_node( { x = pos.x, y = pos.y, z = pos.z + 1 } )
...
... and so on
end
I am learning modding. So I need help.
- azekill_DIABLO
- Member
- Posts: 7507
- Joined: Wed Oct 29, 2014 20:05
- GitHub: azekillDIABLO
- In-game: azekill_DIABLO
- Location: OMICRON
- Contact:
Re: How to…
inventory is hard thing to understand. I never figured how to use it really.
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!
DMs are always open if you want to get in touch!
- rubenwardy
- Moderator
- Posts: 6978
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
- azekill_DIABLO
- Member
- Posts: 7507
- Joined: Wed Oct 29, 2014 20:05
- GitHub: azekillDIABLO
- In-game: azekill_DIABLO
- Location: OMICRON
- Contact:
Re: How to…
^^^this guy is a professional
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!
DMs are always open if you want to get in touch!
- octacian
- Member
- Posts: 597
- Joined: Mon Dec 21, 2015 22:18
- GitHub: octacian
- IRC: octacian
- In-game: octacian
- Location: Canada
Re: How to…
I know all your questions have been mostly answered, but I figured I'd go through them one-by-one here.
1. Use the on_destruct method or minetest.register_on_dignode
2. Use a function like this in combination with the above
3. See this (adding items)
4. See this (taking items)
5. Use the get_wear, set_wear, and add_wear ItemStack (this or this) methods
1. Use the on_destruct method or minetest.register_on_dignode
2. Use a function like this in combination with the above
3. See this (adding items)
4. See this (taking items)
5. Use the get_wear, set_wear, and add_wear ItemStack (this or this) methods
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.
I'm currently inactive in the Minetest community! So if I don't respond, that's why.
Re: How to…
What is "main" itemstack?
How many stacks there are?
What are their names and what are their purpose?
If I add stack of 10 cobbles to my inventory, will these cobble append to cobbles I already have in inventory? Or they will use separate cell in inventory?
Sorry, if I ask silly questions.
How many stacks there are?
What are their names and what are their purpose?
If I add stack of 10 cobbles to my inventory, will these cobble append to cobbles I already have in inventory? Or they will use separate cell in inventory?
Sorry, if I ask silly questions.
- azekill_DIABLO
- Member
- Posts: 7507
- Joined: Wed Oct 29, 2014 20:05
- GitHub: azekillDIABLO
- In-game: azekill_DIABLO
- Location: OMICRON
- Contact:
Re: How to…
>main is the inventory of player. For items you always refer to their containers, before calling them.
>stacks? depends on the size on the inventory!
>no idea, sorry
>depends if you tell them to go in your main inventory, everything will be fine.
don't be sorry, everyone must start somewhere.
>stacks? depends on the size on the inventory!
>no idea, sorry
>depends if you tell them to go in your main inventory, everything will be fine.
don't be sorry, everyone must start somewhere.
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!
DMs are always open if you want to get in touch!
Re: How to…
Player or chests have a "main" inventory.Sergey wrote:What is "main" itemstack?
The furnace has inventories "fuel", "src" and "dst".
For items from mods (eg. workbench or circular saw),
you need to look at their source / api-docs.
'My' wiki-pages: Build-a-home - basic-robot - basic_robot_csm - basic-machines - digtron - xdecor -
Map-Database
Map-Database
Re: How to…
This is from tools.lua which is installed with the game
I don't understand why uses=30 if I can use diamond pickaxe 810 times to break stone.
What do all this parameters mean? Official documentation is poor!
Code: Select all
minetest.register_tool("default:pick_diamond", {
description = "Diamond Pickaxe",
inventory_image = "default_tool_diamondpick.png",
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level=3,
groupcaps={
cracky = {times={[1]=2.0, [2]=1.0, [3]=0.50}, uses=30, maxlevel=3},
},
damage_groups = {fleshy=5},
},
sound = {breaks = "default_tool_breaks"},
})
What do all this parameters mean? Official documentation is poor!
Re: How to…
How to get current player's name?
I need it to get player's inventory:
I need it to get player's inventory:
Code: Select all
local inv = minetest.get_inventory({type="player", name="foobar"})
Re: How to…
OK. That's my progress.
[SOLVED] 1. How to get information about node player destroyed?
[SOLVED] 2. How to get information about near/adjacent nodes around destroyed node?
Thanks to octacian.
[SOLVED] 3. How to put item(s) into my inventory?
[SOLVED] 4. How to remove item(s) from my inventory?
Thanks to rubenwardy.
[SOLVED] 5. How to get current player's name?
It is simple. I used minetest.register_on_joinplayer method which run at the moment player start playing and give info about player joined. Then I use global variable to save that player's name.
What is unclear yet for me?
1. How to know what tool was used inside node's on_destruct method?
2. How to manipulate durability/wear bar of this tool correctly (e.g. pickaxe)?
3. How wear range 0–65535 of tools related to info in /usr/share/minetest/games/minetest/mods/default/tools.lua
For example, this is info about diamond pickaxe:
I don't know what all these parameters mean. I wish I know but I can't get details in official documentation. But from here (and from real experience) I know that I can use diamond pickaxe 810 times to break stone (stone pickaxe — 60 times respectively). So I don't see such info in tools.lua.
4. (from above) How I can manually increase wear state of some tool by 10 (for example) uses?
[SOLVED] 1. How to get information about node player destroyed?
[SOLVED] 2. How to get information about near/adjacent nodes around destroyed node?
Thanks to octacian.
[SOLVED] 3. How to put item(s) into my inventory?
[SOLVED] 4. How to remove item(s) from my inventory?
Thanks to rubenwardy.
[SOLVED] 5. How to get current player's name?
It is simple. I used minetest.register_on_joinplayer method which run at the moment player start playing and give info about player joined. Then I use global variable to save that player's name.
What is unclear yet for me?
1. How to know what tool was used inside node's on_destruct method?
2. How to manipulate durability/wear bar of this tool correctly (e.g. pickaxe)?
3. How wear range 0–65535 of tools related to info in /usr/share/minetest/games/minetest/mods/default/tools.lua
For example, this is info about diamond pickaxe:
Code: Select all
minetest.register_tool("default:pick_diamond", {
description = "Diamond Pickaxe",
inventory_image = "default_tool_diamondpick.png",
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level=3,
groupcaps={
cracky = {times={[1]=2.0, [2]=1.0, [3]=0.50}, uses=30, maxlevel=3},
},
damage_groups = {fleshy=5},
},
sound = {breaks = "default_tool_breaks"},
})
4. (from above) How I can manually increase wear state of some tool by 10 (for example) uses?
Re: How to…
Is there event like register_on_toolwearout that run when active tool completely wear out?
Re: How to…
I will continue posting my questions in more suitable topic — Post your modding questions here
I had to start asking questions there — more chances to get answers.
I had to start asking questions there — more chances to get answers.
Who is online
Users browsing this forum: No registered users and 5 guests