Page 1 of 1

[mod]Chains Mod [1.1][chains]

PostPosted: Wed Nov 14, 2012 22:03
by Doc
This mod adds chains which can be climbed.

Dependencies: default

Licence: WTFPL

Downloads:
Version 1.1:Download


Image

Chain Top:
Image

Chain:
Image

Chandelier:
Image

Recipes:

Chain Link (chains:chain)
Image

Chain Top: (chains:chain_top)
Image

Chandelier (as of 1.1):
Image

PostPosted: Wed Nov 14, 2012 23:41
by nomohakon
Nice!

PostPosted: Wed Nov 14, 2012 23:42
by Doc
Thanks! I have little ideas, and I make em into a quick mod. Eventually, I want to make a big mod though.

PostPosted: Wed Nov 14, 2012 23:47
by InfinityProject
Instead of crafting the individual chains you may like 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
function chain(pos, node)
if node.name == "chains:chain_top" then
minetest.env:add_node(pos.x,pos.y-1,pos.x{name="chains:chain"})
minetest.env:add_node(pos.x,pos.y-2,pos.x{name="chains:chain"})
minetest.env:add_node(pos.x,pos.y-3,pos.x{name="chains:chain"})
end
end
minetest.register_on_placenode(chain)


What it does is when chains:chain_top is placed, 3 chains are added underneath it.

PostPosted: Wed Nov 14, 2012 23:52
by Doc
Yeah, that sounds like a good idea. I still want there to be the ability to place single chain tops though. This gave me the idea of a chain roll item which uses this function! Perhaps I will add something like this in the next version or so. Thanks for the idea!

PostPosted: Thu Nov 15, 2012 04:52
by VanessaE
InfinityProject, you'll also need to check for the presence of air just before each of those add_node() calls, otherwise you could easily end up replacing dirt, stone, or part of a building.

PostPosted: Thu Nov 15, 2012 15:46
by Doc
Thanks VanessaE,
I was just about to borrow this code. I will be sure to add this.

Edit:
Here is my code:
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_craftitem("chains:roll", {
    description = "Roll of chains",
    inventory_image = "Chains_roll.png",
    on_place_on_ground = function chain(pos, node)
           
            if node.name == "default:air" then
            minetest.env:add_node(pos.x,pos.y-1,pos.x                    {name="chains:chaintop"})
            end
            if node.name == "default:air" then
            minetest.env:add_node(pos.x,pos.y-2,pos.x                    {name="chains:chain"})
            end
            if node.name == "default:air" then
            minetest.env:add_node(pos.x,pos.y-3,pos.x                    {name="chains:chain"})
            end
}),

I think I am doing something wrong on check for air... Can someone fix my code? This is basically an item that places chain when you use it.

Edit: Actually, I think I am doing this all wrong. Please help me out!

PostPosted: Thu Nov 15, 2012 17:18
by ashenk69
First off you need to take a look at your register with minetest. Do you want the roll to act like a node where it is placeable like dirt or stone or do you want it to be treated much like placing a tool on the ground where it becomes an entity. Either one can be crafted by recipes but each has there own events that fires by minetest. I am not sure if on_place_on_ground is a registered event since I don't have the lua api with me since I am in class right now.

Moving into the code, with a event function you don't need to name it anything.
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
trigger event = function(pos, node)

is acceptable.
To add a node to 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
pos = {x=value, y=value, z=value}

You have the correct function and node declaration just change the pos declaration.

Now how to actually accomplish what you want it to do. I would use a while loop to check if the node below is air and if it is then place a chain.
Pseudocode:
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
incremented y value outside while loop
while(node below is air) then
  add chain
end

PostPosted: Sat Nov 17, 2012 05:04
by Doc
Thanks ashenk69! I will look at the api to see if there is that function or something similar. I essentially want it to be a minetest.register_craftitem that when right clicked on a block, it spawns a chain top and two or three chain below it.

Edit: I found on_place... will this work for what I need, and is pointed_thing a pos item that can be accessed with pointed_thing:x, y, z?

PostPosted: Sat Nov 17, 2012 17:26
by Doc
I have tried many things, but I just can't get it to work. Oh well, maybe later. For now I updated with chandeliers!

PostPosted: Wed Nov 21, 2012 18:54
by webdesigner97
Looks cool!

PostPosted: Wed Dec 05, 2012 23:44
by Doc
Thanks!

PostPosted: Wed May 15, 2013 21:53
by Dan Duncombe
Overall- EPIC! The chandelier looks a little derpy though, maybe check out my Simply Candles mod for a slightly less derpy, however weedy and small looking chandelier. Still, epic mod!

Another thing, a suggestion. Maybe horizontal chains that can be used to cross lava, for example.

I have uploaded this mod with horizontal chains (they really work!) at:
https://www.dropbox.com/s/46sucqgmrqdwkhs/chains.zip

They go up diagonally like rails too!

Image of an example of flat Horizontal Chains
Image

My test code:
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("chains:horizontalchain", {
    description = "Horizontal Chain",
    walkable = false,
    climbable = true,
    sunlight_propagates = true,
    paramtype = "light",
    drops = "",
    tile_images = { "Horizontal_chain.png" },
    drawtype = "raillike",
    groups = {cracky=3},
    sounds =  default.node_sound_stone_defaults(),
    })

Note: they don't connect properly at corners, but in real life a hanging chain would be straight anyway so it wouldn't matter.

PostPosted: Thu May 16, 2013 03:10
by Sokomine
There's the vines mod that also comes with a ropebox that auto-extends downwards. It has the drawtype plantlike and looks and works very well. I've wished for a horizontal version of that for some time.

PostPosted: Fri Apr 04, 2014 18:14
by JPRuehmann
link broken

PostPosted: Fri Apr 04, 2014 22:25
by mimilus
maybe there is a working link : https://github.com/Doc22/chains-mod

PostPosted: Sat Apr 05, 2014 20:12
by JPRuehmann
Thanks,
JPR

Re: [mod]Chains Mod [1.1][chains]

PostPosted: Mon Jul 07, 2014 13:41
by Doc
Links fixed.