Robot Mining Site

by anye77

对原作者judos作品更新: 添加中文本地化 Added support for Factorio 1.1.38 Adds mining robots and a robot mining site which can be configured to mine nearby resources

2 years ago
1.1
1.37K

b Doesnt work

2 years ago

Crash game when Extra large roboport is used.

2 years ago
(updated 2 years ago)

I'm getting an error when I'm attaching an unloader to the mining site...
I haven't yet tried a normal inserter, but given that the unloaders are just using invisible inserters, I'd guess that that will also crash the game.

Edit 2: seems like my guess was correct, now that I've routed the belt through some free tiles away from the site it ran fine for several minutes so far.
Edit 3: and to make sure, I placed a whole lane right over the ore and as soon as one was "mined" onto the belt the game crashed again.
So I'm certain now that that's the issue, even though I don't understand how a mined and marked as "to be deconstructed" ore can cause that...

Edit: ok, I was able to grab the ore manually, and when I tried to attach just an inserter, I first laid out the belts and then the game crashed again...
So given that I didn't even get to the point of the inserter touching the mining site, it's more likely that the "mined" ores on the ground landing on a belt tile crash?

I've already looked at the error log and there's not even a hint of useful info at all, but for what's it worth:

 274.752 Error CrashHandler.cpp:633: Received SIGSEGV
Factorio crashed. Generating symbolized stacktrace, please wait ...
c:\cygwin64\tmp\factorio-build-6ejpwc\libraries\stackwalker\stackwalker.cpp (924): StackWalker::ShowCallstack
c:\cygwin64\tmp\factorio-build-6ejpwc\src\util\logger.cpp (545): Logger::writeStacktrace
c:\cygwin64\tmp\factorio-build-6ejpwc\src\util\logger.cpp (552): Logger::logStacktrace
c:\cygwin64\tmp\factorio-build-6ejpwc\src\util\crashhandler.cpp (184): CrashHandler::writeStackTrace
c:\cygwin64\tmp\factorio-build-6ejpwc\src\util\crashhandler.cpp (642): CrashHandler::SignalHandler
minkernel\crts\ucrt\src\appcrt\misc\exception_filter.cpp (219): _seh_filter_exe
f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (304): `__scrt_common_main_seh'::`1'::filt$0
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00000001403325C4)
00000001403325C4 (factorio): (filename not available): __C_specific_handler
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 000000007766812D)
000000007766812D (ntdll): (filename not available): RtlDecodePointer
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 000000007765855F)
000000007765855F (ntdll): (filename not available): RtlUnwindEx
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 000000007768BCB8)
000000007768BCB8 (ntdll): (filename not available): KiUserExceptionDispatcher
c:\cygwin64\tmp\factorio-build-6ejpwc\src\sound\environmentsoundplayer.cpp (169): EnvironmentSoundPlayer::update
c:\cygwin64\tmp\factorio-build-6ejpwc\src\gameview.cpp (801): GameView::update
c:\cygwin64\tmp\factorio-build-6ejpwc\src\game.cpp (442): Game::processGameViewFlags
c:\cygwin64\tmp\factorio-build-6ejpwc\src\game.cpp (429): Game::prepareRender
c:\cygwin64\tmp\factorio-build-6ejpwc\src\mainloop.cpp (1050): MainLoop::prepare
c:\cygwin64\tmp\factorio-build-6ejpwc\src\mainloop.cpp (689): MainLoop::mainLoopStep
c:\cygwin64\tmp\factorio-build-6ejpwc\src\mainloop.cpp (394): MainLoop::run
c:\cygwin64\tmp\factorio-build-6ejpwc\src\main.cpp (1142): wmain
f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl (288): __scrt_common_main_seh
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00000000774359CD)
00000000774359CD (kernel32): (filename not available): BaseThreadInitThunk
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 000000007766A561)
000000007766A561 (ntdll): (filename not available): RtlUserThreadStart
Stack trace logging done
 278.199 Error CrashHandler.cpp:189: Map tick at moment of crash: 7280125
 278.233 Info CrashHandler.cpp:309: Executable CRC: 1917135225
 278.233 Error Util.cpp:97: 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.
 286.169 Uploading log file
 286.183 Error CrashHandler.cpp:260: Heap validation: success.
 286.183 Creating crash dump.
 286.275 CrashDump success
2 years ago
(updated 2 years ago)

So I've done some digging into this again and I've managed to find a way to circumvent the function that seems to be causing the crash.

In the file "control/roboticMiningSite.lua" in the function "f.work" there's the line

if entity.surface.can_place_entity{name="item-on-ground", position=position, stack=testStack} then

and it seems that some entities can crash the check. But since the crash happens faster than the log writing I can't pin down the tiles that actually cause the call to crash because the log writing is lagging behind by at least 1 tile but likely more around 3.

And after looking a bit in the API documentation I've found a function that serves the same purpose but doesn't crash, and it also returns a position to throw the ore down too:

local space = entity.surface.find_non_colliding_position("mining-item-on-ground", position, 0.8, 0.2)

So all I did was adding this line and then replacing the if above with simply

if space ~= nil then

and then I was able to use the mining site fine again.

I also changed this line (a bit below all that)

local itemEntity = entity.surface.create_entity{name="mining-item-on-ground", position=space, stack=itemStack}

so that it uses the returned free space position instead. But that's just a bonus (I think).

New response