Page 1 of 1

Mod: Bridges and handrails

PostPosted: Sat Sep 15, 2012 23:24
by Sokomine
Can I post this time? I do get error messages :-(

PostPosted: Sat Sep 15, 2012 23:25
by Jordach
Yes.

PostPosted: Sat Sep 15, 2012 23:26
by Sokomine
This is a very small mod that was created after having had a look at 3dforniture (those chairs and tables are a must have for each house).

The mod does not always work - do not trust your virtual life to it! Sometimes one can walk through the rail (Bug!), sometimes not. I have no idea why that is the case.

What it does: Provide bridges one node wide with a thin wooden floor on which you can walk. Second part: Handrails to keep the top of your stairs safe. They requrire less space than fences and can be walked under. The third part is intended to make those nice roof shingles from the homedecor mod more usable. Right now it is just another wooden "stick" that doesn't do much. My intention is to keep people from accidently walking through the shingles and to have some optical "decoration" which looks like structural support for the shingles.

There are no crafting recipes included. If anyone comes up with a recipe and has a use for it they can be added.

Upload of screenshots or the mod itself does not seem to be possible? Well, here's the code:
[code="place in bridges/init.lua"]
-- to make life a bit easier
bild_pfad = "default_wood.png"; --"forniture_wood.png";
bild_pfad_s1 = "default_wood.png"; --"forniture_wood_s1.png";
bild_pfad_s2 = "default_wood.png"; --"forniture_wood_s2.png";

leg_front_left = {-0.5,-0.5,-0.5, -0.4,0.5,-0.4};
leg_front_right = { 0.4,-0.5,-0.5, 0.5,0.5,-0.4};
leg_back_left = {-0.5,-0.5, 0.4, -0.4,0.5, 0.5};
leg_back_right = { 0.4,-0.5, 0.4, 0.5,0.5, 0.5};

bar_left = {-0.5, 0.35,-0.4,-0.4, 0.4, 0.4};
bar_right = { 0.4, 0.35,-0.4, 0.5, 0.4, 0.4};
bar_back = { 0.4, 0.35, 0.4,-0.5, 0.4, 0.5};
bar_front = { 0.5, 0.35,-0.5,-0.5, 0.4,-0.4};

bar_left_long = {-0.4, 0.35,-0.5,-0.5, 0.4, 0.5};
bar_right_long = { 0.4, 0.35,-0.5, 0.5, 0.4, 0.5};

groundplate_small = {-0.4,-0.45,-0.5, 0.4,-0.4,0.5};
groundplate_corner = {-0.5,-0.45,-0.5, 0.5,-0.4,0.5}; -- slightly larger


local BRIDGE_PARTS = {
-- bridges
{ "bridge_small", "small bridge", { -- TODO: slim legs?
leg_front_left,
leg_front_right,
leg_back_left,
leg_back_right,
bar_right,
bar_left,
groundplate_small, }},
{ "bridge_middle", "middle of a bridge", {
bar_right_long,
bar_left_long,
groundplate_small, }},
{ "bridge_corner", "corner of a bridge", {
leg_front_left,
leg_front_right,
leg_back_left,
leg_back_right,
bar_right,
bar_back,
groundplate_corner, }},
{ "bridge_t", "T junction of a bridge", {
leg_front_left,
leg_front_right,
leg_back_left,
leg_back_right,
bar_back,
groundplate_corner, }},
{ "bridge_end", "end of a bridge", {
leg_front_left,
leg_front_right,
leg_back_left,
leg_back_right,
bar_left,
bar_right,
bar_back,
groundplate_corner, }},

-- handrails for the top of starcaises so that people won't fall down
{ "handrail_top", "handrail for staircases, one side closed", {
leg_front_left,
leg_front_right,
bar_front, }},

{ "handrail_corner", "handrail for staircases, two sides closed", {
leg_front_left,
leg_front_right,
bar_front,
bar_left }},

{ "handrail_closed", "handrail for staircases, three sides closed", {
leg_front_left,
leg_front_right,
bar_front,
bar_right,
bar_left }},

{ "handrail_middle", "handrail for staircases, middle part", {
bar_front }},
}



for i in ipairs( BRIDGE_PARTS ) do
minetest.register_node("bridges:"..BRIDGE_PARTS\[i\][1],
{
description = BRIDGE_PARTS\[i\][2],

tiles = {
bild_pfad,
bild_pfad,
bild_pfad_s1,
bild_pfad_s1,
bild_pfad_s2,
bild_pfad_s2,
},
drawtype = "nodebox",
sunlight_propagates = true,
paramtype = 'light',
paramtype2 = "facedir",
node_box = {
type = "fixed",
fixed = BRIDGE_PARTS\[i\][3],
},
selection_box = {
type = "fixed",
fixed = {-0.5,-0.5,-0.5, 0.5, 0.5, 0.5},

},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}
})
end



-- a bridge with covers 3 nodes in size

minetest.register_node("bridges:bridge_large",
{ description = 'large bridge',
tiles = {
bild_pfad,
bild_pfad,
bild_pfad_s1,
bild_pfad_s1,
bild_pfad_s2,
bild_pfad_s2,
},
drawtype = "nodebox",
sunlight_propagates = true,
paramtype = 'light',
paramtype2 = "facedir",
node_box = {
type = "fixed",
fixed = {
-- the large bridge covers 3 nodes
{-0.5,-0.5,-0.7, -0.4,0.5,-0.6},
{ 0.4,-0.5,-0.7, 0.5,0.5,-0.6},

{-0.5, 0.35,-1.5, -0.4,0.4, 1.5},

{-0.5,-0.5, 0.6, -0.4,0.5, 0.7},
{ 0.4,-0.5, 0.6, 0.5,0.5, 0.7},

{ 0.4, 0.35,-1.5, 0.5,0.4, 1.5},

{-0.4,-0.45,-1.5, 0.4,-0.4,1.5},

}
},
selection_box = {
type = "fixed",
fixed = {-0.5,-0.5,-1.5, 0.5,0.5, 1.5},

},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}
})


-- TODO these are intended to work with shingles from the homedecor-mod but do not work quite as I intend them to
-- desicred functions:
-- 1. decoration/structural "support" for the shingles
-- 2. prevent player from accidently running through the shingles

minetest.register_node("bridges:roof_stair",
{ description = 'wooden bar/stair to support shingles',
tiles = {
bild_pfad,
bild_pfad,
bild_pfad_s1,
bild_pfad_s1,
bild_pfad_s2,
bild_pfad_s2,
},
drawtype = "nodebox",
sunlight_propagates = true,
paramtype = 'light',
paramtype2 = "facedir",
node_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5, -0.4,-0.4,0.5},
{-0.05,-0.05,-0.5, 0.05,0.05,0.5},
{ 0.4,0.4,-0.5, 0.5,0.5,0.5},
}
},
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},

},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}
})


minetest.register_node("bridges:roof_bar",
{ description = 'wooden bar to support shingles',
tiles = {
bild_pfad,
bild_pfad,
bild_pfad_s1,
bild_pfad_s1,
bild_pfad_s2,
bild_pfad_s2,
},
drawtype = "nodebox",
sunlight_propagates = true,
paramtype = 'light',
paramtype2 = "facedir",
node_box = {
type = "fixed",
fixed = {
{0.4, 0.4,-0.5, 0.5, 0.5,0.5},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, 0.4,-0.5, 0.5, 0.5,0.5},
}

},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}
})
[/code]

PostPosted: Fri Apr 05, 2013 01:32
by Likwid H-Craft
Do this ever work? well for Least build?

PostPosted: Fri Apr 05, 2013 04:10
by Sokomine
Oh yes, it does work. The finished mod can be found here. It comes with a download link as well.