Page 1 of 1

Add radius_visualisation_specification to scripting api

Posted: Sun Jan 29, 2023 7:28 am
by micromario
Currently we have this value for entity prototypes:

Code: Select all

radius_visualisation_specification = {
    sprite = {
      filename = '__base__/graphics/entity/electric-mining-drill/electric-mining-drill-radius-visualization.png',
      width = 10,
      height = 10
    },
    distance = 12.5,
    offset = {0, -16}
  }
However, it cannot be read during runtime.
Could it be added to LuaEntityPrototype?

I have a scripted mining drill that uses this property, and would rather not hardcode the range in two places.

Re: Add radius_visualisation_specification to scripting api

Posted: Mon Jan 30, 2023 5:08 pm
by Honktown
A file can be required in two different stages, though of course it will not be the same as if the file required twice in the same stage. I use a 'constants' kind of file for that. It won't match if another mod changes that value of yours (in data), but that'd be something to resolve with them (dependency, data-final-fixes check, asking them not to, etc).

Re: Add radius_visualisation_specification to scripting api

Posted: Sat Oct 07, 2023 8:04 pm
by Rseding91
Ok, I've added this for the next 1.1. release. The value you're looking for is actually already exposed specifically for the mining drill as: https://lua-api.factorio.com/latest/cla ... ill_radius but generic access still allows reading those values for things that don't have purpose-built uses for the radius.