-
Notifications
You must be signed in to change notification settings - Fork 8
/
digi_copier_fixer.lua
169 lines (159 loc) · 7.05 KB
/
digi_copier_fixer.lua
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
local function apply_overrides()
local additionalnodes = {
["beacon:black"] = "channel",
["beacon:blue"] = "channel",
["beacon:cyan"] = "channel",
["beacon:green"] = "channel",
["beacon:magenta"] = "channel",
["beacon:orange"] = "channel",
["beacon:red"] = "channel",
["beacon:violet"] = "channel",
["beacon:white"] = "channel",
["beacon:yellow"] = "channel",
["digibuilder:digibuilder"] = "channel",
["digicontrol:filter"] = "channel",
["digiline_global_memory:controller"] = "channel",
["digiline_routing:filter"] = "channel", -- infotext is not updated
["digilines:chest"] = "channel",
["digilines:lcd"] = "channel",
["digilines:lightsensor"] = "channel",
["digilines:rtc"] = "channel",
["digiterms:beige_keyboard"] = "channel",
["digiterms:black_keyboard"] = "channel",
["digiterms:cathodic_beige_monitor"] = "channel",
["digiterms:cathodic_black_monitor"] = "channel",
["digiterms:cathodic_white_monitor"] = "channel",
["digiterms:lcd_monitor"] = "channel",
["digiterms:scifi_glassscreen"] = "channel",
["digiterms:scifi_keysmonitor"] = "channel",
["digiterms:scifi_tallscreen"] = "channel",
["digiterms:scifi_widescreen"] = "channel",
["digiterms:white_keyboard"] = "channel",
["drawers:controller"] = "digilineChannel",
["jumpdrive:engine"] = "channel", -- formspec is not updated (reset button does it)
["jumpdrive:fleet_controller"] = "channel", -- formspec is not updated (reset button does it)
["mesecons_detector:node_detector_off"] = "digiline_channel",
["mesecons_detector:node_detector_on"] = "digiline_channel",
["mesecons_detector:object_detector_off"] = "digiline_channel",
["mesecons_detector:object_detector_on"] = "digiline_channel",
["monitoring_digilines:metric_controller"] = "channel",
["pipeworks:autocrafter"] = "channel",
["pipeworks:deployer_off"] = "channel",
["pipeworks:deployer_on"] = "channel",
["pipeworks:digiline_detector_tube_1"] = "channel",
["pipeworks:digiline_detector_tube_2"] = "channel",
["pipeworks:digiline_detector_tube_3"] = "channel",
["pipeworks:digiline_detector_tube_4"] = "channel",
["pipeworks:digiline_detector_tube_5"] = "channel",
["pipeworks:digiline_detector_tube_6"] = "channel",
["pipeworks:digiline_detector_tube_7"] = "channel",
["pipeworks:digiline_detector_tube_8"] = "channel",
["pipeworks:digiline_detector_tube_9"] = "channel",
["pipeworks:digiline_detector_tube_10"] = "channel",
["pipeworks:digiline_filter"] = "channel",
["pipeworks:dispenser_off"] = "channel",
["pipeworks:dispenser_on"] = "channel",
["pipeworks:nodebreaker_off"] = "channel",
["pipeworks:nodebreaker_on"] = "channel",
["pipeworks:teleport_tube_1"] = "digiline_channel",
["pipeworks:teleport_tube_2"] = "digiline_channel",
["pipeworks:teleport_tube_3"] = "digiline_channel",
["pipeworks:teleport_tube_4"] = "digiline_channel",
["pipeworks:teleport_tube_5"] = "digiline_channel",
["pipeworks:teleport_tube_6"] = "digiline_channel",
["pipeworks:teleport_tube_7"] = "digiline_channel",
["pipeworks:teleport_tube_8"] = "digiline_channel",
["pipeworks:teleport_tube_9"] = "digiline_channel",
["pipeworks:teleport_tube_10"] = "digiline_channel",
["spacecannon:cannon_green"] = "channel",
["spacecannon:cannon_red"] = "channel",
["spacecannon:cannon_yellow"] = "channel",
["technic:forcefield_emitter_off"] = "channel", -- formspec is not updated
["technic:forcefield_emitter_on"] = "channel", -- formspec is not updated
["technic:hv_battery_box0"] = "channel",
["technic:hv_battery_box1"] = "channel",
["technic:hv_battery_box2"] = "channel",
["technic:hv_battery_box3"] = "channel",
["technic:hv_battery_box4"] = "channel",
["technic:hv_battery_box5"] = "channel",
["technic:hv_battery_box6"] = "channel",
["technic:hv_battery_box7"] = "channel",
["technic:hv_battery_box8"] = "channel",
["technic:hv_nuclear_reactor_core"] = "remote_channel",
["technic:hv_nuclear_reactor_core_active"] = "remote_channel",
["technic:lv_battery_box0"] = "channel",
["technic:lv_battery_box1"] = "channel",
["technic:lv_battery_box2"] = "channel",
["technic:lv_battery_box3"] = "channel",
["technic:lv_battery_box4"] = "channel",
["technic:lv_battery_box5"] = "channel",
["technic:lv_battery_box6"] = "channel",
["technic:lv_battery_box7"] = "channel",
["technic:lv_battery_box8"] = "channel",
["technic:mithril_chest"] = "channel",
["technic:mithril_locked_chest"] = "channel",
["technic:mithril_protected_chest"] = "channel",
["technic:mv_battery_box0"] = "channel",
["technic:mv_battery_box1"] = "channel",
["technic:mv_battery_box2"] = "channel",
["technic:mv_battery_box3"] = "channel",
["technic:mv_battery_box4"] = "channel",
["technic:mv_battery_box5"] = "channel",
["technic:mv_battery_box6"] = "channel",
["technic:mv_battery_box7"] = "channel",
["technic:mv_battery_box8"] = "channel",
["technic:power_monitor"] = "channel",
["technic:quarry"] = "channel",
["technic:supply_converter"] = "channel", -- formspec is not updated
["technic:switching_station"] = "channel",
["textline:lcd"] = "channel",
}
for name, field in pairs(additionalnodes) do
if minetest.registered_nodes[name]
and not minetest.registered_nodes[name]._digistuff_channelcopier_fieldname then
minetest.override_item(name,{ _digistuff_channelcopier_fieldname = field })
end
end
-- after channel change, some need special attention
-- routing filter
local osRoutingFilter = function(pos, node, player, new_channel, old_channel)
local FILTER_INFOTEXT = "Digiline Filter (channel \"%s\")"
local meta = minetest.get_meta(pos)
meta:set_string("infotext", FILTER_INFOTEXT:format(meta:get_string("channel")))
end
-- jumpdrive engine
local osJumpdrive = function(pos, node, player, new_channel, old_channel)
local meta = minetest.get_meta(pos)
jumpdrive.migrate_engine_meta(pos, meta)
jumpdrive.update_formspec(meta, pos)
end
-- jumpdrive fleet controller
local osFleetController = function(pos, node, player, new_channel, old_channel)
local meta = minetest.get_meta(pos)
jumpdrive.fleet.update_formspec(meta, pos)
end
-- force field
local osForceField = function(pos, node, player, new_channel, old_channel)
local nodedef = minetest.registered_nodes[node.name]
nodedef.on_receive_fields(pos, "", { channel = new_channel }, player)
end
-- supply converter
local osSupplyConverter = function(pos, node, player, new_channel, old_channel)
local nodedef = minetest.registered_nodes[node.name]
nodedef.on_receive_fields(pos, "", { channel = new_channel }, player)
end
local onsets = {
["digiline_routing:filter"] = osRoutingFilter,
["jumpdrive:engine"] = osJumpdrive,
["jumpdrive:fleet_controller"] = osFleetController,
["technic:forcefield_emitter_off"] = osForceField,
["technic:forcefield_emitter_on"] = osForceField,
["technic:supply_converter"] = osSupplyConverter,
}
for name, field in pairs(onsets) do
if minetest.registered_nodes[name] and not minetest.registered_nodes[name]._digistuff_channelcopier_onset then
minetest.override_item(name,{ _digistuff_channelcopier_onset = field })
end
end
end
apply_overrides()