Skip to content

Commit bc91f4c

Browse files
ahicks92claude
andcommitted
Remove dead logistic-filter readout in worker-robots
add_formatted_filters and push_request_readout had no callers anywhere in the repo (verified across all file types and dynamic-dispatch forms) -- a half-removed, never-wired logistic readout. push_request_readout was built for the LogisticFilter shape (value/min/max) but its only (uncalled) caller fed it CompiledLogisticFilter from LuaLogisticPoint.filters; that shape mismatch predates 2.1 (2.0.73 returned CompiledLogisticFilter too), so this was never a working path. Removing the functions and their now-orphaned locale keys. Replaces the misleading "BUG (2.1)" suppression comment from the prior lint-cleanup commit -- this was not 2.1 breakage. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 4807f94 commit bc91f4c

3 files changed

Lines changed: 0 additions & 98 deletions

File tree

‎locale/en/logistics.cfg‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ logistics-storage-filter-cleared=Storage filter cleared
8383

8484
# Logistics network status
8585
logistics-in-network=in network __1__
86-
logistics-no-items=No items
8786

8887
# Logistics overview
8988
logistics-overview=Overview

‎locale/en/worker-robots.cfg‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@ robots-rename-this-network=Rename this network
1313
robots-rename-this-roboport=Rename this roboport
1414
roboport-name-cannot-be-empty=Roboport name cannot be empty
1515

16-
# Request announcements
17-
bots-request-unconstrained=Any amount of __1__
18-
bots-request-min-only=At least __2__ __1__
19-
bots-request-max-only=At most __2__ __1__
20-
bots-request-exactly=Exactly __2__ __1__
21-
bots-request-range=__1__ between __2__ and __3__
22-
2316
# Storage filters
2417
logistic-storage-filter-nothing=Nothing set as logistic storage filter
2518
logistic-storage-filter-set=__1__ set as logistic storage filter
@@ -40,4 +33,3 @@ network-no-chests=No logistic chests in network
4033
# Errors
4134
error-no-network=Error: no network
4235
error-unable-to-determine-item=ERROR: unable to determine item
43-
error-unable-to-handle-request=Unable to handle this request. Serpent:

‎scripts/worker-robots.lua‎

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -61,48 +61,6 @@ local function schedule_personal_logistics_announcement(pindex)
6161
worker_robots_storage[pindex].pending_logistic_state_announcement = true
6262
end
6363

64-
-- Push a readout of a logistic request to the provided builder as a fragment.
65-
---@param msg_builder fa.MessageBuilder
66-
---@param req LogisticFilter
67-
local function push_request_readout(msg_builder, req)
68-
-- Error conditions are unlocalised because they should never happen. We
69-
-- should probably change these to asserts in the long run, but for now this
70-
-- is very new code and it is better to function partially.
71-
72-
local protoname = req.value
73-
if not protoname then
74-
msg_builder:fragment({ "fa.error-unable-to-determine-item" })
75-
return
76-
end
77-
78-
if type(protoname) ~= "string" then protoname = protoname.name end
79-
80-
local bottom = req.min
81-
local top = req.max
82-
83-
local localised_item = Localising.get_localised_name_with_fallback(prototypes.item[protoname])
84-
if not bottom and not top then
85-
msg_builder:fragment({ "fa.bots-request-unconstrained", localised_item })
86-
return
87-
elseif bottom and top then
88-
if bottom == top then
89-
msg_builder:fragment({ "fa.bots-request-exactly", localised_item, bottom })
90-
else
91-
msg_builder:fragment({ "fa.bots-request-range", localised_item, bottom, top })
92-
end
93-
94-
return
95-
elseif not bottom or bottom == 0 then
96-
msg_builder:fragment({ "fa.bots-request-max-only", localised_item, top })
97-
return
98-
elseif not top then
99-
msg_builder:fragment({ "fa.bots-request-min-only", localised_item, bottom })
100-
return
101-
end
102-
103-
msg_builder:fragment({ "fa.error-unable-to-handle-request" }):fragment(serpent.line(req))
104-
end
105-
10664
function mod.logistics_info_key_handler(pindex)
10765
local p = game.get_player(pindex)
10866
local ent = p.selected
@@ -274,53 +232,6 @@ function mod.get_network_name_for_point(point)
274232
return mod.get_network_name_from_network(network)
275233
end
276234

277-
---Add formatted compiled filters from a point to a message builder
278-
---@param point LuaLogisticPoint
279-
---@param msg_builder fa.MessageBuilder
280-
---@param filter_type "filters" | "targeted_items_pickup" | "targeted_items_deliver"
281-
function mod.add_formatted_filters(point, msg_builder, filter_type)
282-
if not point or not point.valid then return end
283-
284-
local items
285-
if filter_type == "filters" then
286-
items = point.filters
287-
elseif filter_type == "targeted_items_pickup" then
288-
items = point.targeted_items_pickup
289-
elseif filter_type == "targeted_items_deliver" then
290-
items = point.targeted_items_deliver
291-
end
292-
293-
if not items or not next(items) then
294-
msg_builder:list_item({ "fa.logistics-no-items" })
295-
return
296-
end
297-
298-
-- For filters (CompiledLogisticFilter array)
299-
if filter_type == "filters" then
300-
for _, filter in ipairs(items) do
301-
-- BUG (2.1): items are CompiledLogisticFilter (name/count/max_count), but
302-
-- push_request_readout still expects the old LogisticFilter (value/min/max).
303-
-- filter.value is always nil, so this readout is currently a no-op. Needs a
304-
-- real rewrite to read CompiledLogisticFilter fields.
305-
---@diagnostic disable-next-line: undefined-field
306-
if filter and filter.value then
307-
msg_builder:list_item()
308-
---@diagnostic disable-next-line: param-type-mismatch
309-
push_request_readout(msg_builder, filter)
310-
end
311-
end
312-
else
313-
-- For targeted_items (ItemWithQualityCounts - table of item_name -> count)
314-
for item_name, count in pairs(items) do
315-
if count and count > 0 then
316-
msg_builder:list_item()
317-
msg_builder:fragment(Localising.get_localised_name_with_fallback(prototypes.item[item_name]))
318-
msg_builder:fragment(tostring(count))
319-
end
320-
end
321-
end
322-
end
323-
324235
---Get the network name (custom name if set, else network ID)
325236
---@param port LuaEntity
326237
---@return LocalisedString

0 commit comments

Comments
 (0)