kyranf / robotarmyfactorio

A mod to add robot troop units and perhaps associated support buildings and items to produce and control them.
MIT License
35 stars 12 forks source link

Crash: attempt to index local 'squad' (a nil value) #97

Closed thisismynombre closed 7 years ago

thisismynombre commented 7 years ago

This morning, I was messing around with destroyer droids. I changed the squad size to 100, and the retreat size to 40, via the settings module. Then I setup a circuit between an activity module and an inserter arm to maintain a total army of 200.

The first group of 100 went off hunting just fine. I left them alone for a while, and when I came back, I noticed that there were ~150 droids just buzzing around the assembling machine. I tried using the rally point to get them all to reconnoiter, but only about half of them responded to the rally flag. Then I started running around and picking them up. While I was picking them up, I was getting a lot of "squad is no more messages." After I had picked up like 50 of them, I got this error:

Error MainLoop.cpp:788: Exception at tick 5212150: Error while running event on_tick (ID 0)
__robotarmy__/robolib/Squad.lua:728: attempt to index local 'squad' (a nil value)

Log files: robot_army_logs.zip factorio-current.zip

kyranf commented 7 years ago

Thanks I'll look into it this weekend! Should be a quick fix. 

-------- Original message -------- From: thisismynombre notifications@github.com Date: 14/04/2017 12:37 (GMT+00:00) To: kyranf/robotarmyfactorio robotarmyfactorio@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [kyranf/robotarmyfactorio] Crash: attempt to index local 'squad' (a nil value) (#97)

This morning, I was messing around with destroyer droids. I changed the squad size to 100, and the retreat size to 40, via the settings module. Then I setup a circuit between an activity module and an inserter arm to maintain a total army of 200. The first group of 100 went off hunting just fine. I left them alone for a while, and when I came back, I noticed that there were ~150 droids just buzzing around the assembling machine. I tried using the rally point to get them all to reconnoiter, but only about half of them responded to the rally flag. Then I started running around and picking them up. While I was picking them up, I was getting a lot of "squad is no more messages." After I had picked up like 50 of them, I got this error: Error MainLoop.cpp:788: Exception at tick 5212150: Error while running event on_tick (ID 0)

robotarmy/robolib/Squad.lua:728: attempt to index local 'squad' (a nil value) Log files:

robot_army_logs.zip

factorio-current.zip

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kyranf/robotarmyfactorio","title":"kyranf/robotarmyfactorio","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/kyranf/robotarmyfactorio"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Crash: attempt to index local 'squad' (a nil value) (#97)"}],"action":{"name":"View Issue","url":"https://github.com/kyranf/robotarmyfactorio/issues/97"}}}

kyranf commented 7 years ago

I updated the squad.lua file with a check that should fix the error you found. It was probably a rare case where a squad was removed in the same tick but before the artifact gather function was called, with the squad now being nil by the time that function was called.