skip strawberry registration if farming redo loaded
This commit is contained in:
parent
1e67afe05e
commit
cce63ba781
10
init.lua
10
init.lua
@ -7,7 +7,7 @@
|
||||
]]
|
||||
|
||||
|
||||
ethereal = {version = "20240125"}
|
||||
ethereal = {version = "20240310"}
|
||||
|
||||
|
||||
local function setting(stype, name, default)
|
||||
@ -96,6 +96,11 @@ function ethereal.check_creative(name)
|
||||
return creative_mode_cache or minetest.check_player_privs(name, {creative = true})
|
||||
end
|
||||
|
||||
if minetest.get_modpath("farming") and farming.mod and farming.mod == "redo" then
|
||||
-- farming redo already has strawberry included
|
||||
else
|
||||
dofile(path .. "/strawberry.lua")
|
||||
end
|
||||
|
||||
dofile(path .. "/plantlife.lua")
|
||||
dofile(path .. "/onion.lua")
|
||||
@ -106,7 +111,6 @@ dofile(path .. "/food.lua")
|
||||
dofile(path .. "/wood.lua")
|
||||
dofile(path .. "/leaves.lua")
|
||||
dofile(path .. "/sapling.lua")
|
||||
dofile(path .. "/strawberry.lua")
|
||||
dofile(path .. "/fishing.lua")
|
||||
dofile(path .. "/extra.lua")
|
||||
dofile(path .. "/sealife.lua")
|
||||
@ -146,5 +150,5 @@ if minetest.get_modpath("xanadu") then
|
||||
dofile(path .. "/plantpack.lua")
|
||||
end
|
||||
|
||||
|
||||
print ("[MOD] Ethereal loaded")
|
||||
|
||||
|
@ -74,7 +74,7 @@ def.drop = {
|
||||
minetest.register_node("ethereal:onion_5", table.copy(def))
|
||||
|
||||
|
||||
-- growing routine if farming redo isn't present
|
||||
-- register for use with farming redo growth routines if present
|
||||
if farming and farming.mod and farming.mod == "redo" then
|
||||
|
||||
-- add to registered_plants
|
||||
@ -126,3 +126,4 @@ else
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -92,56 +92,42 @@ def.drop = {
|
||||
minetest.register_node("ethereal:strawberry_8", table.copy(def))
|
||||
|
||||
|
||||
-- growing routine if farming redo isn't present
|
||||
if farming and farming.mod and farming.mod == "redo" then
|
||||
minetest.register_abm({
|
||||
label = "Ethereal grow strawberry",
|
||||
nodenames = {
|
||||
"ethereal:strawberry_1", "ethereal:strawberry_2", "ethereal:strawberry_3",
|
||||
"ethereal:strawberry_4", "ethereal:strawberry_5", "ethereal:strawberry_6",
|
||||
"ethereal:strawberry_7"
|
||||
},
|
||||
neighbors = {"farming:soil_wet"},
|
||||
interval = 9,
|
||||
chance = 20,
|
||||
catch_up = false,
|
||||
|
||||
-- add to registered_plants
|
||||
farming.registered_plants["ethereal:strawberry"] = {
|
||||
crop = "ethereal:strawberry",
|
||||
seed = "ethereal:strawberry",
|
||||
minlight = farming.min_light,
|
||||
maxlight = farming.max_light,
|
||||
steps = 8
|
||||
}
|
||||
action = function(pos, node)
|
||||
|
||||
else
|
||||
-- are we on wet soil?
|
||||
pos.y = pos.y - 1
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Ethereal grow strawberry",
|
||||
nodenames = {
|
||||
"ethereal:strawberry_1", "ethereal:strawberry_2", "ethereal:strawberry_3",
|
||||
"ethereal:strawberry_4", "ethereal:strawberry_5", "ethereal:strawberry_6",
|
||||
"ethereal:strawberry_7"
|
||||
},
|
||||
neighbors = {"farming:soil_wet"},
|
||||
interval = 9,
|
||||
chance = 20,
|
||||
catch_up = false,
|
||||
|
||||
action = function(pos, node)
|
||||
|
||||
-- are we on wet soil?
|
||||
pos.y = pos.y - 1
|
||||
|
||||
if minetest.get_item_group(minetest.get_node(pos).name, "soil") < 3 then
|
||||
return
|
||||
end
|
||||
|
||||
pos.y = pos.y + 1
|
||||
|
||||
-- do we have enough light?
|
||||
local light = minetest.get_node_light(pos)
|
||||
|
||||
if not light or light < 13 then
|
||||
return
|
||||
end
|
||||
|
||||
-- grow to next stage
|
||||
local num = node.name:split("_")[2]
|
||||
|
||||
node.name = "ethereal:strawberry_" .. tonumber(num + 1)
|
||||
|
||||
minetest.swap_node(pos, node)
|
||||
if minetest.get_item_group(minetest.get_node(pos).name, "soil") < 3 then
|
||||
return
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
pos.y = pos.y + 1
|
||||
|
||||
-- do we have enough light?
|
||||
local light = minetest.get_node_light(pos)
|
||||
|
||||
if not light or light < 13 then
|
||||
return
|
||||
end
|
||||
|
||||
-- grow to next stage
|
||||
local num = node.name:split("_")[2]
|
||||
|
||||
node.name = "ethereal:strawberry_" .. tonumber(num + 1)
|
||||
|
||||
minetest.swap_node(pos, node)
|
||||
end
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user