IIRC, I ran into two problems with this concept, which I implemented in Vacuum a long time ago. I think it's kind of curious how my code got referred to, "as somebody's boilerplate", rather than crediting the source, but I suppose I was "naively breaking things" at the time, rather than boldly demonstrating a concept. Ahem.
So, the problems with the concept code, as they existed then, were serious, and remain unaddressed.
1. It wasn't possible to move the firepoints via code. This screwed up anything where the weapons were offset in the Y or X (i.e., most multi-barrel setups).
2. Centerlines obviously have the problem that there is no, "right answer". A weapon should therefore have mirrored right/left setups, ideally, and a centerline setup as well.
3. Off-center firepoints, not being mobile, also meant serious problems.
Now, some of that could actually be worked around, with some fancy code rebuilding the offsets, perhaps, and instantly removing / rebuilding projectiles on birth, perhaps. I think that would cause various troubles.
Anyhow, the code has no issues with frames as written:
public class weaponSide implements EveryFrameWeaponEffectPlugin {
private boolean runOnce = false;
@Override
public void advance(float amount, CombatEngineAPI engine, WeaponAPI weapon){
if(runOnce == false){
if (weapon.getShip().getOwner() == 0 && weapon.getLocation().getX() < weapon.getShip().getLocation().getX()
|| weapon.getShip().getOwner() == 1 && weapon.getLocation().getX() > weapon.getShip().getLocation().getX()){
SpriteAPI theSprite = weapon.getSprite();
theSprite.setWidth(-theSprite.getWidth());
theSprite.setCenter(-theSprite.getCenterX(),theSprite.getCenterY());
}
runOnce = true;
}
}
}
The issues are purely functional, frankly.