How to make things walkthrough-able?

User avatar
Lunarhiro
Member
 
Posts: 121
Joined: Fri Feb 10, 2012 23:13

How to make things walkthrough-able?

by Lunarhiro » Mon Feb 13, 2012 20:01

Say if I want to make like, a portal or what not, how would I make the lil portal bits so that you can walk through it?

I just started with lua scripting...and have been looking at some mods, and they all use node, but you can't walk through nodes...can you?
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46

by Jeija » Mon Feb 13, 2012 20:10

Yes, you can walk through nodes.
Just add this to your node definition:

walkable = false,
Redstone for minetest: Mesecons (mesecons.net)
 

User avatar
Lunarhiro
Member
 
Posts: 121
Joined: Fri Feb 10, 2012 23:13

by Lunarhiro » Mon Feb 13, 2012 20:19

Oh thank you! Now one more question...I been messin wit it only for like an hour now, but think I'm understanding a bit now.

I'm currently looking through more_ores mod and have stumbled across this...

Edited this part: Alright good thanks guys for this, but theres still more under this now! :/

and how could I make it so I could obtain the node upon hitting it once with anything? O.e

Sorry, working on a flower mod so thats why I asked for the walkthrough as well. xD

This is what I got so far... still need help though xD

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
--[[
****
Flowers
by Lunarhiro
Version 1.0
****
--]]

-- Flowers

minetest.register_node( "flowers:flowers_flower_red", {
    description = "Red Flower",
    tile_images = { "flowers_flower_red.png" },
    walkable = false,
    inventory_inventory_image = minetest.inventorycube( "flowers_flower_red.png" ),
    is_ground_content = true,
    material = minetest.digprop_constanttime(0.5),
    drop = 'craft "flowers:flowers_flower_red" 1',
})




-- Items

minetest.register_craftitem( "flowers:flowers_flower_red", {
    description = "Red Flower",
    inventory_image = "flowers_flower_red.png",
    on_place_on_ground = minetest.craftitem_place_item,
})


Now I also...need to know, how can I make it spawn on top of grass? And how can I place the flower like if it was an actual ...well node? When I right click to drop it, it just falls down onto the floor like if I dropped iron or something xD. Thanks ;D
Last edited by Lunarhiro on Mon Feb 13, 2012 21:16, edited 1 time in total.
 

User avatar
sdzen
Member
 
Posts: 1170
Joined: Fri Aug 05, 2011 22:33

by sdzen » Mon Feb 13, 2012 21:08

its simple drop is what will go into your inventory
sorry if ive double posted i left this one mid response
[h]Zen S.D.[/h] The next generation of tranquility!
malheureusement mon français n'est pas bon :<
Owner of the Zelo's
In game name: MuadTralk, spdtainted, sdzen, sd zen, sdzeno
 

kahrl
Member
 
Posts: 236
Joined: Fri Sep 02, 2011 07:51

by kahrl » Mon Feb 13, 2012 21:14

BTW, the way the drop line is written is outdated, it should be written like this in the newest version of minetest:
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
drop = 'flowers:flowers_flower_red 1'


EDIT: And it's inventory_image, not inventory_inventory_image. Are you sure you want to have an inventorycube there?
Last edited by kahrl on Mon Feb 13, 2012 21:16, edited 1 time in total.
 

User avatar
Lunarhiro
Member
 
Posts: 121
Joined: Fri Feb 10, 2012 23:13

by Lunarhiro » Mon Feb 13, 2012 21:17

kahrl wrote:BTW, the way the drop line is written is outdated, it should be written like this in the newest version of minetest:
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
drop = 'flowers:flowers_flower_red 1'



Yea, I figured that part on my own after it failed to load the game, and told me to check the debug.txt.

It said "no name: or ":"" provided...or something like that, so I looked around in other mods and found that, but still have trouble with spawning it on grass terrains and being able to place it. Sorry, I'm a newb to lua xD...and c...and all that other stuff. Just okay at Sadscripting O.e
 

User avatar
sdzen
Member
 
Posts: 1170
Joined: Fri Aug 05, 2011 22:33

by sdzen » Mon Feb 13, 2012 21:19

kahrl wrote:BTW, the way the drop line is written is outdated, it should be written like this in the newest version of minetest:
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
drop = 'flowers:flowers_flower_red 1'


EDIT: And it's inventory_image, not inventory_inventory_image. Are you sure you want to have an inventorycube there?

yeah i spotted that but didnt know if for some reason it was intentional
Edit I never post in time! :(
Last edited by sdzen on Mon Feb 13, 2012 21:19, edited 1 time in total.
[h]Zen S.D.[/h] The next generation of tranquility!
malheureusement mon français n'est pas bon :<
Owner of the Zelo's
In game name: MuadTralk, spdtainted, sdzen, sd zen, sdzeno
 

kahrl
Member
 
Posts: 236
Joined: Fri Sep 02, 2011 07:51

by kahrl » Mon Feb 13, 2012 21:21

OK, the spawning part is a bit tricky. Do you want them to be generated during world generation or should they grow randomly later on? You'd do the first with an on_generated callback and the second using ABMs. Perhaps you could look how the existing flowers mod does it, I think it also has some algorithm that prevents too many flowers from spawning next to each other.
 

User avatar
Lunarhiro
Member
 
Posts: 121
Joined: Fri Feb 10, 2012 23:13

by Lunarhiro » Mon Feb 13, 2012 21:23

Randomly appearing, that way they can always appear wherever, but on grass. Hm, So Ima get the mod and see what I figure out, if anything xD. Should I repost what I fixed and did to the whole script?

Edit:
o.e oh god, looking at all this...

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
local grow_blocks_on_surfaces = function(growdelay, grownames, surfaces)
    for _, surface in ipairs(surfaces) do
        minetest.register_abm({
            nodenames = { surface.name },
            interval = growdelay,
            chance = 30,
            action = function(pos, node, active_object_count, active_object_count_wider)
                local p_top = {
                    x = pos.x,
                    y = pos.y + 1,
                    z = pos.z
                }
                local n_top = minetest.env:get_node(p_top)
                local rnd = math.random(1, MAX_RATIO)

                if (MAX_RATIO - surface.chance < rnd) then
                    local flower_in_range = is_node_in_cube(grownames, p_top, surface.spacing)
                    if (n_top.name == "air") and (flower_in_range == false) then
                        local nnode = grownames[math.random(1, #grownames)]
                        dbg('Adding node ' .. nnode .. ' ('
                            .. pos.x .. ', '
                            .. pos.y .. ', '
                            .. pos.z .. ')')
                        minetest.env:add_node(p_top, { name = nnode })


Kinda hurts not knowing what the hell is going on LOL xD. Im'a eventually figure this out with you guys helping like you are thankfully...unlike where I learned sadscripting where people would turn a cold shoulder...learned it mostly alone...and ended up teaching some. xD
Last edited by Lunarhiro on Mon Feb 13, 2012 21:26, edited 1 time in total.
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 45 guests

cron