summaryrefslogtreecommitdiff
path: root/constructionarea/init.lua
blob: 6ae32fe1672da40012c6431d13823e36f82a4ae2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
minetest.register_node(":streets:constructionfence_bottom",{
	description = "Construction fence",
	tiles = {"streets_fence_fromtop.png","streets_fence_fromtop.png","streets_fence_fromtop.png","streets_fence_fromtop.png","streets_fence_bottom.png","streets_fence_bottom.png"},
	groups = {cracky = 2,},
	paramtype = "light",
	inventory_image = "streets_fence_inv.png",
	wield_image = "streets_fence_inv.png",
	paramtype2 = "facedir",
	drawtype = "nodebox",
	node_box = {
		type = "fixed",
		fixed = {
			{-0.5,-0.5,-0.1,0.5,0.0,0.1},	-- lower part
			{-0.2,-0.0,-0.1,0.2,0.5,0.1}	-- thing in the middle
		}
	},
	selection_box = {
		type = "fixed",
		fixed = {
			{-0.5,-0.5,-0.1,0.5,1.0,0.1}
		}
	},
	after_dig_node = function(pos,node,digger)
		pos.y = pos.y + 1
		minetest.remove_node(pos)
	end,
	after_place_node = function(pos,placer,itemstack)
		pos.y = pos.y + 1
		if minetest.get_node(pos).name == "air" then
			minetest.add_node(pos,{name = "streets:constructionfence_top", param2 = minetest.dir_to_facedir(placer:get_look_dir())})
		else
			minetest.chat_send_player(placer:get_player_name(),"Not enough free space! A construction fence has a height of 2 blocks!")
		end
	end
})

minetest.register_node(":streets:constructionfence_top",{
	description = "Construction fence",
	tiles = {"streets_fence_fromtop.png","streets_fence_fromtop.png","streets_fence_fromtop.png","streets_fence_fromtop.png","streets_fence_top.png","streets_fence_top.png"},
	groups = {cracky = 2, not_in_creative_inventory = 1},
	paramtype = "light",
	paramtype2 = "facedir",
	drawtype = "nodebox",
	drop = "streets:constructionfence_bottom",
	node_box = {
		type = "fixed",
		fixed = {
			{-0.5,-0.5,-0.1,0.5,0.0,0.1}		-- upper part
		}
	},
	selection_box = {
		type = "fixed",
		fixed = {
			{-0.5,-1.5,-0.1,0.5,0.0,0.1}
		}
	},
	after_dig_node = function(pos,node,digger)
		pos.y = pos.y - 1
		minetest.remove_node(pos)
	end
})

minetest.register_craft({
	output = "streets:constructionfence_bottom 8",
	recipe = {
		{"","",""},
		{"","streets:sign_construction",""},
		{"wool:red","wool:white","wool:red"}
	}
})