From be2416af8ad65a92d0565370aaf1c424f39e71fc Mon Sep 17 00:00:00 2001 From: Darkborderman Date: Fri, 13 Sep 2024 18:37:19 +0800 Subject: [PATCH] Update --- .../debris/StarSystemDesignDebrisScript.java | 4 +-- .../entity/StarSystemDesignEntityScript.java | 34 +++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/mod/starsystemdesign/rulecmd/debris/StarSystemDesignDebrisScript.java b/src/mod/starsystemdesign/rulecmd/debris/StarSystemDesignDebrisScript.java index 71e733c..50c4b27 100644 --- a/src/mod/starsystemdesign/rulecmd/debris/StarSystemDesignDebrisScript.java +++ b/src/mod/starsystemdesign/rulecmd/debris/StarSystemDesignDebrisScript.java @@ -44,6 +44,7 @@ public boolean execute(String ruleId, InteractionDialogAPI dialog, List params, Map memoryMap) { + OptionPanelAPI opts = dialog.getOptionPanel(); + opts.clearOptions(); + + String arg = null; + SectorEntityToken target = dialog.getInteractionTarget().getOrbitFocus(); + try{ + arg = params.get(0).getString(memoryMap); + }catch(IndexOutOfBoundsException e){} + + if(arg == null){ + opts.addOption("Remove object", "StarSystemDesignDebrisRemoveOption"); + opts.setEnabled("StarSystemDesignDebrisRemoveOption", false); + opts.addOption("Back", "StarSystemDesignDebrisRemoveOption"); + opts.setShortcut("StarSystemDesignDebrisRemoveOption", Keyboard.KEY_ESCAPE, false, false, false, false); + }else{ + switch(arg){ + case "remove":{ + CampaignTerrain terrain = (CampaignTerrain) target; + if(terrain.getPlugin().getClass() == DebrisFieldTerrainPlugin.class){ + DebrisFieldTerrainPlugin debris = (DebrisFieldTerrainPlugin)terrain.getPlugin(); + debris.getParams().lastsDays = 1f; + } + else { + Global.getSector().getPlayerFleet().getStarSystem().removeEntity(target); + } + dialog.dismiss(); + } + } + } return true; } }