Starsector API
Loading...
Searching...
No Matches
SettingsAPI.java
Go to the documentation of this file.
1package com.fs.starfarer.api;
2
3import java.io.IOException;
4import java.io.InputStream;
5import java.util.Collection;
6import java.util.List;
7import java.util.Set;
8
9import java.awt.Color;
10
11import org.json.JSONArray;
12import org.json.JSONException;
13import org.json.JSONObject;
14import org.lwjgl.util.vector.Vector2f;
15
16import com.fs.starfarer.api.campaign.CargoAPI;
17import com.fs.starfarer.api.campaign.CargoAPI.CargoItemType;
18import com.fs.starfarer.api.campaign.CargoStackAPI;
19import com.fs.starfarer.api.campaign.CustomEntitySpecAPI;
20import com.fs.starfarer.api.campaign.CustomUIPanelPlugin;
21import com.fs.starfarer.api.campaign.FactionAPI;
22import com.fs.starfarer.api.campaign.FactionSpecAPI;
23import com.fs.starfarer.api.campaign.LocationAPI;
24import com.fs.starfarer.api.campaign.PlanetSpecAPI;
25import com.fs.starfarer.api.campaign.SectorEntityToken;
26import com.fs.starfarer.api.campaign.SpecialItemSpecAPI;
27import com.fs.starfarer.api.campaign.econ.CommoditySpecAPI;
28import com.fs.starfarer.api.campaign.econ.MarketAPI;
29import com.fs.starfarer.api.campaign.econ.SubmarketSpecAPI;
30import com.fs.starfarer.api.characters.MarketConditionSpecAPI;
31import com.fs.starfarer.api.characters.PersonAPI;
32import com.fs.starfarer.api.characters.PersonalityAPI;
33import com.fs.starfarer.api.characters.SkillSpecAPI;
34import com.fs.starfarer.api.combat.CombatEntityAPI;
35import com.fs.starfarer.api.combat.CombatReadinessPlugin;
36import com.fs.starfarer.api.combat.ShipAIConfig;
37import com.fs.starfarer.api.combat.ShipAIPlugin;
38import com.fs.starfarer.api.combat.ShipAPI;
39import com.fs.starfarer.api.combat.ShipHullSpecAPI;
40import com.fs.starfarer.api.combat.ShipSystemSpecAPI;
41import com.fs.starfarer.api.combat.ShipVariantAPI;
42import com.fs.starfarer.api.combat.WeaponAPI.WeaponSize;
43import com.fs.starfarer.api.combat.WeaponAPI.WeaponType;
44import com.fs.starfarer.api.fleet.FleetMemberAPI;
45import com.fs.starfarer.api.fleet.FleetMemberType;
46import com.fs.starfarer.api.graphics.SpriteAPI;
47import com.fs.starfarer.api.impl.codex.CodexEntryPlugin;
48import com.fs.starfarer.api.loading.AbilitySpecAPI;
49import com.fs.starfarer.api.loading.BarEventSpec;
50import com.fs.starfarer.api.loading.Description;
51import com.fs.starfarer.api.loading.Description.Type;
52import com.fs.starfarer.api.loading.EventSpecAPI;
53import com.fs.starfarer.api.loading.FighterWingSpecAPI;
54import com.fs.starfarer.api.loading.HullModSpecAPI;
55import com.fs.starfarer.api.loading.IndustrySpecAPI;
56import com.fs.starfarer.api.loading.PersonMissionSpec;
57import com.fs.starfarer.api.loading.RoleEntryAPI;
58import com.fs.starfarer.api.loading.TerrainSpecAPI;
59import com.fs.starfarer.api.loading.WeaponSlotAPI;
60import com.fs.starfarer.api.loading.WeaponSpecAPI;
61import com.fs.starfarer.api.plugins.LevelupPlugin;
62import com.fs.starfarer.api.ui.ButtonAPI;
63import com.fs.starfarer.api.ui.ButtonAPI.UICheckboxSize;
64import com.fs.starfarer.api.ui.CustomPanelAPI;
65import com.fs.starfarer.api.ui.LabelAPI;
66import com.fs.starfarer.api.ui.TextFieldAPI;
67import com.fs.starfarer.api.ui.TooltipMakerAPI;
68import com.fs.starfarer.api.util.ListMap;
69
75public interface SettingsAPI {
77
78 boolean isShowingCodex();
79
85
86 CargoStackAPI createCargoStack(CargoItemType type, Object data, CargoAPI cargo);
87
88 LabelAPI createLabel(String text, String font);
89
90 float getBonusXP(String key);
91
92 float getFloat(String key);
93 boolean getBoolean(String key);
94 boolean optBoolean(String key, boolean defaultValue);
95 ClassLoader getScriptClassLoader();
96
98
99 boolean isDevMode();
100 void setDevMode(boolean devMode);
101
102 Color getColor(String id);
103
104 Object getInstanceOfScript(String className);
105
112 String getString(String category, String id);
113
119 SpriteAPI getSprite(String filename);
120
127 SpriteAPI getSprite(String category, String key);
128
136
137 String getSpriteName(String category, String id);
138
145 InputStream openStream(String filename) throws IOException;
146
153 String loadText(String filename) throws IOException;
154
161 JSONObject loadJSON(String filename) throws IOException, JSONException;
162
173 JSONArray loadCSV(String filename) throws IOException, JSONException;
174
190 JSONArray getMergedSpreadsheetDataForMod(String idColumn, String path, String masterMod) throws IOException, JSONException;
191
192 JSONObject getMergedJSONForMod(String path, String masterMod) throws IOException, JSONException;
193
194
200
206
209
216 Description getDescription(String id, Type type);
217
219
220 int getCodeFor(String key);
221
222
223
224
225 WeaponSpecAPI getWeaponSpec(String weaponId);
226
227 void loadTexture(String filename) throws IOException;
228
229
237 float getTargetingRadius(Vector2f from, CombatEntityAPI target, boolean considerShield);
238
239
240 ShipVariantAPI getVariant(String variantId);
241
248 Object getPlugin(String id);
249
250 List<String> getSortedSkillIds();
251
252 SkillSpecAPI getSkillSpec(String skillId);
253
254 String getString(String key);
255
257
258 List<String> getSortedAbilityIds();
259
261
263
265
267
269 EventSpecAPI getEventSpec(String eventId);
271
273
277
278 List<String> getAllVariantIds();
279 List<String> getAptitudeIds();
280 List<String> getSkillIds();
283
284 JSONObject loadJSON(String filename, String modId) throws IOException, JSONException;
285 JSONArray loadCSV(String filename, String modId) throws IOException, JSONException;
286 String loadText(String filename, String modId) throws IOException, JSONException;
287
289
293
294 List<RoleEntryAPI> getEntriesForRole(String factionId, String role);
295 void addEntryForRole(String factionId, String role, String variantId, float weight);
296 void removeEntryForRole(String factionId, String role, String variantId);
297
298 List<RoleEntryAPI> getDefaultEntriesForRole(String role);
299 void addDefaultEntryForRole(String role, String variantId, float weight);
300 void removeDefaultEntryForRole(String role, String variantId);
301
302 void profilerBegin(String id);
305
306 List<PlanetSpecAPI> getAllPlanetSpecs();
307
308 Object getSpec(Class c, String id, boolean nullOnNotFound);
309 void putSpec(Class c, String id, Object spec);
310 <T> Collection<T> getAllSpecs(Class<T> c);
311
316 String getRoman(int n);
318 String getNextCoolGreekLetter(Object context);
319 String getNextGreekLetter(Object context);
320
322
323
325
328 List<HullModSpecAPI> getAllHullModSpecs();
329 List<FighterWingSpecAPI> getAllFighterWingSpecs();
330
331 List<WeaponSpecAPI> getAllWeaponSpecs();
336 List<WeaponSpecAPI> getActuallyAllWeaponSpecs();
337
338 boolean isSoundEnabled();
339
341
343
344 float getAngleInDegreesFast(Vector2f v);
345 float getAngleInDegreesFast(Vector2f from, Vector2f to);
346
348
350
352
354
355
360 boolean isInGame();
361
362 Object getNewPluginInstance(String id);
364
365
371 String getControlStringForEnumName(String name);
372
373 boolean isNewPlayer();
374
376
377 List<CommoditySpecAPI> getAllCommoditySpecs();
378
379 int getInt(String key);
380
381 List<IndustrySpecAPI> getAllIndustrySpecs();
382
384
385 List<SpecialItemSpecAPI> getAllSpecialItemSpecs();
386
387 List<ShipHullSpecAPI> getAllShipHullSpecs();
388
389 SpriteAPI getSprite(String category, String id, boolean emptySpriteOnNotFound);
390
391 ShipVariantAPI createEmptyVariant(String hullVariantId, ShipHullSpecAPI hullSpec);
392
398
399
400
401 String readTextFileFromCommon(String filename) throws IOException;
402
409 void writeTextFileToCommon(String filename, String data) throws IOException;
410
411 boolean fileExistsInCommon(String filename);
412 void deleteTextFileFromCommon(String filename);
413
415 Color getDesignTypeColor(String designType);
416
417 boolean doesVariantExist(String variantId);
418
420 int max, boolean withText, boolean withSell, boolean withBuy);
421
422
423 JSONObject getJSONObject(String key) throws JSONException;
424 JSONArray getJSONArray(String key) throws JSONException;
425
431 FactionAPI createBaseFaction(String factionId);
432
433 List<MarketConditionSpecAPI> getAllMarketConditionSpecs();
434 List<SubmarketSpecAPI> getAllSubmarketSpecs();
435
437
439
441 List<ShipSystemSpecAPI> getAllShipSystemSpecs();
442
445
451
457
458 int getShippingCapacity(MarketAPI market, boolean inFaction);
459 JSONObject getSettingsJSON();
464
465 void setFloat(String key, Float value);
466 void setBoolean(String key, Boolean value);
467
468 List<PersonMissionSpec> getAllMissionSpecs();
470
471 List<BarEventSpec> getAllBarEventSpecs();
473
474 void setAutoTurnMode(boolean autoTurnMode);
475 boolean isAutoTurnMode();
476
478
479 float getFloatFromArray(String key, int index);
480
481 int getIntFromArray(String key, int index);
482
483 void loadTextureConvertBlackToAlpha(String filename) throws IOException;
484
486
488
489 void unloadTexture(String filename);
490
491 void profilerSetEnabled(boolean enabled);
492
494
496
498
500
501 void forceMipmapsFor(String filename, boolean forceMipmaps) throws IOException;
502
508
509 float computeStringWidth(String in, String font);
510
511 TextFieldAPI createTextField(String text, String font);
512
513 ButtonAPI createCheckbox(String text, UICheckboxSize size);
514 ButtonAPI createCheckbox(String text, String font, Color checkColor, UICheckboxSize size);
515
516 CustomPanelAPI createCustom(float width, float height, CustomUIPanelPlugin plugin);
517
518 int getMissionScore(String id);
519
520 WeaponSlotAPI createWeaponSlot(String id, WeaponType weaponType, WeaponSize slotSize, String slotTypeStr,
521 String nodeId, Vector2f nodePos, float angle, float arc);
522
523 JSONArray getMergedSpreadsheetData(String idColumn, String path) throws IOException, JSONException;
524 JSONObject getMergedJSON(String path) throws IOException, JSONException;
525
526 void setEasySensorBonus(float easySensorBonus);
527
529 void setEnableShipExplosionWhiteout(boolean enableShipExplosionWhiteout);
530
531 List<WeaponSpecAPI> getSystemWeaponSpecs();
532
533 List<String> getSpriteKeys(String category);
534 List<String> getSpriteKeys(String category, String listId);
535
536 JSONObject loadJSON(String filename, boolean withMods) throws IOException, JSONException;
537 JSONArray loadCSV(String filename, boolean withMods) throws IOException, JSONException;
538
541
542 void loadFont(String filename) throws IOException;
543
545
546 List<FactionSpecAPI> getAllFactionSpecs();
547
549
556 void writeJSONToCommon(String filename, JSONObject json, boolean onlyIfChanged) throws IOException, JSONException;
557
562 JSONObject readJSONFromCommon(String filename, boolean putInWriteCache) throws IOException, JSONException;
563
564 List<String> getSimOpponents();
565 List<String> getSimOpponentsDev();
566
570 Set<String> getIndustrySupply(String industryId);
571
575 Set<String> getIndustryDemand(String industryId);
576
577
582 void showCodex(String entryId);
584
589 void showCodex(List<CodexEntryPlugin> tempEntries);
591
592 FleetMemberAPI createFleetMember(FleetMemberType type, String variantOrWingId);
594
595 List<TerrainSpecAPI> getAllTerrainSpecs();
597 boolean hasDesignTypeColor(String designType);
598
599 public float getFriendlyFireDanger(ShipAPI shooter, CombatEntityAPI target,
600 Vector2f from, Vector2f to,
601 float weaponSpeed, float burstFireDuration, float weaponRange);
602 public float getSafeMovementDir(ShipAPI ship);
603}
604
605
WeaponSlotAPI createWeaponSlot(String id, WeaponType weaponType, WeaponSize slotSize, String slotTypeStr, String nodeId, Vector2f nodePos, float angle, float arc)
ButtonAPI createCheckbox(String text, String font, Color checkColor, UICheckboxSize size)
boolean hasDesignTypeColor(String designType)
List< String > getSimOpponentsDev()
float getAngleInDegreesFast(Vector2f from, Vector2f to)
List< WeaponSpecAPI > getSystemWeaponSpecs()
void deleteTextFileFromCommon(String filename)
JSONArray getMergedSpreadsheetDataForMod(String idColumn, String path, String masterMod)
void putSpec(Class c, String id, Object spec)
JSONArray loadCSV(String filename)
List< String > getSimOpponents()
JSONArray getJSONArray(String key)
ListMap< String > getHullIdToVariantListMap()
AbilitySpecAPI getAbilitySpec(String abilityId)
FleetMemberAPI createFleetMember(FleetMemberType type, ShipVariantAPI variant)
float getSafeMovementDir(ShipAPI ship)
SpecialItemSpecAPI getSpecialItemSpec(String itemId)
int getIntFromArray(String key, int index)
List< TerrainSpecAPI > getAllTerrainSpecs()
CargoStackAPI createCargoStack(CargoItemType type, Object data, CargoAPI cargo)
void setEasySensorBonus(float easySensorBonus)
String getControlDescriptionForEnumName(String name)
LabelAPI createLabel(String text, String font)
SpriteAPI getSprite(String category, String key)
BarEventSpec getBarEventSpec(String id)
void loadTextureConvertBlackToAlpha(String filename)
void setBoolean(String key, Boolean value)
< T > Collection< T > getAllSpecs(Class< T > c)
int getMaxSensorRange(LocationAPI loc)
List< SubmarketSpecAPI > getAllSubmarketSpecs()
void writeTextFileToCommon(String filename, String data)
Description getDescription(String id, Type type)
boolean optBoolean(String key, boolean defaultValue)
void showCodex(String entryId)
float getTargetingRadius(Vector2f from, CombatEntityAPI target, boolean considerShield)
JSONObject loadJSON(String filename, boolean withMods)
List< String > getSpriteKeys(String category, String listId)
void loadFont(String filename)
List< String > getAllVariantIds()
List< BarEventSpec > getAllBarEventSpecs()
void setAutoTurnMode(boolean autoTurnMode)
List< FactionSpecAPI > getAllFactionSpecs()
String loadText(String filename)
JSONObject getJSONObject(String key)
String getSpriteName(String category, String id)
SectorEntityToken createLocationToken(float x, float y)
float getFloatFromArray(String key, int index)
List< WeaponSpecAPI > getActuallyAllWeaponSpecs()
FactionSpecAPI getFactionSpec(String id)
void unloadTexture(String filename)
List< ShipSystemSpecAPI > getAllShipSystemSpecs()
void setDevMode(boolean devMode)
TerrainSpecAPI getTerrainSpec(String terrainId)
ShipVariantAPI getVariant(String variantId)
void addEntryForRole(String factionId, String role, String variantId, float weight)
List< IndustrySpecAPI > getAllIndustrySpecs()
SpriteAPI getSprite(String category, String id, boolean emptySpriteOnNotFound)
float computeStringWidth(String in, String font)
MarketConditionSpecAPI getMarketConditionSpec(String conditionId)
Object getSpec(Class c, String id, boolean nullOnNotFound)
CombatReadinessPlugin getCRPlugin()
Object getInstanceOfScript(String className)
SkillSpecAPI getSkillSpec(String skillId)
TextFieldAPI createTextField(String text, String font)
List< String > getSortedSkillIds()
CustomEntitySpecAPI getCustomEntitySpec(String id)
ShipHullSpecAPI getHullSpec(String hullId)
Set< String > getIndustryDemand(String industryId)
HullModSpecAPI getHullModSpec(String modId)
boolean doesVariantExist(String variantId)
IndustrySpecAPI getIndustrySpec(String industryId)
List< WeaponSpecAPI > getAllWeaponSpecs()
String loadText(String filename, String modId)
List< HullModSpecAPI > getAllHullModSpecs()
void showCodex(FleetMemberAPI member)
String getString(String category, String id)
JSONObject loadJSON(String filename)
JSONObject getMergedJSON(String path)
InputStream openStream(String filename)
void addCommodityInfoToTooltip(TooltipMakerAPI tooltip, float initPad, CommoditySpecAPI spec, int max, boolean withText, boolean withSell, boolean withBuy)
int computeNumFighterBays(ShipVariantAPI variant)
JSONArray loadCSV(String filename, boolean withMods)
String getControlStringForAbilitySlot(int index)
Object getNewPluginInstance(String id)
boolean getBoolean(String key)
List< String > getSpriteKeys(String category)
EventSpecAPI getEventSpec(String eventId)
ShipVariantAPI createEmptyVariant(String hullVariantId, ShipHullSpecAPI hullSpec)
CommoditySpecAPI getCommoditySpec(String commodityId)
List< String > getSortedAbilityIds()
JSONObject loadJSON(String filename, String modId)
ShipAIPlugin pickShipAIPlugin(FleetMemberAPI member, ShipAPI ship)
ShipAIPlugin createDefaultShipAI(ShipAPI ship, ShipAIConfig config)
JSONArray getMergedSpreadsheetData(String idColumn, String path)
void setFloat(String key, Float value)
String getNextGreekLetter(Object context)
boolean fileExistsInCommon(String filename)
void showCodex(CodexEntryPlugin tempEntry)
CustomPanelAPI createCustom(float width, float height, CustomUIPanelPlugin plugin)
void removeEntryForRole(String factionId, String role, String variantId)
int getShippingCapacity(MarketAPI market, boolean inFaction)
void profilerSetEnabled(boolean enabled)
FighterWingSpecAPI getFighterWingSpec(String wingId)
FleetMemberAPI createFleetMember(FleetMemberType type, String variantOrWingId)
List< SpecialItemSpecAPI > getAllSpecialItemSpecs()
List< PlanetSpecAPI > getAllPlanetSpecs()
void setEnableShipExplosionWhiteout(boolean enableShipExplosionWhiteout)
JSONObject getMergedJSONForMod(String path, String masterMod)
void forceMipmapsFor(String filename, boolean forceMipmaps)
void writeJSONToCommon(String filename, JSONObject json, boolean onlyIfChanged)
List< CommoditySpecAPI > getAllCommoditySpecs()
WeaponSpecAPI getWeaponSpec(String weaponId)
JSONArray loadCSV(String filename, String modId)
ShipSystemSpecAPI getShipSystemSpec(String id)
List< RoleEntryAPI > getDefaultEntriesForRole(String role)
List< ShipHullSpecAPI > getAllShipHullSpecs()
SpriteAPI getSprite(String filename)
float getFriendlyFireDanger(ShipAPI shooter, CombatEntityAPI target, Vector2f from, Vector2f to, float weaponSpeed, float burstFireDuration, float weaponRange)
void addDefaultEntryForRole(String role, String variantId, float weight)
FactionAPI createBaseFaction(String factionId)
String getString(String key)
Set< String > getIndustrySupply(String industryId)
PersonalityAPI getPersonaltySpec(String id)
String readTextFileFromCommon(String filename)
ButtonAPI createCheckbox(String text, UICheckboxSize size)
PersonMissionSpec getMissionSpec(String id)
List< RoleEntryAPI > getEntriesForRole(String factionId, String role)
String getNextCoolGreekLetter(Object context)
List< MarketConditionSpecAPI > getAllMarketConditionSpecs()
void loadTexture(String filename)
String getControlStringForEnumName(String name)
JSONObject readJSONFromCommon(String filename, boolean putInWriteCache)
void showCodex(List< CodexEntryPlugin > tempEntries)
List< PersonMissionSpec > getAllMissionSpecs()
List< FighterWingSpecAPI > getAllFighterWingSpecs()
float getAngleInDegreesFast(Vector2f v)
void removeDefaultEntryForRole(String role, String variantId)
SpriteAPI getSprite(SpriteId id)
Color getDesignTypeColor(String designType)