Algester

Untitled

Jun 10th, 2020
2,023
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. runcode String name = "Planet_Name";
  2.     float Min = 100;
  3.     float Max = 300;
  4.     String PlanetType = "planet_terrain_type";
  5.     float planetRadius = Min + new Random().nextFloat() * (Max - Min);
  6.     SectorEntityToken fleet = Global.getSector().getPlayerFleet();
  7.     StarSystemAPI sys = (StarSystemAPI)fleet.getContainingLocation();
  8.     SectorEntityToken star = sys.getStar();
  9.     float orbitRadius = com.fs.starfarer.api.util.Misc.getDistance(fleet, sys.getCenter());
  10.     float orbitDays = orbitRadius / (20f + new Random().nextFloat() * 10f);
  11.     float angle = com.fs.starfarer.api.util.Misc.getAngleInDegrees(sys.getCenter().getLocation(), fleet.getLocation());
  12.     PlanetAPI world = sys.addPlanet( name, star, name, PlanetType,
  13.         angle, planetRadius, orbitRadius, orbitDays);
  14.     sys.updateAllOrbits();
  15.  
  16. //Moon Spawning
  17. //to get Planet ID since we can't get the context market interacted with you will need to use devmode and do a memory dump
  18. runcode String id = "Planet_ID";
  19.     String moonName = "Moon Name";
  20.     String terrainType = "Planet Terrain";
  21.     float Min = 90;
  22.     float Max = 150;
  23.     float moonRadius = Min + new Random().nextFloat() * (Max - Min);
  24.     SectorEntityToken fleet = Global.getSector().getPlayerFleet();
  25.     StarSystemAPI sys = (StarSystemAPI)fleet.getContainingLocation();
  26.     SectorEntityToken star = sys.getEntityById(id);
  27.     float orbitRadius = com.fs.starfarer.api.util.Misc.getDistance(fleet, star);
  28.     float orbitDays = orbitRadius / (20f + new Random().nextFloat() * 10f);
  29.     float angle = com.fs.starfarer.api.util.Misc.getAngleInDegrees(sys.getCenter().getLocation(), fleet.getLocation());
  30.     PlanetAPI world = sys.addPlanet(moonName, star, moonName, terrainType,
  31.         angle, moonRadius, orbitRadius, orbitDays);
  32.     sys.updateAllOrbits();
  33.  
  34. //Replace terrain_type with the following
  35. //terran = terran planet world
  36. //terran-eccentric = terran eccentric world
  37. //barren = barren world
  38. //cryovolcanic = cryovolcanic world
  39. //arid = arid world
  40. //barren-bombarded = barren bombarded world
  41. //water = water world
  42. //gas_giant = ordinary gas giant
  43. //ice_giant = ice giant
  44. //frozen = frozen world
  45. //lava = volcanic world
  46. //toxic = toxic world
  47. //desert = desert world
  48. //jungle = jungle world
  49. //tundra = tundra world
  50. //rocky_ice = rocky ice world
  51. //rocky_unstable = rocky unstable world
  52. //radiated = irridiated world
  53.  
  54.  
  55. //there are some planets that come in different texture flavors
  56. //barren1
  57. //barren2
  58. //barren3
  59. //barren_castiron
  60. //desert1
  61. //frozen1
  62. //frozen2
  63. //lava_minor
Add Comment
Please, Sign In to add comment