001package com.fs.starfarer.api.combat;
002
003import java.awt.Color;
004
005import org.json.JSONObject;
006import org.lwjgl.util.vector.Vector2f;
007
008public interface EmpArcEntityAPI extends CombatEntityAPI {
009
010        public static class EmpArcParams {
011                /**
012                 * Setting to a really high value produces straight lines,
013                 * higher values = more performant but also more angular-looking.
014                 */
015                public float segmentLengthMult = 1f;
016                
017                /**
018                 * 0.25f is pretty reasonable to reduce how far out it bends. Increases the volatility of 
019                 * the zig-zagging, reducing the extremes it gets to.
020                 */
021                public float zigZagReductionFactor = 0f;
022                
023                public float maxZigZagMult = 1f;
024                
025                /**
026                 * Only used if arc.setFadedOutAtStart(true).
027                 */
028                public float fadeOutDist = 100f;
029                
030                /**
031                 * Arc fades in over at most 1f/minFadeOutMult of its length.
032                 */
033                public float minFadeOutMult = 2f;
034                
035                public float flickerRateMult = 1f;
036                public float glowSizeMult = 1f;
037                public float glowAlphaMult = 1f;
038                
039                /**
040                 * Only used if arc.setSingleFlickerMode(true).
041                 * Not supported for arcs from an EMP-type ship system, only those spawned using CombatEngineAPI, i.e.
042                 * where it's possible to call setSingleFlickerMode().
043                 */
044                public float movementDurOverride = -1f; // defaults to value based on flicker duration
045                public float movementDurMax = 0.1f;
046                public float movementDurMin = 0f;
047                
048                /**
049                 * How large the moving bright area is, if arc.setSingleFlickerMode(true).
050                 */
051                public float brightSpotFullFraction = 0.33f;
052                public float brightSpotFadeFraction = 0.33f;
053                public float nonBrightSpotMinBrightness = 0f;
054                public Color glowColorOverride = null;
055                
056                public boolean flamesOutMissiles = true;
057                
058                public void loadFromSystemJson(JSONObject json) {
059                        if (json == null) return;
060                        segmentLengthMult = (float) json.optDouble("emp_segmentLengthMult", 1f);
061                        zigZagReductionFactor = (float) json.optDouble("emp_zigZagReductionFactor", 0f);
062                        maxZigZagMult = (float) json.optDouble("emp_maxZigZagMult", 1f);
063                        fadeOutDist = (float) json.optDouble("emp_fadeOutDist", 100f);
064                        minFadeOutMult = (float) json.optDouble("emp_minFadeOutMult", 2f);
065                        flickerRateMult = (float) json.optDouble("emp_flickerRateMult", 1f);
066                        glowSizeMult = (float) json.optDouble("emp_glowSizeMult", 1f);
067                        glowAlphaMult = (float) json.optDouble("emp_glowAlphaMult", 1f);
068                        flamesOutMissiles = json.optBoolean("emp_flamesOutMissiles", true);
069                }
070                
071        }
072        
073        
074        float getCoreWidthOverride();
075        void setCoreWidthOverride(float coreWidthOverride);
076        void setTargetToShipCenter(Vector2f sourceSlotPos, ShipAPI ship);
077        Vector2f getTargetLocation();
078        void setSingleFlickerMode();
079        void setUpdateFromOffsetEveryFrame(boolean updateFromOffsetEveryFrame);
080        void setRenderGlowAtStart(boolean renderGlowAtStart);
081        void setRenderGlowAtEnd(boolean renderGlowAtEnd);
082        
083        /**
084         * Makes the rendering MUCH slower, use with caution.
085         * @param fadedOutAtStart
086         */
087        void setFadedOutAtStart(boolean fadedOutAtStart);
088//      void setDelay(float delay);
089//      float getDelay();
090        void setSingleFlickerMode(boolean withMovement);
091        void setLayer(CombatEngineLayers layer);
092        void setWarping(float dur);
093        boolean isShieldHit();
094
095}