Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- runcode import com.fs.starfarer.api.impl.campaign.procgen.themes.BaseThemeGenerator;
- import com.fs.starfarer.api.impl.campaign.procgen.themes.BaseThemeGenerator.AddedEntity;
- import com.fs.starfarer.api.impl.campaign.procgen.themes.BaseThemeGenerator.EntityLocation;
- import com.fs.starfarer.api.util.WeightedRandomPicker;
- import com.fs.starfarer.api.impl.campaign.procgen.StarSystemGenerator.StarSystemType;
- import com.fs.starfarer.api.impl.campaign.procgen.themes.MiscellaneousThemeGenerator.MakeCoronalTapFaceNearestStar;
- // set star system name here
- StarSystemAPI system = Global.getSector().getStarSystem("Corvus");
- String factionId = Factions.NEUTRAL;
- Random random = new Random();
- AddedEntity entity = null;
- if (system.getType() == StarSystemType.TRINARY_2CLOSE) {
- EntityLocation loc = new EntityLocation();
- loc.location = new Vector2f();
- entity = BaseThemeGenerator.addEntity(random, system, loc, Entities.CORONAL_TAP, factionId);
- if (entity != null) {
- system.addScript(new MakeCoronalTapFaceNearestStar(entity.entity));
- }
- } else {
- WeightedRandomPicker picker = new WeightedRandomPicker();
- WeightedRandomPicker fallback = new WeightedRandomPicker();
- for (PlanetAPI planet : system.getPlanets()) {
- if (!planet.isNormalStar()) continue;
- if (planet.getTypeId().equals(StarTypes.BLUE_GIANT) ||
- planet.getTypeId().equals(StarTypes.BLUE_SUPERGIANT)) {
- picker.add(planet);
- } else {
- fallback.add(planet);
- }
- }
- if (picker.isEmpty()) {
- picker.addAll(fallback);
- }
- PlanetAPI star = (PlanetAPI)picker.pick();
- if (star != null) {
- CustomEntitySpecAPI spec = Global.getSettings().getCustomEntitySpec(Entities.CORONAL_TAP);
- EntityLocation loc = new EntityLocation();
- float orbitRadius = star.getRadius() + spec.getDefaultRadius() + 100f;
- float orbitDays = orbitRadius / 20f;
- loc.orbit = Global.getFactory().createCircularOrbitPointingDown(star, random.nextFloat() * 360f, orbitRadius, orbitDays);
- entity = BaseThemeGenerator.addEntity(random, system, loc, Entities.CORONAL_TAP, factionId);
- }
- }
Add Comment
Please, Sign In to add comment