mirror of
https://github.com/minetest-mods/technic.git
synced 2025-03-20 11:20:31 +01:00
fix crashes and undecleared global variables
This commit is contained in:
parent
e4d6eb1a7d
commit
3b3d3995b3
@ -1,4 +1,7 @@
|
|||||||
|
|
||||||
|
local mesecons_path = minetest.get_modpath("mesecons")
|
||||||
|
local digilines_path = minetest.get_modpath("digilines")
|
||||||
|
|
||||||
local S = technic.getter
|
local S = technic.getter
|
||||||
|
|
||||||
technic.register_power_tool("technic:battery", 10000)
|
technic.register_power_tool("technic:battery", 10000)
|
||||||
@ -76,7 +79,7 @@ function technic.register_battery_box(data)
|
|||||||
"listring[current_player;main]"..
|
"listring[current_player;main]"..
|
||||||
"listring[context;src]"..
|
"listring[context;src]"..
|
||||||
"listring[current_player;main]"
|
"listring[current_player;main]"
|
||||||
if digilines then
|
if digilines_path then
|
||||||
formspec = formspec..
|
formspec = formspec..
|
||||||
"field[0.28,4.1;3.2,1;channel;Digiline Channel;${channel}]"
|
"field[0.28,4.1;3.2,1;channel;Digiline Channel;${channel}]"
|
||||||
end
|
end
|
||||||
@ -104,7 +107,7 @@ function technic.register_battery_box(data)
|
|||||||
local max_charge = data.max_charge * (1 + EU_upgrade / 10)
|
local max_charge = data.max_charge * (1 + EU_upgrade / 10)
|
||||||
|
|
||||||
-- send digiline information
|
-- send digiline information
|
||||||
if mesecon and digilines and mesecon.is_powered(pos) then
|
if mesecons_path and digilines_path and mesecon.is_powered(pos) then
|
||||||
if eu_input ~= 0 then
|
if eu_input ~= 0 then
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
digilines.receptor_send(pos, digilines.rules.default, meta:get_string("channel"), {
|
digilines.receptor_send(pos, digilines.rules.default, meta:get_string("channel"), {
|
||||||
@ -192,6 +195,15 @@ function technic.register_battery_box(data)
|
|||||||
groups.tubedevice_receiver = 1
|
groups.tubedevice_receiver = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local mesecon_def
|
||||||
|
if mesecons_path then
|
||||||
|
mesecon_def = {effector = {
|
||||||
|
rules = mesecon.rules.default,
|
||||||
|
}}
|
||||||
|
else
|
||||||
|
mesecon_def = nil
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_node("technic:"..ltier.."_battery_box"..i, {
|
minetest.register_node("technic:"..ltier.."_battery_box"..i, {
|
||||||
description = S("%s Battery Box"):format(tier),
|
description = S("%s Battery Box"):format(tier),
|
||||||
tiles = {
|
tiles = {
|
||||||
@ -243,9 +255,7 @@ function technic.register_battery_box(data)
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("channel", fields.channel)
|
meta:set_string("channel", fields.channel)
|
||||||
end,
|
end,
|
||||||
mesecons = {effector = {
|
mesecons = mesecon_def,
|
||||||
rules = mesecon.rules.default,
|
|
||||||
}},
|
|
||||||
digiline = {
|
digiline = {
|
||||||
receptor = {action = function() end},
|
receptor = {action = function() end},
|
||||||
effector = {
|
effector = {
|
||||||
|
@ -48,6 +48,15 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local mesecon_def
|
||||||
|
if mesecons_path then
|
||||||
|
mesecon_def = {effector = {
|
||||||
|
rules = mesecon.rules.default,
|
||||||
|
}}
|
||||||
|
else
|
||||||
|
mesecon_def = nil
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_node("technic:switching_station",{
|
minetest.register_node("technic:switching_station",{
|
||||||
description = S("Switching Station"),
|
description = S("Switching Station"),
|
||||||
tiles = {"technic_water_mill_top_active.png", "technic_water_mill_top_active.png",
|
tiles = {"technic_water_mill_top_active.png", "technic_water_mill_top_active.png",
|
||||||
@ -80,9 +89,7 @@ minetest.register_node("technic:switching_station",{
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("channel", fields.channel)
|
meta:set_string("channel", fields.channel)
|
||||||
end,
|
end,
|
||||||
mesecons = {effector = {
|
mesecons = mesecon_def,
|
||||||
rules = mesecon.rules.default,
|
|
||||||
}},
|
|
||||||
digiline = {
|
digiline = {
|
||||||
receptor = {action = function() end},
|
receptor = {action = function() end},
|
||||||
effector = {
|
effector = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user