While I grappled with the idea of rectangle vs circle collision (which was kinda demotivating...), I decided to scrap the rectangle, and only have line vs circle. The reason is that with rectangles, it's possible to hit one circle more than two times, and there's no easy way of making it only two hits (entry and exit points). A line is guaranteed to have at most two points of intersection with a circle, which simplifies my life a lot. The downside to this is that if you have a huge laser cannon of doom that fills up half of the screen, it'll only collide with ships that are in middle of the beam. You can go around this by spawning a lot of lines close together, the neat side effect will be the visual effect of some ships blocking part of the beam.
With this decision made, I then added line vs circle collision, have it detect all points of impact, then sorted the list of collisions. I then added script support for "OnHit" on the equipment being hit, and "PostHit" on the particle doing the hitting. It's not done yet, the line vs circle collision isn't working quite right, and I need a way for the particle to tell the game "The shield was too strong for me, I'm done here", so it don't continue processing the rest of impacts.
OnHit is done by calling the equipment that's being hit, and have it modify the values (for example, shield would reduce the damage) of the particle, and spawn any visual effects (shield ripple effect for example)
After the OnHit call is made, it then calls the particle's "PostHit" with the new values, and see if it's done or should spawn any other particles (such as a fragmentation shell that bursts into shrapnel). If it's not done, then the loop continues with the next round of "OnHit" and "PostHit" with the next equipment in list. It continues until the particle is done, or there's no more collisions.
Now for the screenshots of this in action! First one is the laser beam particle missing as a reference:
The next screenshot is of it "hitting" (line vs circle algorithm isn't correct, will need to fix that), it shows that it spawns two shield particles (was supposed to be "entry" and "exit" points, with exit eliminating the remaining damage from the beam) and the beam was cut off:
I can almost taste the victory! This scripting system is almost done! Just need to polish up a few things, fix the line/circle collision algorithm, fix the sorting algorithm, then add a simple projectile weapon to test a projectile-type weapon, then this part is done! There's still a lot more to be done, but for the purposes of "playable", it'll be done until I come back to add missiles and other goodies.
After that, it's tutorial, then I'll release a new version for the pre-orderers!