Hi everyone, I made my first mod with help (/me waves @KRS) but I want some extra features that I'm not sure about how to implement.
The mod in question is https://mods.factorio.com/mod/dumpchest
The goal of this mod is to dump your trash slot items in a active provider chest(s) near the player. I made this because sometimes you just want to quickly "dump" your items and get on with it, instead of waiting for your bots.
The problem is that after item transfer the bot's still fly towards the player, is there a way to make them cancel their "trash pickup" job.
Some idea's that spring to mind are:
- In the jetpack mod when you fly up the bots "stop" for a short moment, I think this is because the player that lifts off is a new entity?
- A way to turn off the player logistics capabilities for a short moment.
Thanks
Made my first mod but need advice on extra feature
-
- Inserter
- Posts: 29
- Joined: Mon Sep 13, 2021 6:53 pm
- Contact:
Re: Made my first mod but need advice on extra feature
When you iterate over trash_inventory, you're copying its contents to your own trash_to_clean table. Later on, when you're subtracting item counts, you're doing it with your own copy of the data, so that will have no influence on the actual LuaInventory you meant to manipulate.
Since the items are still in your trash inventory, the bots will continue towards you to pick them up.
Last edited by InappropriatePenguin on Sun Jan 23, 2022 7:44 pm, edited 1 time in total.
Re: Made my first mod but need advice on extra feature
Indexing operator on an inventory gives out LUAItemStack instances - trash_to_clean is just holding references to those and calling their attributes, which works fine. A quick test confirms mod is working as expected.
This is a problem with vanilla Factorio, not the mod. Robots don't get any notifications if the contents of the trash slots change, so they just keep flying until they reach the character and finally check the inventory to see there's nothing there. This happens even if you move things out of your trash slots by hand, or if you take things out of logistic chests. Not aware of any way to solve it other than removing the character and replacing it with a new one (which is what jetpack does to remove the collision), which does tell the robots to stop, but is probably overcomplicated for this.
-
- Inserter
- Posts: 29
- Joined: Mon Sep 13, 2021 6:53 pm
- Contact:
Re: Made my first mod but need advice on extra feature
Ah, so I was missing something after all.
Re: Made my first mod but need advice on extra feature
Can the hidden teleportation to the same place or to other surface and back to this one help in this situation?