Infinite Research Supply MK2

by mat1k

This mod adds a craftable chest that contains an infinite supply of science packs. 0.17.x Patch

Content
29 days ago
0.17 - 2.0
4.31K
Cheats

b Deletion by bots is impossible

4 years ago

Since the chest continues to pump out items even if marked for deletion, this means that its impossible to delete this chest as it will never be empty.

Only way to delete it is by hand.

4 years ago

I know of this but have not found a way to check if chest is marked for deletion yet.

4 years ago
(updated 4 years ago)

Hi,

I dont have much experience with Factorio mods (any actually, before opening your mod), but I found this quickly with a Google search, would this be what you need?

https://lua-api.factorio.com/latest/events.html#on_marked_for_deconstruction

4 years ago
(updated 4 years ago)

In fact, there is direct boolean in entity:

https://lua-api.factorio.com/latest/LuaEntity.html#LuaEntity.to_be_deconstructed

You could add this to your check for is valid and disable updates to those chests which are to_be_deconstructed, doing it this way is simpler and I think it might work better in the case where a unit is deconstructed, game is saved and then loaded again without it actually being removed yet.

Edit: Tested it locally and it works :D

for uid,chest in pairs(global.infiniteResearchContainers) do --for each force that has built chests
        if not chest.valid or chest.to_be_deconstructed() then -- delete chest if not valid
          global.infiniteResearchContainers[uid]=nil
        else
          updateItems(chest)
          mat = e.tick%180
          -- game.print("Tick: " .. e.tick .. " - Mat: " .. mat)
        end
    end

New response