technic/concrete/init.lua

127 lines
3.9 KiB
Lua
Raw Normal View History

--Minetest 0.4.7 mod: concrete
2013-04-04 03:17:39 +04:00
--(c) 2013 by RealBadAngel <mk@realbadangel.pl>
local technic = rawget(_G, "technic") or {}
2013-07-17 23:34:35 +04:00
technic.concrete_posts = {}
2014-04-16 21:10:00 +04:00
-- Boilerplate to support localized strings if intllib mod is installed.
2015-02-05 12:07:38 +03:00
local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
2014-04-16 21:10:00 +04:00
for i = 0, 31 do
minetest.register_alias("technic:concrete_post"..i,
"technic:concrete_post")
end
for i = 32, 63 do
minetest.register_alias("technic:concrete_post"..i,
"technic:concrete_post_with_platform")
end
2013-07-17 23:34:35 +04:00
local steel_ingot
if minetest.get_modpath("technic_worldgen") then
steel_ingot = "technic:carbon_steel_ingot"
else
steel_ingot = "default:steel_ingot"
end
2013-04-04 03:17:39 +04:00
minetest.register_craft({
output = 'technic:concrete_post_platform 6',
2013-04-04 03:17:39 +04:00
recipe = {
{'technic:concrete','technic:concrete_post','technic:concrete'},
2013-04-04 03:17:39 +04:00
}
})
minetest.register_craft({
output = 'technic:concrete_post 12',
2013-04-04 03:17:39 +04:00
recipe = {
{'default:stone','basic_materials:steel_bar','default:stone'},
{'default:stone','basic_materials:steel_bar','default:stone'},
{'default:stone','basic_materials:steel_bar','default:stone'},
}
2013-04-04 03:17:39 +04:00
})
2013-07-14 14:11:56 +04:00
minetest.register_craft({
output = 'technic:blast_resistant_concrete 5',
recipe = {
{'technic:concrete','technic:composite_plate','technic:concrete'},
{'technic:composite_plate','technic:concrete','technic:composite_plate'},
{'technic:concrete','technic:composite_plate','technic:concrete'},
}
})
minetest.register_node(":technic:blast_resistant_concrete", {
2014-04-16 21:10:00 +04:00
description = S("Blast-resistant Concrete Block"),
2015-10-02 20:45:39 +03:00
tiles = {"technic_blast_resistant_concrete_block.png",},
groups = {cracky=1, level=3, concrete=1},
2013-07-14 14:11:56 +04:00
sounds = default.node_sound_stone_defaults(),
on_blast = function(pos, intensity)
if intensity > 9 then
minetest.remove_node(pos)
return {"technic:blast_resistant_concrete"}
end
end,
2013-07-14 14:11:56 +04:00
})
local box_platform = {-0.5, 0.3, -0.5, 0.5, 0.5, 0.5}
local box_post = {-0.15, -0.5, -0.15, 0.15, 0.5, 0.15}
2017-04-13 20:12:46 +03:00
local box_front = {-0.1, -0.3, -0.5, 0.1, 0.3, 0}
local box_back = {-0.1, -0.3, 0, 0.1, 0.3, 0.5}
2017-04-13 20:12:46 +03:00
local box_left = {-0.5, -0.3, -0.1, 0, 0.3, 0.1}
local box_right = {0, -0.3, -0.1, 0.5, 0.3, 0.1}
2013-04-04 03:17:39 +04:00
minetest.register_node(":technic:concrete_post_platform", {
2014-04-16 21:10:00 +04:00
description = S("Concrete Post Platform"),
tiles = {"basic_materials_concrete_block.png",},
2013-07-17 23:34:35 +04:00
groups={cracky=1, level=2},
2013-04-04 03:17:39 +04:00
sounds = default.node_sound_stone_defaults(),
paramtype = "light",
drawtype = "nodebox",
node_box = {
type = "fixed",
2013-07-17 23:34:35 +04:00
fixed = {box_platform}
},
on_place = function (itemstack, placer, pointed_thing)
local node = minetest.get_node(pointed_thing.under)
if node.name ~= "technic:concrete_post" then
2013-07-17 23:34:35 +04:00
return minetest.item_place_node(itemstack, placer, pointed_thing)
end
minetest.set_node(pointed_thing.under, {name="technic:concrete_post_with_platform"})
2013-07-17 23:34:35 +04:00
itemstack:take_item()
placer:set_wielded_item(itemstack)
return itemstack
2013-04-04 03:17:39 +04:00
end,
})
2013-07-17 23:34:35 +04:00
for platform = 0, 1 do
local after_dig_node = nil
if platform == 1 then
after_dig_node = function(pos, old_node)
old_node.name = "technic:concrete_post"
minetest.set_node(pos, old_node)
2013-07-17 23:34:35 +04:00
end
end
minetest.register_node(":technic:concrete_post"..(platform == 1 and "_with_platform" or ""), {
2014-04-16 21:10:00 +04:00
description = S("Concrete Post"),
tiles = {"basic_materials_concrete_block.png"},
groups = {cracky=1, level=2, concrete_post=1, not_in_creative_inventory=platform},
2013-07-17 23:34:35 +04:00
sounds = default.node_sound_stone_defaults(),
drop = (platform == 1 and "technic:concrete_post_platform" or
"technic:concrete_post"),
2013-07-17 23:34:35 +04:00
paramtype = "light",
sunlight_propagates = true,
drawtype = "nodebox",
connects_to = {"group:concrete", "group:concrete_post"},
2013-07-17 23:34:35 +04:00
node_box = {
type = "connected",
fixed = {box_post, (platform == 1 and box_platform or nil)},
connect_front = box_front,
connect_back = box_back,
connect_left = box_left,
connect_right = box_right,
2013-07-17 23:34:35 +04:00
},
after_dig_node = after_dig_node,
})
end