Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,17 @@ end
local function setup_item(item_name, target_quality)
if data.raw.item["qrc-"..target_quality.."-"..item_name] then return end

local item = table.deepcopy(data.raw.item[item_name])
-- Check if the item is a module, since modules are not in data.raw.item but instead in data.raw.module
local item = nil
if string.find(item_name, "-module") then
item = table.deepcopy(data.raw.module[item_name])
else
item = table.deepcopy(data.raw.item[item_name])
end

if not item then
error("Couldn't find item " .. item_name .. " in data.raw!")
end

make_icon(item, target_quality)

Expand Down
6 changes: 6 additions & 0 deletions src/control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ script.on_event("on_tick", function()
if player.opened then
local entity = player.opened
if not entity then return end

-- also check if the player opened the equipment grid to avoid a crash
if entity.object_name == "LuaEquipmentGrid" then
return
end

if entity.type == "assembling-machine" or (entity.type == "entity-ghost" and entity.ghost_type == "assembling-machine") then
check_machine_quality(entity)
end
Expand Down