For anyone who wants to make a planet orbit around another planet
runcode PlanetAPI planet = (PlanetAPI) $loc.getEntityById("desired planet"); $loc.addPlanet("cc_barren", planet, "Barren World", "barren", VectorUtils.getAngle(planet.getLocation(), $playerLoc), 150, MathUtils.getDistance(planet.getLocation(), $playerLoc), 120)
Change "desired planet" to the planet you want it to be orbiting around (can be gained by typing list planets in console)
Change "cc_barren" to something fitting(Not too sure right now what it does again)
Change "Barren World" to your desired name
Change "barren" to the type of world(can be gained by typing list conditions)
Change the 150 before mathUtils for size
Change the 120 at the end for planet_orbit_length
If you are not happy with the planet you made dock at it and run the below code to get rid off it
runcode SectorEntityToken ent = Global.getSector().getCampaignUI().getCurrentInteractionDialog().getInteractionTarget(); if (ent.getMarket() != null) Global.getSector().getEconomy().removeMarket(ent.getMarket()); ent.getContainingLocation().removeEntity(ent);
Am still trying to figure out how to write the adding market data so for now it is just a blank planet (Maybe someone knows how we can do it based on type so that we don't have to manually pick and choose?)
And for spawning a general planet to move around a star run the following code
runcode PlanetAPI star = ((StarSystemAPI) $loc).getStar(); $loc.addPlanet("cc_barren", star, "Barren World"", "barren", VectorUtils.getAngle(star.getLocation(), $playerLoc), 150, MathUtils.getDistance(star.getLocation(), $playerLoc), 120)
To get a planet to follow a specific star in your system run the following code and change "change to star name" to the star you found in the list planets it would look something like this
"system_a488" < this is your main star
"system_a488_b < this is your second star And so on
runcode PlanetAPI star = (PlanetAPI) $loc.getEntityById("change to star name"); $loc.addPlanet("cc_barren", star, "Barren World", "barren", VectorUtils.getAngle(star.getLocation(), $playerLoc), 150, MathUtils.getDistance(star.getLocation(), $playerLoc), 120)
I hope this will help for the few of us who keep asking how to do this, once i find out or someone shares with me how to add conditions based on planet type i will update this post to include that