The Ruins Mod 2.0 deprecated


This mod is now deprecated and merged with `AbandonedRuins_updated_fork`.

Content
a month ago
2.0
3.15K
Environment

b [FIXED] Boxes not filling with items

6 months ago
(updated 6 months ago)

Caused by improperly checking if item names are valid in spawning.lua lines: 75-84
instead of prototypes[name] you need to check prototypes.item[name], additionally local prototypes is set earlier to prototypes.entity so finally you can deal with both by using _G['prototypes'].item[name]
Original mod was skipping over invalid items instead of aborting.
If skipping items is implemented there can be 0 items to insert.
You could replace:

if not prototypes[name] then
        util.debugprint("item '" .. name .. "' does not exist")
        return
      end
      local count = expressions.number(count_expression, vars)
      if count > 0 then
        items[name] = count
      end
    end
    util.safe_insert(e, items)

with:

if not _G['prototypes'].item[name] then
        util.debugprint("item '" .. name .. "' does not exist")
        log("item '" .. name .. "' does not exist")
      else
        local count = expressions.number(count_expression, vars)
        if count > 0 then
          items[name] = count
        end
      end
    end
    if not (next(items) == nil) then
      util.safe_insert(e, items)
    end
6 months ago

I added it and will release it with next (1.1.14) release. Thank you, my knowledge in LUA is limited so I depend on others to help me out. I just wanted to have this running again.

6 months ago

1.1.15 removes the return keyword. Need to go to work.

6 months ago
(updated 6 months ago)

All parentheses are needed here if not (next(items) == nil) then otherwise it does operations out of order and straight up doesn't work as result.
With changes here and line 38 in other topic the mod seems to work fine (at least without Space Age): no crashes, assemblers can have recipes, boxes have items.

4 months ago

Sorry for long response time, I have added it. Thank you.

This thread has been locked.