ZenonSeth / logistica

A Minetest item transport and storage mod
Other
1 stars 4 forks source link

Item replication #20

Open KAnon20 opened 1 month ago

KAnon20 commented 1 month ago

Originally, a Bulk Request Inserter (BRI) took items from inventories and deposited them in the target inventory. Now, the Autocrafter inventory seems to dump 1 (or more items) through an Inserter into a chest, barrel, or similar and gives the stack specified by the BRI. For example, when the autocrafter crafts Octuple Compressed Cobblestone (OCC or 8CC) x1 and exporters to the chest through BRI that exports up to OCC x64, the inventory receives OCC x64 rather than just the OCC x1 in the Autocrafter's inventory.

Items to replicate: Network Controlled x1, Optic Cable x1+, Bulk Request Inserter x2, Fast Network Importer x1, Autocrafter x1, Mass Storage or Vacuum Chest or Passive Supply Chest x1, Chest or Barrel x1, and items to replicate (ie: 7CC x9 or 8CC x1).

  1. Put the recipe for 8CC into the Autocrafter.
  2. Set the Inserter into the Autocrafter to 7CC x9 and the Inserter into the Barrel/etc. to 2~64 8CC (shift clicking the 8CC x1 repeatedly until it reaches the desired amount.
  3. Load the 7CC x9 into the network inventory (Mass Storage, Passive Supply Chest, or Vacuum Chest).
  4. Turn on the 2 Inserters, 1 Importer, and 1 Autocrafter.
  5. Get 8CC x64, or the desired craftable item duped.
ZenonSeth commented 1 month ago

Would you be able to test a fix for this, along with some of the other features you requested, prior to me making a release? I have limited time so I can only do so much testing before releases.

If you are, I'm pushing the changes to the main branch right now, you can download a copy and temporarily replace your Logistica mod from the main page (https://github.com/ZenonSeth/logistica/tree/main) via the Green Code Button, then Download ZIP

Otherwise I will do a bit more testing later on, and will publish a release.

The fixed issues are:

ZenonSeth commented 1 month ago

OK, had time to do more testing, and I believe it should be fixed and working correctly now in Release 1.2.5 - also available on ContentDB.

KAnon20 commented 1 month ago

Well, I was out exercising, I checked it after coming back, took a shower, tested it and started writing, and then you released 1.2.5. I tried 1.2.5 and then wrote up what's necessary.

First:

  1. Item Replication is 100% fixed
  2. Access Point search seems safe. I tried a bunch of characters and nothing crashed or complained.
  3. Crafting Suppliers are working properly (and unaffected by Mass Storage pull).

Great Job! :100:


screenshot1 This is what it looks like (though it didn't entirely work before and now). The stacks were set to full (64, except for items with smaller stacks like White Banner and Ender Pearls). Inserter 1: String, Coal, Spider Eye Inserter 2: Bone, Arrow, Frost Arrow, Ice Crystal Inserter 3: Rotten Flesh, Carrot, Carrot Inserter 4: Potato, Baked Potato, Iron Ingot, Poppy Inserter 5: Bow (as it doesn't get stored in a Mass Storage) Inserter 6: Emerald, Iron Nugget, White Banner, Leather Inserter 7: Raw Beef, Steak, Gunpowder, Ghast Tear Inserter 8: Blaze Rod, Ender Pearl Inserter 9: Wither Skull, Zombie Head, Skeleton Skull At that time, Blaze Rod and Gunpowder weren't sending. Of course, others might not have been sending based on not coming in from rarer drops.


screenshot2 screenshot3 screenshot4 screenshot5 I broke the Inserters and placed them again, adding the items in order (4 per Inserter with the center Inserter dedicated only to Bows). The Right most Inserter was turned off and the one left of it only had 2 items, all at full stacks. At first, Coal, Gunpowder, and Shiny Ice Crystals weren't sending. I grabbed a stack from my Mass Storage network (or less for heads and rare items) and dumped them all in and then Ender Pearls, Gunpowder, Shiny Ice Crystals, and Skeleton Skulls didn't send.

I tried ticking inf and nothing changed so I reduced stacks to 1 to see if anything special happened but items were only sent 1 at a time (even when there was more of items). While doing this, a Wither Skull showed up and refused to be insterted. Considering the Inserters themselves might've been the issue, I replaced them and added everything x1 and ticked inf and it still only sent 1 at a time (or whatever the amount I listed was after I later increased them to full stacks again). Again, Coal, Gunpowder, and Shiny Ice Crystals refused to send.

Since 2 Inserters were pushing into a the same barrel, I thought they might've been fighting for the same slot (as they're both 4th in their Inserters) and added a send trio (Inserter, Barrel, Importer, +Cable where necessary) to free it up and nothing changed.

Looking at the Mass Storage Pull option, I tried ticking it off and nothing changed (even when I moved their inventories to Vacuum Chests or removed the Mass Storages from the network.

At the Access Point, I removed items from the network and dumped them into it and they'd sometimes empty out before getting stuck again.


After preparing to post and coming here, I found 1.2.5 and tried installing it. I found:

  1. Singleplayer (and or server?) were repeatedly spamming text regarding stacks for my Octuple Cobble network (and others inactive regions). Debug text left behind probably.
  2. The Spawn Tower network was still having issues sending items. It's just the items with issues don't always seem to be the same, I guess? Blaze Rods, Bone, Iron Nugget, and Poppy?

And here I am now. :sweat_smile: My spawner tower has 14 spawners; Blaze, Rover, Ghast, Cow, Vindicator, Stray, Spider, Iron Golem, 2x Zombie, and 4x Wither Skeleton. All but the Wither Skeletons are basically auto and my kill box has them + Zombies flowing to it so everything flows in.


I don't know if this is anything but the Vindicator sometimes drop White Banners and the text can vary (even though they're being sent through different Inserters so it shouldn't matter):

  1. 2024-07-24 19:27:29: [Server]: toInsertStack = mcl_banners:banner_item_white
  2. 2024-07-24 19:33:17: [Server]: toInsertStack = mcl_banners:banner_item_white 1 0 "\u0001name\u0002\u001b(T@mclraids)Ominous Banner\u001bE\u0003layers\u0002local ={};_[1]=\"unicolorblack\";[2]=\"pattern\";_[3]=\"unicolorgrey\";return {{[[2]]=\"rhombus\",color=\"unicolorcyan\"},{[[2]]=\"stripebottom\",color=[3]},{[_[2]]=\"stripe_center\",color=\"unicolordarkgrey\"},{[[2]]=\"stripemiddle\",color=[1]},{[_[2]]=\"halfhorizontal\",color=[3]},{[[2]]=\"circle\",color=[3]},{[[2]]=\"border\",color=[1]}}\u0003"
ZenonSeth commented 1 month ago

Yes, that's what happens when I push commits late night, I sometimes leave debug text. Will clean it up in a release in a bit. Edit: Release 1.2.6 now published and available on ContentDB should have now removed the extra debug logs.

The other issue, the inconsistency you're having, I'll look into your post and setup more closely when I'm free.

Just a few notes:

I will try to investigate later, unfortunately you have a bit of a complex setup so I don't know if I can reproduce it, but will get back to you.

ZenonSeth commented 1 month ago

Also is this on a server I could possibly join and look at your setup? That may help out to see what's going on, and if everything is working as expected or not.

KAnon20 commented 1 month ago

It's single player and with Spawncraft, you can make spawn eggs. I made a shcematic (EDIT: It's a 23x23 building with a height of 31.) with the WorldEdit mod. Github doesn't allow .mts file uploads. I checked for viruses and spyware/adware before uploading but always be careful with checks.

There's a hidden room below that I use as a brewing room with 48 Passive Chests and a Wireless Receiver for potions that don't allow passive storage. I considered Tool Chests and it's optional to use them instead but they don't have an option not to store other items and I felt there's few uses for potions (especially in single player). It uses its own Wireless Receiver to reduce main network nodes a small bit. This room was mainly made to fill space though.

Spawners: (replace 9 *redstone blocks with Vacuum Chests and turn them on)

  1. top-most room*: blaze
  2. bottom-most room*: rover
  3. upper room1-4 (flowing water): wither skeleton
  4. middle room1-2 (flowing water): zombie
  5. middle room3*: iron golem
  6. middle room4*: vindicator
  7. lower room above hidden room room1*: cow
  8. lower room above hidden room room2*: stray
  9. lower room3* (flowing water): ghast
  10. lower room4*: spider
  11. Kill chamber*: travelnet, no spawner, within the spawner activation range (15-cubed-block range)

The top room has 2 lapis blocks (for a Logistic Network Controller (LNC) and a Wireless Transmitter). The redstone blocks are traded out for Inserters and Importers and you need the Screwdriver to turn their angles. The bottom ones are for the LNC and Inserters and the top are for the others. You can optionally add an Access Point to the front of the LNC to view the storage on the network and the relevant 4 Mass Storages to the side of it if you see the network filling up (because of not sending items and completely filling a chest). The 2 furthest send trios on the sides were originally Inserters with an extra cable and aimed towards their adjacent barrel in the image before but I changed them around the time of posting trying to fix it and because it looks nicer.

Everything should be connected (with the Brewing room on its own setup) but I was modifying it and deleted my old schematic. The cables work from WorldEdit but other machines show empty inventories and need to be replaced so I used this fix to make the schematic. My main network has relevant Mass Storages with full upgrades with 8-slots per item (1024x5x8 = 40960) and were not full of materials. Because of having Tool Chests on the network, I created a sub-net that takes Bows from it and trashes beyond 1 full Tool Chest of its own.


Although I didn't consider it before, I just checked Block Bounds and several items that are successfully sent are within the same bounds of other items that are having issues so that shouldn't be a problem. My Mass Storage network has 15x15 space with walls of 15x4 (60 MS per wall) and cables behind them - This is my 4th setup and I plan to convert this towards the 16x16x16 Block style later since not all items are available in the end. There are plenty of Passive chests connected near the LNC of the main network so I don't believe this is the issue since it refuses to send some after killing for a few minutes (since the kill chamber is within 15-blocks of all the spawners).

ZenonSeth commented 1 month ago

Hm, ok I loaded your schematic fine, will have to replace the blocks sometime, might have to wait till the weekend though.

I'm curious about one thing:

I considered Tool Chests and it's optional to use them instead but they don't have an option not to store other items

Did you need a Tool Chest just to manually store potions in, but nothing else? Or are you planning to get them in another way?

Because I guess one thing I had considered in the past is filters on the Tool Chests, but I never got around to it since it was an extra, and there's a few uncertainties on functionality.

KAnon20 commented 1 month ago

Storing Order: Also, I don't know how TCs and PCs are used for storage but they seem to work differently. The 60 PCs on my main network fill up in a certain order, not decided by when they were added to the network or distance from the LNC. On the other hand, TCs don't always fill up only 1 TC before moving on; I had 8 TCs on a network before and added several items in 3 of them (similar items like saddles were all in 1 though). Of course, the order doesn't really matter until you don't know what you're looking for. I considered a toggle cable for my Mass Storages (MS) to make the tools easier to search but going too far away cut off the networks access so I didn't include it in the current MS network tower.


I have Tool Chests (TC) and Passive Chests (PC), and it's optional which to use. I indeed avoided Tool Chests (TC) because it could randomly receive items from the network. The Passive Chests (PC) with the storage option turned off is a marginally good replacement. Only if I need to store tens of potions or more would I consider a TC, and that would require me to spend time to create them and have a place to use them. Single Player doesn't really need potions for combat (except for the Ender Dragon, the Wither, or shulker fields in the End, and Withers can be easily spawned near a beacon after killing them once). While water breathing potions and fire resistance potions might be necessary at some points, if I'm going to do those actions, I'd stock up and fill my network's default TCs, avoiding the issue. With dark oak sign's text standing out and only brewing in that room, it's quick and easy to fill them and see them on the network. Unless people are duping, I wouldn't expect people to full up 128+ in each TC for multiplayer either.

Of course, I considered using the Stackable Potions mod to make stack-able potions and use MSs but the mod only half works. Any potion gets converted into a basic stack-able potion (ie: Regen, Regen+ Regen II ~> Regen (stack) ). While there are Regen+ stack-able potions in creative, they need to be created with commands or through creative.

I don't recommend a filter for TCs for multiple reasons:

  1. Many people don't care as they'll just search their terminal for what they want and not care where it's stored. Also, those of us who want their inventories in certain places will build workarounds like my PC Brewing room or Enchanting room with TCs on a default-off Toggle-able cable.
  2. People are insatiable; if you add an item filter, they'll want an enchantment filter for "enchanted books with specifically Protection IV" and so on. Of note, Enchanted Books from different sources (ie: Enchantment Extractor, Villagers, tabled books, and fishing) can be treated as different items in the Wireless Pad and AP.
  3. No Trashcan priority deletion after it's full will flood into other inventories and it doesn't have a pull items option.

Unless you're adding TC filter for your personal convenience, I wouldn't recommend it. If someone offers the code themselves, I'd say it's worth it.

Unlike this line of thought, the Trashcan feature I recommended has to do with a MS-storable, 40960-limit item likely easily to flooding all PCs on the network from common automated items (like cobble/stone : cobble gen/furnace and various fish : fishing traps).

ZenonSeth commented 1 month ago

Storing Order: Also, I don't know how TCs and PCs are used for storage but they seem to work differently...

The order of insertion should be consistent, but it isn't anything user-controllable. The reason is that for optimization purposes, the machines in a network are stored in a Lua set (or what passes for a set), with the key for each node being its position hash. This makes it really fast to ensure that no machine is added to a network twice, and to check which machine belongs to which network. But unfortunately Sets don't have sorting, or at least, not developer controlled sorting. I could do something to sort the chests, but a good solution would come at the cost of speed. There's an easier solution that would cost less, which is to sort the chests by physical distance (not network distance) to the LNC, which would at least make things consistent, but not sure if its too useful. I'll have to think about that before doing anything

I indeed avoided Tool Chests (TC) because it could randomly receive items from the network. The Passive Chests (PC) with the storage option turned off is a marginally good replacement.

I actually remember that I originally had a "Allow storing from network" toggle on TCs, but took it away because I thought it was unnecessary. I can easily put it back really.

I still haven't had time to test your setup, but I have to tell you that debugging issues in such a large setup is no guarantee I'll be able to figure out what might be going wrong. If it only happens on large setups, I'm a little afraid that it may be a timer issue - I've read that having too many node timers causes issues. There is a workaround to it - specifically I would have to write my own timer system and call it manually - but that means I have to make sure its foolproof. I may try it anyway, it's an interesting challenge, and then I would have to ask you to test a new version at some point, perhaps.

Anyway, all of that will take time, so unfortunately there won't be quick fixes for your issue. I'll keep this issue open, even though the original is already resolved, just so we can keep this discussion visible.

KAnon20 commented 1 month ago

I was just talking about my experience, not requesting features :sweat: . The current hash optimization is fine. TCs don't need an allow storing toggle. It'll just make people with OCD more crazy.

Large setups can be a problem? I remember having it hooked up to my MS network (with a wireless receiver) before going over the 4k limit and it was running fine. Tomorrow, I'll try loading my schematic on a new world and with a small MS network and get back to you.

Thinking about it now, when I posted on the other guys request about sending items out of a network, I was referring to a "Network Exporter" effect (like a reverse Network Importer) to send "anything and everything on the network out". What you did was just add an inf toggle to Inserters which confused me. I don't know why someone would export to a chest that doesn't get imported into a furnace/etc. or a new networks storage right away as that would indirectly produce the effect of transferring every single item of the given type with the send-trio). Of course, I do run a few inserters into barrels for my semi-automated farms/cactus to send a full stacks for replanting without having to open and search my wireless pad, and waiting a few tenths of a second for it to refill the second stack isn't an issue.


EDIT: It bothered me so I quickly made a new world and loaded the schematic in and set up a small network a short distance away. LNC, AP, Wireless Transmitter, 3 TC, 8 PC, 4 MS, 23 cable.

After killing for about 2 minutes, Shiny Ice Crystals, String, and White Banners were stuck. I took them out in an AP and put them in the same AP and went killing for a few more minutes. When checking, the 3 items were stuck again. For reference, no Skeleton Skull, (uncooked) potato, or raw beef dropped at this point (though I'm using magma blocks but they can drop). Of note, the tower on my game world easily filled up a mass storage (without upgrades) for a couple items that weren't sending (such as coal and bones when they were stuck).