Hi, I'm starting with minetest programming and I have some doubts that I would like to be helped if you can.
I am currently doing a block that counts the empty air nodes (in the room that is placed, represents that it is on a wall) and replace them with an air node of my mod, then I would like to know how I can make the nodes of air of my mod have metadata like temperature, humidity and things like that, would be possible (and how to access those metadata from a function)?
PD: then would come to eliminate the nodes of the room if the block is broken and a little silly question is like making the ovens give more than one item (I see that it has more inventory tables (the oven) but I do not know how to put it in the code, if I have any questions, I will post it here thanks in advance
PD: If someone wants to join and know more about the project, they can ask for mp. I am using the google translator and my poor english, sorry for the inconvenience
I have problems and doubts, do you help me?
- ChimneySwift
- Member
- Posts: 320
- Joined: Fri Sep 22, 2017 06:46
- GitHub: ChimneySwift
- IRC: ChimneySwift
- In-game: ChimneySwift
- Location: 127.0.0.1
Re: I have problems and doubts, do you help me?
A node metadata object can be accessed via:then I would like to know how I can make the nodes of air of my mod have metadata like temperature, humidity and things like that, would be possible (and how to access those metadata from a function)?
local meta = minetest.get_meta(pos) -- Get meta object for node at pos
With that you can set metadata as per the documentation:
https://github.com/minetest/minetest/bl ... .txt#L3185
To set/get an integer, you use:
meta:set_int("temp", 20)
local temp = meta:get_int("temp") -- returns "20"
Metadata will remain persistent through out server reboots
minetest.remove_node(pos) -- set node at pos to regular airthen would come to eliminate the nodes of the room if the block is broken
https://github.com/minetest/minetest/bl ... .txt#L2520
you can also set buildable_to = true in the air item def to make blocks placed on that block replace the block, for example when you place a block on grass it actually replaces the grass. Regular air has this set.
As far as I'm aware, you should be able to set "output" in the cooking craft definition to "<item name> <number>", since this is just a serialized ItemStack eg "default:dirt 99" would output 99 dirt each time.little silly question is like making the ovens give more than one item
https://github.com/minetest/minetest/bl ... .txt#L1390
A spoon is basically a tiny bowl with a stick on it
- rubenwardy
- Moderator
- Posts: 6978
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
Re: I have problems and doubts, do you help me?
I wrote this chapter on metadata and storage: https://rubenwardy.com/minetest_modding ... orage.html
Re: I have problems and doubts, do you help me?
Thank you for responding, and been testing the information that you give me and for the moment everything is fine, as for the oven I was referring to how you can give more than two objects (example: burn 1 gold and refine it in X mineral and with X probability you can get the mineral Z, we go for a rudimentary system of refining, later I would like to do something better) the shots went that way.
And now I have another question as to how I can make the blocks when they are placed with the front facing the player? in blocks like a refrigerator and / or generator it is important to know how you are going to put them above all if you are to receive objects from the other sides (and not from the front xD) I am doing the nodeboxes with the node box editor that is the one they recommend, Thank you very much again to those who have answered and to those who respond now ;) :D
PS: in an air block can functions be done? I mean for example if there are 11 square blocks (a room of 11x11 air blocks) and in the middle of that space there is a block that emits cold or heat (at the moment I do not want to touch the issue of which temperature expands more than the other on one material or another) and I want if all the air blocks in that space are at 20 degrees and I want them to go down or up depending on what that block emits, how could it do it? Would I have to make an invisible block that manages all the surrounding blocks? I do not have much idea of how to do it
And now I have another question as to how I can make the blocks when they are placed with the front facing the player? in blocks like a refrigerator and / or generator it is important to know how you are going to put them above all if you are to receive objects from the other sides (and not from the front xD) I am doing the nodeboxes with the node box editor that is the one they recommend, Thank you very much again to those who have answered and to those who respond now ;) :D
PS: in an air block can functions be done? I mean for example if there are 11 square blocks (a room of 11x11 air blocks) and in the middle of that space there is a block that emits cold or heat (at the moment I do not want to touch the issue of which temperature expands more than the other on one material or another) and I want if all the air blocks in that space are at 20 degrees and I want them to go down or up depending on what that block emits, how could it do it? Would I have to make an invisible block that manages all the surrounding blocks? I do not have much idea of how to do it
Who is online
Users browsing this forum: Gmr_Leon and 12 guests