Abandoned Ruins - Updated (core)

by Keysivi

This mod doesn't do anything by itself. You need to install ruin-set mods or no ruin will be spawned. It then can spawn randomly choosen ruins in the world. These ruins are destroyed fragments of bases, forts, small oases, and more. (Now co-authored with roland77)

Content
5 days ago
2.0
4.50K

b [FIXED] Kaboom while exploring the map

a month ago
(updated a month ago)

First you need to know how to properly report bugs, making a screenshot and uploading it is maybe the simplest way for you, but it requires me to read that from a screenshot and then I need to zoom into it to be able to read the error message. Second it doesn't contain the whole debug log.

You can generate this very easily by:
- loading your save-game
- opening menu (e.g. ESC key)
- Settings -> Mod settings -> Map -> Abandoned Ruins - Updated -> Enable debug log (not on_tick please!)
- Then save your game
- Resume game (may delay now depending on your amount of mods, size of your map, etc.)

If the crash happens, you were able to reprocuce it. Now quit Factorio and go to its folder. There should be a file called factorio-current.log. I need all lines from it. So please upload it somewhere (no "free" one-click hosters, please), e.g. on a public pastebin.

When you write your report, please be as descriptive as possible, not just what you did here. For example, I would include the main error message (requires some skill to know which one) as the post's title and paste the backtrace in 3 backticks.

Example:
Title: on_tick: LuaEntity API call when LuaEntity was invalid.
Post message:


Hello there!

I suddenly had this crash during Freeplay (Space Age) at single-player mode:

3912.638 Error MainLoop.cpp:1510: Exception at tick 408010771: The mod The Ruins Mod - Updated (1.3.0) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event AbandonedRuins_updated_fork::on_tick (ID 0)
LuaEntity API call when LuaEntity was invalid.
stack traceback:
        [C]: in function '__index'
        __AbandonedRuins_updated_fork__/lua/spawning.lua:258: in function 'clear_area'
        __AbandonedRuins_updated_fork__/lua/spawning.lua:280: in function 'spawn_ruin'
        __AbandonedRuins_updated_fork__/lua/spawning.lua:317: in function 'spawn_random_ruin'
        __AbandonedRuins_updated_fork__/control.lua:124: in function <__AbandonedRuins_updated_fork__/control.lua:105>
3931.519 Info AppManager.cpp:352: Deleting active scenario.
3933.700 Quitting: user-quit.

My uploaded factorio-current.log can be found here: https://example.org/paste-xxxxxx


This way you have already included some important information:
- error in title
- your environment (Freeplay (Space Age), single-player)
- full backtrace to the error

Maybe it is already fixable then. I have not linked there as this is an example. But otherwise, please always link to your pastebin'ed log file.

a month ago
(updated a month ago)

I just noticed and found out that since LUA 5.2 something like #my_table is unspecified and does mostly return 0 results which disturbs this mod in some ways. I now introduced a safe utils.count() function that will safely count the elements (keys) in a table.

a month ago

Oh, gosh! I found my mistake. One local for variable variables in function spawn_ruin() to much and 0 variables are used:

 182.468 Script @____AbandonedRuins_updated_fork__/lua/spawning.lua:231: [parse_variables]: parsed()=1 - EXIT!
 182.468 Script @____AbandonedRuins_updated_fork__/lua/spawning.lua:285: [spawn_ruin]: variables[table]()=0,ruin.entities[]='table'

Do you see it? parsed()=1 was returned: One parsed variable but next line says it has zero. The additional local statement caused the scope of the variable to change into the if() block and not go back outside. I test this change now.

a month ago

Turns out, Factorio added table_size(table) → uint to deal with #my_table issue.
https://lua-api.factorio.com/latest/auxiliary/libraries.html

a month ago
(updated a month ago)

Turns out, Factorio added table_size(table) → uint to deal with #my_table issue.
https://lua-api.factorio.com/latest/auxiliary/libraries.html

Oh, that's good to know. I was already looking around for it and couldn't find anything. I will then include a removal of my own function in next release.

EDIT: 1.3.1 is re-uploaded now. It includes the said removal.

a month ago

Open the screenshot in a new tab

a month ago

Have you updated this mod (and -base, too) to 1.3.1? There is a fix contained in it. And I know how to open web addresses efficiently. My point here was, that a screenshot is purely not enough. It needs to be accompanied with a logfile from the program/game in question so I can see more what happened on your side that leads to this error.

a month ago
(updated a month ago)

Error while running event AbandonedRuins_updated_fork::on_tick (ID 0)
LuaEntity API call when LuaEntity was invalid.
stack traceback:
[C]: in function 'index'
__AbandonedRuins_updated_fork
/lua/spawning.lua:258: in function 'clear_area'
AbandonedRuins_updated_fork/lua/spawning.lua:280: in function 'spawn_ruin'
AbandonedRuins_updated_fork/lua/spawning.lua:317: in function 'spawn_random_ruin'
AbandonedRuins_updated_fork/control.lua:124: in function <AbandonedRuins_updated_fork/control.lua:105>
3931.519 Info AppManager.cpp:352: Deleting active scenario.
3933.700 Quitting: user-quit.
```

In 1.3.4 the same error occurs when exploring the map.

a month ago

Original ruins code:
if (entity.valid and entity.type ~= "tree") or math.random() < (half_size / 14) then
was modified to:
if entity.type ~= "tree" or math.random() < (half_size / 14) then
which causes an error when entity.type is checked on invalid entity

a month ago

Original ruins code:
if (entity.valid and entity.type ~= "tree") or math.random() < (half_size / 14) then
was modified to:
if entity.type ~= "tree" or math.random() < (half_size / 14) then
which causes an error when entity.type is checked on invalid entity
This is now more confusing. Before you wrote that entities should be deleted regardless if they are valid or not. And now you say the opposite of it?

Here is the other topic:
https://mods.factorio.com/mod/AbandonedRuins_updated_fork/discussion/687ecf7dafe239e39f888bf3

a month ago

The original code (from before 2.0) would sometimes destroy invalid entities, not always. Just revert this line to original and it works.

a month ago

Okay, I reverted it now. Added two checks in try_ruin_spawn() for parameter's types.

a month ago
(updated a month ago)

In 2 debug logs in clear_area() you switched from
if
if
to
if
elseif
but you left end at the end of if, you need to remove the end from if to use elseif

a month ago

e.g:

  for _, entity in pairs(surface.find_entities_filtered({area = area, type = {"resource"}, invert = true})) do
    if debug_log and not entity.valid then log("[clear_area]: Found an invalid entity ...")
    elseif debug_log and entity.valid then log(string.format("[clear_area]: Found entity.type='%s',entity.name='%s' ...", entity.type, entity.name)) end

    if (entity.valid and entity.type ~= "tree") or math.random() < (half_size / 14) then
      if debug_log and not entity.valid then log("[clear_area]: Destroying invalid  ...")
      elseif debug_log and entity.valid then log(string.format("[clear_area]: Destroying entity.name='%s' ...", entity.name)) end

      entity.destroy({do_cliff_correction = true, raise_destroy = true})
    end
  end
a month ago

In 2 debug logs in clear_area() you switched from
if
if
to
if
elseif
but you left end at the end of if, you need to remove the end from if to use elseif

:-(

a month ago

I have addressed this with version 1.3.6 but 1.3.7 is out already.

This thread has been locked.