diff --git a/PHI-CL/changelog.txt b/PHI-CL/changelog.txt index f0e4310..b5b233f 100644 --- a/PHI-CL/changelog.txt +++ b/PHI-CL/changelog.txt @@ -4,6 +4,7 @@ Date: 2026-07-05 Changes: - [CT] Added a infinity chest. + - [CT] Added a status light. --------------------------------------------------------------------------------------------------- Version: 3.1.2 diff --git a/PHI-CL/data/b/mbe.lua b/PHI-CL/data/b/mbe.lua index f8b69c2..c03e5ee 100644 --- a/PHI-CL/data/b/mbe.lua +++ b/PHI-CL/data/b/mbe.lua @@ -204,6 +204,15 @@ function main_entity(source, tier) item.heat_buffer.max_transfer = tostring(tonumber(string.match(item.heat_buffer.max_transfer, '[%d%.]+')) * (2 * (tier - source.min + 1))) .. string.match(item.heat_buffer.max_transfer, '%a+') end + if item.icons and item.icons[1] then + item.icons[1].tint = mod_tint[tier] + + elseif item.icon then + item.icons = {{icon = item.icon, icon_size = (item.icon_size and item.icon_size) or nil, tint = mod_tint[tier]}} + item.icon = nil + end + + table.insert(item.icons, {icon = '__base__/graphics/icons/signal/signal_' .. tier .. '.png', icon_size = 64, scale = 0.25, shift = {12, 12}}) item.localised_name = (tier > 1 and {'phi-cl.combine', {'?', {'entity-name.' .. source.ref_name}, {'name.' .. source.ref_name}}, tostring(tier)}) or {'?', {'entity-name.' .. source.ref_name}, {'name.' .. source.ref_name}} item.localised_description = {'?', {'entity-description.' .. source.ref_name}, {'description.' .. source.ref_name}} diff --git a/PHI-CL/data/b/mbm.lua b/PHI-CL/data/b/mbm.lua index 74c56b2..80cc188 100644 --- a/PHI-CL/data/b/mbm.lua +++ b/PHI-CL/data/b/mbm.lua @@ -328,6 +328,15 @@ function main_entity(source, tier) end end + if item.icons and item.icons[1] then + item.icons[1].tint = mod_tint[tier] + + elseif item.icon then + item.icons = {{icon = item.icon, icon_size = (item.icon_size and item.icon_size) or nil, tint = mod_tint[tier]}} + item.icon = nil + end + + table.insert(item.icons, {icon = '__base__/graphics/icons/signal/signal_' .. tier .. '.png', icon_size = 64, scale = 0.25, shift = {12, 12}}) item.localised_name = (tier > 1 and {'phi-cl.combine', {'?', {'entity-name.' .. source.ref_name}, {'name.' .. source.ref_name}}, tostring(tier)}) or {'?', {'entity-name.' .. source.ref_name}, {'name.' .. source.ref_name}} item.localised_description = {'?', {'entity-description.' .. source.ref_name}, {'description.' .. source.ref_name}} diff --git a/PHI-CL/data/f/ct-c.lua b/PHI-CL/data/f/ct-c.lua new file mode 100644 index 0000000..a6528d7 --- /dev/null +++ b/PHI-CL/data/f/ct-c.lua @@ -0,0 +1,29 @@ +return { + ['hide'] = { + ['parameters'] = true, + ['spawnables'] = true, + }, + ['status'] = { + ['disabled'] = {r = 255, g = 0, b = 0}, + ['idle'] = {r = 255, g = 0, b = 0}, + ['insufficient_input'] = {r = 255, g = 0, b = 0}, + ['no_minable_resources'] = {r = 255, g = 0, b = 0}, + ['no_power'] = {r = 255, g = 0, b = 0}, + ['low_power'] = {r = 255, g = 128, b = 0}, + ['full_output'] = {r = 255, g = 255, b = 0}, + ['working'] = {r = 0, g = 255, b = 0}, + }, + ['status_ignore'] = { + -- Mining Drones + ['mining-depot'] = true, + -- Transport Drones + ['buffer-depot'] = true, + ['fluid-depot'] = true, + ['fuel-depot'] = true, + ['request-depot'] = true, + ['supply-depot'] = true, + -- Space Exploration + ['se-core-miner'] = true, + ['se-rocket-launch-pad-silo'] = true, + } +} diff --git a/PHI-CL/data/f/ct.lua b/PHI-CL/data/f/ct.lua index aaf4412..17df0f6 100644 --- a/PHI-CL/data/f/ct.lua +++ b/PHI-CL/data/f/ct.lua @@ -1,15 +1,12 @@ -local hide = { - ['parameters'] = true, - ['spawnables'] = true, -} +local items = require('ct-c') -if data.raw['infinity-container']['super-infinity-chest'] then +if data.raw['infinity-container']['super-infinity-chest'] and items['hide'] then local sc = 1 for c, _ in pairs(defines.prototypes.item) do if data.raw[c] then for _, i in pairs(data.raw[c]) do - if not (i.hidden or (i.subgroup and hide[i.subgroup])) then + if not (i.hidden or (i.subgroup and items['hide'][i.subgroup])) then sc = sc + 1 end end @@ -18,3 +15,78 @@ if data.raw['infinity-container']['super-infinity-chest'] then data.raw['infinity-container']['super-infinity-chest'].inventory_size = sc end + +if items['status'] and items['status_ignore'] then + function main_entity_number_position(entity) + local box = entity.selection_box or entity.collision_box + + if not box then + return + end + + if not box.left_top and not box.right_bottom and type(box[1]) == 'table' and type(box[2]) == 'table' then + box = { + left_top = {x = box[1][1], y = box[1][2]}, + right_bottom = {x = box[2][1], y = box[2][2]} + } + end + + local w = box.right_bottom.x - box.left_top.x + local h = box.right_bottom.y - box.left_top.y + local cx = (box.left_top.x + box.right_bottom.x) / 2 + local cy = (box.left_top.y + box.right_bottom.y) / 2 + + local positions = { + [1] = { + x = cx - 0.2 * w, + y = cy + h / 2 - 0.25 + }, + [2] = { + x = cx - 0.2 * h, + y = cy + w / 2 - 0.25 + } + } + + return positions + end + + for _, c in pairs({'assembling-machine', 'furnace', 'rocket-silo', 'mining-drill'}) do + for _, v in pairs(data.raw[c]) do + if not v.bottleneck_ignore and not items['status_ignore'][v.name] then + for _, a in pairs({'graphics_set', 'wet_mining_graphics_set', 'graphics_set_flipped'}) do + if v[a] then + v[a].status_colors = items['status'] + + if not v[a].working_visualisations then + v[a].working_visualisations = {} + end + + local positions = main_entity_number_position(v) + + if positions then + v[a].working_visualisations[#v[a].working_visualisations + 1] = { + always_draw = true, + apply_tint = 'status', + render_layer = 'light-effect', + animation = { + filename = '__base__/graphics/icons/signal/signal_white.png', + flags = {'icon'}, + size = 64, + scale = 0.15, + line_length = 1, + frame_count = 1, + animation_speed = 1, + draw_as_glow = true + }, + north_position = positions[1], + east_position = positions[2], + south_position = positions[1], + west_position = positions[2], + } + end + end + end + end + end + end +end