Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkborderman committed Sep 12, 2024
1 parent 34df28d commit 1309687
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
5 changes: 5 additions & 0 deletions data/campaign/rules.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ id,trigger,conditions,script,text,options,notes
StarSystemDesignOption,OpenInteractionDialog,"$option == StarSystemDesignOption","StarSystemDesignEntryScript",,,
StarSystemDesignLeaveOption,DialogOptionSelected,"$option == StarSystemDesignLeaveOption","DismissDialog",,,

# Star entry,,,,,,
StarSystemDesignStarOption,DialogOptionSelected, "$option == StarSystemDesignStarOption","StarSystemDesignStarScript",,,
StarSystemDesignStarNebulaOption,DialogOptionSelected, "$option == StarSystemDesignStarNebularOption","StarSystemDesignStarScript nebula",,,
StarSystemDesignStableStarBackOption,DialogOptionSelected,"$option == StarSystemDesignStarBackOption","StarSystemDesignEntryScript",,,

# Stable location entry,,,,,,
StarSystemDesignStableLocationOption,DialogOptionSelected,"$option == StarSystemDesignStableLocationOption","StarSystemDesignStableLocationScript",,,
StarSystemDesignStableLocationCreateOption,DialogOptionSelected,"$option == StarSystemDesignStableLocationCreateOption","StarSystemDesignStableLocationScript 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 @@ -2,6 +2,7 @@
"stablelocationcount": 3,
"ruleCommandPackages": [
"mod.starsystemdesign.rulecmd",
"mod.starsystemdesign.rulecmd.star",
"mod.starsystemdesign.rulecmd.colony",
"mod.starsystemdesign.rulecmd.debris",
"mod.starsystemdesign.rulecmd.hyperspacejumppoint",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public boolean execute(String ruleId, InteractionDialogAPI dialog, List<Misc.Tok
boolean isInHyperspace = dialog.getInteractionTarget().isInHyperspace();

if(!isInHyperspace){
dialog.getOptionPanel().addOption("Manage star", "StarSystemDesignStarOption");
opts.setEnabled("StarSystemDesignStarOption", true);

dialog.getOptionPanel().addOption("Manage stable locations", "StarSystemDesignStableLocationOption");
opts.setEnabled("StarSystemDesignStableLocationOption", true);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package mod.starsystemdesign.rulecmd.star;

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

import org.lwjgl.input.Keyboard;

import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.campaign.InteractionDialogAPI;
import com.fs.starfarer.api.campaign.OptionPanelAPI;
import com.fs.starfarer.api.campaign.SectorEntityToken;
import com.fs.starfarer.api.campaign.StarSystemAPI;
import com.fs.starfarer.api.campaign.rules.MemoryAPI;
import com.fs.starfarer.api.impl.campaign.ids.Tags;
import com.fs.starfarer.api.impl.campaign.procgen.StarSystemGenerator;
import com.fs.starfarer.api.impl.campaign.rulecmd.BaseCommandPlugin;
import com.fs.starfarer.api.util.Misc;

public class StarSystemDesignStarScript extends BaseCommandPlugin{

@Override
public boolean execute(String ruleId, InteractionDialogAPI dialog, List<Misc.Token> params, Map<String, MemoryAPI> memoryMap) {
OptionPanelAPI opts = dialog.getOptionPanel();
opts.clearOptions();

String arg = null;
try{
arg = params.get(0).getString(memoryMap);
}catch(IndexOutOfBoundsException e){}
if(arg == null){
opts.addOption("Change star to nebula", "StarSystemDesignStaNebularOption");
opts.setEnabled("StarSystemDesignStaNebularOption", false);

opts.addOption("Back", "StarSystemDesignStarBackOption");
opts.setShortcut("StarSystemDesignStarBackOption", Keyboard.KEY_ESCAPE, false, false, false, false);
}else{
switch(arg){
case "nebula": {
// pass
break;
}
}
}

return true;
}
}

0 comments on commit 1309687

Please sign in to comment.