Allowed enemy spawns on water

This commit is contained in:
Anuken 2020-10-22 09:43:21 -04:00
parent f2dd5ba113
commit a732237005
10 changed files with 18 additions and 13 deletions

View File

@ -34,8 +34,8 @@ public class FormationAI extends AIController implements FormationMember{
return;
}
if(unit.type.canBoost && unit.canPassOn()){
unit.elevation = Mathf.approachDelta(unit.elevation, 0f, 0.08f);
if(unit.type.canBoost){
unit.elevation = Mathf.approachDelta(unit.elevation, !unit.canPassOn() ? 1f : leader.type.canBoost ? leader.elevation : 0f, 0.08f);
}
unit.controlWeapons(true, leader.isShooting);
@ -53,10 +53,12 @@ public class FormationAI extends AIController implements FormationMember{
float margin = 3f;
float speed = unit.realSpeed();
if(unit.dst(realtarget) <= margin){
unit.vel.approachDelta(Vec2.ZERO, type.speed * type.accel / 2f);
unit.vel.approachDelta(Vec2.ZERO, speed * type.accel / 2f);
}else{
unit.moveAt(realtarget.sub(unit).limit(type.speed));
unit.moveAt(realtarget.sub(unit).limit(speed));
}
if(unit instanceof Minerc mine && leader instanceof Minerc com){

View File

@ -121,6 +121,7 @@ public class Blocks implements ContentList{
spawn = new OverlayFloor("spawn"){
{
variants = 0;
needsSurface = false;
}
@Override
public void drawBase(Tile tile){}

View File

@ -26,7 +26,7 @@ public class EditorTile extends Tile{
if(type instanceof OverlayFloor){
//don't place on liquids
if(floor.hasSurface()){
if(floor.hasSurface() || !type.needsSurface){
setOverlayID(type.id);
}
return;
@ -75,7 +75,7 @@ public class EditorTile extends Tile{
return;
}
if(floor.isLiquid) return;
if(!floor.hasSurface() && overlay.asFloor().needsSurface) return;
if(overlay() == overlay) return;
op(OpType.overlay, this.overlay.id);
super.setOverlay(overlay);

View File

@ -118,7 +118,7 @@ public enum EditorTool{
if(editor.drawBlock.isOverlay()){
Block dest = tile.overlay();
if(dest == editor.drawBlock) return;
tester = t -> t.overlay() == dest && t.floor().hasSurface();
tester = t -> t.overlay() == dest && (t.floor().hasSurface() || !t.floor().needsSurface);
setter = t -> t.setOverlay(editor.drawBlock);
}else if(editor.drawBlock.isFloor()){
Block dest = tile.floor();

View File

@ -417,7 +417,7 @@ public class MapGenerateDialog extends BaseDialog{
public void set(Block floor, Block wall, Block ore, Team team){
this.floor = floor.id;
this.block = wall.id;
this.ore = !floor.asFloor().hasSurface() ? 0 : ore.id;
this.ore = (!floor.asFloor().hasSurface() && ore.asFloor().needsSurface) ? 0 : ore.id;
this.team = (byte)team.id;
}

View File

@ -54,7 +54,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc, Unitc{
}
}
if(core == null || !validMine(mineTile)){
if(!validMine(mineTile)){
mineTile = null;
mineTimer = 0f;
}else if(mining()){
@ -69,7 +69,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc, Unitc{
if(mineTimer >= 50f + item.hardness*15f){
mineTimer = 0;
if(within(core, mineTransferRange) && core.acceptStack(item, 1, this) == 1 && offloadImmediately()){
if(core != null && within(core, mineTransferRange) && core.acceptStack(item, 1, this) == 1 && offloadImmediately()){
Call.transferItemTo(item, 1,
mineTile.worldx() + Mathf.range(tilesize / 2f),
mineTile.worldy() + Mathf.range(tilesize / 2f), core);

View File

@ -610,7 +610,7 @@ public class DesktopInput extends InputHandler{
baseSpeed = unit.minFormationSpeed * 0.95f;
}
float speed = baseSpeed * Mathf.lerp(1f, unit.isCommanding() ? 1f : unit.type.canBoost ? unit.type.boostMultiplier : 1f, unit.elevation) * strafePenalty;
float speed = baseSpeed * Mathf.lerp(1f, unit.type.canBoost ? unit.type.boostMultiplier : 1f, unit.elevation) * strafePenalty;
float xa = Core.input.axis(Binding.move_x);
float ya = Core.input.axis(Binding.move_y);
boolean boosted = (unit instanceof Mechc && unit.isFlying());

View File

@ -865,7 +865,7 @@ public class MobileInput extends InputHandler implements GestureListener{
baseSpeed = unit.minFormationSpeed * 0.98f;
}
float speed = baseSpeed * Mathf.lerp(1f, unit.isCommanding() ? 1f : type.canBoost ? type.boostMultiplier : 1f, unit.elevation) * strafePenalty;
float speed = baseSpeed * Mathf.lerp(1f, type.canBoost ? type.boostMultiplier : 1f, unit.elevation) * strafePenalty;
float range = unit.hasWeapons() ? unit.range() : 0f;
float bulletSpeed = unit.hasWeapons() ? type.weapons.first().bullet.speed : 0f;
float mouseAngle = unit.angleTo(unit.aimX(), unit.aimY());

View File

@ -64,6 +64,8 @@ public class Floor extends Block{
public Block wall = Blocks.air;
/** Decoration block. Usually a rock. May be air. */
public Block decoration = Blocks.air;
/** Whether this overlay needs a surface to be on. False for floating blocks, like spawns. */
public boolean needsSurface = true;
protected TextureRegion[][] edges;
protected Seq<Block> blenders = new Seq<>();

View File

@ -1,3 +1,3 @@
org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=b6e614dd1c272073a420aa946797118ea6b48324
archash=3f883ca573d8b3132cab878c07487febecf1d4e2