[mod]Chains Mod [1.1][chains]
[mod]Chains Mod [1.1][chains]
This mod adds chains which can be climbed.
Dependencies: default
Licence: WTFPL
Downloads:
Version 1.1:Download
Chain Top:
Chain:
Chandelier:
Recipes:
Chain Link (chains:chain)
Chain Top: (chains:chain_top)
Chandelier (as of 1.1):
Dependencies: default
Licence: WTFPL
Downloads:
Version 1.1:Download
Chain Top:
Chain:
Chandelier:
Recipes:
Chain Link (chains:chain)
Chain Top: (chains:chain_top)
Chandelier (as of 1.1):
Last edited by Doc on Mon Jul 07, 2014 07:31, edited 3 times in total.
- InfinityProject
- Member
- Posts: 1009
- Joined: Sat Mar 17, 2012 00:52
- Location: World of Infinity, US
Instead of crafting the individual chains you may like this:
What it does is when chains:chain_top is placed, 3 chains are added underneath it.
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)
- VanessaE
- Moderator
- Posts: 4655
- Joined: Sun Apr 01, 2012 12:38
- GitHub: VanessaE
- IRC: VanessaE
- In-game: VanessaE
- Location: Western NC
- Contact:
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)
Thanks VanessaE,
I was just about to borrow this code. I will be sure to add this.
Edit:
Here is my code:
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!
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
}),
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.
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.
is acceptable.
To add a node to minetest
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:
Moving into the code, with a event function you don't need to name it anything.
Code: Select all
trigger event = function(pos, node)
To add a node to minetest
Code: Select all
pos = {x=value, y=value, z=value}
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
Youtube Channel: http://www.youtube.com/user/ashenkster69
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?
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.
- webdesigner97
- Member
- Posts: 1328
- Joined: Mon Jul 30, 2012 19:16
- GitHub: webD97
- IRC: webdesigner97
- In-game: webdesigner97
- Location: Cologne, Germany
- Contact:
Looks cool!
Visit me: webD97.de | @GitHub | @DeviantArt
Mods: StreetsMod | Vehicles
Featured from my blog: Dockerize the Minetest server
On my own behalf: Chameleon - A PHP image manipulation library built around GD
Mods: StreetsMod | Vehicles
Featured from my blog: Dockerize the Minetest server
On my own behalf: Chameleon - A PHP image manipulation library built around GD
- Dan Duncombe
- Member
- Posts: 904
- Joined: Thu May 09, 2013 21:11
- Location: In the unknown depths of Earth
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
My test code:
Note: they don't connect properly at corners, but in real life a hanging chain would be straight anyway so it wouldn't matter.
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
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(),
})
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.
My Games: Nostalgia Realtest Revamped
Servers: See above games.
-
- Member
- Posts: 4276
- Joined: Sun Sep 09, 2012 17:31
- GitHub: Sokomine
- IRC: Sokomine
- In-game: 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.
A list of my mods can be found here.
- JPRuehmann
- Member
- Posts: 334
- Joined: Fri Mar 21, 2014 21:40
- Location: Germany
- Contact:
- JPRuehmann
- Member
- Posts: 334
- Joined: Fri Mar 21, 2014 21:40
- Location: Germany
- Contact:
Re: [mod]Chains Mod [1.1][chains]
Links fixed.
Who is online
Users browsing this forum: No registered users and 18 guests