Page 1 of 1
Generating decoratives for one chunk
Posted: Sun Mar 25, 2018 6:57 pm
by sparr
Code: Select all
surface.regenerate_decorative{chunks={{math.floor(slave_pos.x/32),math.floor(slave_pos.y/32)}}}
slave_pos is a tile position, so I'm trying to produce a single chunk position, and pass that to regenerate_decorative. I also tried {x=foo,y=bar} for the chunk position just in case. either way, I get this:
Code: Select all
Error while running event world-mirror::on_chunk_generated (ID 12)
Value must be a string in property tree at ROOT.chunks
stack traceback:
__world-mirror__/control.lua:123: in function 'mirror_chunk'
__world-mirror__/control.lua:140: in function <__world-mirror__/control.lua:126>
This sounds like it wants the chunks parameter to be a string instead of an array of chunkpositions?
Re: Generating decoratives for one chunk
Posted: Mon Mar 26, 2018 12:22 pm
by Rseding91
You can't use the chunks parameter without also giving the decoratives to regenerate.
Re: Generating decoratives for one chunk
Posted: Mon Mar 26, 2018 4:34 pm
by sparr
Is there a quick way to enumerate all of the default decoratives?
Re: Generating decoratives for one chunk
Posted: Mon Mar 26, 2018 6:45 pm
by Rseding91
sparr wrote:Is there a quick way to enumerate all of the default decoratives?
http://lua-api.factorio.com/latest/LuaG ... prototypes
Re: Generating decoratives for one chunk
Posted: Mon Mar 26, 2018 8:11 pm
by sparr
For future reference, if anyone else finds this thread...
Code: Select all
-- get a list of all known autoplace-able decorative names
local decorative_names = {}
for k,v in pairs(game.decorative_prototypes) do
if v.autoplace_specification then
decorative_names[#decorative_names+1] = k
end
end
-- apply them all to this chunk
surface.regenerate_decorative(decorative_names, {{x=math.floor(position.x/32),y=math.floor(position.y/32)}})