[1.1.0] Writing to LuaControl::auto_trash_filters misbehaves on Spidertron entities

This subforum contains all the issues which we already resolved.
robot256
Smart Inserter
Smart Inserter
Posts: 1253
Joined: Sun Mar 17, 2019 1:52 am
Contact:

[1.1.0] Writing to LuaControl::auto_trash_filters misbehaves on Spidertron entities

Post by robot256 »

What I did:
  • Tried to save and restore logistics auto trash filters via script on a spider-vehicle that already had other logistic requests configured in random slots.
What happened:
  • Auto trash filters were saved correctly (infinite values are returned as 2^32-1), but no effect was observed when the script tried to restore them. Tried both setting individual entries with "entity.auto_trash_filters[name]=count" and by setting the whole table with "entity.auto_trash_filters = {[name]=count, ...}"
  • Further investigation revealed certain cases where a filter will be set. It appears that it will only set trash filters on slots starting at slot 1, and only if doing so will overwrite an existing logistic request entry. The new entry will have a request amount of 0 and the correct trash amount for the new item, even if that slot previously contained a nonzero request for the same item.
What I thought should happen:
  • Assigning auto trash filters to item types already requested should alter the auto trash amounts for the existing requests. Items not already requested should be added as 0-item requests in empty slots before setting the auto trash amount.
My mods: Multiple Unit Train Control, RGB Pipes, Shipping Containers, Rocket Log, Smart Artillery Wagons.
Maintainer of Auto Deconstruct, Cargo Ships, Vehicle Wagon, Honk, Shortwave.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16021
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.1.0] Writing to LuaControl::auto_trash_filters misbehaves on Spidertron entities

Post by Rseding91 »

Huh, I thought we removed that function. You should be using LuaControl::set_vehicle_logistic_slot to set filters since it requires you set the min and max at the same time + what the item is. The old auto_trash_filters function will be removed in the next 1.1 update.
If you want to get ahold of me I'm almost always on Discord.
robot256
Smart Inserter
Smart Inserter
Posts: 1253
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: [1.1.0] Writing to LuaControl::auto_trash_filters misbehaves on Spidertron entities

Post by robot256 »

Thanks for the quick reply! Your fix works perfectly now. I was confused because I thought that was how it should work, but LuaEntity::set_request_slot() only took the minimum amount and I didn't realize the LuaControl functions were newer and took min and max together.
My mods: Multiple Unit Train Control, RGB Pipes, Shipping Containers, Rocket Log, Smart Artillery Wagons.
Maintainer of Auto Deconstruct, Cargo Ships, Vehicle Wagon, Honk, Shortwave.
Post Reply

Return to “Resolved Problems and Bugs”