Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkborderman committed Sep 13, 2024
1 parent eb32b69 commit f58de92
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 2 deletions.
4 changes: 4 additions & 0 deletions data/campaign/rules.csv
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ StarSystemDesignDebrisOption,DialogOptionSelected,"$option == StarSystemDesignDe
StarSystemDesignDebrisRemoveOption,DialogOptionSelected,"$option == StarSystemDesignDebrisRemoveOption","StarSystemDesignDebrisScript remove",,,
StarSystemDesignDebrisBackOption,DialogOptionSelected,"$option == StarSystemDesignDebrisBackOption","StarSystemDesignEntryScript",,,

# Entity entry,,,,,,
StarSystemDesignEntityOption,DialogOptionSelected,"$option == StarSystemDesignEntityOption","StarSystemDesignDebrisScript",,,
StarSystemDesignEntityRemoveOption,DialogOptionSelected,"$option == StarSystemDesignEntityRemoveOption","StarSystemDesignDebrisScript remove",,,

# Jump point(in system) entry,,,,,,
StarSystemDesignJumpPointOption,DialogOptionSelected,"$option == StarSystemDesignJumpPointOption","StarSystemDesignJumpPointScript",,,
StarSystemDesignJumpPointCreateOption,DialogOptionSelected,"$option == StarSystemDesignJumpPointCreateOption","StarSystemDesignJumpPointScript create",,,
Expand Down
1 change: 1 addition & 0 deletions data/config/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"mod.starsystemdesign.rulecmd",
"mod.starsystemdesign.rulecmd.colony",
"mod.starsystemdesign.rulecmd.debris",
"mod.starsystemdesign.rulecmd.entity",
"mod.starsystemdesign.rulecmd.hyperspacejumppoint",
"mod.starsystemdesign.rulecmd.jumppoint",
"mod.starsystemdesign.rulecmd.nascentgravitywell",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.fs.starfarer.api.impl.campaign.ids.Tags;
import com.fs.starfarer.api.impl.campaign.rulecmd.BaseCommandPlugin;
import com.fs.starfarer.api.util.Misc;
import com.fs.starfarer.campaign.CampaignTerrain;
import com.fs.starfarer.campaign.NascentGravityWell;

import org.lwjgl.input.Keyboard;
Expand All @@ -36,10 +37,15 @@ public boolean execute(String ruleId, InteractionDialogAPI dialog, List<Misc.Tok
dialog.getOptionPanel().addOption("Manage system colony", "StarSystemDesignColonyOption");
opts.setEnabled("StarSystemDesignColonyOption", true);

dialog.getOptionPanel().addOption("Select current orbiting object", "StarSystemDesignDebrisOption");
dialog.getOptionPanel().addOption("Manage orbiting terain", "StarSystemDesignDebrisOption");
opts.setEnabled("StarSystemDesignDebrisOption", false);
SectorEntityToken orbit = dialog.getInteractionTarget().getOrbitFocus();
if(orbit != null) opts.setEnabled("StarSystemDesignDebrisOption", true);
if(orbit != null && orbit.getClass() == CampaignTerrain.class) opts.setEnabled("StarSystemDesignDebrisOption", true);

dialog.getOptionPanel().addOption("Manage nearby entity", "StarSystemDesignEntityOption");
SectorEntityToken token = Utilities.getClosetEntity(dialog.getInteractionTarget(), 100, null);
if(token != null) opts.setEnabled("StarSystemDesignEntityOption", true);
else opts.setEnabled("StarSystemDesignEntityOption", false);

}else{
dialog.getOptionPanel().addOption("Manage nearby jump point", "StarSystemDesignHyperspaceJumpPointOption");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public boolean execute(String ruleId, InteractionDialogAPI dialog, List<Misc.Tok
if(target.getClass() == CampaignTerrain.class){
// terrain
CampaignTerrain terrain = (CampaignTerrain) target;
dialog.getTextPanel().addParagraph(terrain.getPlugin().getClass().toString());

if(terrain.getPlugin().getClass() == DebrisFieldTerrainPlugin.class){
DebrisFieldTerrainPlugin debris = (DebrisFieldTerrainPlugin)terrain.getPlugin();
if(debris.isScavenged()) opts.setEnabled("StarSystemDesignDebrisRemoveOption", true);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package mod.starsystemdesign.rulecmd.entity;

import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;

import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.campaign.InteractionDialogAPI;
import com.fs.starfarer.api.campaign.rules.MemoryAPI;
import com.fs.starfarer.api.impl.campaign.rulecmd.BaseCommandPlugin;
import com.fs.starfarer.api.util.Misc;

import mod.starsystemdesign.rulecmd.debris.StarSystemDesignDebrisScript;

public class StarSystemDesignEntityScript extends BaseCommandPlugin{
public static Logger log = Global.getLogger(StarSystemDesignDebrisScript.class);

@Override
public boolean execute(String ruleId, InteractionDialogAPI dialog, List<Misc.Token> params, Map<String, MemoryAPI> memoryMap) {
return true;
}
}

0 comments on commit f58de92

Please sign in to comment.