I believe the issue is precisely with:
function warploader.dofilters(e)
local tp=e.loader_type
local wpg=global.warploaders
if(tp~="output")then
for i=1,2,1 do table.RemoveByValue(wpg.output,e.get_transport_line(i)) end
for k,v in pairs(wpg.outputf)do for i=1,2,1 do table.RemoveByValue(v,e.get_transport_line(i)) end end
for a=1,2,1 do table.insertExclusive(global.warploaders.input,e.get_transport_line(a)) end
else
local ct=global.warploaders.outputf
local hf=false
for i=1,5,1 do local f=e.get_filter(i) if(f)then hf=true
ct[f]=ct[f] or {} ct=ct[f] for a=1,2,1 do table.insertExclusive(ct,e.get_transport_line(a)) end
end end
if(not hf)then
for a=1,2,1 do table.insertExclusive(global.warploaders.output,e.get_transport_line(a)) end
end
for a=1,2,1 do table.RemoveByValue(global.warploaders.input,e.get_transport_line(a)) end
end
end
and it should instead be:
function warploader.dofilters(e)
local tp=e.loader_type
for a=1,2,1 do table.RemoveByValue(global.warploaders.input,e.get_transport_line(a)) end
for i=1,2,1 do table.RemoveByValue(global.warploaders.output,e.get_transport_line(i)) end
for k,v in pairs(global.warploaders.outputf) do for i=1,2,1 do table.RemoveByValue(v,e.get_transport_line(i)) end end
if(tp~="output")then
for a=1,2,1 do table.insertExclusive(global.warploaders.input,e.get_transport_line(a)) end
else
local ct=global.warploaders.outputf
local hf=false
for i=1,5,1 do local f=e.get_filter(i) if(f)then hf=true
ct[f]=ct[f] or {} ct=ct[f] for a=1,2,1 do table.insertExclusive(ct,e.get_transport_line(a)) end
end end
if(not hf)then
for a=1,2,1 do table.insertExclusive(global.warploaders.output,e.get_transport_line(a)) end
end
end
end
as, for example, adding a filter to a filterless warp loader doesn't currently remove it from the global filterless list, but does add it to the filtered item's list (as dofilters only sees the updated warp loader, not its previous state, and so should not be basing its removals on the current state). Then at destroy time it only gets moved from the filtered item's list as it shouldn't be in anything else, so it stays in the filterless list and then later on an incoming item is sent to the non-existent warp loader.
This also explains why filters aren't currently respected by warp loaders on overflow; even after adding a filter its presence in the global filterless list means it will still receive overflow items of any kind.