forked from VoxeLibre/VoxeLibre
Double the odds, to halve the ABM frequencies.
This commit is contained in:
parent
e9453d6210
commit
78a958db4e
|
@ -172,7 +172,7 @@ minetest.register_craft({
|
|||
})
|
||||
|
||||
-- beetroots grow 1/3rd of the default speed
|
||||
mcl_farming:add_plant("plant_beetroot", "mcl_farming:beetroot", {"mcl_farming:beetroot_0", "mcl_farming:beetroot_1", "mcl_farming:beetroot_2"}, 13.512, 15)
|
||||
mcl_farming:add_plant("plant_beetroot", "mcl_farming:beetroot", {"mcl_farming:beetroot_0", "mcl_farming:beetroot_1", "mcl_farming:beetroot_2"}, 16.2012, 25)
|
||||
|
||||
if minetest.get_modpath("doc") then
|
||||
for i = 1, 2 do
|
||||
|
|
|
@ -118,7 +118,7 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
mcl_farming:add_plant("plant_carrot", "mcl_farming:carrot", {"mcl_farming:carrot_1", "mcl_farming:carrot_2", "mcl_farming:carrot_3", "mcl_farming:carrot_4", "mcl_farming:carrot_5", "mcl_farming:carrot_6", "mcl_farming:carrot_7"}, 13.513, 5)
|
||||
mcl_farming:add_plant("plant_carrot", "mcl_farming:carrot", {"mcl_farming:carrot_1", "mcl_farming:carrot_2", "mcl_farming:carrot_3", "mcl_farming:carrot_4", "mcl_farming:carrot_5", "mcl_farming:carrot_6", "mcl_farming:carrot_7"}, 5.4013, 25)
|
||||
|
||||
if minetest.get_modpath("doc") then
|
||||
for i=2,7 do
|
||||
|
|
|
@ -123,10 +123,10 @@ local stem_def = {
|
|||
}
|
||||
|
||||
-- Register stem growth
|
||||
mcl_farming:add_plant("plant_melon_stem", "mcl_farming:melontige_unconnect", {"mcl_farming:melontige_1", "mcl_farming:melontige_2", "mcl_farming:melontige_3", "mcl_farming:melontige_4", "mcl_farming:melontige_5", "mcl_farming:melontige_6", "mcl_farming:melontige_7"}, 13.514, 5)
|
||||
mcl_farming:add_plant("plant_melon_stem", "mcl_farming:melontige_unconnect", {"mcl_farming:melontige_1", "mcl_farming:melontige_2", "mcl_farming:melontige_3", "mcl_farming:melontige_4", "mcl_farming:melontige_5", "mcl_farming:melontige_6", "mcl_farming:melontige_7"}, 5.4014, 25)
|
||||
|
||||
-- Register actual melon, connected stems and stem-to-melon growth
|
||||
mcl_farming:add_gourd("mcl_farming:melontige_unconnect", "mcl_farming:melontige_linked", "mcl_farming:melontige_unconnect", stem_def, stem_drop, "mcl_farming:melon", melon_base_def, 13.515, 5, "mcl_farming_melon_stem_connected.png^[colorize:#FFA800:127")
|
||||
mcl_farming:add_gourd("mcl_farming:melontige_unconnect", "mcl_farming:melontige_linked", "mcl_farming:melontige_unconnect", stem_def, stem_drop, "mcl_farming:melon", melon_base_def, 5.4015, 25, "mcl_farming_melon_stem_connected.png^[colorize:#FFA800:127")
|
||||
|
||||
-- Items and crafting
|
||||
minetest.register_craftitem("mcl_farming:melon_item", {
|
||||
|
|
|
@ -135,7 +135,7 @@ minetest.register_craft({
|
|||
cooktime = 10,
|
||||
})
|
||||
|
||||
mcl_farming:add_plant("plant_potato", "mcl_farming:potato", {"mcl_farming:potato_1", "mcl_farming:potato_2", "mcl_farming:potato_3", "mcl_farming:potato_4", "mcl_farming:potato_5", "mcl_farming:potato_6", "mcl_farming:potato_7"}, 13.516, 5)
|
||||
mcl_farming:add_plant("plant_potato", "mcl_farming:potato", {"mcl_farming:potato_1", "mcl_farming:potato_2", "mcl_farming:potato_3", "mcl_farming:potato_4", "mcl_farming:potato_5", "mcl_farming:potato_6", "mcl_farming:potato_7"}, 5.4016, 25)
|
||||
|
||||
minetest.register_on_item_eat(function (hp_change, replace_with_item, itemstack, user, pointed_thing)
|
||||
|
||||
|
|
|
@ -180,10 +180,10 @@ if minetest.get_modpath("mcl_armor") then
|
|||
end
|
||||
|
||||
-- Register stem growth
|
||||
mcl_farming:add_plant("plant_pumpkin_stem", "mcl_farming:pumpkintige_unconnect", {"mcl_farming:pumpkin_1", "mcl_farming:pumpkin_2", "mcl_farming:pumpkin_3", "mcl_farming:pumpkin_4", "mcl_farming:pumpkin_5", "mcl_farming:pumpkin_6", "mcl_farming:pumpkin_7"}, 13.517, 5)
|
||||
mcl_farming:add_plant("plant_pumpkin_stem", "mcl_farming:pumpkintige_unconnect", {"mcl_farming:pumpkin_1", "mcl_farming:pumpkin_2", "mcl_farming:pumpkin_3", "mcl_farming:pumpkin_4", "mcl_farming:pumpkin_5", "mcl_farming:pumpkin_6", "mcl_farming:pumpkin_7"}, 5.4017, 25)
|
||||
|
||||
-- Register actual pumpkin, connected stems and stem-to-pumpkin growth
|
||||
mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", "mcl_farming:pumpkintige_unconnect", stem_def, stem_drop, "mcl_farming:pumpkin", pumpkin_base_def, 13.518, 5, "mcl_farming_pumpkin_stem_connected.png^[colorize:#FFA800:127")
|
||||
mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", "mcl_farming:pumpkintige_unconnect", stem_def, stem_drop, "mcl_farming:pumpkin", pumpkin_base_def, 5.4018, 25, "mcl_farming_pumpkin_stem_connected.png^[colorize:#FFA800:127")
|
||||
|
||||
-- Steal function to properly disconnect a carved pumpkin
|
||||
pumpkin_face_base_def.after_destruct = minetest.registered_nodes["mcl_farming:pumpkin"].after_destruct
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
--
|
||||
local math = math
|
||||
local vector = vector
|
||||
local random = math.random
|
||||
local floor = math.floor
|
||||
|
||||
local plant_lists = {}
|
||||
mcl_farming.plant_lists = plant_lists -- export
|
||||
|
@ -123,12 +125,13 @@ function mcl_farming:grow_plant(identifier, pos, node, stages, ignore_light_wate
|
|||
-- number of missed interval ticks, for catch-up in block loading
|
||||
local plant_info = plant_lists[identifier]
|
||||
if plant_info then
|
||||
stages = stages + math.floor(get_intervals_counter(pos, plant_info.interval, plant_info.chance))
|
||||
stages = stages + floor(get_intervals_counter(pos, plant_info.interval, plant_info.chance))
|
||||
end
|
||||
if not ignore_light_water then
|
||||
local odds = math.floor(25 / (get_moisture_level(pos) * get_moisture_penalty(pos))) + 1
|
||||
local odds = floor(25 / (get_moisture_level(pos) * get_moisture_penalty(pos))) + 1
|
||||
for i = 1,stages do
|
||||
if math.random(1, odds) ~= 1 then stages = stages - 1 end
|
||||
-- we double the odds, and rather call the ABM less often
|
||||
if random() * odds >= 2 then stages = stages - 1 end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -307,7 +310,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
|
|||
local light = minetest.get_node_light(stempos)
|
||||
if not light or light < 9 then return end
|
||||
-- Pick one neighbor and check if it can be used to grow
|
||||
local dir = math.random(1, 4) -- pick direction at random
|
||||
local dir = random(1, 4) -- pick direction at random
|
||||
local neighbor = (dir == 1 and vector.offset(stempos, 1, 0, 0))
|
||||
or (dir == 2 and vector.offset(stempos, -1, 0, 0))
|
||||
or (dir == 3 and vector.offset(stempos, 0, 0, 1))
|
||||
|
@ -322,7 +325,8 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
|
|||
|
||||
-- check moisture level
|
||||
local moisture = get_moisture_level(stempos) * get_moisture_penalty(stempos)
|
||||
if math.random(1, math.floor(25 / moisture) + 1) ~= 1 then return end
|
||||
-- we double the odds, and rather call the ABM less often
|
||||
if random() * (math.floor(25 / moisture) + 1) >= 2 then return end
|
||||
|
||||
minetest.swap_node(stempos, { name = connected_stem_names[dir] })
|
||||
if gourd_def.paramtype2 == "facedir" then
|
||||
|
|
|
@ -99,8 +99,8 @@ minetest.register_craftitem("mcl_farming:sweet_berry", {
|
|||
})
|
||||
minetest.register_alias("mcl_sweet_berry:sweet_berry", "mcl_farming:sweet_berry")
|
||||
|
||||
-- TODO: Find proper interval and chance values for sweet berry bushes. Current interval and chance values are copied from mcl_farming:beetroot which has similar growth stages.
|
||||
mcl_farming:add_plant("plant_sweet_berry_bush", "mcl_farming:sweet_berry_bush_3", {"mcl_farming:sweet_berry_bush_0", "mcl_farming:sweet_berry_bush_1", "mcl_farming:sweet_berry_bush_2"}, 13.519, 15)
|
||||
-- TODO: Find proper interval and chance values for sweet berry bushes. Current interval and chance values are copied from mcl_farming:beetroot which has similar growth stages, 1/3rd of the default.
|
||||
mcl_farming:add_plant("plant_sweet_berry_bush", "mcl_farming:sweet_berry_bush_3", {"mcl_farming:sweet_berry_bush_0", "mcl_farming:sweet_berry_bush_1", "mcl_farming:sweet_berry_bush_2"}, 16.2019, 25)
|
||||
|
||||
local function berry_damage_check(obj)
|
||||
local p = obj:get_pos()
|
||||
|
|
|
@ -99,7 +99,7 @@ minetest.register_node("mcl_farming:wheat", {
|
|||
}
|
||||
})
|
||||
|
||||
mcl_farming:add_plant("plant_wheat", "mcl_farming:wheat", {"mcl_farming:wheat_1", "mcl_farming:wheat_2", "mcl_farming:wheat_3", "mcl_farming:wheat_4", "mcl_farming:wheat_5", "mcl_farming:wheat_6", "mcl_farming:wheat_7"}, 13.520, 5)
|
||||
mcl_farming:add_plant("plant_wheat", "mcl_farming:wheat", {"mcl_farming:wheat_1", "mcl_farming:wheat_2", "mcl_farming:wheat_3", "mcl_farming:wheat_4", "mcl_farming:wheat_5", "mcl_farming:wheat_6", "mcl_farming:wheat_7"}, 5.4020, 25)
|
||||
|
||||
minetest.register_craftitem("mcl_farming:wheat_item", {
|
||||
description = S("Wheat"),
|
||||
|
|
Loading…
Reference in New Issue