Dimension Warp

by Anakhon

Build your base, defend it from the locals and get back to your home, Nauvis. A remake of the great warptorio2 (Vanilla and SpaceAge compatible).

Overhaul
2 months ago
2.0
2.62K
Combat Enemies Environment Mining Power

b BUG

15 days ago

The mod Dimension Warp (0.8.3) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event dimension-warp::on_nth_tick(300)
LuaEntity API call when LuaEntity was invalid.
stack traceback:
[C]: in function 'index'
__dimension-warp
/scripts/scenario/lab_intro.lua:134: in function 'cb'
dimension-warp/lib/events.lua:18: in function <dimension-warp/lib/events.lua:16>

13 days ago

Hello,

What mods are you using ? What did you do ?
This place is not supposed to fail.

You either have something that removed the faction "neutral" or something that allows you to mine some of the struture present at the beginning (which is not supposed to be possible and leads to this error)

3 days ago

The crash is caused by Dimension Warp trying to use a LuaEntity that no longer exists.

The error points to:

__dimension-warp/scripts/scenario/lab_intro.lua:134

At that point, the mod loops through storage.intro_built_entities and calls .die() on each entity. The problem is that at least one of those entities has already been removed or destroyed, so Factorio marks it as invalid. Calling any LuaEntity function on an invalid entity causes this crash.

The safe fix is to check whether the entity is still valid before using it.

Change this:

for _, entity in pairs(storage.intro_built_entities) do
    entity.die(game.forces['neutral'], nil)
end

To this:

for _, entity in pairs(storage.intro_built_entities) do
    if entity and entity.valid then
        entity.die(game.forces['neutral'], nil)
    end
end

So basically: the mod is trying to kill/delete an entity that is already invalid. Adding if entity and entity.valid then before calling .die() should stop the crash without changing the mod’s logic.

3 days ago

I could have fixed this myself, but I didn’t want to modify your mod or touch anything without your permission.

I just wanted to let you know where the error is coming from and that it looks like it can be fixed quite easily by checking if the entity is still valid before using it.

So no pressure at all — I only wanted to point it out so you know what is causing the crash.

3 days ago

once again:
- Did you do something when this crash happened ?
- what mods are you using ?
- what is the map seed causing the crash ?
- can you share the save game to test ?

The only way i'm able to reproduce it is if I manually delete some of the structure in the start of the game, during the alarm before everything explodes...

the fix you suggest is not supposed to be necessary as entities are not supposed to be minable , so at no point they should be invalid, because the check if the entities are valid is done at the moment I create the list storage.intro_built_entities as i'm building a blueprint ghost and revive returns the entity created, (nothing otherwise) https://github.com/Kyria/dimension-warp/blob/main/scripts/scenario/lab_intro.lua#L48

I don't mind fixing this, and i will, but I also want to understand what caused the issue, as it's not possible in normal situation, so clearly, something happened.

New response