Page 1 of 1

Having trouble modifying player.auto_trash_filters

Posted: Mon Jun 05, 2017 9:04 pm
by Tain
the example from the API works as intended, fully replaces the current auto trash with what is in the new table.

Code: Select all

game.player.auto_trash_filters = {["iron-plate"] = 20, ["copper-cable"] = 42}
But I can't seem to modify the existing table, only replace it.

Code: Select all

game.player.auto_trash_filters["iron-plate"] = 20
doesn't work

Code: Select all

print(game.player.auto_trash_filters["iron-plate"])
does work

I've tried a lot of variations on this, using dot notation or character instead of player; all with the same results.

how can I modify a single entry of the table, but leave everything else?

Also what is the event for modifying player logistic/auto trash slots?

Re: Having trouble modifying player.auto_trash_filters

Posted: Mon Jun 05, 2017 10:25 pm
by Nexela
It is either replaced with the new table (like fluid boxes, but typically the api would tell us), or the table needs to be edited directly


local filters = game.player.auto_trash_filters

--modify filters table

if it needs to replace then:
game.player.auto_trash_fiters = filters

Re: Having trouble modifying player.auto_trash_filters

Posted: Mon Jun 05, 2017 10:54 pm
by Tain
copying to a local variable, then replacing worked for me. thanks!

do you know what event is triggered when the players logistic request/auto trash slots are modified?

Re: Having trouble modifying player.auto_trash_filters

Posted: Tue Jun 06, 2017 7:14 am
by Rseding91
Tain wrote:copying to a local variable, then replacing worked for me. thanks!

do you know what event is triggered when the players logistic request/auto trash slots are modified?
There is none.

Re: Having trouble modifying player.auto_trash_filters

Posted: Tue Jun 06, 2017 7:32 am
by Tain
Rseding91 wrote:
Tain wrote:copying to a local variable, then replacing worked for me. thanks!

do you know what event is triggered when the players logistic request/auto trash slots are modified?
There is none.
So if I want to do something when that happens, I would need to use on_tick and then somehow check if the slots have been modified manually?

Re: Having trouble modifying player.auto_trash_filters

Posted: Tue Jun 06, 2017 7:44 am
by mophydeen
Tain wrote:
Rseding91 wrote:
Tain wrote:copying to a local variable, then replacing worked for me. thanks!

do you know what event is triggered when the players logistic request/auto trash slots are modified?
There is none.
So if I want to do something when that happens, I would need to use on_tick and then somehow check if the slots have been modified manually?

yes