mirror of
https://github.com/joe7575/techpack.git
synced 2024-11-22 23:33:44 +01:00
parent
87bbf759fd
commit
e7b1da2636
@ -1,6 +1,24 @@
|
|||||||
# Release Notes for ModPack TechPack [techpack]
|
# 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)
|
## V2.03.01 (2019-05-03)
|
||||||
|
|
||||||
### Additions
|
### Additions
|
||||||
|
@ -77,7 +77,7 @@ tubelib.register_node("tubelib:blackhole", {}, {
|
|||||||
on_push_item = function(pos, side, item)
|
on_push_item = function(pos, side, item)
|
||||||
if side == "L" then
|
if side == "L" then
|
||||||
local meta = minetest.get_meta(pos)
|
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_int("disappeared", disappeared)
|
||||||
meta:set_string("infotext", disappeared.." items disappeared")
|
meta:set_string("infotext", disappeared.." items disappeared")
|
||||||
return true
|
return true
|
||||||
|
@ -112,6 +112,18 @@ local function AddToTbl(kvTbl, new_items)
|
|||||||
return kvTbl
|
return kvTbl
|
||||||
end
|
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
|
-- 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)
|
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?
|
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 filter = minetest.deserialize(meta:get_string("filter")) or {false,false,false,false}
|
||||||
local kvFilterItemNames = {} -- {<item:name> = true,...}
|
local kvFilterItemNames = {} -- {<item:name> = true,...}
|
||||||
local kvSide2ItemNames = {} -- {"F" = {<item:name>,...},...}
|
local kvSide2ItemNames = {} -- {"F" = {<item:name>,...},...}
|
||||||
|
local kvNumOccur = {}
|
||||||
|
|
||||||
-- collect all filter settings
|
-- collect all filter settings
|
||||||
for idx,slot in ipairs(SlotColors) do
|
for idx,slot in ipairs(SlotColors) do
|
||||||
@ -179,6 +192,7 @@ local function filter_settings(pos)
|
|||||||
local filter = invlist_entries_as_list(list)
|
local filter = invlist_entries_as_list(list)
|
||||||
AddToTbl(kvFilterItemNames, filter)
|
AddToTbl(kvFilterItemNames, filter)
|
||||||
kvSide2ItemNames[side] = filter
|
kvSide2ItemNames[side] = filter
|
||||||
|
countItemOccurrenceInFilters(kvNumOccur, filter)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -186,6 +200,7 @@ local function filter_settings(pos)
|
|||||||
kvFilterItemNames = kvFilterItemNames,
|
kvFilterItemNames = kvFilterItemNames,
|
||||||
kvSide2ItemNames = kvSide2ItemNames,
|
kvSide2ItemNames = kvSide2ItemNames,
|
||||||
kvRejectedItemNames = {},
|
kvRejectedItemNames = {},
|
||||||
|
kvNumOccur = kvNumOccur,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -213,6 +228,7 @@ local function distributing(pos, meta)
|
|||||||
local kvFilterItemNames = FilterCache[hash].kvFilterItemNames
|
local kvFilterItemNames = FilterCache[hash].kvFilterItemNames
|
||||||
-- filter items of one slot as list {{<item:name>, <num-items>},...}
|
-- filter items of one slot as list {{<item:name>, <num-items>},...}
|
||||||
local items = FilterCache[hash].kvSide2ItemNames[side]
|
local items = FilterCache[hash].kvSide2ItemNames[side]
|
||||||
|
local kvNumOccur = FilterCache[hash].kvNumOccur
|
||||||
-- rejected items from other filter slots
|
-- rejected items from other filter slots
|
||||||
local rejected = FilterCache[hash].kvRejectedItemNames
|
local rejected = FilterCache[hash].kvRejectedItemNames
|
||||||
|
|
||||||
@ -244,7 +260,7 @@ local function distributing(pos, meta)
|
|||||||
local num = num_items(moved_items, name, kvFilterItemNames, rejected)
|
local num = num_items(moved_items, name, kvFilterItemNames, rejected)
|
||||||
if num then
|
if num then
|
||||||
local item = tubelib.get_this_item(meta, "src", kvSrc[name], num) -- <<=== tubelib
|
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
|
if not tubelib.push_items(pos, side, item, player_name) then -- <<=== tubelib
|
||||||
tubelib.put_item(meta, "src", item)
|
tubelib.put_item(meta, "src", item)
|
||||||
else
|
else
|
||||||
|
@ -426,6 +426,9 @@ minetest.register_craft({
|
|||||||
|
|
||||||
tubelib.register_node("tubelib_addons1:autocrafter",
|
tubelib.register_node("tubelib_addons1:autocrafter",
|
||||||
{"tubelib_addons1:autocrafter_active", "tubelib_addons1:autocrafter_defect"}, {
|
{"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)
|
on_pull_item = function(pos, side)
|
||||||
return tubelib.get_item(M(pos), "dst")
|
return tubelib.get_item(M(pos), "dst")
|
||||||
end,
|
end,
|
||||||
|
@ -265,6 +265,9 @@ minetest.register_craft({
|
|||||||
|
|
||||||
tubelib.register_node("tubelib_addons1:grinder",
|
tubelib.register_node("tubelib_addons1:grinder",
|
||||||
{"tubelib_addons1:grinder_active", "tubelib_addons1:grinder_defect"}, {
|
{"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)
|
on_pull_item = function(pos, side)
|
||||||
return tubelib.get_item(M(pos), "dst")
|
return tubelib.get_item(M(pos), "dst")
|
||||||
end,
|
end,
|
||||||
|
@ -425,6 +425,9 @@ minetest.register_craft({
|
|||||||
|
|
||||||
|
|
||||||
tubelib.register_node("tubelib_addons1:harvester_base", {"tubelib_addons1:harvester_defect"}, {
|
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)
|
on_pull_item = function(pos, side)
|
||||||
return tubelib.get_item(M(pos), "main")
|
return tubelib.get_item(M(pos), "main")
|
||||||
end,
|
end,
|
||||||
|
@ -194,7 +194,7 @@ local function distributing(pos, meta)
|
|||||||
local open_ports = table.copy(FilterCache[hash].OpenPorts)
|
local open_ports = table.copy(FilterCache[hash].OpenPorts)
|
||||||
|
|
||||||
-- no filter configured?
|
-- 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 busy = false
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -230,7 +230,7 @@ local function distributing(pos, meta)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- try unconfigured open output ports
|
-- 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)
|
side = random_list_elem(open_ports)
|
||||||
if side then
|
if side then
|
||||||
if tubelib.push_items(pos, side, stack, player_name) 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
|
return count
|
||||||
end
|
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 function aging(pos, meta)
|
||||||
local cnt = meta:get_int("tubelib_aging") + 1
|
local cnt = meta:get_int("tubelib_aging") + 1
|
||||||
meta:set_int("tubelib_aging", cnt)
|
meta:set_int("tubelib_aging", cnt)
|
||||||
@ -286,6 +302,11 @@ tubelib.register_node("tubelib_addons3:pushing_chest",
|
|||||||
return "not supported"
|
return "not supported"
|
||||||
end
|
end
|
||||||
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)
|
on_pull_item = function(pos, side)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local items = tubelib.get_num_items(meta, "main", 2)
|
local items = tubelib.get_num_items(meta, "main", 2)
|
||||||
|
Loading…
Reference in New Issue
Block a user