Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Planetary Conditions Enums #5203

Merged
merged 39 commits into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
8c4a96c
light enum
kuronekochomusuke Feb 24, 2024
23fca2f
typos
kuronekochomusuke Feb 24, 2024
b539019
fix warnings
kuronekochomusuke Feb 24, 2024
5841696
weather enum
kuronekochomusuke Feb 25, 2024
94572f0
fix warnings
kuronekochomusuke Feb 25, 2024
5e78be6
fix warnings
kuronekochomusuke Feb 25, 2024
468b224
wind enum
kuronekochomusuke Feb 25, 2024
0e17bca
fix tests
kuronekochomusuke Feb 25, 2024
7dfbc4e
fix warning
kuronekochomusuke Feb 25, 2024
5b3a09a
wind direction enum
kuronekochomusuke Feb 25, 2024
ed9a93a
atmosphere enum
kuronekochomusuke Feb 25, 2024
1cb068c
fix tests
kuronekochomusuke Feb 25, 2024
72e0714
fog enum
kuronekochomusuke Feb 25, 2024
823b314
blowing sand enum
kuronekochomusuke Feb 25, 2024
1df2446
emi enum
kuronekochomusuke Feb 25, 2024
75d62fc
code cleanup
kuronekochomusuke Feb 25, 2024
b18ad89
code cleanup
kuronekochomusuke Feb 26, 2024
7715de0
code cleanup
kuronekochomusuke Feb 26, 2024
2b3e8a7
remove static functions
kuronekochomusuke Feb 27, 2024
c9c40bb
fix warnings
kuronekochomusuke Feb 28, 2024
2fa6de3
remove idicators from messages
kuronekochomusuke Feb 28, 2024
9542933
split functions for mekhq
kuronekochomusuke Feb 29, 2024
bcaf32d
split function for mekhq
kuronekochomusuke Feb 29, 2024
1679b9e
fix tests
kuronekochomusuke Feb 29, 2024
6f7ece9
use enum in combobox
kuronekochomusuke Feb 29, 2024
7ad4fcb
use enum functions
kuronekochomusuke Mar 2, 2024
f947e3c
code cleanup
kuronekochomusuke Mar 2, 2024
44b7255
Merge remote-tracking branch 'origin/master' into planetaryConditions…
kuronekochomusuke Mar 2, 2024
6fa0e4a
external id to enum
kuronekochomusuke Mar 3, 2024
f94e63f
code cleanup
kuronekochomusuke Mar 3, 2024
1156684
Merge remote-tracking branch 'origin/master' into planetaryConditions…
kuronekochomusuke Mar 9, 2024
27248b6
move to planetaryconditions package
kuronekochomusuke Mar 20, 2024
cb629b5
fix package imports
kuronekochomusuke Mar 20, 2024
802d851
remove space from resource name
kuronekochomusuke Mar 20, 2024
8e70405
add isX() functions
kuronekochomusuke Mar 20, 2024
2f787bb
fix test imports
kuronekochomusuke Mar 20, 2024
993983e
store indicator in enum
kuronekochomusuke Mar 20, 2024
23686a3
fix warnings
kuronekochomusuke Mar 20, 2024
dbc04f0
Merge remote-tracking branch 'origin/master' into planetaryConditions…
kuronekochomusuke Mar 20, 2024
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
52 changes: 1 addition & 51 deletions megamek/i18n/megamek/common/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,10 @@ PlanetaryConditions.DisplayableName.Weather.Moderate\ Snowfall=Moderate Snowfall
PlanetaryConditions.DisplayableName.Weather.Heavy\ Snowfall=Heavy Snowfall
PlanetaryConditions.DisplayableName.Weather.Sleet=Sleet
PlanetaryConditions.DisplayableName.Weather.Snow\ Flurries=Snow Flurries
PlanetaryConditions.DisplayableName.Weather.Blizzard=Blizzard
PlanetaryConditions.DisplayableName.Weather.Ice\ Storm=Ice Storm
PlanetaryConditions.DisplayableName.Weather.Light\ Hail=Light Hail
PlanetaryConditions.DisplayableName.Weather.Heavy\ Hail=Heavy Hail
PlanetaryConditions.DisplayableName.Weather.Lightning\ Storm=Lightning Storm
kuronekochomusuke marked this conversation as resolved.
Show resolved Hide resolved
PlanetaryConditions.DisplayableName.WindStrength.Calm=Calm
PlanetaryConditions.DisplayableName.WindStrength.Light\ Gale=Light Gale
PlanetaryConditions.DisplayableName.WindStrength.Moderate\ Gale=Moderate Gale
Expand Down Expand Up @@ -261,56 +261,6 @@ PlanetaryConditions.DisplayableName.Temperature.ExtremeCold=Extreme Cold
PlanetaryConditions.DisplayableName.Temperature.ExtremeHeat=Extreme Heat
PlanetaryConditions.DisplayableName.EMI.true=Yes
PlanetaryConditions.DisplayableName.EMI.false=No
PlanetaryConditions.Indicator.Light.Day=\u2600
PlanetaryConditions.Indicator.Light.Dusk=\u263D \u263C
PlanetaryConditions.Indicator.Light.FullMoon=\u26AB
PlanetaryConditions.Indicator.Light.Moonless=\u26AA
PlanetaryConditions.Indicator.Light.PitchBlack=\u2588
PlanetaryConditions.Indicator.Fog.None=\uD83D\uDC41
PlanetaryConditions.Indicator.Fog.Light=\u2588 \u2022
PlanetaryConditions.Indicator.Fog.Heavy=\u2588 \u2588
PlanetaryConditions.Indicator.WindStrength.Calm=\u2690
PlanetaryConditions.Indicator.WindStrength.LightGale=\u21F6 \u2022 \u2022 \u2022
PlanetaryConditions.Indicator.WindStrength.ModGale=\u21F6 \u21F6 \u2022 \u2022
PlanetaryConditions.Indicator.WindStrength.StrongGale=\u21F6 \u21F6 \u21F6 \u2022
PlanetaryConditions.Indicator.WindStrength.Storm=\u21F6 \u21F6 \u21F6 \u21F6
PlanetaryConditions.Indicator.WindStrength.TornadoF13=\uD83C\uDF2A \uD83C\uDF2A \uD83C\uDF2A \u2022
PlanetaryConditions.Indicator.WindStrength.TornadoF4=\uD83C\uDF2A \uD83C\uDF2A \uD83C\uDF2A \uD83C\uDF2A
PlanetaryConditions.Indicator.WindDirection.North=\u2193
PlanetaryConditions.Indicator.WindDirection.Northeast=\u2B0B
PlanetaryConditions.Indicator.WindDirection.Southeast=\u2B09
PlanetaryConditions.Indicator.WindDirection.South=\u2191
PlanetaryConditions.Indicator.WindDirection.Southwest=\u2B08
PlanetaryConditions.Indicator.WindDirection.Northwest=\u2B0A
PlanetaryConditions.Indicator.WindDirection.RandomWindDirection=
PlanetaryConditions.Indicator.Weather.None=\u239A
PlanetaryConditions.Indicator.Weather.LightRain=\u2601 \u2022 \u2022 \u2022 \u2022
PlanetaryConditions.Indicator.Weather.ModRain=\u2601 \u2601 \u2022 \u2022 \u2022
PlanetaryConditions.Indicator.Weather.HeavyRain=\u2601 \u2601 \u2601 \u2022 \u2022
PlanetaryConditions.Indicator.Weather.GustingRain=\u2601 \u2601 \u2601 \u2601 \u2022
PlanetaryConditions.Indicator.Weather.Downpour=\u2601 \u2601 \u2601 \u2601 \u2601
PlanetaryConditions.Indicator.Weather.LightSnow=\u2744 \u2022 \u2022 \u2022
PlanetaryConditions.Indicator.Weather.ModSnow=\u2744 \u2744 \u2022 \u2022
PlanetaryConditions.Indicator.Weather.SnowFlurries=\u2744 \u2744 \u2744 \u2022
PlanetaryConditions.Indicator.Weather.HeavySnow=\u2744 \u2744 \u2744 \u2744
PlanetaryConditions.Indicator.Weather.Sleet=\u26C6 \u2022
PlanetaryConditions.Indicator.Weather.IceStorm=\u26C6 \u26C6
PlanetaryConditions.Indicator.Atmosphere.Vacuum=\u2726 \u2727 \u2727 \u25AF \u2727 \u2727
PlanetaryConditions.Indicator.Atmosphere.Trace=\u2726 \u2726 \u2727 \u25AF \u2727 \u2727
PlanetaryConditions.Indicator.Atmosphere.Thin=\u2726 \u2726 \u2726 \u25AF \u2727 \u2727
PlanetaryConditions.Indicator.Atmosphere.Standard=\u2726 \u2726 \u2726 \u25AE \u2727 \u2727
PlanetaryConditions.Indicator.Atmosphere.High=\u2726 \u2726 \u2726 \u25AE \u2726 \u2727
PlanetaryConditions.Indicator.Atmosphere.VHigh=\u2726 \u2726 \u2726 \u25AE \u2726 \u2726
PlanetaryConditions.Indicator.SandBlowing.true=\uD83C\uDF2C
PlanetaryConditions.Indicator.SandBlowing.false=\uD83D\uDC41
PlanetaryConditions.Indicator.Temperature.ExtremeCold=\u2744
PlanetaryConditions.Indicator.Temperature.Normal=\uD83C\uDF21
PlanetaryConditions.Indicator.Temperature.ExtremeHeat=\uD83D\uDD25
PlanetaryConditions.Indicator.Gravity.Low=\u2B71
PlanetaryConditions.Indicator.Gravity.Normal=\u23AF
PlanetaryConditions.Indicator.Gravity.High=\u2B73
PlanetaryConditions.Indicator.EMI.true=\u2301
PlanetaryConditions.Indicator.EMI.false=\u2312
UnitType.Aero=Aerospace
UnitType.AeroSpaceFighter=Aerospace Fighter
UnitType.BattleArmor=Battle Armor
Expand Down
51 changes: 0 additions & 51 deletions megamek/i18n/megamek/common/messages_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ PlanetaryConditions.DisplayableName.Weather.Moderate\ Snowfall=Nevada Moderada
PlanetaryConditions.DisplayableName.Weather.Heavy\ Snowfall=Nevada Fuerte
PlanetaryConditions.DisplayableName.Weather.Sleet=Aguanieve
PlanetaryConditions.DisplayableName.Weather.Snow\ Flurries=Rafagas de Nieve
PlanetaryConditions.DisplayableName.Weather.Blizzard=Ventisca
PlanetaryConditions.DisplayableName.Weather.Ice\ Storm=Tormenta de Hielo
PlanetaryConditions.DisplayableName.Weather.Light\ Hail=Granizo Ligero
PlanetaryConditions.DisplayableName.Weather.Heavy\ Hail=Granizo Intenso
Expand Down Expand Up @@ -255,56 +254,6 @@ PlanetaryConditions.DisplayableName.Temperature.ExtremeCold=Frio Extremo
PlanetaryConditions.DisplayableName.Temperature.ExtremeHeat=Calor Extremo
PlanetaryConditions.DisplayableName.EMI.true=Si
PlanetaryConditions.DisplayableName.EMI.false=No
PlanetaryConditions.Indicator.Light.Day=\u2600
PlanetaryConditions.Indicator.Light.Dusk=\u263D \u263C
PlanetaryConditions.Indicator.Light.FullMoon=\u26AB
PlanetaryConditions.Indicator.Light.Moonless=\u26AA
PlanetaryConditions.Indicator.Light.PitchBlack=\u2588
PlanetaryConditions.Indicator.Fog.None=\uD83D\uDC41
PlanetaryConditions.Indicator.Fog.Light=\u2588 \u2022
PlanetaryConditions.Indicator.Fog.Heavy=\u2588 \u2588
PlanetaryConditions.Indicator.WindStrength.Calm=\u2690
PlanetaryConditions.Indicator.WindStrength.LightGale=\u21F6 \u2022 \u2022 \u2022
PlanetaryConditions.Indicator.WindStrength.ModGale=\u21F6 \u21F6 \u2022 \u2022
PlanetaryConditions.Indicator.WindStrength.StrongGale=\u21F6 \u21F6 \u21F6 \u2022
PlanetaryConditions.Indicator.WindStrength.Storm=\u21F6 \u21F6 \u21F6 \u21F6
PlanetaryConditions.Indicator.WindStrength.TornadoF13=\uD83C\uDF2A \uD83C\uDF2A \uD83C\uDF2A \u2022
PlanetaryConditions.Indicator.WindStrength.TornadoF4=\uD83C\uDF2A \uD83C\uDF2A \uD83C\uDF2A \uD83C\uDF2A
PlanetaryConditions.Indicator.WindDirection.North=\u2193
PlanetaryConditions.Indicator.WindDirection.Northeast=\u2B0B
PlanetaryConditions.Indicator.WindDirection.Southeast=\u2B09
PlanetaryConditions.Indicator.WindDirection.South=\u2191
PlanetaryConditions.Indicator.WindDirection.Southwest=\u2B08
PlanetaryConditions.Indicator.WindDirection.Northwest=\u2B0A
PlanetaryConditions.Indicator.WindDirection.RandomWindDirection=
PlanetaryConditions.Indicator.Weather.None=\u239A
PlanetaryConditions.Indicator.Weather.LightRain=\u2601 \u2022 \u2022 \u2022 \u2022
PlanetaryConditions.Indicator.Weather.ModRain=\u2601 \u2601 \u2022 \u2022 \u2022
PlanetaryConditions.Indicator.Weather.HeavyRain=\u2601 \u2601 \u2601 \u2022 \u2022
PlanetaryConditions.Indicator.Weather.GustingRain=\u2601 \u2601 \u2601 \u2601 \u2022
PlanetaryConditions.Indicator.Weather.Downpour=\u2601 \u2601 \u2601 \u2601 \u2601
PlanetaryConditions.Indicator.Weather.LightSnow=\u2744 \u2022 \u2022 \u2022
PlanetaryConditions.Indicator.Weather.ModSnow=\u2744 \u2744 \u2022 \u2022
PlanetaryConditions.Indicator.Weather.SnowFlurries=\u2744 \u2744 \u2744 \u2022
PlanetaryConditions.Indicator.Weather.HeavySnow=\u2744 \u2744 \u2744 \u2744
PlanetaryConditions.Indicator.Weather.Sleet=\u26C6 \u2022
PlanetaryConditions.Indicator.Weather.IceStorm=\u26C6 \u26C6
PlanetaryConditions.Indicator.Atmosphere.Vacuum=\u2726 \u2727 \u2727 \u25AF \u2727 \u2727
PlanetaryConditions.Indicator.Atmosphere.Trace=\u2726 \u2726 \u2727 \u25AF \u2727 \u2727
PlanetaryConditions.Indicator.Atmosphere.Thin=\u2726 \u2726 \u2726 \u25AF \u2727 \u2727
PlanetaryConditions.Indicator.Atmosphere.Standard=\u2726 \u2726 \u2726 \u25AE \u2727 \u2727
PlanetaryConditions.Indicator.Atmosphere.High=\u2726 \u2726 \u2726 \u25AE \u2726 \u2727
PlanetaryConditions.Indicator.Atmosphere.VHigh=\u2726 \u2726 \u2726 \u25AE \u2726 \u2726
PlanetaryConditions.Indicator.SandBlowing.true=\uD83C\uDF2C
PlanetaryConditions.Indicator.SandBlowing.false=\uD83D\uDC41
PlanetaryConditions.Indicator.Temperature.ExtremeCold=\u2744
PlanetaryConditions.Indicator.Temperature.Normal=\uD83C\uDF21
PlanetaryConditions.Indicator.Temperature.ExtremeHeat=\uD83D\uDD25
PlanetaryConditions.Indicator.Gravity.Low=\u2B71
PlanetaryConditions.Indicator.Gravity.Normal=\u23AF
PlanetaryConditions.Indicator.Gravity.High=\u2B73
PlanetaryConditions.Indicator.EMI.true=\u2301
PlanetaryConditions.Indicator.EMI.false=\u2312
UnitType.Aero=Caza Aeroespacial
UnitType.BattleArmor=Armadura de Combate
UnitType.Conventional\ Fighter=Caza Convencional
Expand Down
9 changes: 5 additions & 4 deletions megamek/src/megamek/client/bot/princess/Princess.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import megamek.common.actions.*;
import megamek.common.annotations.Nullable;
import megamek.common.containers.PlayerIDandList;
import megamek.common.enums.Light;
import megamek.common.event.GameCFREvent;
import megamek.common.event.GamePlayerChatEvent;
import megamek.common.net.enums.PacketCommand;
Expand Down Expand Up @@ -2025,10 +2026,10 @@ private void evadeIfNotFiring(MovePath path, boolean possibleToInflictDamage) {
*/
private void turnOnSearchLight(MovePath path, boolean possibleToInflictDamage) {
Entity pathEntity = path.getEntity();
if (possibleToInflictDamage &&
pathEntity.hasSearchlight() &&
!pathEntity.isUsingSearchlight() &&
(path.getGame().getPlanetaryConditions().getLight() >= PlanetaryConditions.L_FULL_MOON)) {
if (possibleToInflictDamage
&& pathEntity.hasSearchlight()
&& !pathEntity.isUsingSearchlight()
&& path.getGame().getPlanetaryConditions().getLight().isDarkerThan(Light.DUSK)) {
path.addStep(MoveStepType.SEARCHLIGHT);
}
}
Expand Down
2 changes: 1 addition & 1 deletion megamek/src/megamek/client/ratgenerator/SubforcesNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public ArrayList<ForceDescriptor> generateSubforces(ForceDescriptor fd,
} else if (vn.getContent().endsWith("-")) {
sub.setSizeMod(ForceDescriptor.UNDERSTRENGTH);
sub.setEschelon(Integer.parseInt(vn.getContent().replace("-", "")));
} else {
} else {
sub.setEschelon(Integer.parseInt(vn.getContent()));
}
apply(sub, i);
Expand Down
3 changes: 2 additions & 1 deletion megamek/src/megamek/client/ui/swing/EquipChoicePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import megamek.client.ui.GBC;
import megamek.client.ui.Messages;
import megamek.common.*;
import megamek.common.enums.Light;
import megamek.common.options.AbstractOptions;
import megamek.common.options.OptionsConstants;
import megamek.common.util.fileUtils.MegaMekFile;
Expand Down Expand Up @@ -262,7 +263,7 @@ public EquipChoicePanel(Entity entity, ClientGUI clientgui, Client client) {

// Set up searchlight
if (!entity.getsAutoExternalSearchlight()
&& (client.getGame().getPlanetaryConditions().getLight() > PlanetaryConditions.L_DUSK)) {
&& client.getGame().getPlanetaryConditions().getLight().isDarkerThan(Light.DUSK)) {
add(labSearchlight, GBC.std());
add(chSearchlight, GBC.eol());
chSearchlight.setSelected(entity.hasSearchlight()
Expand Down
19 changes: 13 additions & 6 deletions megamek/src/megamek/client/ui/swing/MovementDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import megamek.common.actions.DfaAttackAction;
import megamek.common.actions.RamAttackAction;
import megamek.common.annotations.Nullable;
import megamek.common.enums.Atmosphere;
import megamek.common.enums.Light;
import megamek.common.event.GamePhaseChangeEvent;
import megamek.common.event.GameTurnChangeEvent;
import megamek.common.options.AbstractOptions;
Expand Down Expand Up @@ -1096,8 +1098,10 @@ private void updateAeroButtons() {
setEvadeAeroEnabled(cmd != null && !cmd.contains(MoveStepType.EVADE));
setEjectEnabled(true);
// no turning for spheroids in atmosphere
if ((((IAero) ce()).isSpheroid() || clientgui.getClient().getGame()
.getPlanetaryConditions().isVacuum())
PlanetaryConditions conditions = clientgui.getClient().getGame().getPlanetaryConditions();
boolean spheroidOrLessThanThin = ((IAero) ce()).isSpheroid()
|| conditions.getAtmosphere().isLighterThan(Atmosphere.THIN);
if (spheroidOrLessThanThin
&& !clientgui.getClient().getGame().getBoard().inSpace()) {
setTurnEnabled(false);
}
Expand Down Expand Up @@ -2360,7 +2364,7 @@ private void updateSearchlightButton() {
if (ce == null) {
return;
}
boolean isNight = clientgui.getClient().getGame().getPlanetaryConditions().isIlluminationEffective();
boolean isNight = clientgui.getClient().getGame().getPlanetaryConditions().getLight().isDarkerThan(Light.DAY);
setSearchlightEnabled(isNight && ce.hasSearchlight() && !cmd.contains(MoveStepType.SEARCHLIGHT),
ce.isUsingSearchlight());
}
Expand Down Expand Up @@ -4223,8 +4227,9 @@ private void checkAtmosphere() {

IAero a = (IAero) ce;
if (!clientgui.getClient().getGame().getBoard().inSpace()) {
PlanetaryConditions conditions = clientgui.getClient().getGame().getPlanetaryConditions();
if (a.isSpheroid()
|| clientgui.getClient().getGame().getPlanetaryConditions().isVacuum()) {
|| conditions.getAtmosphere().isLighterThan(Atmosphere.THIN)) {
getBtn(MoveCommand.MOVE_ACC).setEnabled(false);
getBtn(MoveCommand.MOVE_DEC).setEnabled(false);
getBtn(MoveCommand.MOVE_ACCN).setEnabled(false);
Expand Down Expand Up @@ -5039,12 +5044,14 @@ public synchronized void actionPerformed(ActionEvent ev) {
} else if (actionCmd.equals(MoveCommand.MOVE_RAISE_ELEVATION.getCmd())) {
addStepToMovePath(MoveStepType.UP);
} else if (actionCmd.equals(MoveCommand.MOVE_LOWER_ELEVATION.getCmd())) {
PlanetaryConditions conditions = clientgui.getClient().getGame().getPlanetaryConditions();
boolean spheroidOrLessThanThin = ((IAero) ce).isSpheroid()
|| conditions.getAtmosphere().isLighterThan(Atmosphere.THIN);
if (ce.isAero()
&& (null != cmd.getLastStep())
&& (cmd.getLastStep().getNDown() == 1)
&& (cmd.getLastStep().getVelocity() < 12)
&& !(((IAero) ce).isSpheroid() || clientgui.getClient()
.getGame().getPlanetaryConditions().isVacuum())) {
&& !spheroidOrLessThanThin) {
addStepToMovePath(MoveStepType.ACC, true);
computeAeroMovementEnvelope(ce);
}
Expand Down
Loading
Loading