mirror of
https://github.com/joe7575/techpack.git
synced 2024-11-22 15:23:43 +01:00
parent
87bbf759fd
commit
e7b1da2636
@ -1,6 +1,24 @@
|
||||
# Release Notes for ModPack TechPack [techpack]
|
||||
|
||||
|
||||
## V2.03.02 (2019-05-09)
|
||||
|
||||
### Additions
|
||||
|
||||
### Removals
|
||||
|
||||
### Changes
|
||||
- HighPerf Pusher support for autocrafter, grinder, and harvester
|
||||
added (issue #22, #23)
|
||||
- Both distributor behaviours changed (issue #26)
|
||||
|
||||
### Fixes
|
||||
- Black Hole "items disappeared" counter bugfix (issue #24)
|
||||
- HighPerf distributor behaviour without an active filtered channel
|
||||
changed (issue #25)
|
||||
|
||||
|
||||
|
||||
## V2.03.01 (2019-05-03)
|
||||
|
||||
### Additions
|
||||
|
@ -77,7 +77,7 @@ tubelib.register_node("tubelib:blackhole", {}, {
|
||||
on_push_item = function(pos, side, item)
|
||||
if side == "L" then
|
||||
local meta = minetest.get_meta(pos)
|
||||
local disappeared = meta:get_int("disappeared") + 1
|
||||
local disappeared = meta:get_int("disappeared") + item:get_count()
|
||||
meta:set_int("disappeared", disappeared)
|
||||
meta:set_string("infotext", disappeared.." items disappeared")
|
||||
return true
|
||||
|
@ -112,6 +112,18 @@ local function AddToTbl(kvTbl, new_items)
|
||||
return kvTbl
|
||||
end
|
||||
|
||||
local function countItemOccurrenceInFilters(kvTbl, new_items)
|
||||
for _, l in ipairs(new_items) do
|
||||
local name = l[1]
|
||||
if kvTbl[name] == nil then
|
||||
kvTbl[name] = 1
|
||||
else
|
||||
kvTbl[name] = kvTbl[name] + 1
|
||||
end
|
||||
end
|
||||
return kvTbl
|
||||
end
|
||||
|
||||
-- return the number of items to be pushed to an unconfigured slot
|
||||
local function num_items(moved_items, name, filter_item_names, rejected_item_names)
|
||||
if filter_item_names[name] == nil then -- not configured in one filter?
|
||||
@ -170,6 +182,7 @@ local function filter_settings(pos)
|
||||
local filter = minetest.deserialize(meta:get_string("filter")) or {false,false,false,false}
|
||||
local kvFilterItemNames = {} -- {<item:name> = true,...}
|
||||
local kvSide2ItemNames = {} -- {"F" = {<item:name>,...},...}
|
||||
local kvNumOccur = {}
|
||||
|
||||
-- collect all filter settings
|
||||
for idx,slot in ipairs(SlotColors) do
|
||||
@ -179,6 +192,7 @@ local function filter_settings(pos)
|
||||
local filter = invlist_entries_as_list(list)
|
||||
AddToTbl(kvFilterItemNames, filter)
|
||||
kvSide2ItemNames[side] = filter
|
||||
countItemOccurrenceInFilters(kvNumOccur, filter)
|
||||
end
|
||||
end
|
||||
|
||||
@ -186,6 +200,7 @@ local function filter_settings(pos)
|
||||
kvFilterItemNames = kvFilterItemNames,
|
||||
kvSide2ItemNames = kvSide2ItemNames,
|
||||
kvRejectedItemNames = {},
|
||||
kvNumOccur = kvNumOccur,
|
||||
}
|
||||
end
|
||||
|
||||
@ -213,6 +228,7 @@ local function distributing(pos, meta)
|
||||
local kvFilterItemNames = FilterCache[hash].kvFilterItemNames
|
||||
-- filter items of one slot as list {{<item:name>, <num-items>},...}
|
||||
local items = FilterCache[hash].kvSide2ItemNames[side]
|
||||
local kvNumOccur = FilterCache[hash].kvNumOccur
|
||||
-- rejected items from other filter slots
|
||||
local rejected = FilterCache[hash].kvRejectedItemNames
|
||||
|
||||
@ -244,7 +260,7 @@ local function distributing(pos, meta)
|
||||
local num = num_items(moved_items, name, kvFilterItemNames, rejected)
|
||||
if num then
|
||||
local item = tubelib.get_this_item(meta, "src", kvSrc[name], num) -- <<=== tubelib
|
||||
if item then
|
||||
if item and (not kvNumOccur[item:get_name()] or kvNumOccur[item:get_name()] < 2) then
|
||||
if not tubelib.push_items(pos, side, item, player_name) then -- <<=== tubelib
|
||||
tubelib.put_item(meta, "src", item)
|
||||
else
|
||||
|
@ -426,6 +426,9 @@ minetest.register_craft({
|
||||
|
||||
tubelib.register_node("tubelib_addons1:autocrafter",
|
||||
{"tubelib_addons1:autocrafter_active", "tubelib_addons1:autocrafter_defect"}, {
|
||||
on_pull_stack = function(pos, side)
|
||||
return tubelib.get_stack(M(pos), "dst")
|
||||
end,
|
||||
on_pull_item = function(pos, side)
|
||||
return tubelib.get_item(M(pos), "dst")
|
||||
end,
|
||||
|
@ -265,6 +265,9 @@ minetest.register_craft({
|
||||
|
||||
tubelib.register_node("tubelib_addons1:grinder",
|
||||
{"tubelib_addons1:grinder_active", "tubelib_addons1:grinder_defect"}, {
|
||||
on_pull_stack = function(pos, side)
|
||||
return tubelib.get_stack(M(pos), "dst")
|
||||
end,
|
||||
on_pull_item = function(pos, side)
|
||||
return tubelib.get_item(M(pos), "dst")
|
||||
end,
|
||||
|
@ -425,6 +425,9 @@ minetest.register_craft({
|
||||
|
||||
|
||||
tubelib.register_node("tubelib_addons1:harvester_base", {"tubelib_addons1:harvester_defect"}, {
|
||||
on_pull_stack = function(pos, side)
|
||||
return tubelib.get_stack(M(pos), "main")
|
||||
end,
|
||||
on_pull_item = function(pos, side)
|
||||
return tubelib.get_item(M(pos), "main")
|
||||
end,
|
||||
|
@ -194,7 +194,7 @@ local function distributing(pos, meta)
|
||||
local open_ports = table.copy(FilterCache[hash].OpenPorts)
|
||||
|
||||
-- no filter configured?
|
||||
if next(kvFilterItemNames) == nil then return end
|
||||
if not next(kvFilterItemNames) and not next(open_ports) then return end
|
||||
|
||||
local busy = false
|
||||
local inv = meta:get_inventory()
|
||||
@ -230,7 +230,7 @@ local function distributing(pos, meta)
|
||||
end
|
||||
|
||||
-- try unconfigured open output ports
|
||||
if second_try then
|
||||
if second_try and (not kvFilterItemNames[name] or #kvFilterItemNames[name] == 1) then
|
||||
side = random_list_elem(open_ports)
|
||||
if side then
|
||||
if tubelib.push_items(pos, side, stack, player_name) then
|
||||
|
@ -48,6 +48,22 @@ local function allow_metadata_inventory_move(pos, from_list, from_index, to_list
|
||||
return count
|
||||
end
|
||||
|
||||
local function keep_the_rest(meta, list, taken)
|
||||
if taken then
|
||||
local inv = meta:get_inventory()
|
||||
local rest = ItemStack(taken:get_name())
|
||||
if not inv:contains_item(list, rest) then
|
||||
inv:add_item(list, rest)
|
||||
if taken:get_count() > 1 then
|
||||
taken:set_count(taken:get_count() - 1)
|
||||
return taken
|
||||
end
|
||||
else
|
||||
return taken
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function aging(pos, meta)
|
||||
local cnt = meta:get_int("tubelib_aging") + 1
|
||||
meta:set_int("tubelib_aging", cnt)
|
||||
@ -286,6 +302,11 @@ tubelib.register_node("tubelib_addons3:pushing_chest",
|
||||
return "not supported"
|
||||
end
|
||||
end,
|
||||
on_pull_stack = function(pos, side)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local taken = tubelib.get_stack(meta, "main")
|
||||
return keep_the_rest(meta, "main", taken)
|
||||
end,
|
||||
on_pull_item = function(pos, side)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local items = tubelib.get_num_items(meta, "main", 2)
|
||||
|
Loading…
Reference in New Issue
Block a user