Advertisement
LJLim

Starsector hyperspace station quick hax

Jun 4th, 2017
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.15 KB | None | 0 0
  1. package data.scripts.world.systems;
  2.  
  3. import java.awt.Color;
  4.  
  5. import com.fs.starfarer.api.Global;
  6. import com.fs.starfarer.api.campaign.LocationAPI;
  7. import com.fs.starfarer.api.campaign.PlanetAPI;
  8. import com.fs.starfarer.api.campaign.SectorAPI;
  9. import com.fs.starfarer.api.campaign.SectorEntityToken;
  10. import com.fs.starfarer.api.campaign.StarSystemAPI;
  11. import com.fs.starfarer.api.campaign.econ.MarketAPI;
  12. import com.fs.starfarer.api.campaign.econ.MarketAPI.SurveyLevel;
  13. import com.fs.starfarer.api.impl.campaign.ids.Conditions;
  14. import com.fs.starfarer.api.impl.campaign.ids.Factions;
  15. import com.fs.starfarer.api.impl.campaign.ids.Submarkets;
  16. import com.fs.starfarer.api.impl.campaign.ids.Terrain;
  17. import com.fs.starfarer.api.impl.campaign.procgen.StarAge;
  18. import com.fs.starfarer.api.impl.campaign.procgen.StarSystemGenerator;
  19. import com.fs.starfarer.api.impl.campaign.terrain.MagneticFieldTerrainPlugin.MagneticFieldParams;
  20.  
  21. public class Duzahk {
  22.  
  23.     // testing hax; do not keep
  24.     public void addHyperspaceStation(SectorAPI sector) {
  25.         LocationAPI hyper = Global.getSector().getHyperspace();
  26.        
  27.         SectorEntityToken hyperstation = hyper.addCustomEntity("hyperstation_test", "Hyper Station", "station_mining00", Factions.INDEPENDENT);
  28.         hyperstation.setInteractionImage("illustrations", "orbital");
  29.         hyperstation.setCircularOrbit(hyper.createToken(0, 0), 0, 500, 100);
  30.        
  31.         // create a market for derinkuyuStation - not connected to the rest of the economy to start with
  32.         MarketAPI market = Global.getFactory().createMarket("derinkuyu_market", hyperstation.getName(), 0);
  33.         market.setSize(4);
  34.         market.setFactionId(Factions.PIRATES);
  35.        
  36.         market.setSurveyLevel(SurveyLevel.FULL);
  37.         market.setPrimaryEntity(hyperstation);
  38.        
  39.         market.setFactionId(hyperstation.getFaction().getId());
  40.         market.addCondition(Conditions.POPULATION_4);
  41.         market.addCondition(Conditions.ORBITAL_STATION);
  42.         market.addCondition(Conditions.ORE_COMPLEX);
  43.         market.addCondition(Conditions.ORE_COMPLEX);
  44.         market.addCondition(Conditions.FREE_PORT);
  45.        
  46.         market.addSubmarket(Submarkets.SUBMARKET_OPEN);
  47.         market.addSubmarket(Submarkets.SUBMARKET_BLACK);
  48.         market.addSubmarket(Submarkets.SUBMARKET_STORAGE);
  49.        
  50.         hyperstation.setMarket(market);
  51.         sector.getEconomy().addMarket(market);
  52.     }
  53.  
  54.     public void generate(SectorAPI sector) {
  55.         addHyperspaceStation(sector);
  56.        
  57.         StarSystemAPI system = sector.createStarSystem("Duzahk");
  58.         LocationAPI hyper = Global.getSector().getHyperspace();
  59.        
  60.         system.setBackgroundTextureFilename("graphics/backgrounds/background1.jpg");
  61.        
  62.         // create the star and generate the hyperspace anchor for this system
  63.         PlanetAPI duzahk_star = system.initStar("duzahk", // unique id for this star
  64.                                             "star_orange",  // id in planets.json
  65.                                             600f,         // radius (in pixels at default zoom)
  66.                                             500); // corona radius, from star edge
  67.         duzahk_star.getSpec().setGlowTexture(Global.getSettings().getSpriteName("hab_glows", "banded"));
  68.         duzahk_star.getSpec().setGlowColor(new Color(255,235,50,128));
  69.         duzahk_star.getSpec().setAtmosphereThickness(0.5f);
  70.         duzahk_star.applySpecChanges();
  71.        
  72.         system.setLightColor(new Color(255, 240, 220)); // light color in entire system, affects all entities
  73.        
  74.  
  75.         // Hot Jupiter, stark blue.
  76.         PlanetAPI duzahk1 = system.addPlanet("duzahk1", duzahk_star, "Aka Mainyu", "gas_giant", 0, 230, 1550, 24);
  77.         duzahk1.getSpec().setPlanetColor(new Color(16,16,255,255));
  78.         duzahk1.getSpec().setGlowTexture(Global.getSettings().getSpriteName("hab_glows", "banded"));
  79.         duzahk1.getSpec().setGlowColor(new Color(235,38,8,145));
  80.         duzahk1.getSpec().setUseReverseLightForGlow(true);
  81.         duzahk1.getSpec().setAtmosphereThickness(0.5f);
  82.         duzahk1.getSpec().setCloudRotation( 15f );
  83.         duzahk1.getSpec().setAtmosphereColor(new Color(138,118,255,245));
  84.         duzahk1.getSpec().setPitch( -5f );
  85.         duzahk1.getSpec().setTilt( 30f );
  86.         duzahk1.applySpecChanges();
  87.         duzahk1.setCustomDescriptionId("planet_aka_mainyu");
  88.        
  89.         system.addCorona(duzahk1, Terrain.CORONA_AKA_MAINYU,
  90.                         300f, // radius outside planet
  91.                         5f, // burn level of "wind"
  92.                         0f, // flare probability
  93.                         1f // CR loss mult while in it
  94.                         );
  95.        
  96.         // duzahk_star magnetic field
  97.             SectorEntityToken field = system.addTerrain(Terrain.MAGNETIC_FIELD,
  98.             new MagneticFieldParams(500f, // terrain effect band width
  99.                     2000, // terrain effect middle radius
  100.                     duzahk_star, // entity that it's around
  101.                     1750f, // visual band start
  102.                     2250f, // visual band end
  103.                     new Color(50, 20, 100, 40), // base color
  104.                     1f, // probability to spawn aurora sequence, checked once/day when no aurora in progress
  105.                     new Color(50, 20, 110, 130),
  106.                     new Color(150, 30, 120, 150),
  107.                     new Color(200, 50, 130, 190),
  108.                     new Color(250, 70, 150, 240),
  109.                     new Color(200, 80, 130, 255),
  110.                     new Color(75, 0, 160),
  111.                     new Color(127, 0, 255)
  112.                     ));
  113.             field.setCircularOrbit(duzahk_star, 0, 0, 150);
  114.        
  115.         // Asteroid belt!
  116.         system.addRingBand(duzahk_star, "misc", "rings_asteroids0", 256f, 0, Color.white, 256f, 2420, 34f, null, null);
  117.         system.addAsteroidBelt(duzahk_star, 50, 2400, 100, 30, 40, Terrain.ASTEROID_BELT, "The Daevas");
  118.        
  119.         //system.addRingBand(duzahk_star, "misc", "rings3", 256, 2, new Color(255,245,235,255), 256, 2500, 90f);
  120.         //system.addRingBand(duzahk_star, "misc", "rings4", 512f, 1, new Color(235,38,8,145), 512f, 2500, 90f);
  121.         //system.addRingBand(duzahk_star, "misc", "rings4", 512f, 1, new Color(200,190,140,200), 512f, 2500, 120f);
  122.         //system.addRingBand(duzahk_star, "misc", "rings5", 1024f, 0, new Color(200,190,170,250), 1024f, 2800, 140f);
  123.        
  124.         // Lies!
  125.         PlanetAPI duzahk2 = system.addPlanet("duzahk2", duzahk_star, "Druj", "barren", 130, 60, 4200, 135);
  126.         duzahk2.getSpec().setGlowTexture(Global.getSettings().getSpriteName("hab_glows", "aurorae"));
  127.         duzahk2.getSpec().setGlowColor(new Color(20,255,48,125));
  128.         duzahk2.getSpec().setUseReverseLightForGlow(true);
  129.         duzahk2.applySpecChanges();
  130.         duzahk2.setCustomDescriptionId("planet_druj");
  131.        
  132.         // Druj Relay - L5 (behind)
  133.         SectorEntityToken druj_relay = system.addCustomEntity("druj_relay", // unique id
  134.                  "Druj Relay", // name - if null, defaultName from custom_entities.json will be used
  135.                  "comm_relay", // type of object, defined in custom_entities.json
  136.                  "pirates"); // faction
  137.         druj_relay.setCircularOrbitPointingDown( duzahk_star, 130 - 60, 4200, 135);
  138.  
  139.         //JumpPointAPI jumpPoint = Global.getFactory().createJumpPoint("penelope_jump_point_alpha", "Penelope's Star Inner System Jump");
  140.         //OrbitAPI orbit = Global.getFactory().createCircularOrbit(penelope_star, 0, 800, 45);
  141.         //jumpPoint.setOrbit(orbit);
  142.         //jumpPoint.setRelatedPlanet(penelope_star);
  143.         //jumpPoint.setStandardWormholeToHyperspaceVisual();
  144.         //system.addEntity(jumpPoint);
  145.        
  146.         float radiusAfter = StarSystemGenerator.addOrbitingEntities(system, duzahk_star, StarAge.AVERAGE,
  147.                 1, 3, // min/max entities to add
  148.                 7000, // radius to start adding at
  149.                 2, // name offset - next planet will be <system name> <roman numeral of this parameter + 1>
  150.                 false);
  151.                 //true); // whether to use custom or system-name based names
  152.  
  153.         system.autogenerateHyperspaceJumpPoints(true, true);
  154.     }
  155. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement