Procedural sectors on Serpulo now require a Foundation core

This commit is contained in:
Anuken
2025-05-01 17:12:17 -04:00
parent aecc3980fd
commit d820557bd3
6 changed files with 41 additions and 12 deletions

View File

@@ -817,6 +817,7 @@ sector.changeicon = Change Icon
sector.noswitch.title = Unable to Switch Sectors sector.noswitch.title = Unable to Switch Sectors
sector.noswitch = You may not switch sectors while an existing sector is under attack.\n\nSector: [accent]{0}[] on [accent]{1}[] sector.noswitch = You may not switch sectors while an existing sector is under attack.\n\nSector: [accent]{0}[] on [accent]{1}[]
sector.view = View Sector sector.view = View Sector
sector.foundationrequired = [lightgray] Core: Foundation[] Required
threat.low = Low threat.low = Low
threat.medium = Medium threat.medium = Medium

View File

@@ -475,7 +475,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
/** @return whether the unit *can* be commanded, even if its controller is not currently CommandAI. */ /** @return whether the unit *can* be commanded, even if its controller is not currently CommandAI. */
public boolean allowCommand(){ public boolean allowCommand(){
return controller instanceof CommandAI || (controller instanceof LogicAI ai && (ai.controller == null || !ai.controller.block.privileged) && type.allowChangeCommands); return controller instanceof CommandAI;
} }
/** @return whether the unit has a CommandAI controller */ /** @return whether the unit has a CommandAI controller */

View File

@@ -265,12 +265,6 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
Unit unit = Groups.unit.getByID(id); Unit unit = Groups.unit.getByID(id);
if(unit != null && unit.team == player.team()){ if(unit != null && unit.team == player.team()){
//Units with logic AI can still be controlled, but there currently aren't any mechanisms to do so on the client end unless the processor "steals" units that are already selected (control issue)
if(unit.controller() instanceof LogicAI ai && !(ai.controller != null && ai.controller.block.privileged)){
//reset to commandAI if applicable
unit.resetController();
}
if(unit.controller() instanceof CommandAI ai){ if(unit.controller() instanceof CommandAI ai){
//implicitly order it to move //implicitly order it to move
if(ai.command == null || ai.command.switchToMove){ if(ai.command == null || ai.command.switchToMove){

View File

@@ -1,5 +1,7 @@
package mindustry.maps.generators; package mindustry.maps.generators;
import arc.*;
import arc.graphics.g2d.*;
import arc.math.geom.*; import arc.math.geom.*;
import arc.struct.*; import arc.struct.*;
import arc.struct.ObjectIntMap.*; import arc.struct.ObjectIntMap.*;
@@ -8,10 +10,12 @@ import arc.util.noise.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.ctype.*; import mindustry.ctype.*;
import mindustry.game.*; import mindustry.game.*;
import mindustry.gen.*;
import mindustry.graphics.g3d.*; import mindustry.graphics.g3d.*;
import mindustry.graphics.g3d.PlanetGrid.*; import mindustry.graphics.g3d.PlanetGrid.*;
import mindustry.type.*; import mindustry.type.*;
import mindustry.type.Weather.*; import mindustry.type.Weather.*;
import mindustry.ui.*;
import mindustry.world.*; import mindustry.world.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
@@ -52,6 +56,14 @@ public abstract class PlanetGenerator extends BasicGenerator implements HexMeshe
} }
} }
public void getLockedText(Sector hovered, StringBuilder out){
out.append("[gray]").append(Iconc.lock).append(" ").append(Core.bundle.get("locked"));
}
public TextureRegion getLockedIcon(Sector hovered){
return (hovered.preset == null && !hovered.planet.allowLaunchToNumbered ? Fonts.getLargeIcon("cancel") : Fonts.getLargeIcon("lock"));
}
/** @return whether to allow landing on the specified procedural sector */ /** @return whether to allow landing on the specified procedural sector */
public boolean allowLanding(Sector sector){ public boolean allowLanding(Sector sector){
return sector.planet.allowLaunchToNumbered && (sector.hasBase() || sector.near().contains(Sector::hasBase)); return sector.planet.allowLaunchToNumbered && (sector.hasBase() || sector.near().contains(Sector::hasBase));

View File

@@ -1,5 +1,6 @@
package mindustry.maps.planet; package mindustry.maps.planet;
import arc.*;
import arc.graphics.*; import arc.graphics.*;
import arc.math.*; import arc.math.*;
import arc.math.geom.*; import arc.math.geom.*;
@@ -10,6 +11,7 @@ import mindustry.ai.*;
import mindustry.ai.BaseRegistry.*; import mindustry.ai.BaseRegistry.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.game.*; import mindustry.game.*;
import mindustry.gen.*;
import mindustry.graphics.g3d.PlanetGrid.*; import mindustry.graphics.g3d.PlanetGrid.*;
import mindustry.maps.generators.*; import mindustry.maps.generators.*;
import mindustry.type.*; import mindustry.type.*;
@@ -63,6 +65,21 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
return (Mathf.pow(Simplex.noise3d(seed, 7, 0.5f, 1f/3f, position.x, position.y, position.z), 2.3f) + waterOffset) / (1f + waterOffset); return (Mathf.pow(Simplex.noise3d(seed, 7, 0.5f, 1f/3f, position.x, position.y, position.z), 2.3f) + waterOffset) / (1f + waterOffset);
} }
@Override
public boolean allowLanding(Sector sector){
return sector.planet.allowLaunchToNumbered && (sector.hasBase() || sector.near().contains(s -> s.hasBase() &&
(s.info.bestCoreType.size >= 4 || s.isBeingPlayed() && state.rules.defaultTeam.cores().contains(b -> b.block.size >= 4))));
}
@Override
public void getLockedText(Sector hovered, StringBuilder out){
if(hovered.preset == null && hovered.near().contains(Sector::hasBase)){
out.append("[red]").append(Iconc.cancel).append("[]").append(Blocks.coreFoundation.emoji()).append(Core.bundle.get("sector.foundationrequired"));
}else{
super.getLockedText(hovered, out);
}
}
@Override @Override
public void generateSector(Sector sector){ public void generateSector(Sector sector){

View File

@@ -558,7 +558,10 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
Draw.color(hovered.isAttacked() ? Pal.remove : Color.white, Pal.accent, Mathf.absin(5f, 1f)); Draw.color(hovered.isAttacked() ? Pal.remove : Color.white, Pal.accent, Mathf.absin(5f, 1f));
Draw.alpha(state.uiAlpha); Draw.alpha(state.uiAlpha);
var icon = hovered.locked() && !canSelect(hovered) ? Fonts.getLargeIcon("lock") : hovered.isAttacked() ? Fonts.getLargeIcon("warning") : hovered.icon(); var icon =
hovered.locked() && !canSelect(hovered) && hovered.planet.generator != null ? hovered.planet.generator.getLockedIcon(hovered) :
hovered.isAttacked() ? Fonts.getLargeIcon("warning") :
hovered.icon();
if(icon != null){ if(icon != null){
Draw.rect(icon, 0, 0, iw, iw * icon.height / icon.width); Draw.rect(icon, 0, 0, iw, iw * icon.height / icon.width);
@@ -871,10 +874,12 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
if(hovered != null){ if(hovered != null){
StringBuilder tx = hoverLabel.getText(); StringBuilder tx = hoverLabel.getText();
if(!canSelect(hovered)){ if(!canSelect(hovered)){
if(mode == planetLaunch){ if(!(hovered.preset == null && !hovered.planet.allowLaunchToNumbered)){
tx.append("[gray]").append(Iconc.cancel); if(mode == planetLaunch){
}else{ tx.append("[gray]").append(Iconc.cancel);
tx.append("[gray]").append(Iconc.lock).append(" ").append(Core.bundle.get("locked")); }else if(hovered.planet.generator != null){
hovered.planet.generator.getLockedText(hovered, tx);
}
} }
}else{ }else{
tx.append("[accent][[ [white]").append(hovered.name()).append("[accent] ]"); tx.append("[accent][[ [white]").append(hovered.name()).append("[accent] ]");