OreTracker/xray/abm.lua
david 31f430bf22 V1.3: Crash Repairer
The ABM appears to be perfect only if the server crashed, else
swapnode seems to be perfect for our code.

  The ABM appears to be fired at a hard coded rate so I have set the
intervals to 0 to fire instantly. (Which means nodes will be cleaned up
quickly when a crash occured)
2021-10-08 20:46:45 -04:00

129 lines
4.2 KiB
Lua

-- https://rubenwardy.com/minetest_modding_book/en/map/timers.html#active-block-modifiers
-- An ABM seems slow, so this is a great feature for cleaning up those crashs
-- MTG
minetest.register_abm({
nodenames = {"xray:mtg_stone"},
interval = 0, -- Run every X seconds
action = function(pos, node, active_object_count,
active_object_count_wider)
minetest.set_node(pos, {name = "default:stone"})
end
})
minetest.register_abm({
nodenames = {"xray:mtg_dstone"},
interval = 0, -- Run every X seconds
action = function(pos, node, active_object_count,
active_object_count_wider)
minetest.set_node(pos, {name = "default:desert_stone"})
end
})
minetest.register_abm({
nodenames = {"xray:mtg_sstone"},
interval = 0, -- Run every X seconds
action = function(pos, node, active_object_count,
active_object_count_wider)
minetest.set_node(pos, {name = "default:sandstone"})
end
})
minetest.register_abm({
nodenames = {"xray:mtg_dsstone"},
interval = 0, -- Run every X seconds
action = function(pos, node, active_object_count,
active_object_count_wider)
minetest.set_node(pos, {name = "default:desert_sandstone"})
end
})
minetest.register_abm({
nodenames = {"xray:mtg_ssstone"},
interval = 0, -- Run every X seconds
action = function(pos, node, active_object_count,
active_object_count_wider)
minetest.set_node(pos, {name = "default:silver_sandstone"})
end
})
-- MCL (2 and 5)
minetest.register_abm({
nodenames = {"xray:mcl_stone"},
interval = xray.scan_frequency / 2, -- Run every X seconds
action = function(pos, node, active_object_count,
active_object_count_wider)
minetest.set_node(pos, {name = "mcl_core:stone"})
end
})
minetest.register_abm({
nodenames = {"xray:mcl_granite"},
interval = 0, -- Run every X seconds
action = function(pos, node, active_object_count,
active_object_count_wider)
minetest.set_node(pos, {name = "mcl_core:granite"})
end
})
minetest.register_abm({
nodenames = {"xray:mcl_andesite"},
interval = 0, -- Run every X seconds
action = function(pos, node, active_object_count,
active_object_count_wider)
minetest.set_node(pos, {name = "mcl_core:andesite"})
end
})
minetest.register_abm({
nodenames = {"xray:mcl_diorite"},
interval = 0, -- Run every X seconds
action = function(pos, node, active_object_count,
active_object_count_wider)
minetest.set_node(pos, {name = "mcl_core:diorite"})
end
})
minetest.register_abm({
nodenames = {"xray:mcl_sstone"},
interval = 0, -- Run every X seconds
action = function(pos, node, active_object_count,
active_object_count_wider)
minetest.set_node(pos, {name = "mcl_core:sandstone"})
end
})
minetest.register_abm({
nodenames = {"xray:mcl_rsstone"},
interval = 0, -- Run every X seconds
action = function(pos, node, active_object_count,
active_object_count_wider)
minetest.set_node(pos, {name = "mcl_core:redsandstone"})
end
})
-- MCL (5 only)
minetest.register_abm({
nodenames = {"xray:mcl_bstone"},
interval = 0, -- Run every X seconds
action = function(pos, node, active_object_count,
active_object_count_wider)
minetest.set_node(pos, {name = "mcl_blackstone:blackstone"})
end
})
minetest.register_abm({
nodenames = {"xray:mcl_basalt"},
interval = 0, -- Run every X seconds
action = function(pos, node, active_object_count,
active_object_count_wider)
minetest.set_node(pos, {name = "mcl_blackstone:basalt"})
end
})
minetest.register_abm({
nodenames = {"xray:mcl_netherrack"},
interval = 0, -- Run every X seconds
action = function(pos, node, active_object_count,
active_object_count_wider)
minetest.set_node(pos, {name = "mcl_nether:netherrack"})
end
})
minetest.register_abm({
nodenames = {"xray:mcl_deepslate"},
interval = 0, -- Run every X seconds
action = function(pos, node, active_object_count,
active_object_count_wider)
minetest.set_node(pos, {name = "mcl_deepslate:deepslate"})
end
})