Not sure what to call this one: Destroying all cactuses in a column

super_tnt
Member
 
Posts: 22
Joined: Mon Sep 02, 2013 17:56

Not sure what to call this one: Destroying all cactuses in a column

by super_tnt » Wed Sep 04, 2013 17:02

So, I know I shouldn't compare this game to minecraft but a simple thing that I was missing was cactuses being destroyed when you dig the bottom one, so I added it to this game, It could be added to trees but it should use the axe's durability.
Image
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("default:cactus", {
    description = "Cactus",
    tiles = {"default_cactus_top.png", "default_cactus_top.png", "default_cactus_side.png"},
    is_ground_content = true,
    groups = {snappy=1,choppy=3,flammable=2},
    sounds = default.node_sound_wood_defaults(),
    after_destruct = function(pos,oldnode)
        local node = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})
        if node.name == "default:cactus" then
            minetest.dig_node({x=pos.x,y=pos.y+1,z=pos.z})
            minetest.add_item(pos,"default:cactus")
        end
    end,
})


Edit: source is included, replace the same cactus bit of could in the nodes.lua file in the default folder.
Last edited by super_tnt on Wed Sep 04, 2013 20:14, edited 1 time in total.
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Wed Sep 04, 2013 17:20

You can create screenshots with F12
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

super_tnt
Member
 
Posts: 22
Joined: Mon Sep 02, 2013 17:56

by super_tnt » Wed Sep 04, 2013 17:29

Thanks for that, I usually hold alt+prtsc which gives the window but I'll use f12 in future.
 

User avatar
hoodedice
Member
 
Posts: 1372
Joined: Sat Jul 06, 2013 06:33

by hoodedice » Wed Sep 04, 2013 17:40

I think there is already a mod like this...
7:42 PM - Bauglio: I think if you go to staples you could steal firmware from a fax machine that would run better than win10 does on any platform
7:42 PM - Bauglio: so fudge the stable build
7:43 PM - Bauglio: get the staple build
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Wed Sep 04, 2013 19:11

I cropped the image for you:
Image

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
Mossmanikin
Member
 
Posts: 599
Joined: Sun May 19, 2013 16:26

by Mossmanikin » Wed Sep 04, 2013 19:56

Thanks for sharing this, I can really use the code for my plant mods :)

Noob 4 life!
My stuff
 

super_tnt
Member
 
Posts: 22
Joined: Mon Sep 02, 2013 17:56

by super_tnt » Wed Sep 04, 2013 20:13

Mossmanikin wrote:Thanks for sharing this, I can really use the code for my plant mods :)


No problems, I get quite happy when things like this work.

You see there is no need to cycle through each cactus block and destroy it. Alls we have to do is add a little bit of code so that when it is destroyed it triggers the next one to get destroyed. This process is repeated until it can't trigger the next block because it's not a cactus.
 

super_tnt
Member
 
Posts: 22
Joined: Mon Sep 02, 2013 17:56

by super_tnt » Wed Sep 04, 2013 20:14

Jordach wrote:I cropped the image for you:

~~~~~~~

Thank you for that
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 10 guests

cron