0.16.51 creating a ghost with mod causes an appcrash
Posted: Tue Jul 17, 2018 2:21 pm
Shift clicking (creating a ghost) with this piece of code causes an appcrash. It has probably something to do with creating a ghost where there is already one or trying to destroy a ghost because the normal click works without any problems.
This piece of code causes the crash:
script.on_event(defines.events.on_built_entity, function(event)
local ghost = {
name = "entity-ghost",
inner_name = event.created_entity .name,
position = event.created_entity .position,
force = event.created_entity .force
}
event.created_entity.destroy()
game.surfaces['nauvis'].create_entity(ghost)
end)
This piece of code causes the crash:
script.on_event(defines.events.on_built_entity, function(event)
local ghost = {
name = "entity-ghost",
inner_name = event.created_entity .name,
position = event.created_entity .position,
force = event.created_entity .force
}
event.created_entity.destroy()
game.surfaces['nauvis'].create_entity(ghost)
end)