1package com.fs.starfarer.api.impl.campaign.terrain;
3import java.util.ArrayList;
5import java.util.Random;
7import org.lwjgl.util.vector.Vector2f;
9import com.fs.starfarer.api.Global;
10import com.fs.starfarer.api.campaign.CampaignFleetAPI;
11import com.fs.starfarer.api.campaign.LocationAPI;
12import com.fs.starfarer.api.campaign.StarSystemAPI;
13import com.fs.starfarer.api.impl.campaign.enc.EncounterPoint;
14import com.fs.starfarer.api.impl.campaign.enc.EncounterPointProvider;
15import com.fs.starfarer.api.impl.campaign.procgen.StarSystemGenerator.StarSystemType;
16import com.fs.starfarer.api.util.Misc;
40 public static class AbyssalEPData {
47 public float distToNearest = Float.MAX_VALUE;
49 public AbyssalEPData() {
59 protected Random
random =
new Random();
77 float baseW = 100000f;
80 float normalizedX = (loc.x + w/2f) / baseW;
81 float normalizedY = (loc.y + h/2f) / baseH;
83 float test = (float) (Math.sqrt(Math.max(0f, normalizedX)) + Math.sqrt(Math.max(0f, normalizedY)));
95 float depthBasedOnCorner = 0f;
97 float threshold = 0.95f;
103 depthBasedOnCorner = (1f - (test - threshold) / (1f - threshold));
105 if (test < threshold) depthBasedOnCorner = 1f;
106 else depthBasedOnCorner = 1f - (test - threshold) / (1f - threshold);
113 float left = -w/2f - loc.x;
114 float below = -h/2f - loc.y;
115 float right = loc.x - w/2f;
116 float above = loc.y - h/2f;
118 float max = Math.max(left, Math.max(right, Math.max(above, below)));
126 return Math.max(depthBasedOnCorner, max / 2000f);
128 return Math.min(1f, Math.max(depthBasedOnCorner, max / 2000f));
133 return depthBasedOnCorner;
147 List<StarSystemAPI> abyssal =
new ArrayList<StarSystemAPI>();
178 float startAngle =
random.nextFloat() * 360f;
179 for (
float angle = startAngle; angle < startAngle + 360f; angle += 30f) {
193 String
id =
"abyssal_" + (int)(loc.x/1000f) +
"_" + (int)(loc.y/1000f);
196 AbyssalEPData data =
new AbyssalEPData();
200 float minDist = Float.MAX_VALUE;
205 if (system.getType() == StarSystemType.DEEP_SPACE) {
208 if (distToSystem < testDist && distToSystem < minDist) {
209 minDist = distToSystem;
213 if (nearest !=
null) {
214 data.nearest = nearest;
215 data.distToNearest = minDist;
static SettingsAPI getSettings()
static SectorAPI getSector()
Vector2f playerLocWhenGeneratingEPs
float getAbyssalDepth(Vector2f loc, boolean uncapped)
static float DEPTH_THRESHOLD_FOR_FLEETS_FLEEING
static float DEPTH_THRESHOLD_FOR_DWELLER_LIGHT
static float JUMP_POINT_DETECTED_RANGE
static float NASCENT_WELL_DETECTED_RANGE
List< StarSystemAPI > getAbyssalSystems()
List< EncounterPoint > generateEncounterPoints(LocationAPI where)
HyperspaceAbyssPluginImpl()
void advance(float amount)
static float DEPTH_THRESHOLD_FOR_ABYSSAL_LIGHT
static float GAS_GIANT_DETECTED_RANGE
static float PLAYER_DIST_TRAVELLED_TO_REGEN_EPS
static float DEPTH_THRESHOLD_FOR_ABYSSAL_STELLAR_OBJECT
static float DEPTH_THRESHOLD_FOR_ABYSSAL_STAR_SYSTEM
static float DEPTH_THRESHOLD_FOR_ENCOUNTER
static float ENCOUNTER_NEAR_ABYSSAL_SYSTEM_DIST
static float DEPTH_THRESHOLD_FOR_NO_DUST_PARTICLES_IN_COMBAT
static float STAR_DETECTED_RANGE
static String EP_TYPE_ABYSSAL
List< EncounterPoint > encounterPoints
static Vector2f getUnitVectorAtDegreeAngle(float degrees)
static Random getRandom(long seed, int level)
static float getDistance(SectorEntityToken from, SectorEntityToken to)
static float getAbyssalDepth(Vector2f loc)
static Vector2f getPointWithinRadius(Vector2f from, float r)
float getFloat(String key)
CampaignFleetAPI getPlayerFleet()
List< StarSystemAPI > getStarSystems()
ListenerManagerAPI getListenerManager()
void addListener(Object listener)
boolean hasListener(Object listener)