Page 1 of 1

how to change zoom_to_world_can_use_nightvision?

Posted: Thu Oct 28, 2021 12:29 pm
by palmic
Hello,
i would like to create mod specifically to change zoom_to_world_can_use_nightvision=true however no success yet.

Could somebody help me figure out the context?
  • can i set it up in some callback in control.lua etc?
  • is it some game.utils. object?

Re: how to change zoom_to_world_can_use_nightvision?

Posted: Thu Oct 28, 2021 3:16 pm
by Silari
It's a constant stored in data.raw during the data phase. You need to modify it there. You can't change it in control.lua - that's the control phase and it can't modify constants/prototypes/other startup stuff.

Code: Select all

data.raw["utility-constants"].zoom_to_world_can_use_nightvision = true
in data.lua should work correctly.

You should read up on the stages and how they work: https://lua-api.factorio.com/latest/Data-Lifecycle.html

Re: how to change zoom_to_world_can_use_nightvision?

Posted: Thu Oct 28, 2021 4:12 pm
by palmic
Thank you very much that was the missing piece i needed.
It just required a little change:

Code: Select all

data.raw["utility-constants"].default.zoom_to_world_can_use_nightvision = true
Have a nice day.