Seems you didn't entirely fix it :
The mod Companion Drones 2.0 (2.0.6) caused a non-recoverable error.
Please report this error to the mod author.
Error while running event companion-drones::on_pre_build (ID 9)
Record is not a BlueprintRecord.
stack traceback:
[C]: in function 'get_blueprint_entities'
__companion-drones__/script/companion.lua:1545: in function 'get_blueprint_area'
__companion-drones__/script/companion.lua:1585: in function 'handler'
__core__/lualib/event_handler.lua:47: in function <__core__/lualib/event_handler.lua:45>
You didn't take into account the fact that it might be a book within a book ? :3
Or rather, the book in the player's cursor contains not only blueprints but also more books.
Here's how I fixed it :
Before get_blueprint_area, add this function :
local function get_all_blueprint_entities(blueprint_record)
local entities = {}
-- Check if the item is a blueprint book
if blueprint_record.type == "blueprint-book" then
-- Recursively process each item inside the book
for _, item in pairs(blueprint_record.contents) do
local nested_entities = get_all_blueprint_entities(item)
for _, nested_entity in pairs(nested_entities) do
table.insert(entities, nested_entity)
end
end
elseif blueprint_record.type == "blueprint" then
-- Add entities if it's a single blueprint
local blueprint_entities = blueprint_record.get_blueprint_entities()
if blueprint_entities then
for _, entity in pairs(blueprint_entities) do
table.insert(entities, entity)
end
end
end
return entities
end
Then edit the elseif of the get_blueprint_area function like so :
elseif player.cursor_record.type == "blueprint-book" then
local all_entities = get_all_blueprint_entities(player.cursor_record)
if #all_entities > 0 then
entities[#entities + 1] = all_entities
else
max = dissect_area_size
end
end