|
楼主 |
发表于 2024-12-14 22:40:57
|
显示全部楼层
改了一下代码,现在星系内该生成的东西都正常了,但还是null跳出崩溃
本帖最后由 遥远繁星 于 2024-12-15 08:56 编辑
package data.scripts.world.systems;
import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.campaign.*;
import com.fs.starfarer.api.campaign.econ.*;
import com.fs.starfarer.api.campaign.CargoAPI.CargoItemType;
import com.fs.starfarer.api.campaign.JumpPointAPI;
import com.fs.starfarer.api.campaign.LocationAPI;
import com.fs.starfarer.api.campaign.PlanetAPI;
import com.fs.starfarer.api.campaign.SectorAPI;
import com.fs.starfarer.api.campaign.SectorEntityToken;
import com.fs.starfarer.api.campaign.StarSystemAPI;
import com.fs.starfarer.api.impl.campaign.procgen.StarSystemGenerator;
import com.fs.starfarer.api.fleet.FleetMemberType;
import com.fs.starfarer.api.impl.*;
import com.fs.starfarer.api.impl.campaign.ids.*;
import com.fs.starfarer.api.impl.campaign.procgen.*;
import com.fs.starfarer.api.impl.campaign.terrain.BaseRingTerrain.RingParams;
import com.fs.starfarer.api.impl.campaign.terrain.MagneticFieldTerrainPlugin.*;
import com.fs.starfarer.api.impl.campaign.terrain.AsteroidFieldTerrainPlugin.AsteroidFieldParams;
import com.fs.starfarer.api.impl.campaign.terrain.BaseRingTerrain;
import com.fs.starfarer.api.util.Misc;
import org.magiclib.util.MagicCampaign;
import indevo.industries.artillery.utils.ArtilleryStationPlacer;
import java.util.*;
import java.util.HashMap;
import java.util.Map;
public class LostFortess {
public void generate(SectorAPI sector) {
StarSystemAPI system = sector.createStarSystem("失落要塞");
system.getLocation().set(-1400, -6000);
system.setBackgroundTextureFilename("graphics/backgrounds/background4.jpg");
PlanetAPI LF_star = system.initStar("LostFortess", "star_blue_giant", 800f, 400f);
PlanetAPI LF_planet1 = system.addPlanet("LostFortess_planet1", LF_star, "要塞核心", "terran", 0f, 300f, 4500f, 372f);
LF_planet1.setCustomDescriptionId("LostFortess_planet1");
MarketAPI LF_planet1_market = Global.getFactory().createMarket("LostFortess_planet1_market", LF_planet1.getName(), 0);
LF_planet1_market.setPlanetConditionMarketOnly(true);
LF_planet1_market.addCondition("habitable");
LF_planet1_market.addCondition("mild_climate");
LF_planet1_market.addCondition("farmland_bountiful");
LF_planet1_market.addCondition("stealth_minefields");
LF_planet1_market.addCondition("ruins_vast");
LF_planet1_market.addCondition("regional_capital");
LF_planet1_market.addCondition("trade_center");
LF_planet1_market.setPrimaryEntity(LF_planet1);
LF_planet1.setMarket(LF_planet1_market);
PlanetAPI LF_planet1a = system.addPlanet("LostFortess_planet1a", LF_planet1, "守望", "lava", 0f, 150f, 900f, 124f);
MarketAPI LF_planet1a_market = Global.getFactory().createMarket("LostFortess_planet1a_market", LF_planet1a.getName(), 0);
LF_planet1a_market.setPlanetConditionMarketOnly(true);
LF_planet1a_market.addCondition("very_hot");
LF_planet1a_market.addCondition("ruins_vast");
LF_planet1a_market.addCondition("volatiles_plentiful");
LF_planet1a_market.addCondition("organics_plentiful");
LF_planet1a_market.addCondition("rare_ore_ultrarich");
LF_planet1a_market.addCondition("ore_ultrarich");
LF_planet1a_market.addCondition("stealth_minefields");
LF_planet1a_market.setPrimaryEntity(LF_planet1a);
LF_planet1a.setMarket(LF_planet1a_market);
ArtilleryStationPlacer.addArtilleryToPlanet(LF_planet1a_market.getPrimaryEntity(), true);
PlanetAPI LF_planet1b = system.addPlanet("LostFortess_planet1b", LF_planet1, "缄默", "lava", 120f, 150f, 900f, 124f);
MarketAPI LF_planet1b_market = Global.getFactory().createMarket("LostFortess_planet1b_market", LF_planet1b.getName(), 0);
LF_planet1b_market.addCondition("very_hot");
LF_planet1b_market.addCondition("ruins_vast");
LF_planet1b_market.addCondition("volatiles_plentiful");
LF_planet1b_market.addCondition("organics_plentiful");
LF_planet1b_market.addCondition("rare_ore_ultrarich");
LF_planet1b_market.addCondition("ore_ultrarich");
LF_planet1b_market.addCondition("stealth_minefields");
LF_planet1b_market.setPrimaryEntity(LF_planet1b);
LF_planet1b.setMarket(LF_planet1b_market);
ArtilleryStationPlacer.addArtilleryToPlanet(LF_planet1b_market.getPrimaryEntity(), true);
PlanetAPI LF_planet1c = system.addPlanet("LostFortess_planet1c", LF_planet1, "审判", "lava", 240f, 150f, 900f, 124f);
MarketAPI LF_planet1c_market = Global.getFactory().createMarket("LostFortess_planet1c_market", LF_planet1c.getName(), 0);
LF_planet1c_market.setPlanetConditionMarketOnly(true);
LF_planet1c_market.addCondition("very_hot");
LF_planet1c_market.addCondition("ruins_vast");
LF_planet1c_market.addCondition("volatiles_plentiful");
LF_planet1c_market.addCondition("organics_plentiful");
LF_planet1c_market.addCondition("rare_ore_ultrarich");
LF_planet1c_market.addCondition("ore_ultrarich");
LF_planet1c_market.addCondition("stealth_minefields");
LF_planet1c_market.setPrimaryEntity(LF_planet1c);
LF_planet1c.setMarket(LF_planet1c_market);
ArtilleryStationPlacer.addArtilleryToPlanet(LF_planet1c_market.getPrimaryEntity(), true);
JumpPointAPI LF_JumpPoint = Global.getFactory().createJumpPoint("LostFortess_jump", "失落要塞跳跃点");
LF_JumpPoint.setCircularOrbit( LF_star, 180f, 4500f, 372f);
LF_JumpPoint.setRelatedPlanet(LF_planet1);
system.addEntity(LF_JumpPoint);
SectorEntityToken gate = system.addCustomEntity("LF_gate", "深渊之门", "inactive_gate", null);
gate.setCircularOrbit(LF_star, 0f, 6000f, 372f);
CustomCampaignEntityAPI customCampaignEntityAPI1 = system.addCustomEntity("LF_Array", "共感", "sensor_array", "neutral");
customCampaignEntityAPI1.setCircularOrbitPointingDown(LF_star, 0f, 1800f, 372f);
CustomCampaignEntityAPI customCampaignEntityAPI2 = system.addCustomEntity("LF_Relay", "同心", "comm_relay", "neutral");
customCampaignEntityAPI2.setCircularOrbitPointingDown(LF_star, 128f, 1800f, 372f);
CustomCampaignEntityAPI customCampaignEntityAPI3 = system.addCustomEntity("LF_Buoy", "连结", "nav_buoy", "neutral");
customCampaignEntityAPI3.setCircularOrbitPointingDown(LF_star, 240f, 1800f, 372f);
CustomCampaignEntityAPI IndEvo_Watchtower1 = system.addCustomEntity("IndEvo_Watchtower1", null, "IndEvo_Watchtower", null);
IndEvo_Watchtower1.setCircularOrbitPointingDown((SectorEntityToken)LF_JumpPoint, 0f, 100f, 372f);
CustomCampaignEntityAPI IndEvo_Watchtower2 = system.addCustomEntity("IndEvo_Watchtower1", null, "IndEvo_Watchtower", null);
IndEvo_Watchtower2.setCircularOrbitPointingDown(system.getEntityById("LF_gate"), 0f, 100f, 372f);
system.autogenerateHyperspaceJumpPoints(false, false);
}
}
|
|