Page 1 of 1

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

Posted: Tue Nov 24, 2020 2:42 am
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.

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

Posted: Tue Nov 24, 2020 3:00 am
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.

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

Posted: Tue Nov 24, 2020 3:15 am
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.