Hey,
Could you please write a short mod modifying existing entities, as follows?
Let me provide a list of entity names as an array and a value by which I can multiply their collision box. I'd like to multiply collision box elements by that value, making the box bigger or smaller, for testing. This concerns biter pathfinding. I'd like to experiment with either oversized or very small collision boxes.
I have trouble understanding how to extend existing entities without copy-pasting them from data.raw. What I need is to specify entity prototype names and collision box scaling factor, without copy-pasting the entities.
I'd write it on my own but semantics of "data:extend(...)" for rewriting entities elude me
biter pathfinding collision box mod
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: biter pathfinding collision box mod
Code: Select all
local function box_scale (box,scale)
return {{box[1][1]*scale,box[1][2]*scale},{box[2][1]*scale,box[2][2]*scale}}
end
biter_list = { --biter name to box scale
["small-biter"] = 2,
["big-biter"] = 0.1,
}
for name,scale in pairs(biter_list) do
data.raw.unit[name].collision_box = box_scale(data.raw.unit[name].collision_box,scale)
end
Re: biter pathfinding collision box mod
Thank you very much.