summaryrefslogtreecommitdiff
path: root/mesecons_lamp/init.lua
blob: cad6870677d79474ad2f2bcbac9626c912ad474a (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
71
72
73
-- MESELAMPS
minetest.register_node("mesecons_lamp:lamp_on", {
	drawtype = "nodebox",
	tile_images = {"jeija_meselamp_on.png"},
	paramtype = "light",
	paramtype2 = "wallmounted",
	legacy_wallmounted = true,
	sunlight_propagates = true,
	walkable = true,
	light_source = LIGHT_MAX,
	node_box = {
		type = "wallmounted",
		wall_top = {-0.3125,0.375,-0.3125,0.3125,0.5,0.3125},
		wall_bottom = {-0.3125,-0.5,-0.3125,0.3125,-0.375,0.3125},
		wall_side = {-0.375,-0.3125,-0.3125,-0.5,0.3125,0.3125},
	},
	selection_box = {
		type = "wallmounted",
		wall_top = {-0.3125,0.375,-0.3125,0.3125,0.5,0.3125},
		wall_bottom = {-0.3125,-0.5,-0.3125,0.3125,-0.375,0.3125},
		wall_side = {-0.375,-0.3125,-0.3125,-0.5,0.3125,0.3125},
	},
	groups = {dig_immediate=3,not_in_creative_inventory=1},
	drop='"mesecons_lamp:lamp_off" 1',
})

minetest.register_node("mesecons_lamp:lamp_off", {
	drawtype = "nodebox",
	tile_images = {"jeija_meselamp_off.png"},
	inventory_image = "jeija_meselamp.png",
	wield_image = "jeija_meselamp.png",
	paramtype = "light",
	paramtype2 = "wallmounted",
	sunlight_propagates = true,
	walkable = true,
	node_box = {
		type = "wallmounted",
		wall_top = {-0.3125,0.375,-0.3125,0.3125,0.5,0.3125},
		wall_bottom = {-0.3125,-0.5,-0.3125,0.3125,-0.375,0.3125},
		wall_side = {-0.375,-0.3125,-0.3125,-0.5,0.3125,0.3125},
	},
	selection_box = {
		type = "wallmounted",
		wall_top = {-0.3125,0.375,-0.3125,0.3125,0.5,0.3125},
		wall_bottom = {-0.3125,-0.5,-0.3125,0.3125,-0.375,0.3125},
		wall_side = {-0.375,-0.3125,-0.3125,-0.5,0.3125,0.3125},
	},
	groups = {dig_immediate=3},
    	description="Meselamp",
})

minetest.register_craft({
	output = '"mesecons_lamp:lamp_off" 1',
	recipe = {
		{'', '"default:glass"', ''},
		{'"mesecons:mesecon_off"', '"default:steel_ingot"', '"mesecons:mesecon_off"'},
		{'', '"default:glass"', ''},
	}
})

mesecon:register_on_signal_on(function(pos, node)
	if node.name == "mesecons_lamp:lamp_off" then
		minetest.env:add_node(pos, {name="mesecons_lamp:lamp_on", param2 = node.param2})
		nodeupdate(pos)
	end
end)

mesecon:register_on_signal_off(function(pos, node)
	if node.name == "mesecons_lamp:lamp_on" then
		minetest.env:add_node(pos, {name="mesecons_lamp:lamp_off", param2 = node.param2})
		nodeupdate(pos)
	end
end)