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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
| -- LED
| -- Intended primarily as a core component for LED lamps.
|
| local S = technic.getter
|
| local desc = S("@1 LED", S("LV"))
| local active_desc = S("@1 Active", desc)
| local unpowered_desc = S("@1 Unpowered", desc)
| local demand = 5
|
|
| local function led_run(pos, node)
| local meta = minetest.get_meta(pos)
| local eu_input = meta:get_int("LV_EU_input")
|
| if eu_input < demand and node.name == "technic:lv_led_active" then
| technic.swap_node(pos, "technic:lv_led")
| meta:set_string("infotext", unpowered_desc)
| elseif eu_input >= demand and node.name == "technic:lv_led" then
| technic.swap_node(pos, "technic:lv_led_active")
| meta:set_string("infotext", active_desc)
| end
| end
|
| minetest.register_node("technic:lv_led", {
| description = desc,
| drawtype = "nodebox",
| node_box = {
| type = "fixed",
| fixed = {0.5, 0.5, 0.5, -0.5, 0.3, -0.5}
| },
| collision_box = {
| type = "fixed",
| fixed = {0.5, 0.5, 0.5, -0.5, 0.3, -0.5}
| },
| selection_box = {
| type = "fixed",
| fixed = {0.5, 0.5, 0.5, -0.5, 0.3, -0.5}
| },
| tiles = {
| "technic_lv_led_top.png",
| "technic_lv_led.png",
| "technic_lv_led_side.png",
| "technic_lv_led_side2.png",
| "technic_lv_led_side2.png",
| "technic_lv_led_side2.png",
| },
| inventory_image = "technic_lv_led_inv.png",
| sunlight_propagates = true,
| groups = {cracky = 2, technic_machine = 1, technic_lv = 1},
| connect_sides = {"front", "back", "left", "right", "top", "bottom"},
| can_dig = technic.machine_can_dig,
| technic_run = led_run,
| on_construct = function(pos)
| local meta = minetest.get_meta(pos)
| meta:set_string("infotext", desc)
| meta:set_int("LV_EU_demand", demand)
| end,
| })
|
| minetest.register_node("technic:lv_led_active", {
| description = active_desc,
| drawtype = "nodebox",
| node_box = {
| type = "fixed",
| fixed = {0.5, 0.5, 0.5, -0.5, 0.3, -0.5}
| },
| collision_box = {
| type = "fixed",
| fixed = {0.5, 0.5, 0.5, -0.5, 0.3, -0.5}
| },
| selection_box = {
| type = "fixed",
| fixed = {0.5, 0.5, 0.5, -0.5, 0.3, -0.5}
| },
| tiles = {
| "technic_lv_led_top.png",
| "technic_lv_led.png",
| "technic_lv_led_side.png",
| "technic_lv_led_side2.png",
| "technic_lv_led_side2.png",
| "technic_lv_led_side2.png",
| },
| inventory_image = "technic_lv_led_inv.png",
| paramtype = "light",
| light_source = 9,
| drop = "technic:lv_led",
| sunlight_propagates = true,
| groups = {cracky = 2, technic_machine = 1, technic_lv = 1, not_in_creative_inventory = 1},
| connect_sides = {"front", "back", "left", "right", "top", "bottom"},
| can_dig = technic.machine_can_dig,
| technic_run = led_run,
| technic_on_disable = function(pos)
| technic.swap_node(pos, "technic:lv_led")
| end,
| })
|
| technic.register_machine("LV", "technic:lv_led", technic.receiver)
| technic.register_machine("LV", "technic:lv_led_active", technic.receiver)
|
| minetest.register_craft({
| output = "technic:lv_led 2",
| recipe = {
| {"", "homedecor:plastic_sheeting", ""},
| {"homedecor:plastic_sheeting", "technic:doped_silicon_wafer", "homedecor:plastic_sheeting"},
| {"", "technic:fine_silver_wire", ""},
| }
| })
|
|