Avanitia

Starsector - runcode commands

Feb 29th, 2020 (edited)
2,095
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.98 KB | None | 0 0
  1. // These commands work - I use them myself, so if they don't work, you fucked up.
  2.  
  3. // Spawns Stable Location at your fleet's position, will be orbiting nearby star:
  4. runcode SectorEntityToken fleet = Global.getSector().getPlayerFleet();
  5.       StarSystemAPI sys = (StarSystemAPI)fleet.getContainingLocation();
  6.       SectorEntityToken stable = fleet.getContainingLocation().addCustomEntity(null, null, "stable_location", "neutral");
  7.       float orbitRadius = com.fs.starfarer.api.util.Misc.getDistance(fleet, sys.getCenter());
  8.       float orbitDays = orbitRadius / (20f + new Random().nextFloat() * 5f);
  9.       float angle = com.fs.starfarer.api.util.Misc.getAngleInDegrees(sys.getCenter().getLocation(), fleet.getLocation());
  10.       stable.setCircularOrbit(sys.getCenter(), angle, orbitRadius, orbitDays);
  11.  
  12. // You can replace "stable_location" with something different:
  13. // derelict_probe - Domain-era Probe
  14. // derelict_survey_ship - Domain-era Survey Ship
  15. // derelict_mothership - Domain-era Mothership
  16. // derelict_cryosleeper - Cryosleeper
  17. // supply_cache - Supply Cache
  18. // station_research - Research Station
  19. // orbital_habitat - Orbital Habitat
  20. // station_mining - Mining Station
  21. // inactive_gate - Gate
  22. // coronal_tap - Coronal Hypershunt
  23.  
  24. // [REQUIRES NEXERELIN] Spawns Prism Freeport in hyperspace if you forgot to enable it - don't use if you have it spawned, you must disable starscape on sector map to see it (press "1" when looking at map, it goes from pretty to less pretty, but more informative look) [REQUIRES NEXERELIN]
  25. runcode new exerelin.world.ExerelinNewGameSetup().addPrismMarket(Global.getSector(), false);
  26. // (REQUIRES NEXERELIN)
  27. // If you spawned another Prism anyway, I can't help you
  28.  
  29. // Thanks to tomatopaste for this one - removes jump point when sitting on top of it (removes jump point from the system itself and Hyperspace)
  30. //  I CAN'T guarantee that command is entirely safe - it might cause a nullpointer crash if there is an AI fleet on its way to use the jump point you've just removed - SAVE BEFORE USING
  31. runcode StarSystemAPI starSystem = Global.getSector().getPlayerFleet().getStarSystem();
  32.                 for (SectorEntityToken jumpPointAPI : starSystem.getJumpPoints()) {
  33.                     if (100 > MathUtils.getDistance(jumpPointAPI.getLocation(), Global.getSector().getPlayerFleet().getLocation())) {
  34.                         starSystem.removeEntity(jumpPointAPI);
  35.                         Global.getSector().getHyperspace().removeEntity(jumpPointAPI);
  36.                     }
  37.                 }    
  38. // Don't use on last jump point into the system, it should be obvious, right?
  39.  
  40. // Thanks to Histidine for this one - adds jump point on same orbit as player is currently on, orbiting a star (will be helpful in case you remove last jump point, heh)
  41.  
  42. runcode import com.fs.starfarer.api.campaign.JumpPointAPI.JumpDestination;
  43. Random rndm = new Random();
  44.         StarSystemAPI starSystem = Global.getSector().getPlayerFleet().getStarSystem();
  45.         int num = starSystem.getJumpPoints().size();
  46.         float angle = 0;    // TODO: should probably compute this from player's current position
  47.        
  48.         JumpPointAPI newJumpPoint = Global.getFactory().createJumpPoint("console_added_jumppoint" + rndm.nextInt(), "Hyperspace Jump Point " + num);
  49.         float distance = MathUtils.getDistance(Global.getSector().getPlayerFleet().getLocation(), starSystem.getStar().getLocation());
  50.         OrbitAPI newJumpPointOrbitAroundStar = Global.getFactory().createCircularOrbit(starSystem.getStar(), angle, distance, distance / 10);
  51.         newJumpPoint.setOrbit(newJumpPointOrbitAroundStar);
  52.         newJumpPoint.setStandardWormholeToHyperspaceVisual();
  53.         starSystem.addEntity(newJumpPoint);
  54.  
  55.         JumpPointAPI newJumpPoint2 = Global.getFactory().createJumpPoint("console_added_jumppoint_space" + rndm.nextInt(), "Hyperspace Jump Point " + num);
  56.         Global.getSector().getHyperspace().addEntity(newJumpPoint2);
  57.         newJumpPoint2.setLocation(newJumpPoint.getLocationInHyperspace().x, newJumpPoint.getLocationInHyperspace().y);
  58.         //distance = Misc.getDistance(newJumpPoint2, starSystem.getHyperspaceAnchor());
  59.         newJumpPoint2.setCircularOrbit(starSystem.getHyperspaceAnchor(), angle, distance/10, distance/10);
  60.        
  61.         newJumpPoint.addDestination(new JumpDestination(newJumpPoint2, "hyperspace"));
  62.         newJumpPoint2.addDestination(new JumpDestination(newJumpPoint, newJumpPoint.getName()));
  63.  
  64. // LazyWizard wrote this one - it allows you to add a ship/ship's variant into your fleet, with specified amount of d-mods; I know addship command exists already - this one adds ship with d-mods. Really good for your roleplaying needs or when you just want to suffer.
  65.  
  66. runcode FleetMemberAPI ship = Global.getFactory().createFleetMember(FleetMemberType.SHIP, "variant_ID_here"); com.fs.starfarer.api.impl.campaign.DModManager.addDMods(ship, false, 4, MathUtils.getRandom()); com.fs.starfarer.api.impl.campaign.DModManager.setDHull(ship.getVariant()); Global.getSector().getPlayerFleet().getFleetData().addFleetMember(ship);
  67.  
  68. // "variant_ID_here" - use 'list hulls' or 'list variants' <hullname> to find what you're looking for; or just go into the game's / mod's files and find the ID there
  69. // for example, list hulls onslaught will find any ship hull that has an 'onslaught' in its name
  70. // while list variants onslaught will find any variants (loadouts) for ship that has 'onslaught' in its name
  71. // if you want an empty hull, use list hulls command and add the "_Hull" to ship's ID; conquest_Hull would give you an empty Conquest battlecruiser for example
  72. // number (4) in example in second line - this specifies amount of d-mods ship will get
  73. // if you'll replace "variant_ID_here" with "onslaught_Hull" and the number with 2, you'll get an Onslaught with 2 d-mods
  74.  
  75.  
  76. // Thanks to gbb1402 and Wisp for this command - it adds / upgrades skill of the human administrator. Everything here (administrator name, skill names) ARE CASE-SENSITIVE. If command does not work, it is your fault. As long as you are on Starsector 0.95a RC15 anyways.
  77. for (AdminData admin : Global.getSector().getCharacterData().getAdmins()) {
  78.             if (admin.getPerson().getName().equals("ADMIN NAME")) {
  79.                 admin.getPerson().getStats().increaseSkill(Skills.NAME_HERE);
  80.                 Console.showMessage("Modified admin: " + admin.getPerson().getNameString())
  81.             } else {
  82.                 Console.showMessage("Did not modify admin: " + admin.getPerson().getNameString());
  83.             }
  84.         }
  85. // "ADMIN NAME" - put Administrator's name there, they are getting brain surgery
  86. // Skills.NAME_HERE - replace that with skills below
  87. //Skill options:
  88. //  Skills.SPACE_OPERATIONS - Space Operations
  89. //  Skills.PLANETARY_OPERATIONS - Planetary Operations
  90. //  Skills.INDUSTRIAL_PLANNING - Industrial Planning
  91.  
  92. // Thanks to theDragn for this one - it sets the remaining disruption timers on market you are currently at to 1 day. Useful in case you're using Nex and was too happy with Tactical Bombardments or just raided markets too enthusiastically. Gotta get all the blueprints right?
  93.  
  94. runcode MarketAPI market = Global.getSector().getCampaignUI().getCurrentInteractionDialog().getInteractionTarget().getMarket();
  95.         for (Industry industry : market.getIndustries())
  96.         {
  97.             industry.setDisrupted(1f);
  98.         }
  99. // REQUIRES VAYRA'S SECTOR FROM THE UNOFFICIAL DISCORD
  100. // Thanks to theDragn for this one - this runcode gives you the reward you are supposed to get after reaching level 20 in the DnD bar minigame... because you might be still sane and not want to grind to level 20 in every single save.
  101. // What's the reward? +5% OP on every ship in your fleet
  102. // Still cheating tho.
  103. runcode Global.getSector().getPlayerStats().getShipOrdnancePointBonus().modifyMult("$vayra_dungeonMasterRetiredLevelTwenty", 1.05f, "Arcane secrets of engineering");
  104. Global.getSector().getMemoryWithoutUpdate().set("$vayra_dungeonMasterRetiredLevelTwenty", true);
  105. // REQUIRES VAYRA'S SECTOR FROM THE UNOFFICIAL DISCORD
Add Comment
Please, Sign In to add comment