Zerwiport's Zoom


This mode is an overhaul of world display mechanics. The goal is to give more control and make it more productive. It defines two views: 'Character' and 'Remote'. One may switch between them and toggle their internal view modes with separate bindings.

Utilities
1 year, 1 month ago
1.1
934

b [Done] random failures after a GUI was closed caused by accessing an invalid entity

1 year, 1 month ago

this happened when i deconstructed the rocket at the start

148.893 Error MainLoop.cpp:1404: Exception at tick 4367: The mod Zerwiport's Zoom (1.7.0) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event zoom-mod::zoom-mod_update-view-on-move-left (ID 336)
LuaEntity API call when LuaEntity was invalid.
stack traceback:
[C]: in function 'index'
__zoom-mod
/model/ClosedGuiEvent.lua:30: in function 'locomotive'
zoom-mod/model/ClosedGuiEvent.lua:20: in function 'mayChangePosition'
zoom-mod/model/Interface.lua:113: in function 'updateZoom'
zoom-mod/model/Interface.lua:107: in function 'updatePosition'
zoom-mod/model/Interface.lua:91: in function 'update'
zoom-mod/control.lua:37: in function <zoom-mod/control.lua:35>

1 year, 1 month ago

this should fix it :)

if self._on_gui_closed.gui_type == defines.gui_type.entity and self._on_gui_closed.entity.valid and self._on_gui_closed.entity.name == "locomotive" then

1 year, 1 month ago
(updated 1 year, 1 month ago)

Thanks for reporting. I'm going to get rid of accessing of an entity in the next ticks otherwise the functionality won't work sometimes.

1 year, 1 month ago

valid :: booleanRead
Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be false. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.

I hope that not using it in the following ticks will be sufficient. If not, I will add this condition.

You may play with version 1.7.1

1 year, 1 month ago
(updated 1 year, 1 month ago)

Because the documentation is not precise enough when invalidation of an entity may occur I've just added precautious check. Along with the changes from version 1.7.1 it should reduce occurrences of not updating position and zoom after opening the map on a locomotive and eliminate crashes.

1 year, 1 month ago

thanks, things seem fine now :)

that said, i don't know if the rocket wrecks at the start of a game are indeed locomotives, and those caused the crash

1 year, 1 month ago

It was destroyed after you closed the gui and in the following tick the gui's entity was invalid.

New response