Added a config option 'ta_apiary_abm_enabled' to control if the ABMs are enabled or not

This commit is contained in:
Lesya-cpp 2023-08-23 03:55:14 +07:00
parent 851e6c1759
commit 32de288068
3 changed files with 53 additions and 44 deletions

View File

@ -317,7 +317,9 @@ minetest.register_craft({
},
})
minetest.register_abm({
if ta_apiary.abm_enabled then
minetest.register_abm({
label = "spawn bee particles",
nodenames = {"ta_apiary:bee_hive"},
interval = 10,
@ -345,10 +347,10 @@ minetest.register_abm({
minetest.sound_play("bees", {
pos = pos, gain = 0.6, max_hear_distance = 5}, true)
end
})
})
-- spawning bees around bee hive
minetest.register_abm({
minetest.register_abm({
label = "spawn bees around bee hives",
nodenames = {"ta_apiary:bee_hive"},
neighbors = {"group:flower", "group:leaves"},
@ -365,5 +367,7 @@ minetest.register_abm({
minetest.add_node(p, {name="bees:bees"})
end
end
})
})
end

View File

@ -15,6 +15,9 @@ local M = minetest.get_meta
ta_apiary = {}
ta_apiary.abm_enabled = minetest.settings:get_bool("ta_apiary_abm_enabled") ~= false
ta_apiary.S = minetest.get_translator("ta_apiary")
ta_apiary.CRD = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).consumer or {} end

2
settingtypes.txt Normal file
View File

@ -0,0 +1,2 @@
# Disables ABMs (to potentially increase performance)
ta_apiary_abm_enabled(Enable Apiary ABMs) bool true