Starsector API
Loading...
Searching...
No Matches
WeaponAPI.java
Go to the documentation of this file.
1package com.fs.starfarer.api.combat;
2
3import java.awt.Color;
4import java.util.List;
5
6import org.lwjgl.util.vector.Vector2f;
7
8import com.fs.starfarer.api.AnimationAPI;
9import com.fs.starfarer.api.graphics.SpriteAPI;
10import com.fs.starfarer.api.loading.MuzzleFlashSpec;
11import com.fs.starfarer.api.loading.WeaponSlotAPI;
12import com.fs.starfarer.api.loading.WeaponSpecAPI;
13
19public interface WeaponAPI {
20
21 public static interface DerivedWeaponStatsAPI {
22 float getBurstFireDuration();
23 float getSustainedDps();
24 float getEmpPerSecond();
25 float getDamageOver30Sec();
26 float getDps();
27 float getBurstDamage();
28 float getFluxPerDam();
29 float getRoF();
30 float getFluxPerSecond();
31 float getSustainedFluxPerSecond();
36 float getDamagePerShot();
37 float getEmpPerShot();
38 }
39
40 public static enum WeaponType {
41 BALLISTIC("Ballistic"),
42 ENERGY("Energy"),
43 MISSILE("Missile"),
44 LAUNCH_BAY("Launch Bay"),
45 UNIVERSAL("Universal"),
46 HYBRID("Hybrid"),
47 SYNERGY("Synergy"),
48 COMPOSITE("Composite"),
49 BUILT_IN("Built in"),
50 DECORATIVE("Decorative"),
51 SYSTEM("System"),
52 STATION_MODULE("Station Module");
53
54 private String displayName;
55 private WeaponType(String displayName) {
56 this.displayName = displayName;
57 }
58 public String getDisplayName() {
59 return displayName;
60 }
61
62 }
63
64 public static enum WeaponSize {
65 SMALL("Small"),
66 MEDIUM("Medium"),
67 LARGE("Large");
68
69 private String displayName;
70 private WeaponSize(String name) {
71 this.displayName = name;
72 }
73 public String getDisplayName() {
74 return displayName;
75 }
76 }
77
78 public static enum AIHints {
79 PD,
80 PD_ONLY,
81 PD_ALSO, // PD, but only if there are no other targets
82 USE_VS_FRIGATES,
83 STRIKE,
84 DANGEROUS,
85 BOMB,
86 GUIDED_POOR,
87 DO_NOT_AIM,
88 ANTI_FTR,
89 HEATSEEKER,
90 SYSTEM,
91 SHOW_IN_CODEX,
92 AUTOZOOM,
93 DO_NOT_CONSERVE,
94 CONSERVE_1,
95 CONSERVE_2,
96 CONSERVE_3,
97 CONSERVE_4,
98 CONSERVE_5,
99 CONSERVE_ALL,
100 CONSERVE_FOR_ANTI_ARMOR,
101 FIRE_WHEN_INEFFICIENT,
102 EXTRA_RANGE_ON_FIGHTER,
103
104 IGNORES_FLARES,
105
106 GROUP_LINKED,
107 GROUP_ALTERNATING,
108
109 MISSILE_SPREAD,
110 DIRECT_AIM,
111 NO_TURN_RATE_BOOST_WHEN_IDLE,
112 RESET_BARREL_INDEX_ON_BURST,
113
114 USE_LESS_VS_SHIELDS,
115 }
116
117
118 String getId();
119 WeaponType getType();
120 WeaponSize getSize();
121
122 void setPD(boolean pd);
123
129 float distanceFromArc(Vector2f target);
130 boolean isAlwaysFire();
131
135 float getArc();
136 void setCurrAngle(float angle);
137
138 float getRange();
141 float getTurnRate();
144 int getAmmo();
146 void setMaxAmmo(int maxAmmo);
147 void resetAmmo();
149 float getCooldown();
150 void setRemainingCooldownTo(float value);
151
152 boolean isBeam();
153 boolean isBurstBeam();
154 boolean isPulse();
156
160 Vector2f getLocation();
161
162 boolean isFiring();
163
164 boolean usesAmmo();
165 boolean usesEnergy();
166
167 boolean hasAIHint(AIHints hint);
169
172
175 boolean isDisabled();
177
179
181
183
188 DerivedWeaponStatsAPI getDerivedStats();
189
190 void setAmmo(int ammo);
191
196
197
206 SpriteAPI getSprite();
207
212 SpriteAPI getUnderSpriteAPI();
213
223 void renderBarrel(SpriteAPI sprite, Vector2f loc, float alphaMult);
229
230
231 void disable();
232
233 void disable(boolean permanent);
234
235 void repair();
236
237 WeaponSpecAPI getSpec();
238 WeaponSlotAPI getSlot();
239
241
242 List<MissileRenderDataAPI> getMissileRenderData();
245 boolean isDecorative();
248 void setPDAlso(boolean pdAlso);
249 void setCurrHealth(float currHealth);
250 MuzzleFlashSpec getMuzzleFlashSpec();
251 List<BeamAPI> getBeams();
252 Vector2f getFirePoint(int barrel);
253 void setTurnRateOverride(Float turnRateOverride);
254 SpriteAPI getGlowSpriteAPI();
256 void setRefireDelay(float delay);
257 void setFacing(float facing);
260 void setKeepBeamTargetWhileChargingDown(boolean keepTargetWhileChargingDown);
261 void setScaleBeamGlowBasedOnDamageEffectiveness(boolean scaleGlowBasedOnDamageEffectiveness);
262 void setForceFireOneFrame(boolean forceFire);
263 void setGlowAmount(float glow, Color glowColor);
264 void setForceNoFireOneFrame(boolean forceNoFireOneFrame);
265 void setSuspendAutomaticTurning(boolean suspendAutomaticTurning);
268 void setRenderOffsetForDecorativeBeamWeaponsOnly(Vector2f renderOffsetForDecorativeBeamWeaponsOnly);
271 boolean isInBurst();
272 WeaponSpecAPI getOriginalSpec();
273 void setWeaponGlowWidthMult(float weaponGlowWidthMult);
274 void setWeaponGlowHeightMult(float weaponGlowHeightMult);
276}
277
278
Vector2f getRenderOffsetForDecorativeBeamWeaponsOnly()
void setRenderOffsetForDecorativeBeamWeaponsOnly(Vector2f renderOffsetForDecorativeBeamWeaponsOnly)
DerivedWeaponStatsAPI getDerivedStats()
void setForceNoFireOneFrame(boolean forceNoFireOneFrame)
void renderBarrel(SpriteAPI sprite, Vector2f loc, float alphaMult)
float distanceFromArc(Vector2f target)
CollisionClass getProjectileCollisionClass()
void setKeepBeamTargetWhileChargingDown(boolean keepTargetWhileChargingDown)
EveryFrameWeaponEffectPlugin getEffectPlugin()
void setGlowAmount(float glow, Color glowColor)
void setTurnRateOverride(Float turnRateOverride)
void setSuspendAutomaticTurning(boolean suspendAutomaticTurning)
void setForceFireOneFrame(boolean forceFire)
void setCurrHealth(float currHealth)
List< MissileRenderDataAPI > getMissileRenderData()
void setRemainingCooldownTo(float value)
void disable(boolean permanent)
void setScaleBeamGlowBasedOnDamageEffectiveness(boolean scaleGlowBasedOnDamageEffectiveness)
void setWeaponGlowHeightMult(float weaponGlowHeightMult)
void setWeaponGlowWidthMult(float weaponGlowWidthMult)