create_entity Key "movement" not found in property tree
Posted: Mon May 15, 2017 3:36 pm
I'm calling LuaSurface::create_entity with just a few parameters and getting a weird error about a missing property table key.
Here's the block of code:
And here's the error:
Line 97 is the call to surface.create_entity
Here's the block of code:
Code: Select all
-- clone entities
local master_entities = surface.find_entities({master_pos, {master_pos.x+32, master_pos.y+32}})
for _, entity in ipairs(master_entities) do
if entity.position.x ~= master_pos.x+32 and entity.position.y ~= master_pos.y+32 then
if entity.type ~= "character" and entity.type ~= "player" then
local amount = entity.type == "resource" and entity.amount or nil
surface.create_entity{
name= entity.name,
position= {
x= (entity.position.x - master_pos.x) * slave_dx + slave_pos.x + (master_pos.x > slave_pos.x and 1 or 0),
y= (entity.position.y - master_pos.y) * slave_dy + slave_pos.y + (master_pos.y > slave_pos.y and 1 or 0)
},
direction= entity.direction,
force= entity.force,
-- TODO: more thorough cloning
-- type-specific parameters
amount= amount,
}
end
end
end
Code: Select all
Error while running event world-mirror::on_chunk_generated (ID 12)
Key "movement" not found in property tree at ROOT
stack traceback:
__world-mirror__/control.lua:97: in function mirror_chunk
__world-mirror__/control.lua:130: in function <__world-mirror__/control.lua:116>