Christopher Head
2019-01-26 4f78a69ffc714886c9d6e812f78d543bb33fe674
commit | author | age
4f78a6 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
2b2411 64 if minetest.get_modpath("moreblocks") then
VD 65     stairsplus:register_all("technic","blast_resistant_concrete","technic:blast_resistant_concrete",{
66         description = "Blast-resistant Concrete",
67         tiles = {"technic_blast_resistant_concrete_block.png",},
68         groups = {cracky=1, level=3, concrete=1},
69         sounds = default.node_sound_stone_defaults(),
70         on_blast = function(pos, intensity)
71             if intensity > 1 then
72                 minetest.remove_node(pos)
73                 minetest.add_item(pos, "technic:blast_resistant_concrete")
74             end
75         end,
76     })
77 end
4a993c 78
S 79 local box_platform = {-0.5,  0.3,  -0.5,  0.5,  0.5, 0.5}
80 local box_post     = {-0.15, -0.5, -0.15, 0.15, 0.5, 0.15}
6b8011 81 local box_front    = {-0.1,  -0.3, -0.5,  0.1,  0.3, 0}
4a993c 82 local box_back     = {-0.1,  -0.3, 0,     0.1,  0.3, 0.5}
6b8011 83 local box_left     = {-0.5,  -0.3, -0.1,  0,    0.3, 0.1}
4a993c 84 local box_right    = {0,     -0.3, -0.1,  0.5,  0.3, 0.1}
0ca19d 85
R 86 minetest.register_node(":technic:concrete_post_platform", {
39c41a 87     description = S("Concrete Post Platform"),
44cb8d 88     tiles = {"basic_materials_concrete_block.png",},
ee0765 89     groups={cracky=1, level=2},
0ca19d 90     sounds = default.node_sound_stone_defaults(),
R 91     paramtype = "light",
4f78a6 92     drawtype = "nodebox",
0ca19d 93     node_box = {
R 94         type = "fixed",
ee0765 95         fixed = {box_platform}
S 96     },
97     on_place = function (itemstack, placer, pointed_thing)
98         local node = minetest.get_node(pointed_thing.under)
4f78a6 99         if node.name ~= "technic:concrete_post" then
CH 100             return minetest.item_place_node(itemstack, placer, pointed_thing)
ee0765 101         end
4a993c 102         minetest.set_node(pointed_thing.under, {name="technic:concrete_post_with_platform"})
ee0765 103         itemstack:take_item()
S 104         placer:set_wielded_item(itemstack)
105         return itemstack
106     end,
107 })
108
109 for platform = 0, 1 do
4a993c 110     local after_dig_node = nil
S 111     if platform == 1 then
112         after_dig_node = function(pos, old_node)
113             old_node.name = "technic:concrete_post"
114             minetest.set_node(pos, old_node)
ee0765 115         end
S 116     end
117
4a993c 118     minetest.register_node(":technic:concrete_post"..(platform == 1 and "_with_platform" or ""), {
39c41a 119         description = S("Concrete Post"),
44cb8d 120         tiles = {"basic_materials_concrete_block.png"},
4a993c 121         groups = {cracky=1, level=2, concrete_post=1, not_in_creative_inventory=platform},
ee0765 122         sounds = default.node_sound_stone_defaults(),
4a993c 123         drop = (platform == 1 and "technic:concrete_post_platform" or
S 124                 "technic:concrete_post"),
ee0765 125         paramtype = "light",
S 126         sunlight_propagates = true,
4a993c 127         drawtype = "nodebox",
S 128         connects_to = {"group:concrete", "group:concrete_post"},
ee0765 129         node_box = {
4a993c 130             type = "connected",
S 131             fixed = {box_post, (platform == 1 and box_platform or nil)},
132             connect_front = box_front,
133             connect_back  = box_back,
134             connect_left  = box_left,
135             connect_right = box_right,
ee0765 136         },
S 137         after_dig_node = after_dig_node,
138     })
0defb2 139 end
ee0765 140