## Post your modding questions here

Evergreen
Member

Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
I know this doesn't have to do with mods, but how large is a chunk(otherwise known as block)? And how can I tell that I am on the edge of a chunk?

jojoa1997
Member

Posts: 2890
Joined: Thu Dec 13, 2012 05:11
Location: Earth
For the first question it is 16*16*16
Coding;
1X coding
3X debugging
12X tweaking to be just right

kaeza
Moderator

Posts: 2162
Joined: Thu Oct 18, 2012 05:00
Location: Montevideo, Uruguay
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Evergreen wrote:I know this doesn't have to do with mods, but how large is a chunk(otherwise known as block)? And how can I tell that I am on the edge of a chunk?

16³

for the second question, it's just easy math:

Code: Select all
`local pos = player:getpos()local relpos = { x=pos.x % 16, y=pos.y % 16, z=pos.z % 16 }if relpos.x <= 1 or relpos.x >= 15 or relpos.y <= 1 or relpos.y >= 15 or relpos.z <= 1 or relpos.z >= 15 then  -- I am at the edgeelse  -- I am notend`

Last edited by kaeza on Wed May 22, 2013 22:47, edited 1 time in total.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

Member

Posts: 4026
Joined: Fri Jul 20, 2012 16:19
Location: Germany
Evergreen wrote:I know this doesn't have to do with mods, but how large is a chunk(otherwise known as block)? And how can I tell that I am on the edge of a chunk?

As jojoa said, a mapblock is 16x16x16 nodes. However, the map generator always generates 5x5x5 mapblocks at once.

To see if you are at the edge of the mapblock just look at the animation of lava. It is by default not synced (there is a setting for that in minetest.conf), so you can see the mapblock borders.

EDIT: 2500 POSTS!!!!
Last edited by PilzAdam on Wed May 22, 2013 22:49, edited 1 time in total.

shaneroach
Member

Posts: 141
Joined: Sat Apr 20, 2013 21:05
Location: Austin, TX

LOL

Somehow you didn't strike me as someone who would get excited about your post totals.

In order to change yourself, you must believe the change is possible and that there are rewards for making the change.
- Inspired by Hebrews 11:6

jojoa1997
Member

Posts: 2890
Joined: Thu Dec 13, 2012 05:11
Location: Earth
Evergreen wrote:I know this doesn't have to do with mods, but how large is a chunk(otherwise known as block)? And how can I tell that I am on the edge of a chunk?

As jojoa said, a mapblock is 16x16x16 nodes. However, the map generator always generates 5x5x5 mapblocks at once.

To see if you are at the edge of the mapblock just look at the animation of lava. It is by default not synced (there is a setting for that in minetest.conf), so you can see the mapblock borders.

EDIT: 2500 POSTS!!!!
why do mapblocks generate 5*5*5 and not 16*16*16
Coding;
1X coding
3X debugging
12X tweaking to be just right

kaeza
Moderator

Posts: 2162
Joined: Thu Oct 18, 2012 05:00
Location: Montevideo, Uruguay
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
jojoa1997 wrote:why do mapblocks generate 5*5*5 and not 16*16*16

DERP
Last edited by kaeza on Thu May 23, 2013 10:02, edited 1 time in total.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

Evergreen
Member

Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
Here is something I was working on. What I want is a cauldron that fills with water when right clicked with a bucket of water. I tried this but it doesn't work. Here is the code:
Code: Select all
`minetest.register_node("thaumtest:cauldron_full",{    drawtype="nodebox",    paramtype = "light",    tiles = {"default_wood.png"},    groups = {choppy=2},    node_box = {        type = "fixed",        fixed = {            {-0.500000,-0.375000,-0.500000,-0.375000,0.500000,0.500000},             {0.375000,-0.375000,-0.500000,0.500000,0.500000,0.500000},             {-0.500000,-0.375000,-0.500000,0.500000,0.500000,-0.375000},             {-0.500000,-0.375000,0.375000,0.500000,0.500000,0.500000},            {-0.500000,-0.312500,-0.500000,0.500000,0.312500,0.500000},             {-0.500000,-0.500000,-0.500000,-0.375000,0.500000,-0.375000},             {0.375000,-0.500000,-0.500000,0.500000,0.500000,-0.375000},             {0.375000,-0.500000,0.375000,0.500000,0.500000,0.500000},             {-0.500000,-0.500000,0.375000,-0.375000,0.500000,0.500000},         }    }})minetest.register_node("thaumtest:cauldron_empty",{    drawtype="nodebox",    description= "Cauldron",    paramtype = "light",    tiles = {"default_wood.png"},    groups = {choppy=2},    node_box = {        type = "fixed",        fixed = {            {-0.500000,-0.375000,-0.500000,-0.375000,0.500000,0.500000},             {0.375000,-0.375000,-0.500000,0.500000,0.500000,0.500000},             {-0.500000,-0.375000,-0.500000,0.500000,0.500000,-0.375000},             {-0.500000,-0.375000,0.375000,0.500000,0.500000,0.500000},             {-0.500000,-0.500000,-0.500000,-0.375000,0.500000,-0.375000},             {0.375000,-0.500000,-0.500000,0.500000,0.500000,-0.375000},             {0.375000,-0.500000,0.375000,0.500000,0.500000,0.500000},             {-0.500000,-0.500000,0.375000,-0.375000,0.500000,0.500000},             {-0.500000,-0.375000,-0.500000,0.500000,-0.312500,0.500000},         }    }    on_rightclick = function(pos, node, clicker, itemstack)            if itemstack:get_name() == "bucket:bucket_water" then                  minetest.env:set_node(pos, "thaumtest:cauldron_full")            end    end    }})`

Casimir
Member

Posts: 1163
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi
I thougt it would be nice if you could change stack_max using a setting. So game-modes could use minetest.config instead of overwriting.

This is my first try, but it is not working at all:
in builtin/item.lua line 376
Code: Select all
`---- Item definition defaults--local stack_max = 99if tonumber(minetest.setting_get(stack_max)) then    stack_max = tonumber(minetest.setting_get(stack_max))    print("[builtin] stack_max = ".. tonumber(minetest.setting_get(stack_max)) .."")endminetest.nodedef_default = {    -- Item properties    type="node",    -- name intentionally not defined here    description = "",    groups = {},    inventory_image = "",    wield_image = "",    wield_scale = {x=1,y=1,z=1},    stack_max = stack_max,-- . . .`

@Evergreen
You need to add a , at the end of the on_rightclick and the nodebox.
Last edited by Casimir on Sat May 25, 2013 15:04, edited 1 time in total.

Evergreen
Member

Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
Tried it and it still doesn't work. Code:
Code: Select all
`minetest.register_node("thaumtest:cauldron_full",{    drawtype="nodebox",    paramtype = "light",    tiles = {"default_wood.png"},    groups = {choppy=2},    node_box = {        type = "fixed",        fixed = {            {-0.500000,-0.375000,-0.500000,-0.375000,0.500000,0.500000},             {0.375000,-0.375000,-0.500000,0.500000,0.500000,0.500000},             {-0.500000,-0.375000,-0.500000,0.500000,0.500000,-0.375000},             {-0.500000,-0.375000,0.375000,0.500000,0.500000,0.500000},            {-0.500000,-0.312500,-0.500000,0.500000,0.312500,0.500000},             {-0.500000,-0.500000,-0.500000,-0.375000,0.500000,-0.375000},             {0.375000,-0.500000,-0.500000,0.500000,0.500000,-0.375000},             {0.375000,-0.500000,0.375000,0.500000,0.500000,0.500000},             {-0.500000,-0.500000,0.375000,-0.375000,0.500000,0.500000},         }    }})minetest.register_node("thaumtest:cauldron_empty",{    drawtype="nodebox",    description= "Cauldron",    paramtype = "light",    tiles = {"default_wood.png"},    groups = {choppy=2},    node_box = {        type = "fixed",        fixed = {            {-0.500000,-0.375000,-0.500000,-0.375000,0.500000,0.500000},             {0.375000,-0.375000,-0.500000,0.500000,0.500000,0.500000},             {-0.500000,-0.375000,-0.500000,0.500000,0.500000,-0.375000},             {-0.500000,-0.375000,0.375000,0.500000,0.500000,0.500000},             {-0.500000,-0.500000,-0.500000,-0.375000,0.500000,-0.375000},             {0.375000,-0.500000,-0.500000,0.500000,0.500000,-0.375000},             {0.375000,-0.500000,0.375000,0.500000,0.500000,0.500000},             {-0.500000,-0.500000,0.375000,-0.375000,0.500000,0.500000},             {-0.500000,-0.375000,-0.500000,0.500000,-0.312500,0.500000},         }    },    on_rightclick = function(pos, node, clicker, itemstack)            if itemstack:get_name() == "bucket:bucket_water" then                  minetest.env:set_node(pos, "thaumtest:cauldron_full")            end    end,    }})`

kaeza
Moderator

Posts: 2162
Joined: Thu Oct 18, 2012 05:00
Location: Montevideo, Uruguay
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Code: Select all
`  (...)  on_rightclick = function(pos, node, clicker, itemstack)    if itemstack:get_name() == "bucket:bucket_water" then      minetest.env:set_node(pos, "thaumtest:cauldron_full")    end  end,  } <-- REMOVE THIS})`
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

BlockMen
Developer

Posts: 768
Joined: Fri Mar 01, 2013 17:24
Location: Germany
GitHub: BlockMen
Evergreen wrote:Tried it and it still doesn't work. Code:
Code: Select all
`-code-`

It is caused by the bucket mod. -> https://github.com/minetest/minetest_game/blob/master/mods/bucket/init.lua#L42

When it is changed to on_use() [in bucket mod] it works fine.
^
Edit: Casimirs solution is better (to use on_punch()).

And it has to be
Code: Select all
`  minetest.env:set_node(pos, {name="thaumtest:cauldron_full"})`
Last edited by BlockMen on Sat May 25, 2013 15:59, edited 1 time in total.

Casimir
Member

Posts: 1163
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi
Now working:
Code: Select all
`local stack_max = 99if minetest.setting_get("stack_max") then    stack_max = minetest.setting_get("stack_max")end`

Please interpret this as a pullrequest ;)

@Evergreen
You will encounter an additional problem. The bucket is not calling the on_rightclick function of nodes, it will just place the water. You could use on_punch.
Edit: BlockMen was faster
Last edited by Casimir on Sat May 25, 2013 15:53, edited 1 time in total.

Evergreen
Member

Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
kaeza wrote:
Code: Select all
`  (...)  on_rightclick = function(pos, node, clicker, itemstack)    if itemstack:get_name() == "bucket:bucket_water" then      minetest.env:set_node(pos, "thaumtest:cauldron_full")    end  end,  } <-- REMOVE THIS})`

I looked in the debug, and that is supposed to be there. EDIT: nvm
Last edited by Evergreen on Sat May 25, 2013 16:12, edited 1 time in total.

Evergreen
Member

Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
BlockMen wrote:
Evergreen wrote:Tried it and it still doesn't work. Code:
Code: Select all
`-code-`

It is caused by the bucket mod. -> https://github.com/minetest/minetest_game/blob/master/mods/bucket/init.lua#L42

When it is changed to on_use() [in bucket mod] it works fine.
^
Edit: Casimirs solution is better (to use on_punch()).

And it has to be
Code: Select all
`  minetest.env:set_node(pos, {name="thaumtest:cauldron_full"})`

Soon it will not be minetest.env:set_node it will be minetest.set_node. Just something to think about.

Evergreen
Member

Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
Getting closer, but now I get an error when punching the cauldron with the bucket.
Code: Select all
`12:13:01: ERROR[main]: ServerError: LuaError: error: ...rett/Desktop/Minetest/bin/../mods/thaumtest/init.lua:43: attempt to index local 'itemstack' (a nil value)12:13:01: ERROR[main]: stack traceback:`

BlockMen
Developer

Posts: 768
Joined: Fri Mar 01, 2013 17:24
Location: Germany
GitHub: BlockMen
Evergreen wrote:Getting closer, but now I get an error when punching the cauldron with the bucket.
Code: Select all
`12:13:01: ERROR[main]: ServerError: LuaError: error: ...rett/Desktop/Minetest/bin/../mods/thaumtest/init.lua:43: attempt to index local 'itemstack' (a nil value)12:13:01: ERROR[main]: stack traceback:`

Of cause you get this error, because on_punch gives no itemstack -> https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L1737

you have to change it to this
Code: Select all
`   on_punch = function(pos, node, puncher)    if puncher:get_wielded_item():get_name() == "bucket:bucket_water" then     minetest.env:set_node(pos, {name="thaumtest:cauldron_full"})    end  end,`

Evergreen
Member

Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
Thanks, it works now. The next problem is to empty the bucket when the cauldron is punched. (don't answer this until I have a problem)
Last edited by Evergreen on Sat May 25, 2013 17:00, edited 1 time in total.

Evergreen
Member

Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
I have a problem. I tried to do this:
Code: Select all
`on_punch = function(pos, node, puncher)        if puncher:get_wielded_item():get_name() == "bucket:bucket_water" then            minetest.env:set_node(pos, {name="thaumtest:cauldron_full"})            minetest.env:replace({item="bucket:bucket_empty"})        endend,`
Last edited by Evergreen on Sat May 25, 2013 17:05, edited 1 time in total.

kaeza
Moderator

Posts: 2162
Joined: Thu Oct 18, 2012 05:00
Location: Montevideo, Uruguay
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
BlockMen wrote:
Evergreen wrote:Getting closer, but now I get an error when punching the cauldron with the bucket.
Code: Select all
`12:13:01: ERROR[main]: ServerError: LuaError: error: ...rett/Desktop/Minetest/bin/../mods/thaumtest/init.lua:43: attempt to index local 'itemstack' (a nil value)12:13:01: ERROR[main]: stack traceback:`

Of cause you get this error, because on_punch gives no itemstack -> https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L1737

you have to change it to this
Code: Select all
`   on_punch = function(pos, node, puncher)    if puncher:get_wielded_item():get_name() == "bucket:bucket_water" then     minetest.env:set_node(pos, {name="thaumtest:cauldron_full"})    end  end,`

he was using on_rightclick, not on_punch.
Evergreen wrote:minetest.env:replace({item="bucket:bucket_empty"})

wat

Edit:
just do:
Code: Select all
`local inv = puncher:get_inventory()inv:remove_item("main", itemstack)itemstack = ItemStack("bucket:bucket_empty")inv:add_item("main", itemstack)player:set_wielded_item(itemstack)`

Edit 2:
Scratch that, I missed the earlier post about the bucket mod not calling on_rightclick.
Last edited by kaeza on Sat May 25, 2013 17:19, edited 1 time in total.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

BlockMen
Developer

Posts: 768
Joined: Fri Mar 01, 2013 17:24
Location: Germany
GitHub: BlockMen
Evergreen wrote:I have a problem. I tried to do this:
Code: Select all
`on_punch = function(pos, node, puncher)        if puncher:get_wielded_item():get_name() == "bucket:bucket_water" then            minetest.env:set_node(pos, {name="thaumtest:cauldron_full"})            minetest.env:replace({item="bucket:bucket_empty"})        endend,`

Just set the wieleded item :

Code: Select all
`on_punch = function(pos, node, puncher)        if puncher:get_wielded_item():get_name() == "bucket:bucket_water" then            minetest.env:set_node(pos, {name="thaumtest:cauldron_full"})            puncher:set_wielded_item({name="bucket:bucket_empty"})        endend,`

-> https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L1346

Edit:
kaeza wrote:he was using on_rightclick, not on_punch.

Nope. he changed after the suggestion of Casimir
Last edited by BlockMen on Sat May 25, 2013 17:31, edited 1 time in total.

Evergreen
Member

Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
Thanks everyone! It works now. Idk what I would do without this topic. :D

Evergreen
Member

Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
I am running in to a problem. I want to do the same thing as I did before, except it empties the cauldron into the bucket this time. My problem is that you can't punch anything with an empty bucket. The reason you can't punch anything, is that the only thing you can punch with an empty bucket is water. Since I am using "on_punch" to detect when to take the water out of the cauldron, it doesn't work. Can anyone suggest a workaround for this?

SilverFlame
New member

Posts: 6
Joined: Sat May 25, 2013 05:42
I need help installing mods..i tried several times and it didnt work. is there a specific way of doing it instead of just downloading and temoving it from the file?

Topywo
Member

Posts: 1721
Joined: Fri May 18, 2012 20:27
SilverFlame wrote:I need help installing mods..i tried several times and it didnt work. is there a specific way of doing it instead of just downloading and temoving it from the file?

Do you use stable 0.4.6? --> http://forum.minetest.net/viewtopic.php?pid=88510#p88510

If you use the latest github version(s) --> http://forum.minetest.net/viewtopic.php?pid=91221#p91221
--> don't forget to 'activate' them with configure

Some other "Usual suspects" for mods (still) not working:
- A folder needs to be renamed to the (low-case) name, used in the init.lua.
Example: VanessaE-homedecor-e5c99a3 --> rename --> homedecor
- Trying to use an older mod version or a not up to date mod version
- Use of an older version of minetest than the latest, unofficial
- Missing dependencies (look in the 1st post of a mod or check the depends.txt file in the mod folder you installed)
- Bugs in a mod

PreviousNext