I was in a fema camp and fired a chain lightning at some soldiers behind reinforced glass, the lightning “hits” the square right before the glass as expected, but the game immediately becomes non responsive and a few minutes later crashes completely. I tested a second time and the same thing happened.
Given the long “freeze” I suspect it’s going into some sort of loop it can’t recover from.
Apparently chain lightning invokes projectile_attack infinitely when a target is visible but unreachable.
Upon hitting anything, it will fork to nearest visible (from last hit location) creature (never NPC or player) that doesn’t have “bounced” state. Only actually hit (not just targetted) creatures get the “bounced” state.
It could be fixed by simply applying “bounced” before attempting to fork. More “proper” solutions (actually ignoring unreachable targets) would be more complex than they sound at first, because chain lightning actually has its own dispersion, meaning it could repeatedly miss (and strike an obstacle on the way).
I’ll try to write a simple fix.
Merged. Nice job by Coolthulhu.