[mod]Chains Mod [1.1][chains]

Post Reply
User avatar
Doc
Member
Posts: 75
Joined: Sun Nov 04, 2012 00:21

[mod]Chains Mod [1.1][chains]

by Doc » Post

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
Last edited by Doc on Mon Jul 07, 2014 07:31, edited 3 times in total.

User avatar
nomohakon
Member
Posts: 219
Joined: Fri Aug 10, 2012 16:34
IRC: nomohakon
In-game: nomohakon
Location: VanessaE's servers

by nomohakon » Post

Nice!
"To learn who rules over you, simply find out who you are not allowed to criticize." - Voltaire
"Knowledge, like air, is vital to life. Like air, no one should be denied it." - Alan Moore, V for Vendetta
- - -
"To never die... and to conquer all, that is winning." ―Illyria

User avatar
Doc
Member
Posts: 75
Joined: Sun Nov 04, 2012 00:21

by Doc » Post

Thanks! I have little ideas, and I make em into a quick mod. Eventually, I want to make a big mod though.

User avatar
InfinityProject
Member
Posts: 1009
Joined: Sat Mar 17, 2012 00:52
Location: World of Infinity, US

by InfinityProject » Post

Instead of crafting the individual chains you may like this:

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.

User avatar
Doc
Member
Posts: 75
Joined: Sun Nov 04, 2012 00:21

by Doc » Post

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!

User avatar
VanessaE
Moderator
Posts: 4500
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

by VanessaE » Post

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.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

User avatar
Doc
Member
Posts: 75
Joined: Sun Nov 04, 2012 00:21

by Doc » Post

Thanks VanessaE,
I was just about to borrow this code. I will be sure to add this.

Edit:
Here is my code:

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!
Last edited by Doc on Thu Nov 15, 2012 16:20, edited 1 time in total.

User avatar
ashenk69
Member
Posts: 230
Joined: Tue Jul 03, 2012 00:08

by ashenk69 » Post

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.

Code: Select all

trigger event = function(pos, node)
is acceptable.
To add a node to minetest

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:

Code: Select all

incremented y value outside while loop
while(node below is air) then
  add chain
end

User avatar
Doc
Member
Posts: 75
Joined: Sun Nov 04, 2012 00:21

by Doc » Post

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?
Last edited by Doc on Sat Nov 17, 2012 05:06, edited 1 time in total.

User avatar
Doc
Member
Posts: 75
Joined: Sun Nov 04, 2012 00:21

by Doc » Post

I have tried many things, but I just can't get it to work. Oh well, maybe later. For now I updated with chandeliers!

User avatar
webdesigner97
Member
Posts: 1327
Joined: Mon Jul 30, 2012 19:16
GitHub: webD97
IRC: webdesigner97
In-game: webdesigner97
Location: Cologne, Germany
Contact:

by webdesigner97 » Post

Looks cool!

User avatar
Doc
Member
Posts: 75
Joined: Sun Nov 04, 2012 00:21

by Doc » Post

Thanks!

User avatar
Dan Duncombe
Member
Posts: 904
Joined: Thu May 09, 2013 21:11
Location: In the unknown depths of Earth

by Dan Duncombe » Post

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:

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.
Last edited by Dan Duncombe on Thu May 16, 2013 16:43, edited 1 time in total.
Some Mods: Castles Prefab Camouflage
My Games: Nostalgia Realtest Revamped
Servers: See above games.

User avatar
Sokomine
Member
Posts: 4014
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

by Sokomine » Post

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.
A list of my mods can be found here.

User avatar
JPRuehmann
Member
Posts: 334
Joined: Fri Mar 21, 2014 21:40
Location: Germany
Contact:

by JPRuehmann » Post

link broken

User avatar
mimilus
Member
Posts: 75
Joined: Thu Mar 06, 2014 09:08
GitHub: mimilus
IRC: Mimilus
Location: France

by mimilus » Post

maybe there is a working link : https://github.com/Doc22/chains-mod
minetest 0.4.9
Ubuntu 12.04

User avatar
JPRuehmann
Member
Posts: 334
Joined: Fri Mar 21, 2014 21:40
Location: Germany
Contact:

by JPRuehmann » Post

Thanks,
JPR

User avatar
Doc
Member
Posts: 75
Joined: Sun Nov 04, 2012 00:21

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

by Doc » Post

Links fixed.

Post Reply

Who is online

Users browsing this forum: CalebJ, runs and 6 guests