tweak decomposition.
leaves will now start decomposing faster if touching certain nodes. they'll also take longer overall to start decomposing.
This commit is contained in:
parent
ae26cfad42
commit
400c27c021
1 changed files with 15 additions and 10 deletions
|
@ -7,20 +7,31 @@ local vec = blockgame.vector
|
|||
local leaves = modname .. ":leaves"
|
||||
local leaves_decomposing = modname .. ":leaves_decomposing"
|
||||
|
||||
-- END OF NODE NAMES
|
||||
|
||||
|
||||
local decompose_scores = {
|
||||
dirty = 50,
|
||||
leaves_decomposing = 30,
|
||||
}
|
||||
|
||||
local start_decompose_cost = 4000
|
||||
|
||||
blockgame.register_increasing_abm({
|
||||
id = modname .. ":begin_decompose",
|
||||
label = "decompose leaves",
|
||||
nodenames = {leaves},
|
||||
neighbors = {"group:dirty", leaves_decomposing},
|
||||
interval = 20,
|
||||
interval = 30,
|
||||
chance = 4,
|
||||
rate = function (pos, node, data)
|
||||
return data.value + math.random(4, 6)
|
||||
local score = blockgame.score_nearby_nodes(pos, 2, decompose_scores, function (gain, distance)
|
||||
return math.floor(gain / (distance ^ 3))
|
||||
end)
|
||||
|
||||
return data.value + score
|
||||
end,
|
||||
check = function (pos, node, data)
|
||||
return data.value >= 80
|
||||
return data.value >= start_decompose_cost
|
||||
end,
|
||||
action = function (pos, node, data)
|
||||
-- NOTE: might wanna access the 4 from somewhere, instead of directly knowing it.
|
||||
|
@ -30,11 +41,6 @@ blockgame.register_increasing_abm({
|
|||
end,
|
||||
})
|
||||
|
||||
local decompose_scores = {
|
||||
dirty = 50,
|
||||
leaves_decomposing = 30,
|
||||
}
|
||||
|
||||
local decompose_cost = 30000
|
||||
local average_leaves_per_dirt = 4
|
||||
|
||||
|
@ -53,7 +59,6 @@ blockgame.register_increasing_abm({
|
|||
end)
|
||||
|
||||
score = score + bonus
|
||||
|
||||
return data.value + score
|
||||
end,
|
||||
check = function (pos, node, data)
|
||||
|
|
Loading…
Reference in a new issue