Cant use on_placenode and on_destruct at same time?

FosJonas
Member
 
Posts: 10
Joined: Thu Aug 23, 2012 12:44

Cant use on_placenode and on_destruct at same time?

by FosJonas » Tue Jan 15, 2013 19:24

Hello,

I'm trying to make a Mod for Minetest, but I already got a Problem:

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
minetest.register_node("test:test", {
    description = "test",
      tiles = {"default_gravel.png"},
    paramtype2 = "facedir",
    groups = {cracky=3, stone=1},
   power = true,
   
 
   
   after_destruct = function(pos,oldnode)
    return 0
   end   

   after_place_node = function(pos, placer)
    return 0
    end
   
    })


This code will cause a error (expected to close '{' at line 48 near 'after place node' ).
But I dont understand why, if I use just after_place_node or just after_destruct it works fine.
Cant I use both function in one Node?

I would be happy about every help.
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Tue Jan 15, 2013 19:34

Since after_destruct and after_place_node are regular fields in the table you have to seperate them with commas:
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
minetest.register_node("test:test", {
    description = "test",
    tiles = {"default_gravel.png"},
    paramtype2 = "facedir",
    groups = {cracky=3, stone=1},
    power = true,

    after_destruct = function(pos,oldnode)
        return 0
    end,

    after_place_node = function(pos, placer)
        return 0
    end,

})
 

glomie
Member
 
Posts: 141
Joined: Sun Aug 07, 2011 19:41

by glomie » Tue Jan 15, 2013 19:35

you need a comma after the end before after_place_node
Sorry for my bad english...
 

FosJonas
Member
 
Posts: 10
Joined: Thu Aug 23, 2012 12:44

by FosJonas » Tue Jan 15, 2013 19:47

Wow thanks for the Ultra fast help!

Now it works well.
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 3 guests

cron