Page 1 of 1

Crash when using "entity-preview" gui element

Posted: Wed Feb 21, 2018 12:04 pm
by GalactusX31
I need to know how to use / implement this gui element for my mod; In the wiki and api page there is no information about the use of this, and every time I try to add it and use it, my game crashes and throws me off.

I have tried to find information about it, but I have not been able to find it anywhere, I would appreciate someone showing me how it can be done to have a preview of the selected entity, as does factorio.

Thanks

Image

Re: Use of "entity-preview" gui element

Posted: Wed Feb 21, 2018 12:09 pm
by Klonan
GalactusX31 wrote:I need to know how to use / implement this gui element for my mod; In the wiki and api page there is no information about the use of this, and every time I try to add it and use it, my game crashes and throws me off.

I have tried to find information about it, but I have not been able to find it anywhere, I would appreciate someone showing me how it can be done to have a preview of the selected entity, as does factorio.

Thanks

Image
Seems to crash for me too:

Code: Select all

Factorio crashed. Generating symbolized stacktrace, please wait ...
c:\factorio\libraries\stackwalker\stackwalker.cpp (907): StackWalker::ShowCallstack
c:\factorio\src\util\logger.cpp (367): Logger::writeStacktrace
c:\factorio\src\util\logger.cpp (469): Logger::logStacktrace
c:\factorio\src\util\crashhandler.cpp (155): CrashHandler::writeStackTrace
c:\factorio\src\util\crashhandler.cpp (485): CrashHandler::SignalHandler
d:\th\minkernel\crts\ucrt\src\appcrt\misc\exception_filter.cpp (219): _seh_filter_exe
f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (299): `__scrt_common_main_seh'::`1'::filt$0
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FF6ACAB9AE0)
00007FF6ACAB9AE0 (factorio-run): (filename not available): __C_specific_handler
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFF31774C7D)
00007FFF31774C7D (ntdll): (filename not available): _chkstk
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFF316ED1D8)
00007FFF316ED1D8 (ntdll): (filename not available): RtlWalkFrameChain
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFF31773BAE)
00007FFF31773BAE (ntdll): (filename not available): KiUserExceptionDispatcher
c:\factorio\libraries\agui\src\agui\style.cpp (141): agui::Style::getNaturalWidth
c:\factorio\libraries\agui\src\agui\widget\widget.cpp (1243): agui::Widget::resizeToContents
c:\factorio\libraries\agui\src\agui\widget\widget.cpp (1259): agui::Widget::resizeToContentsRecursive
c:\factorio\libraries\agui\src\agui\widget\widget.cpp (1253): agui::Widget::resizeToContentsRecursive
c:\factorio\libraries\agui\src\agui\topcontainer.cpp (22): agui::TopContainer::processTriggersToResize
c:\factorio\src\graphics\guirenderer.cpp (50): GuiRenderer::prepare
c:\factorio\src\mainloop.cpp (799): MainLoop::prepare
c:\factorio\src\mainloop.cpp (530): MainLoop::mainLoopStep
c:\factorio\src\mainloop.cpp (332): MainLoop::run
c:\factorio\src\main.cpp (1108): wmain
f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (283): __scrt_common_main_seh
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFF2ED61FE4)
00007FFF2ED61FE4 (KERNEL32): (filename not available): BaseThreadInitThunk
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFF3173EFC1)
00007FFF3173EFC1 (ntdll): (filename not available): RtlUserThreadStart
Stack trace logging done
  26.884 Error CrashHandler.cpp:156: Map tick at moment of crash: 650
  26.884 Error Util.cpp:67: Unexpected error occurred. If you're running the latest version of the game you can help us solve the problem by posting the contents of the log file on the Factorio forums.
Please also include the save file(s), any mods you may be using, and any steps you know of to reproduce the crash.
  28.577 Creating crash dump.
  28.673 CrashDump success
moving to bug reports

Code: Select all

/c entity = game.player.selected game.player.gui.center.add{type = "entity-preview", entity = entity}

Re: Crash when using "entity-preview" gui element

Posted: Wed Feb 21, 2018 1:29 pm
by Rseding91
Thanks for the report. It's now fixed for the next version of 0.16.

Re: Crash when using "entity-preview" gui element

Posted: Wed Feb 21, 2018 2:43 pm
by eradicator
Odd. It worked fine when i tested it when it was first added.

Re: Crash when using "entity-preview" gui element

Posted: Wed Feb 21, 2018 5:23 pm
by Klonan
eradicator wrote:Odd. It worked fine when i tested it when it was first added.
If you set a style on it, i think it would work

Re: Crash when using "entity-preview" gui element

Posted: Sat Feb 24, 2018 9:17 pm
by GalactusX31
I can confirm, that even if I put a style to that element, it keeps crashing the game

Re: Crash when using "entity-preview" gui element

Posted: Mon Feb 26, 2018 10:20 pm
by GalactusX31
Nvm, problem solved, thanks

Re: Crash when using "entity-preview" gui element

Posted: Mon Feb 26, 2018 10:42 pm
by eradicator
@0.16.26:

The example code supplied by Klonan that assigns the entity directly when creating the gui element doesn't work for me. It only creates an empty entity-preview. The only way i can get an entity to actually show up in the preview is by assigning the entity after creating the gui element. Would be nice if assignment on creation worked.

Code: Select all

/c
g = game.player.gui.center
g.clear()
entity = game.player.selected
ep = g.add{type = "entity-preview", entity = entity}
ep.entity = entity --[[created empty without this]]


Re: Crash when using "entity-preview" gui element

Posted: Mon Feb 26, 2018 10:48 pm
by Rseding91
eradicator wrote:@0.16.26:

The example code supplied by Klonan that assigns the entity directly when creating the gui element doesn't work for me. It only creates an empty entity-preview. The only way i can get an entity to actually show up in the preview is by assigning the entity after creating the gui element. Would be nice if assignment on creation worked.

Code: Select all

/c
g = game.player.gui.center
g.clear()
entity = game.player.selected
ep = g.add{type = "entity-preview", entity = entity}
ep.entity = entity --[[created empty without this]]

Assignment on creation isn't supported and never will be.

Re: Crash when using "entity-preview" gui element

Posted: Mon Feb 26, 2018 10:55 pm
by eradicator
Rseding91 wrote:Assignment on creation isn't supported and never will be.
Oh. Well. Then i was just confued by Klonans example code :P. Thanks for the hint.