mirror of
https://github.com/joe7575/techpack.git
synced 2024-11-22 23:33:44 +01:00
aging fine adjustment
This commit is contained in:
parent
539401e2fb
commit
c020615b10
@ -57,7 +57,7 @@ local P = minetest.string_to_pos
|
||||
local M = minetest.get_meta
|
||||
|
||||
|
||||
local AGING_FACTOR = 3 -- defect random factor
|
||||
local AGING_FACTOR = 4 -- defect random factor
|
||||
|
||||
--
|
||||
-- Local States
|
||||
|
@ -32,7 +32,7 @@ local State = tubelib.NodeStates:new({
|
||||
infotext_name = "HighPerf Distributor",
|
||||
cycle_time = CYCLE_TIME,
|
||||
standby_ticks = STANDBY_TICKS,
|
||||
aging_factor = 10,
|
||||
aging_factor = 50,
|
||||
})
|
||||
|
||||
local function formspec(pos, meta)
|
||||
@ -197,7 +197,7 @@ local function distributing(pos, meta)
|
||||
-- no filter configured?
|
||||
if next(kvFilterItemNames) == nil then return end
|
||||
|
||||
local moved_items_total = 0
|
||||
local busy = false
|
||||
local inv = meta:get_inventory()
|
||||
local list = inv:get_list("src")
|
||||
|
||||
@ -222,7 +222,7 @@ local function distributing(pos, meta)
|
||||
stack:set_count(0)
|
||||
local color = Side2Color[side]
|
||||
counter[color] = counter[color] + num
|
||||
moved_items_total = moved_items_total + num
|
||||
busy = true
|
||||
else
|
||||
second_try = true -- port blocked
|
||||
end
|
||||
@ -238,7 +238,7 @@ local function distributing(pos, meta)
|
||||
stack:set_count(0)
|
||||
local color = Side2Color[side]
|
||||
counter[color] = counter[color] + num
|
||||
moved_items_total = moved_items_total + num
|
||||
busy = true
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -246,8 +246,8 @@ local function distributing(pos, meta)
|
||||
inv:set_list("src", list)
|
||||
|
||||
meta:set_string("item_counter", minetest.serialize(counter))
|
||||
if moved_items_total > 0 then
|
||||
State:keep_running(pos, meta, COUNTDOWN_TICKS, moved_items_total)
|
||||
if busy then
|
||||
State:keep_running(pos, meta, COUNTDOWN_TICKS, 1)
|
||||
else
|
||||
State:idle(pos, meta)
|
||||
end
|
||||
|
@ -31,7 +31,7 @@ local State = tubelib.NodeStates:new({
|
||||
cycle_time = CYCLE_TIME,
|
||||
standby_ticks = STANDBY_TICKS,
|
||||
has_item_meter = true,
|
||||
aging_factor = 60,
|
||||
aging_factor = 50,
|
||||
})
|
||||
|
||||
local function pushing(pos, meta)
|
||||
@ -44,7 +44,7 @@ local function pushing(pos, meta)
|
||||
State:blocked(pos, meta)
|
||||
return
|
||||
end
|
||||
State:keep_running(pos, meta, COUNTDOWN_TICKS, items:get_count())
|
||||
State:keep_running(pos, meta, COUNTDOWN_TICKS, 1)
|
||||
return
|
||||
end
|
||||
State:idle(pos, meta)
|
||||
|
@ -15,8 +15,8 @@
|
||||
]]--
|
||||
|
||||
-- tubelib aging feature
|
||||
local AGING_LEVEL1 = 80 * tubelib.machine_aging_value
|
||||
local AGING_LEVEL2 = 240 * tubelib.machine_aging_value
|
||||
local AGING_LEVEL1 = 50 * tubelib.machine_aging_value
|
||||
local AGING_LEVEL2 = 150 * tubelib.machine_aging_value
|
||||
|
||||
local Cache = {}
|
||||
|
||||
@ -48,10 +48,10 @@ local function allow_metadata_inventory_move(pos, from_list, from_index, to_list
|
||||
return count
|
||||
end
|
||||
|
||||
local function aging(pos, meta, num)
|
||||
local cnt = meta:get_int("tubelib_aging") + num
|
||||
local function aging(pos, meta)
|
||||
local cnt = meta:get_int("tubelib_aging") + 1
|
||||
meta:set_int("tubelib_aging", cnt)
|
||||
if cnt > AGING_LEVEL1 and math.random(AGING_LEVEL2/num) == 1 then
|
||||
if cnt > AGING_LEVEL1 and math.random(AGING_LEVEL2) == 1 then
|
||||
minetest.get_node_timer(pos):stop()
|
||||
local node = minetest.get_node(pos)
|
||||
node.name = "tubelib_addons3:pushing_chest_defect"
|
||||
@ -97,7 +97,7 @@ local function shift_items(pos, elapsed)
|
||||
stack = inv:get_stack("shift", idx)
|
||||
stack:take_item(num)
|
||||
inv:set_stack("shift", idx, stack)
|
||||
aging(pos, meta, num)
|
||||
aging(pos, meta)
|
||||
return true
|
||||
else
|
||||
set_state(meta, "blocked")
|
||||
|
Loading…
Reference in New Issue
Block a user