mspielberg / factorio-railloader

Rapidly load and unload trains of bulk materials.
GNU Lesser General Public License v3.0
9 stars 19 forks source link

Crash when i place the items #3

Closed Goten87 closed 6 years ago

Goten87 commented 6 years ago

i get the same error when i try to place down the 2 items the mod adds

Error while running event railloader::on_built_entity (ID 6) railloader/control.lua:33: attempt to index local 'event' (a nil value)`

version: 3.2

dgw commented 6 years ago

Factorio version would be good to know. Sometimes modding API changes cause errors like this.

Goten87 commented 6 years ago

Latest 0.16

dgw commented 6 years ago

Specific version numbers are better; assuming 0.16.24, as that is the latest 0.16 release, but I've seen many, many cases (on other projects) where users insisted they were on the "latest" version but weren't receiving experimental updates for some reason and were actually behind.

dgw commented 6 years ago

OK, bug reporting quibbles over version numbers aside, I found the cause.

on_built(event) calls on_railloader_proxy_built(proxy), which calls abort_build(event) in one of two places depending on context—but event was never passed in nor defined, so in cases where the mod tries to abort building it throws an error. I might be able to submit a PR to fix this later today, in something like 6-8 hours.

Goten87 commented 6 years ago

Well it’s 00:46 here so hope it will be fix when I wake up :p

Goten87 commented 6 years ago

And I’m on 0.16.24

dgw commented 6 years ago

Checked the commit history. Somehow I was looking at outdated code? It's not released yet, but the code on master already fixed on_railloader_proxy_built() to take event as a second argument. So no need to wait on a PR from me, just wait on @mspielberg to tag a new release (or download the code from GitHub and use the mod unpacked until a new release is uploaded).

Goten87 commented 6 years ago

I tried that as well then it will not place the building I get the sound that it placeing it down but no building apairs

Goten87 commented 6 years ago

Or dos it need to be on a rails

dgw commented 6 years ago

I don't even have this mod installed, haha, just following its repo for development news. But no, it has to be built on/over rails. The code calls abort_build() if there are no rails found at the build location.

tomkcook commented 6 years ago

I found that this error happens if I try to build one of these items either where there is no rail or where there is already a train on the rail where I build it. It sounds like the crash is fixed, but it'd be nice if there was some clue that you couldn't build it where there isn't suitable rail (like have it turn red or something).

mspielberg commented 6 years ago

it'd be nice if there was some clue that you couldn't build it where there isn't suitable rail (like have it turn red or something). Unfortunately I can't easily control when the red/green highlight is displayed. Also, since robot build order is unpredictable, I didn't want to send a message or play an error sound if trying to place the loader before rails are built.

mspielberg commented 6 years ago

The crash should have been fixed in 0.3.3. Better error reporting will come in the next version, to tell you why a loader couldn't be built.