Fish.

by jbox1

Fish. Need I say more?

Content
5 years ago
0.17
9
Manufacturing

g UPS

5 years ago
script.on_nth_tick(60, function(event)
    for _s, s in pairs(game.surfaces) do
        for _n, n in pairs(s.find_entities_filtered{
            name="fish-net", 
            type="container"
        }) do

You are scanning every second every surface, searching on whole surface your container, for every container will be another locale searching.

Do you want to optimize it?

5 years ago

Yes, but I am not sure how

5 years ago

My mod Fish Catcher works it this way:
On player built entity / on robot built entity
if it was my entity then
add it to the global table
end

On tick take one of them from global table and do search, if fish was found then take it. On next tick the next one from the global table.
If the fish net was invalid then remove it from the global table

Negative: Not every of them are checked every tick
Positive: Absolutely same UPS for megabases. If you have only 60 fish nets then it will be also one checking per second.

5 years ago

Seems like a good idea.

I'll be adding more content in the future. Thanks for the tip :D

5 years ago
(updated 5 years ago)

The same thing I use in RITEG and Show Unconnected - will be updated only one entity per tick.

New response