[Suggestion, PRPL] Better GetNearestTarget

Started by planetfall, December 07, 2016, 10:42:06 PM

Previous topic - Next topic

planetfall

I'm making a custom module that (basically) does the following:
1. Test if there is a target in an area in front of it.
2. If so, damage targets in a line that sweeps back and forth in front of the module.

I was using GetNearestTarget to do this, but it seems that doing so marked all found particles as targeted, and therefore cannons stopped attacking them. But, the module also has the option to ignore the first N things hit and damage the ones behind (the main application being disabling enemy ships by bypassing the first layer of armor and taking out front weapons.) Therefore the particles nearest modules with this property set will never be destroyed by it, and other weapons should be able to take them out. Nonetheless, it does need to register that they're there, and GetNearestTarget is the only way to grab individual hull cells and emergent. So, I propose a new command (or an expansion to the "untargeted" argument) that does the same thing but doesn't prevent other weapons from firing at found targets.

Because I'm exactly the sort of person to veer off topic, some tangentially related PRPLish concerns have been spoilered...

Spoiler

1. The most important: GetNearestTarget can pick up Omni virtual particles. There is no IsOmni to go along with IsParticle, IsHull, IsEmergent.
2. Would be nice: ran into a case of having to avoid Zeno's paradox with the above module vs. shields. Request ability to get a ship ID and hull coords from a hull particle ID, get hull particle ID from ship ID and hull coords, and determine hull resistance (on or auto shields + amp gem) from ship ID.
[close]
Pretty sure I'm supposed to be banned, someone might want to get on that.

Quote from: GoodMorning on December 01, 2016, 05:58:30 PM"Build a ladder to the moon" is simple as a sentence, but actually doing it is not.

knucracker

#1
QuoteI was using GetNearestTarget to do this, but it seems that doing so marked all found particles as targeted
Something is off about this.  Particles should only be marked as targeted by cannon shots and missiles (the classes for each of them add themselves to the target set held by each particle).  Just calling GetNearestTarget shouldn't affect the target status of a particle.  Of course, as always, everything I say is subject to being wrong due to bugs or misunderstanding on my part.


GoodMorning

Quote
[...] misunderstanding on my part.

What hope is there for us, then?

Nice to know I'm not the only one wondering.
A narrative is a lightly-marked path to another reality.

planetfall

I suppose a test map would help matters.

The ship that ignores the first thing hit by the beam is "Surge."
Pretty sure I'm supposed to be banned, someone might want to get on that.

Quote from: GoodMorning on December 01, 2016, 05:58:30 PM"Build a ladder to the moon" is simple as a sentence, but actually doing it is not.