Vanessa Dannenberg
2018-10-31 44cb8df048e09b64214f59db73a3fd23cfe12e77
commit | author | age
f4302f 1 --Minetest 0.4.7 mod: concrete 
0ca19d 2 --(c) 2013 by RealBadAngel <mk@realbadangel.pl>
R 3
49e82a 4 local technic = rawget(_G, "technic") or {}
ee0765 5 technic.concrete_posts = {}
S 6
39c41a 7 -- Boilerplate to support localized strings if intllib mod is installed.
41a10a 8 local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
39c41a 9
4a993c 10 for i = 0, 31 do
S 11     minetest.register_alias("technic:concrete_post"..i,
12             "technic:concrete_post")
13 end
14 for i = 32, 63 do
15     minetest.register_alias("technic:concrete_post"..i,
16             "technic:concrete_post_with_platform")
17 end
ee0765 18
68b7bc 19 local steel_ingot
Z 20 if minetest.get_modpath("technic_worldgen") then
21     steel_ingot = "technic:carbon_steel_ingot"
22 else
23     steel_ingot = "default:steel_ingot"
24 end
25
0ca19d 26 minetest.register_craft({
f4302f 27     output = 'technic:concrete_post_platform 6',
0ca19d 28     recipe = {
4a993c 29         {'technic:concrete','technic:concrete_post','technic:concrete'},
0ca19d 30     }
R 31 })
32
33 minetest.register_craft({
4a993c 34     output = 'technic:concrete_post 12',
0ca19d 35     recipe = {
44cb8d 36         {'default:stone','basic_materials:steel_bar','default:stone'},
VD 37         {'default:stone','basic_materials:steel_bar','default:stone'},
38         {'default:stone','basic_materials:steel_bar','default:stone'},
4a993c 39     }
0ca19d 40 })
R 41
6055ed 42 minetest.register_craft({
R 43     output = 'technic:blast_resistant_concrete 5',
44     recipe = {
45         {'technic:concrete','technic:composite_plate','technic:concrete'},
46         {'technic:composite_plate','technic:concrete','technic:composite_plate'},
47         {'technic:concrete','technic:composite_plate','technic:concrete'},
48     }
49 })
50
51 minetest.register_node(":technic:blast_resistant_concrete", {
39c41a 52     description = S("Blast-resistant Concrete Block"),
2d86ee 53     tiles = {"technic_blast_resistant_concrete_block.png",},
4a993c 54     groups = {cracky=1, level=3, concrete=1},
0ca19d 55     sounds = default.node_sound_stone_defaults(),
0c144c 56     on_blast = function(pos, intensity)
99bebc 57         if intensity > 9 then
0c144c 58             minetest.remove_node(pos)
99bebc 59             return {"technic:blast_resistant_concrete"}
0c144c 60         end
M 61     end,
0ca19d 62 })
4a993c 63
S 64
65 local box_platform = {-0.5,  0.3,  -0.5,  0.5,  0.5, 0.5}
66 local box_post     = {-0.15, -0.5, -0.15, 0.15, 0.5, 0.15}
6b8011 67 local box_front    = {-0.1,  -0.3, -0.5,  0.1,  0.3, 0}
4a993c 68 local box_back     = {-0.1,  -0.3, 0,     0.1,  0.3, 0.5}
6b8011 69 local box_left     = {-0.5,  -0.3, -0.1,  0,    0.3, 0.1}
4a993c 70 local box_right    = {0,     -0.3, -0.1,  0.5,  0.3, 0.1}
0ca19d 71
R 72 minetest.register_node(":technic:concrete_post_platform", {
39c41a 73     description = S("Concrete Post Platform"),
44cb8d 74     tiles = {"basic_materials_concrete_block.png",},
ee0765 75     groups={cracky=1, level=2},
0ca19d 76     sounds = default.node_sound_stone_defaults(),
R 77     paramtype = "light",
78     drawtype = "nodebox", 
79     node_box = {
80         type = "fixed",
ee0765 81         fixed = {box_platform}
S 82     },
83     on_place = function (itemstack, placer, pointed_thing)
84         local node = minetest.get_node(pointed_thing.under)
4a993c 85         if node.name ~= "technic:concrete_post" then 
ee0765 86             return minetest.item_place_node(itemstack, placer, pointed_thing) 
S 87         end
4a993c 88         minetest.set_node(pointed_thing.under, {name="technic:concrete_post_with_platform"})
ee0765 89         itemstack:take_item()
S 90         placer:set_wielded_item(itemstack)
91         return itemstack
92     end,
93 })
94
95 for platform = 0, 1 do
4a993c 96     local after_dig_node = nil
S 97     if platform == 1 then
98         after_dig_node = function(pos, old_node)
99             old_node.name = "technic:concrete_post"
100             minetest.set_node(pos, old_node)
ee0765 101         end
S 102     end
103
4a993c 104     minetest.register_node(":technic:concrete_post"..(platform == 1 and "_with_platform" or ""), {
39c41a 105         description = S("Concrete Post"),
44cb8d 106         tiles = {"basic_materials_concrete_block.png"},
4a993c 107         groups = {cracky=1, level=2, concrete_post=1, not_in_creative_inventory=platform},
ee0765 108         sounds = default.node_sound_stone_defaults(),
4a993c 109         drop = (platform == 1 and "technic:concrete_post_platform" or
S 110                 "technic:concrete_post"),
ee0765 111         paramtype = "light",
S 112         sunlight_propagates = true,
4a993c 113         drawtype = "nodebox",
S 114         connects_to = {"group:concrete", "group:concrete_post"},
ee0765 115         node_box = {
4a993c 116             type = "connected",
S 117             fixed = {box_post, (platform == 1 and box_platform or nil)},
118             connect_front = box_front,
119             connect_back  = box_back,
120             connect_left  = box_left,
121             connect_right = box_right,
ee0765 122         },
S 123         after_dig_node = after_dig_node,
124     })
0defb2 125 end
ee0765 126