Change Mass Storage pull so it doesn't pull from Crafting Suppliers
This commit is contained in:
parent
8f465fe547
commit
2259e02351
@ -18,7 +18,7 @@ local FILTER_TOOLTIP = S("Place item to select what kind of item to store in eac
|
||||
local UPGRADE_TOOLTIP = S("Upgrade slots: The 4 slots to the right are for placing mass storage upgrades.")
|
||||
local STORAGE_TOOLTIP = S("Storage slots: items can be taken from them. To add items, put them in the input slot below.")
|
||||
local INPUT_TOOLTIP = S("Input slot: Place items here (or shift+click items to send them here) to put them in storage")
|
||||
local PULL_TOOLTIP = S("If ON, this mass storage will try to take items from connected suppliers, if it can store them.")
|
||||
local PULL_TOOLTIP = S("If ON, this mass storage will try to take stored items from Suppliers (except Crafting Suppliers) if it can store them.")
|
||||
|
||||
local function get_sel_index(vals, selectedValue)
|
||||
for i, v in ipairs(vals) do if v == selectedValue then return i end end
|
||||
|
@ -96,7 +96,7 @@ You can collectively access all Mass Storage on a particular network from an Acc
|
||||
- Select Front Image: Selects a stored node to display on the front of the storage node
|
||||
- Can Reserve a number of items per slot: Reserved items won't be taken by other machines on the network
|
||||
- Can quickly deposit items by punching it with a stack or sneak-punching it for deposit all stack items from your inventory
|
||||
- Pull items on/off: When On this storage will actively try to pull from Passive Supplier Chests]]
|
||||
- Pull items on/off: When On this storage will actively try to pull from any Supplier machines (e.g. Passive Supply Chests, Cobblegen Suppliers), except Crafting Suppliers.]]
|
||||
|
||||
g.tool_chest = [[
|
||||
The Tool Chest provides a large number of storage slots -- but it can only store tools (specifically, items that have a max stack size of 1). The Tool Chest is also accessed by Requesters to provide items. Tool Chest cannot be dug while it contains items (unlike Mass Storage, which will keep its inventory)
|
||||
|
@ -23,6 +23,22 @@ local function show_deposited_item_popup(player, numDeposited, name)
|
||||
logistica.show_popup(player:get_player_name(), "Stored "..numDeposited.." "..name, 1.5)
|
||||
end
|
||||
|
||||
-- returns an ItemStack of how many items were taken
|
||||
local function take_item_from_supplier_for_mass_storage(pos, stack)
|
||||
logistica.load_position(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local removed = ItemStack("")
|
||||
local network = logistica.get_network_or_nil(pos)
|
||||
local collectFunc = function(st) removed:add_item(st); return 0 end
|
||||
if logistica.GROUPS.crafting_suppliers.is(node.name) then
|
||||
-- no-op: it doesn't really make sense for mass storages too pull from crafting suppliers
|
||||
-- logistica.take_item_from_crafting_supplier(pos, stack, network, collectFunc, false, false, 1)
|
||||
else
|
||||
logistica.take_item_from_supplier(pos, stack, network, collectFunc, false, false)
|
||||
end
|
||||
return removed
|
||||
end
|
||||
|
||||
--------------------------------
|
||||
-- public functions
|
||||
--------------------------------
|
||||
@ -107,7 +123,7 @@ function logistica.pull_items_from_network_into_mass_storage(pos)
|
||||
|
||||
local numTaken = 0
|
||||
for hash, _ in pairs(network.supplier_cache[requestStack:get_name()] or {}) do
|
||||
local taken = logistica.take_item_from_supplier_simple(minetest.get_position_from_hash(hash), requestStack)
|
||||
local taken = take_item_from_supplier_for_mass_storage(minetest.get_position_from_hash(hash), requestStack)
|
||||
numTaken = numTaken + taken:get_count()
|
||||
logistica.insert_item_into_mass_storage(pos, meta:get_inventory(), taken)
|
||||
if numTaken >= spaceForItems then return true end -- everything isnerted, return
|
||||
|
@ -17,22 +17,6 @@ function logistica.get_supplier_inv_size(pos)
|
||||
end
|
||||
end
|
||||
|
||||
-- returns an ItemStack of how many items were taken
|
||||
function logistica.take_item_from_supplier_simple(pos, stack)
|
||||
logistica.load_position(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local removed = ItemStack("")
|
||||
local network = logistica.get_network_or_nil(pos)
|
||||
local collectFunc = function(st) removed:add_item(st); return 0 end
|
||||
if logistica.GROUPS.crafting_suppliers.is(node.name) then
|
||||
logistica.take_item_from_crafting_supplier(pos, stack, network, collectFunc, false, false, 1)
|
||||
else
|
||||
logistica.take_item_from_supplier(pos, stack, network, collectFunc, false, false)
|
||||
end
|
||||
return removed
|
||||
end
|
||||
|
||||
|
||||
-- tries to put the given item in this supplier, returns what's leftover
|
||||
function logistica.put_item_in_supplier(pos, stack)
|
||||
local nodeName = minetest.get_node(pos).name
|
||||
|
Loading…
x
Reference in New Issue
Block a user