Bubbus / ACF-Missiles

Racked munitions for ACF
MIT License
24 stars 13 forks source link

Update guidance_wire.lua #65

Closed matiasah closed 9 years ago

matiasah commented 9 years ago

I certainly noticed that the wire targeter failed sometimes, I'm just suggesting this update so it always works

Bubbus commented 9 years ago

Thanks for this, I'm interested in knowing in what way it failed if possible. I'd rather keep it reading from entity outputs, rather than reading directly from entity inputs. If we get the time we may be adding rack sensors which would transform the input before sending to output (e.g. for viewcone limits).

I've changed the way it works slightly in 7a757d28cb9ec0f584b8b1b0d113f40bae8ad967, inspired by your commit. Hope this will help. If it doesn't then I'm happy to integrate your code as a fallback after output scanning.

matiasah commented 9 years ago

Well, after doing some tests with E2 entity:type() function I noticed that is not necessary that a entity has a "Entity" type, it eventually returned npc_* or something else depending on what it was. So IsEntity seems to work better on it.

Cre8or commented 9 years ago

One problem I'm seeing with reading directly from the inputs is that this failsafe would fail if we were to rename the entity input at some point - which is unlikely, but possible. If we then forget to change the input name in this file, we end up with a bug.

This is coming from someone who's already spent a lot of time searching for bugs in the wrong place, so I'll agree with Bubbus that we should stick to outputs since those won't change.