1package com.fs.starfarer.api.impl.campaign.intel.misc;
3import java.util.ArrayList;
9import org.lwjgl.util.vector.Vector2f;
11import com.fs.starfarer.api.Global;
12import com.fs.starfarer.api.campaign.CampaignFleetAPI;
13import com.fs.starfarer.api.campaign.CampaignTerrainAPI;
14import com.fs.starfarer.api.campaign.FactionAPI;
15import com.fs.starfarer.api.campaign.PlanetAPI;
16import com.fs.starfarer.api.campaign.SectorEntityToken;
17import com.fs.starfarer.api.campaign.StarSystemAPI;
18import com.fs.starfarer.api.campaign.comm.IntelInfoPlugin;
19import com.fs.starfarer.api.campaign.rules.MemoryAPI;
20import com.fs.starfarer.api.impl.campaign.entities.GateHaulerEntityPlugin;
21import com.fs.starfarer.api.impl.campaign.ids.Drops;
22import com.fs.starfarer.api.impl.campaign.ids.Entities;
23import com.fs.starfarer.api.impl.campaign.ids.Factions;
24import com.fs.starfarer.api.impl.campaign.ids.Tags;
25import com.fs.starfarer.api.impl.campaign.intel.BaseIntelPlugin;
26import com.fs.starfarer.api.impl.campaign.procgen.themes.BaseThemeGenerator;
27import com.fs.starfarer.api.impl.campaign.procgen.themes.BaseThemeGenerator.AddedEntity;
28import com.fs.starfarer.api.impl.campaign.procgen.themes.BaseThemeGenerator.EntityLocation;
29import com.fs.starfarer.api.impl.campaign.procgen.themes.BaseThemeGenerator.OrbitGap;
30import com.fs.starfarer.api.impl.campaign.rulecmd.missions.GateHaulerCMD;
31import com.fs.starfarer.api.impl.campaign.terrain.DebrisFieldTerrainPlugin.DebrisFieldParams;
32import com.fs.starfarer.api.impl.campaign.terrain.DebrisFieldTerrainPlugin.DebrisFieldSource;
33import com.fs.starfarer.api.loading.Description;
34import com.fs.starfarer.api.loading.Description.Type;
35import com.fs.starfarer.api.ui.Alignment;
36import com.fs.starfarer.api.ui.SectorMapAPI;
37import com.fs.starfarer.api.ui.TooltipMakerAPI;
38import com.fs.starfarer.api.util.Misc;
48 public static enum GateHaulerAction {
74 protected GateHaulerAction
action =
null;
169 float brakeDist = GateHaulerEntityPlugin.MAX_SPEED * 0.5f * brakeTime;
172 Vector2f spawnVel =
new Vector2f(spawnLoc);
176 spawnLoc.scale(brakeDist * 1f + 4000f);
201 float minDist = 4000f;
202 float maxDist = 8000f;
206 float dist = curr.getLocation().length();
207 if (dist >= minDist && dist <= 8000f) {
214 if (curr.isMoon())
continue;
215 float dist = curr.getLocation().length();
216 if (dist >= minDist && dist <= 8000f) {
226 float orbitRadius = found.
getRadius() + 250f;
227 float orbitDays = orbitRadius / (20f +
Misc.
random.nextFloat() * 5f);
232 if (!gaps.isEmpty()) {
233 OrbitGap gap = gaps.get(0);
234 float orbitRadius = (gap.start + gap.end) * 0.5f;
239 float orbitDays = orbitRadius / (20f +
Misc.
random.nextFloat() * 5f);
246 float orbitRadius = minDist + (maxDist - minDist) *
Misc.
random.nextFloat();
251 float orbitDays = orbitRadius / (20f +
Misc.
random.nextFloat() * 5f);
270 super.advance(amount);
285 if (
action == GateHaulerAction.OUTBOUND) {
294 setAction(GateHaulerAction.DEEP_SPACE_TRANSIT);
299 if (
action == GateHaulerAction.DEEP_SPACE_TRANSIT) {
306 if (
action == GateHaulerAction.INBOUND) {
313 if (overshot || dist < 700f) {
328 float orbitDays = 1000000f;
332 for (
int i = 0; i < 10; i++) {
340 String key =
"$witnessedGateHaulerArrival";
344 if (distToPlayer < 2000f) {
355 if (
action == GateHaulerAction.DEPLOYING) {
377 float orbitDays = 1000000f;
387 EntityLocation loc =
new EntityLocation();
404 if (added.entity !=
null) {
418 DebrisFieldParams params =
new DebrisFieldParams(
423 params.source = DebrisFieldSource.MIXED;
425 params.baseSalvageXP = (long) 500;
455 if (mode == ListInfoMode.IN_DESC) initPad = opad;
464 info.
addPara(
"Entered open space", tc, initPad);
465 String dStr =
"days";
467 info.
addPara(
"Estimated %s " + dStr +
" to complete transit", initPad, tc,
476 info.
addPara(
"Witnessed the arrival of a Gate Hauler to a star system", tc, initPad);
481 if (mode == ListInfoMode.INTEL) {
484 locStr =
"deep space";
488 if (
getPlugin().isInTransit() &&
action == GateHaulerAction.DEEP_SPACE_TRANSIT) {
489 locStr =
"transiting deep space";
492 info.
addPara(
"Location: " + locStr, tc, initPad);
497 info.
addPara(
"Status: dormant", tc, initPad);
499 info.
addPara(
"Status: activating", tc, initPad);
500 }
else if (
action ==
null) {
501 info.
addPara(
"Status: operational", tc, initPad);
502 }
else if (
action == GateHaulerAction.OUTBOUND) {
503 info.
addPara(
"Departing current location", tc, initPad);
505 String dStr =
"days";
507 info.
addPara(
"Estimated %s " + dStr +
" for transit", initPad, tc,
509 }
else if (
action == GateHaulerAction.DEEP_SPACE_TRANSIT) {
510 String dStr =
"days";
512 if (daysRemaining < 1) daysRemaining = 1;
513 if (daysRemaining == 1) dStr =
"day";
514 info.
addPara(
"Estimated %s " + dStr +
" to complete transit", initPad, tc,
515 h,
"" + daysRemaining);
516 }
else if (
action == GateHaulerAction.INBOUND) {
567 info.
addPara(
"The gate hauler is dormant, its systems shut down to conserve power.", opad);
570 info.
addPara(
"The gate hauler is in the process of reactivating its systems and should be operational "
571 +
"within a day.", opad);
572 }
else if (
action ==
null) {
573 info.
addPara(
"The gate hauler is operational and ready to travel to another star system or "
574 +
"deploy its gate at a stable location.", opad);
575 }
else if (
action == GateHaulerAction.OUTBOUND) {
576 info.
addPara(
"The gate hauler is outbound from its current location, "
577 +
"heading for open space and accelerating.", opad);
579 String dStr =
"days";
581 info.
addPara(
"Once it's in open space, it's estimated that it will take %s " + dStr +
" until it arrives "
583 +
"it will take some time to decelerate and attain a parking orbit.", opad,
585 }
else if (
action == GateHaulerAction.DEEP_SPACE_TRANSIT) {
586 String dStr =
"days";
588 if (daysRemaining < 1) daysRemaining = 1;
589 if (daysRemaining == 1) dStr =
"day";
590 info.
addPara(
"The gate hauler is in transit, in deep space. It's estimated that it will take %s " + dStr +
" until it arrives "
592 +
"it will take some time to decelerate and attain a parking orbit.", opad,
593 h,
"" + daysRemaining);
594 }
else if (
action == GateHaulerAction.INBOUND) {
596 +
"and is decelerating in order to attain a parking orbit.", opad);
597 }
else if (
action == GateHaulerAction.DEPLOYING) {
598 info.
addPara(
"The gate hauler has been given an order to deploy its gate.", opad);
615 Set<String> tags = super.getIntelTags(map);
631 return "Gate Hauler";
655 return "ui_discovered_entity";
668 boolean showArrow =
action == GateHaulerAction.OUTBOUND ||
action == GateHaulerAction.DEEP_SPACE_TRANSIT;
669 if (!showArrow)
return null;
675 List<ArrowData> result =
new ArrayList<ArrowData>();
static SettingsAPI getSettings()
static SectorAPI getSector()
void setLongBurn(boolean longBurn)
CampaignEntityMovementUtil getMovement()
CampaignEngineGlowUtil getEngineGlow()
static float ACCELERATION
static final String EXTENDED
static final String INACTIVE_GATE
static final String NEUTRAL
Set< String > getTagsForSort()
String getSortStringNewestFirst()
void addLogTimestamp(TooltipMakerAPI info, Color tc, float opad)
void unindent(TooltipMakerAPI info)
void sendUpdateIfPlayerHasIntel(Object listInfoParam, TextPanelAPI textPanel)
Object getListInfoParam()
Color getBulletColorForMode(ListInfoMode mode)
void bullet(TooltipMakerAPI info)
Color getTitleColor(ListInfoMode mode)
void createIntelInfo(TooltipMakerAPI info, ListInfoMode mode)
GateHaulerIntel(SectorEntityToken gateHauler)
GateHaulerAction getAction()
SectorEntityToken stableLocation
String getCommMessageSound()
FactionAPI getFactionForUIColors()
GateHaulerEntityPlugin getPlugin()
static float TRANSIT_DAYS_BASE
int computeTransitDays(StarSystemAPI destination)
List< ArrowData > getArrowData(SectorMapAPI map)
void createSmallDescription(TooltipMakerAPI info, float width, float height)
static float TRANSIT_SPEED_LY_PER_CYCLE
void advance(float amount)
StarSystemAPI destination
String getSmallDescriptionTitle()
void setAction(GateHaulerAction action)
Set< String > getIntelTags(SectorMapAPI map)
SectorEntityToken gateHauler
static Object UPDATE_WITNESSED_ARRIVAL
void initiateDeployment(SectorEntityToken stableLocation)
void initiateDeparture(StarSystemAPI destination)
SectorEntityToken getMapLocation(SectorMapAPI map)
SectorEntityToken parkingOrbit
void addBulletPoints(TooltipMakerAPI info, ListInfoMode mode)
float elapsedDaysInAction
SectorEntityToken getGateHauler()
static List< OrbitGap > findGaps(SectorEntityToken center, float minPad, float maxDist, float minGap)
static AddedEntity addNonSalvageEntity(LocationAPI system, EntityLocation loc, String type, String faction)
void advance(float amount)
void moveInDirection(float dir)
void setLocation(Vector2f loc)
void setFaceInOppositeDirection(boolean faceInOppositeDirection)
void setVelocity(Vector2f vel)
void setFacing(float facing)
void moveToLocation(Vector2f loc)
void setTurnThenAccelerate(boolean turnThenAccelerate)
static Color getTextColor()
static float getDistanceLY(SectorEntityToken from, SectorEntityToken to)
static Vector2f getUnitVectorAtDegreeAngle(float degrees)
static SectorEntityToken addDebrisField(LocationAPI loc, DebrisFieldParams params, Random random)
static Color getGrayColor()
static void fadeAndExpire(SectorEntityToken entity)
static float getDistance(SectorEntityToken from, SectorEntityToken to)
static float getDays(float amount)
static Color getHighlightColor()
static Vector2f getPointAtRadius(Vector2f from, float r)
static void fadeIn(final SectorEntityToken entity, final float in)
static boolean isInArc(float direction, float arc, Vector2f from, Vector2f to)
static float getAngleInDegrees(Vector2f v)
Description getDescription(String id, Type type)
String getSpriteName(String category, String id)
List< SectorEntityToken > getAllEntities()
List< SectorEntityToken > getEntitiesWithTag(String tag)
List< PlanetAPI > getPlanets()
String getNameWithLowercaseType()
void addEntity(SectorEntityToken entity)
SectorEntityToken createToken(float x, float y)
void removeEntity(SectorEntityToken entity)
MemoryAPI getMemoryWithoutUpdate()
String getNameWithLowercaseTypeShort()
CampaignFleetAPI getPlayerFleet()
void addScript(EveryFrameScript script)
MemoryAPI getPlayerMemoryWithoutUpdate()
void removeScript(EveryFrameScript script)
IntelManagerAPI getIntelManager()
MutableCharacterStatsAPI getPlayerStats()
LocationAPI getContainingLocation()
CustomCampaignEntityPlugin getCustomPlugin()
void setAlwaysUseSensorFaderBrightness(Boolean alwaysUseSensorFaderBrightness)
boolean isInCurrentLocation()
void setExpired(boolean expired)
void setCircularOrbit(SectorEntityToken focus, float angle, float orbitRadius, float orbitDays)
void addDropValue(String group, int value)
void setDiscoverable(Boolean discoverable)
void setOrbit(OrbitAPI orbit)
StarSystemAPI getStarSystem()
String getCustomDescriptionId()
Vector2f getLocationInHyperspace()
MemoryAPI getMemoryWithoutUpdate()
void removeTag(String tag)
void setDiscoveryXP(Float discoveryXP)
InteractionDialogImageVisual getCustomInteractionDialogImageVisual()
SectorEntityToken getHyperspaceAnchor()
SectorEntityToken getCenter()
List< IntelInfoPlugin > getIntel()
void set(String key, Object value)
boolean getBoolean(String key)
void addStoryPoints(int storyPoints)