Procedural sectors on Serpulo now require a Foundation core
This commit is contained in:
@@ -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. */
|
||||
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 */
|
||||
|
||||
@@ -265,12 +265,6 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
Unit unit = Groups.unit.getByID(id);
|
||||
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){
|
||||
//implicitly order it to move
|
||||
if(ai.command == null || ai.command.switchToMove){
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package mindustry.maps.generators;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.struct.*;
|
||||
import arc.struct.ObjectIntMap.*;
|
||||
@@ -8,10 +10,12 @@ import arc.util.noise.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.g3d.*;
|
||||
import mindustry.graphics.g3d.PlanetGrid.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.type.Weather.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
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 */
|
||||
public boolean allowLanding(Sector sector){
|
||||
return sector.planet.allowLaunchToNumbered && (sector.hasBase() || sector.near().contains(Sector::hasBase));
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package mindustry.maps.planet;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
@@ -10,6 +11,7 @@ import mindustry.ai.*;
|
||||
import mindustry.ai.BaseRegistry.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.g3d.PlanetGrid.*;
|
||||
import mindustry.maps.generators.*;
|
||||
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);
|
||||
}
|
||||
|
||||
@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
|
||||
public void generateSector(Sector sector){
|
||||
|
||||
|
||||
@@ -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.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){
|
||||
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){
|
||||
StringBuilder tx = hoverLabel.getText();
|
||||
if(!canSelect(hovered)){
|
||||
if(mode == planetLaunch){
|
||||
tx.append("[gray]").append(Iconc.cancel);
|
||||
}else{
|
||||
tx.append("[gray]").append(Iconc.lock).append(" ").append(Core.bundle.get("locked"));
|
||||
if(!(hovered.preset == null && !hovered.planet.allowLaunchToNumbered)){
|
||||
if(mode == planetLaunch){
|
||||
tx.append("[gray]").append(Iconc.cancel);
|
||||
}else if(hovered.planet.generator != null){
|
||||
hovered.planet.generator.getLockedText(hovered, tx);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
tx.append("[accent][[ [white]").append(hovered.name()).append("[accent] ]");
|
||||
|
||||
Reference in New Issue
Block a user