Add the network param to all tryputitem

This commit is contained in:
2025-03-31 12:49:29 +02:00
parent 4dc465aa46
commit 11be034c8f
4 changed files with 7 additions and 7 deletions

View File

@@ -167,7 +167,7 @@ local function tryStackFabricator(character)
local previous = nil
for _, item in ipairs(items) do
if previous ~= item.Prefab.Identifier then slot = slot + 1 end
local moved = inputInventory.TryPutItem(item, slot, false, true, nil)
local moved = inputInventory.TryPutItem(item, slot, false, true, Character.Controlled, true)
if not moved then
MyModGlobal.debugPrint(string.format("Failed to move %s", item.Prefab.Identifier.Value))
end

View File

@@ -162,7 +162,7 @@ local function tryReloadSlot(slot, preferMinCondition)
break
end
local moved = inventorySlot.inventory.TryPutItem(ititem, inventorySlot.slotIndex, false, true, nil)
local moved = inventorySlot.inventory.TryPutItem(ititem, inventorySlot.slotIndex, false, true, Character.Controlled, true)
-- When the slot is full no more will be able to be moved
-- And tat that point we're done with that slot
if not moved then break end

View File

@@ -122,7 +122,7 @@ local function tryMoveItem(item, itemTree, force)
-- MyModGlobal.debugPrint(string.format("Can be put in slot %d: %s", itemLocation.slotIndex, tostring(canBePut)))
if itemLocation.maxFits > 0 and canBePut then
moved = moved or itemLocation.inventory.TryPutItem(item, itemLocation.slotIndex, false, true, nil)
moved = moved or itemLocation.inventory.TryPutItem(item, itemLocation.slotIndex, false, true, Character.Controlled, true)
if moved then
itemLocation.maxFits = itemLocation.inventory.HowManyCanBePut(item.Prefab, itemLocation.slotIndex)
end
@@ -150,7 +150,7 @@ local function tryMoveItem(item, itemTree, force)
if maxFits > 0 then
-- MyModGlobal.debugPrint(string.format("Trying to move item to empty slot at index: %d", itemLocation.slotIndex))
moved = moved or itemLocation.inventory.TryPutItem(item, itemLocation.slotIndex, true, false, nil)
moved = moved or itemLocation.inventory.TryPutItem(item, itemLocation.slotIndex, true, false, Character.Controlled, true)
if moved then
itemLocation.maxFits = itemLocation.inventory.HowManyCanBePut(item.Prefab, itemLocation.slotIndex)
end
@@ -326,7 +326,7 @@ local function stackToCursor()
-- UPDATE: OK well that was a stupid idea, it returns an error for other shit as well
-- What other shit? Wish I knew
-- So we'll use HowManyCanBePut instead...
local moved = slot.inventory.TryPutItem(ititem, slot.slotIndex - 1, false, true, nil)
local moved = slot.inventory.TryPutItem(ititem, slot.slotIndex - 1, false, true, Character.Controlled, true)
if not moved then
MyModGlobal.debugPrint(string.format("Failed to move item %s to slot %d", ititem.Name, slot
.slotIndex - 1))
@@ -372,7 +372,7 @@ local function stackAllToCursor()
-- UPDATE: OK well that was a stupid idea, it returns an error for other shit as well
-- What other shit? Wish I knew
-- So we'll use HowManyCanBePut instead...
local moved = slot.inventory.TryPutItem(ititem, slot.slotIndex - 1, false, true, nil)
local moved = slot.inventory.TryPutItem(ititem, slot.slotIndex - 1, false, true, Character.Controlled, true)
if not moved then
MyModGlobal.debugPrint(string.format("Failed to move item %s to slot %d", ititem.Name, slot
.slotIndex - 1))

View File

@@ -96,7 +96,7 @@ local function tryUnloadSlot(slot)
for _, nearbySlot in ipairs(nearbySlots) do
local canAccept = nearbySlot.inventory.CanBePutInSlot(iitem.Prefab, nearbySlot.slotIndex)
if canAccept then
local moved = nearbySlot.inventory.TryPutItem(iitem, nearbySlot.slotIndex, true, false, nil)
local moved = nearbySlot.inventory.TryPutItem(iitem, nearbySlot.slotIndex, true, false, Character.Controlled, true)
-- print(string.format("Moved item %s to slot %d", iitem.Name, nearbySlot.slotIndex))
if moved then break end
end