001package com.fs.starfarer.api.combat; 002 003import org.lwjgl.util.vector.Vector2f; 004 005public interface AutofireAIPlugin { 006 007 /** 008 * Only called when the group is on autofire. 009 * 010 * Should generally make the decision on what to fire at 011 * and whether to fire here, and then return the result of that decision in shouldFire(). 012 * 013 * @param amount seconds since last frame. 014 */ 015 void advance(float amount); 016 017 /** 018 * Only called when the group is on autofire. 019 * 020 * @return whether the weapon should fire now. 021 */ 022 boolean shouldFire(); 023 024 /** 025 * Tells the weapon AI to reconsider whether it should be firing, before it decides it should fire again. 026 * 027 * Called when a group is toggled on/off. 028 */ 029 void forceOff(); 030 031 /** 032 * @return location to aim at, with target leading if applicable. Can be null if the weapon has no target/isn't trying to aim anywhere. 033 */ 034 Vector2f getTarget(); 035 /** 036 * @return current target, if it's a ship. null otherwise. 037 */ 038 ShipAPI getTargetShip(); 039 040 /** 041 * @return the weapon that this AI is controlling. That means the plugin should hold on to it when it's passed in in ModPlugin.pickWeaponAutofireAI(). 042 */ 043 WeaponAPI getWeapon(); 044 045 MissileAPI getTargetMissile(); 046}