Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="src/com/pesterenan/resources/krpc-java-0.4.9.jar"/>
<classpathentry kind="lib" path="src/com/pesterenan/resources/krpc-java-0.5.1.jar"/>
<classpathentry kind="lib" path="src/com/pesterenan/resources/javatuples-1.2.jar"/>
<classpathentry kind="lib" path="src/com/pesterenan/resources/protobuf-java-3.5.1.jar"/>
<classpathentry kind="lib" path="src/com/pesterenan/resources/protobuf-java-3.22.1.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ tmp/
local.properties
.loadpath
.metadata
workspace.xml
workspace.xml
settings.json
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ manobras, e pilotar rovers.
---
É necessário ter o [Java](https://java.com/pt-BR/) instalado para utilizar o "MechPeste.jar".
Uma versão mais atualizada do
mod [KRPC](https://github.com/nullprofile/krpc/releases/download/0.4.9-1.12.1/krpc-0.4.9-1.12.1.zip)
mod [KRPC](https://github.com/krpc/krpc/releases/download/v0.5.1/krpc-0.5.1.zip)
pode ser instalada diretamente do aplicativo MechPeste pelo menu Arquivo > Instalar KRPC.

## **Como instalar:**
Expand Down
4 changes: 2 additions & 2 deletions src/com/pesterenan/MechPeste.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private static boolean filterVessels(Vessel vessel, String search) {
if (search == "all") {
return true;
}
double TWO_KILOMETERS = 2000.0;
double TEN_KILOMETERS = 10000.0;
try {
Vessel active = MechPeste.getSpaceCenter().getActiveVessel();
if (vessel.getOrbit().getBody().getName().equals(active.getOrbit().getBody().getName())) {
Expand All @@ -83,7 +83,7 @@ private static boolean filterVessels(Vessel vessel, String search) {
final double distance = Vector.distance(activePos, vesselPos);
switch (search) {
case "closest":
if (distance < TWO_KILOMETERS) {
if (distance < TEN_KILOMETERS) {
return true;
}
break;
Expand Down
2 changes: 1 addition & 1 deletion src/com/pesterenan/controllers/LiftoffController.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private void finalizeCurve() throws RPCException, StreamException, InterruptedEx
private void circularizeOrbitOnApoapsis() {
setCurrentStatus(Bundle.getString("status_planning_orbit"));
Map<String, String> commands = new HashMap<>();
commands.put(Modulos.MODULO.get(), Modulos.MODULO_MANOBRAS.get());
commands.put(Modulos.MODULO.get(), Modulos.MODULO_EXEC_MANOBRAS.get());
commands.put(Modulos.FUNCAO.get(), Modulos.APOASTRO.get());
commands.put(Modulos.AJUSTE_FINO.get(), String.valueOf(false));
MechPeste.newInstance().startModule(commands);
Expand Down
4 changes: 1 addition & 3 deletions src/com/pesterenan/controllers/ManeuverController.java
Original file line number Diff line number Diff line change
Expand Up @@ -334,19 +334,17 @@ public void executeBurn(Node noDeManobra, double duracaoDaQueima) {
Stream<Triplet<Double, Double, Double>> queimaRestante = getConnection().addStream(noDeManobra,
"remainingBurnVector", noDeManobra.getReferenceFrame());
setCurrentStatus(Bundle.getString("status_maneuver_executing"));
double remainingBurnTime = duracaoDaQueima + 0.5;
while (noDeManobra != null) {
if (Thread.interrupted()) {
throw new InterruptedException();
}
if (remainingBurnTime < 0.0 || queimaRestante.get().getValue1() < (fineAdjustment ? 2 : 0.5)) {
if (queimaRestante.get().getValue1() < (fineAdjustment ? 2 : 0.5)) {
throttle(0.0f);
break;
}
navigation.aimAtManeuver(noDeManobra);
throttle(ctrlManeuver.calcPID((noDeManobra.getDeltaV() - Math.floor(queimaRestante.get().getValue1())) /
noDeManobra.getDeltaV() * 1000, 1000));
remainingBurnTime -= 0.05;
Thread.sleep(50);
}
throttle(0.0f);
Expand Down
2 changes: 1 addition & 1 deletion src/com/pesterenan/model/ActiveVessel.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public void startModule(Map<String, String> commands) {
controller = new LandingController(commands);
runningModule = true;
}
if (currentFunction.equals(Modulos.MODULO_MANOBRAS.get())) {
if (currentFunction.equals(Modulos.MODULO_EXEC_MANOBRAS.get())) {
controller = new ManeuverController(commands);
runningModule = true;
}
Expand Down
5 changes: 3 additions & 2 deletions src/com/pesterenan/resources/MechPesteBundle.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
btn_func_landing = Auto Landing
btn_func_liftoff = Orbital Liftoff
btn_func_maneuvers = Exec. Maneuvers
btn_func_create_maneuver = Create Maneuvers
btn_func_exec_maneuver = Exec. Maneuvers
btn_func_rover = Drive Rover
btn_stat_connect = Connect
installer_dialog_btn_browse = Browse...
installer_dialog_btn_cancel = Cancel
installer_dialog_btn_download = Download file and install
installer_dialog_pnl_path = Path to KSP's folder\:
installer_dialog_title = KRPC Installer
installer_dialog_txt_info = <html>Here you can download the recommended version of KRPC to use with MechPeste.<br>The app will connect and download the 0.4.9 version from nullprofile's GitHub, who is maintaining this version of KRPC.</html>
installer_dialog_txt_info = <html>Here you can download the latest version of KRPC to use with MechPeste.<br>The app will connect and download the 0.5.1 version from the original KRPC's Github.</html>
lbl_stat_ready = Ready.
main_mn_file = File
main_mn_help = Help
Expand Down
5 changes: 3 additions & 2 deletions src/com/pesterenan/resources/MechPesteBundle_pt.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
btn_func_landing = Pouso Autom\u00E1tico
btn_func_liftoff = Decolagem Orbital
btn_func_maneuvers = Exec. Manobras
btn_func_create_maneuver = Criar Manobras
btn_func_exec_maneuver = Exec. Manobras
btn_func_rover = Pilotar Rover
btn_stat_connect = Conectar
installer_dialog_btn_browse = Escolher...
installer_dialog_btn_cancel = Cancelar
installer_dialog_btn_download = Fazer download e instalar
installer_dialog_pnl_path = Caminho para a Pasta do KSP\:
installer_dialog_title = Instalador do KRPC
installer_dialog_txt_info = <html>Aqui voc\u00EA poder\u00E1 baixar a vers\u00E3o recomendada do KRPC para usar com o MechPeste.<br>O aplicativo ir\u00E1 conectar e baixar a vers\u00E3o 0.4.9 do GitHub de nullprofile, que est\u00E1 mantendo essa vers\u00E3o do KRPC.</html>
installer_dialog_txt_info = <html>Aqui voc\u00ea pode baixar a \u00faltima vers\u00e3o do KRPC para usar com o MechPeste.<br>O app ir\u00e1 se conectar e baixar a vers\u00e3o 0.5.1 do Github original do KRPC.</html>
lbl_stat_ready = Pronto.
main_mn_file = Arquivo
main_mn_help = Ajuda
Expand Down
Binary file removed src/com/pesterenan/resources/krpc-java-0.4.9.jar
Binary file not shown.
Binary file added src/com/pesterenan/resources/krpc-java-0.5.1.jar
Binary file not shown.
Binary file not shown.
Binary file removed src/com/pesterenan/resources/protobuf-java-3.5.1.jar
Binary file not shown.
6 changes: 3 additions & 3 deletions src/com/pesterenan/updater/KrpcInstaller.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
public class KrpcInstaller {
static final int BUFFER = 2048;
private static final String KRPC_GITHUB_LINK =
"https://github.com/nullprofile/krpc/releases/download/0.4.9-1.12.1/krpc-0.4.9-1.12.1.zip";
"https://github.com/krpc/krpc/releases/download/v0.5.1/krpc-0.5.1.zip";
private static String KSP_FOLDER = null;

public static String getKspFolder() {
Expand All @@ -43,7 +43,7 @@ public static void downloadKrpc() {

krpcLink = new URL(KRPC_GITHUB_LINK);
ReadableByteChannel readableByteChannel = Channels.newChannel(krpcLink.openStream());
FileOutputStream fos = new FileOutputStream(KSP_FOLDER + "\\krpc-0.4.9-1.12.1.zip");
FileOutputStream fos = new FileOutputStream(KSP_FOLDER + "\\krpc-0.5.1.zip");
fos.getChannel().transferFrom(readableByteChannel, 0, Long.MAX_VALUE);
fos.close();

Expand All @@ -60,7 +60,7 @@ public static void unzipKrpc() {
}
BufferedOutputStream dest;
// zipped input
FileInputStream fis = new FileInputStream(KSP_FOLDER + "\\krpc-0.4.9-1.12.1.zip");
FileInputStream fis = new FileInputStream(KSP_FOLDER + "\\krpc-0.5.1.zip");
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis));
ZipEntry entry;
while ((entry = zis.getNextEntry()) != null) {
Expand Down
47 changes: 24 additions & 23 deletions src/com/pesterenan/utils/Modulos.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,40 @@

public enum Modulos {

APOASTRO("Apoastro"),
PERIASTRO("Periastro"),
EXECUTAR("Executar"),
ABRIR_PAINEIS("Abrir Painéis"),
AJUSTAR("Ajustar"),
AJUSTE_FINO("Ajuste Fino"),
ALTITUDE_SOBREVOO("Altitude Sobrevoo"),
APOASTRO("Apoastro"),
CIRCULAR("Circular"),
CUBICA("Cúbica"),
DIRECAO("Direção"),
MODULO("Módulo"),
EXECUTAR("Executar"),
EXPONENCIAL("Exponencial"),
FUNCAO("Função"),
INCLINACAO("Inclinação"),
MARCADOR_MAPA("Marcador no mapa"),
MAX_TWR("Max_TWR"),
MODULO_CRIAR_MANOBRAS("CRIAR_MANOBRAS"),
MODULO_DECOLAGEM("LIFTOFF"),
MODULO_MANOBRAS("MANEUVER"),
MODULO_EXEC_MANOBRAS("MANEUVER"),
MODULO_POUSO_SOBREVOAR("HOVER"),
MODULO_POUSO("LANDING"),
MODULO_ROVER("ROVER"),
MODULO_TELEMETRIA("TELEMETRY"),
MODULO_POUSO_SOBREVOAR("HOVER"),
ALTITUDE_SOBREVOO("Altitude Sobrevoo"),
INCLINACAO("Inclinação"),
CIRCULAR("Circular"),
QUADRATICA("Quadrática"),
CUBICA("Cúbica"),
SINUSOIDAL("Sinusoidal"),
EXPONENCIAL("Exponencial"),
ROLAGEM("Rolagem"),
USAR_ESTAGIOS("Usar Estágios"),
ABRIR_PAINEIS("Abrir Painéis"),
AJUSTE_FINO("Ajuste Fino"),
TIPO_ALVO_ROVER("Tipo de Alvo do Rover"),
MODULO("Módulo"),
NAVE_ALVO("Nave alvo"),
MARCADOR_MAPA("Marcador no mapa"),
NOME_MARCADOR("Nome do marcador"),
VELOCIDADE_MAX("Velocidade Máxima"),
POUSAR("Pousar nave"),
MAX_TWR("Max_TWR"),
ORBITA_BAIXA("ÓRBITA BAIXA"),
SOBREVOO_POS_POUSO("SOBREVOO PÓS POUSO");
PERIASTRO("Periastro"),
POUSAR("Pousar nave"),
QUADRATICA("Quadrática"),
ROLAGEM("Rolagem"),
SINUSOIDAL("Sinusoidal"),
SOBREVOO_POS_POUSO("SOBREVOO PÓS POUSO"),
TIPO_ALVO_ROVER("Tipo de Alvo do Rover"),
USAR_ESTAGIOS("Usar Estágios"),
VELOCIDADE_MAX("Velocidade Máxima");

final String t;

Expand Down
2 changes: 1 addition & 1 deletion src/com/pesterenan/views/AboutJFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public AboutJFrame() {
@Override
public void initComponents() {
// Labels:
lblMechpeste = new JLabel("MechPeste - v.0.6");
lblMechpeste = new JLabel("MechPeste - v.0.6.2");
lblAboutInfo = new JLabel(
"<html>Esse app foi desenvolvido com o intuito de auxiliar o controle de naves<br>no game Kerbal Space Program.<br><br>"
+ "Não há garantias sobre o controle exato do app, portanto fique atento <br>"
Expand Down
2 changes: 1 addition & 1 deletion src/com/pesterenan/views/ChangeVesselDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void initComponents() {

// Buttons:
btnChangeToVessel = new JButton("Mudar para");
rbClosestVessels = new JRadioButton("Naves próximas (2km)");
rbClosestVessels = new JRadioButton("Naves próximas (10km)");
rbOnSameBody = new JRadioButton("No mesmo corpo celeste");
rbAllVessels = new JRadioButton("Todas as naves");

Expand Down
24 changes: 16 additions & 8 deletions src/com/pesterenan/views/FunctionsAndTelemetryJPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class FunctionsAndTelemetryJPanel extends JPanel implements UIMethods {
private static final long serialVersionUID = 0L;

private final Dimension btnFuncDimension = new Dimension(140, 25);
private JButton btnLiftoff, btnLanding, btnManeuver, btnRover, btnCancel;
private JButton btnLiftoff, btnLanding, btnExecManeuver, btnRover, btnCancel, btnCreateManeuver;
private static JLabel lblAltitude, lblSurfaceAlt, lblApoapsis, lblPeriapsis, lblVertSpeed, lblHorzSpeed;
private static JLabel lblAltitudeValue, lblSurfaceAltValue, lblApoapsisValue;
private static JLabel lblPeriapsisValue, lblVertSpeedValue, lblHorzSpeedValue;
Expand Down Expand Up @@ -51,7 +51,8 @@ public void initComponents() {
// Buttons:
btnLiftoff = new JButton(Bundle.getString("btn_func_liftoff"));
btnLanding = new JButton(Bundle.getString("btn_func_landing"));
btnManeuver = new JButton(Bundle.getString("btn_func_maneuvers"));
btnCreateManeuver = new JButton(Bundle.getString("btn_func_create_maneuver"));
btnExecManeuver = new JButton(Bundle.getString("btn_func_exec_maneuver"));
btnRover = new JButton(Bundle.getString("btn_func_rover"));
btnCancel = new JButton(Bundle.getString("pnl_tel_btn_cancel"));
}
Expand All @@ -75,10 +76,15 @@ public void setupComponents() {
btnLiftoff.setActionCommand(Modulos.MODULO_DECOLAGEM.get());
btnLiftoff.setMaximumSize(btnFuncDimension);
btnLiftoff.setPreferredSize(btnFuncDimension);
btnManeuver.addActionListener(this::changeFunctionPanel);
btnManeuver.setActionCommand(Modulos.MODULO_MANOBRAS.get());
btnManeuver.setMaximumSize(btnFuncDimension);
btnManeuver.setPreferredSize(btnFuncDimension);
btnCreateManeuver.addActionListener(this::changeFunctionPanel);
btnCreateManeuver.setActionCommand(Modulos.MODULO_CRIAR_MANOBRAS.get());
btnCreateManeuver.setMaximumSize(btnFuncDimension);
btnCreateManeuver.setPreferredSize(btnFuncDimension);
btnCreateManeuver.setEnabled(false);
btnExecManeuver.addActionListener(this::changeFunctionPanel);
btnExecManeuver.setActionCommand(Modulos.MODULO_EXEC_MANOBRAS.get());
btnExecManeuver.setMaximumSize(btnFuncDimension);
btnExecManeuver.setPreferredSize(btnFuncDimension);
btnRover.addActionListener(this::changeFunctionPanel);
btnRover.setActionCommand(Modulos.MODULO_ROVER.get());
btnRover.setMaximumSize(btnFuncDimension);
Expand All @@ -93,8 +99,10 @@ public void layoutComponents() {
pnlFunctionControls.add(MainGui.createMarginComponent(0, 4));
pnlFunctionControls.add(btnLiftoff);
pnlFunctionControls.add(btnLanding);
pnlFunctionControls.add(btnManeuver);
pnlFunctionControls.add(btnRover);
pnlFunctionControls.add(MainGui.createMarginComponent(0, 20));
pnlFunctionControls.add(btnCreateManeuver);
pnlFunctionControls.add(btnExecManeuver);
pnlFunctionControls.add(Box.createVerticalGlue());

JPanel pnlLeftPanel = new JPanel();
Expand Down Expand Up @@ -159,7 +167,7 @@ public void layoutComponents() {
}

private void changeFunctionPanel(ActionEvent e) {
MainGui.getCardJPanels().firePropertyChange(e.getActionCommand(), false, true);
MainGui.changeToPage(e);
}

public static void updateTelemetry(Map<Telemetry, Double> telemetryData) {
Expand Down
3 changes: 2 additions & 1 deletion src/com/pesterenan/views/LiftoffJPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void initComponents() {
txfFinalApoapsis = new JTextField("80000");
txfFinalApoapsis.setToolTipText(Bundle.getString("pnl_lift_txf_final_apo_tooltip"));
txfHeading = new JTextField("90");
txfLimitTWR = new JTextField("1.5");
txfLimitTWR = new JTextField("2.2");

// Buttons:
btnLiftoff = new JButton(Bundle.getString("pnl_lift_btn_liftoff"));
Expand Down Expand Up @@ -209,6 +209,7 @@ private void handleLiftoff(ActionEvent e) {
commands.put(Modulos.USAR_ESTAGIOS.get(), String.valueOf(chkDecoupleStages.isSelected()));
commands.put(Modulos.ABRIR_PAINEIS.get(), String.valueOf(chkOpenPanels.isSelected()));
MechPeste.newInstance().startModule(commands);
MainGui.backToTelemetry(e);
}
}
}
Loading