Misc bugfixes
This commit is contained in:
@@ -856,8 +856,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
|
|
||||||
boolean omni = unit.type.omniMovement;
|
boolean omni = unit.type.omniMovement;
|
||||||
boolean allowHealing = type.canHeal;
|
boolean allowHealing = type.canHeal;
|
||||||
boolean validHealTarget = allowHealing && target instanceof Building && ((Building)target).isValid() && target.team() == unit.team &&
|
boolean validHealTarget = allowHealing && target instanceof Building b && b.isValid() && target.team() == unit.team && b.damaged() && target.within(unit, type.range);
|
||||||
((Building)target).damaged() && target.within(unit, type.range);
|
|
||||||
boolean boosted = (unit instanceof Mechc && unit.isFlying());
|
boolean boosted = (unit instanceof Mechc && unit.isFlying());
|
||||||
|
|
||||||
//reset target if:
|
//reset target if:
|
||||||
@@ -912,13 +911,8 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
unit.vel.approachDelta(Vec2.ZERO, unit.speed() * type.accel / 2f);
|
unit.vel.approachDelta(Vec2.ZERO, unit.speed() * type.accel / 2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
float expansion = 3f;
|
|
||||||
|
|
||||||
unit.hitbox(rect);
|
unit.hitbox(rect);
|
||||||
rect.x -= expansion;
|
rect.grow(6f);
|
||||||
rect.y -= expansion;
|
|
||||||
rect.width += expansion * 2f;
|
|
||||||
rect.height += expansion * 2f;
|
|
||||||
|
|
||||||
player.boosting = collisions.overlapsTile(rect) || !unit.within(targetPos, 85f);
|
player.boosting = collisions.overlapsTile(rect) || !unit.within(targetPos, 85f);
|
||||||
|
|
||||||
@@ -927,7 +921,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
}else{
|
}else{
|
||||||
unit.moveAt(Tmp.v2.trns(unit.rotation, movement.len()));
|
unit.moveAt(Tmp.v2.trns(unit.rotation, movement.len()));
|
||||||
if(!movement.isZero()){
|
if(!movement.isZero()){
|
||||||
unit.vel.rotateTo(movement.angle(), unit.type.rotateSpeed * Math.max(Time.delta, 1));
|
unit.rotation = Angles.moveToward(unit.rotation, movement.angle(), unit.type.rotateSpeed * Math.max(Time.delta, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ public class PayloadSource extends PayloadBlock{
|
|||||||
hasPower = true;
|
hasPower = true;
|
||||||
rotate = true;
|
rotate = true;
|
||||||
configurable = true;
|
configurable = true;
|
||||||
|
//make sure to display large units.
|
||||||
|
clipSize = 120;
|
||||||
|
|
||||||
config(Block.class, (PayloadSourceBuild build, Block block) -> {
|
config(Block.class, (PayloadSourceBuild build, Block block) -> {
|
||||||
if(canProduce(block) && build.block != block){
|
if(canProduce(block) && build.block != block){
|
||||||
@@ -45,6 +47,13 @@ public class PayloadSource extends PayloadBlock{
|
|||||||
build.scl = 0f;
|
build.scl = 0f;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
configClear((PayloadSourceBuild build) -> {
|
||||||
|
build.block = null;
|
||||||
|
build.unit = null;
|
||||||
|
build.payload = null;
|
||||||
|
build.scl = 0f;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ public class PayloadVoid extends PayloadBlock{
|
|||||||
update = true;
|
update = true;
|
||||||
rotate = false;
|
rotate = false;
|
||||||
size = 3;
|
size = 3;
|
||||||
|
//make sure to display large units.
|
||||||
|
clipSize = 120;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import arc.*;
|
|||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.math.geom.*;
|
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import arc.util.io.*;
|
import arc.util.io.*;
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
|
import mindustry.core.*;
|
||||||
import mindustry.entities.EntityCollisions.*;
|
import mindustry.entities.EntityCollisions.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
@@ -69,14 +69,12 @@ public class UnitPayload implements Payload{
|
|||||||
//check if unit can be dumped here
|
//check if unit can be dumped here
|
||||||
SolidPred solid = unit.solidity();
|
SolidPred solid = unit.solidity();
|
||||||
if(solid != null){
|
if(solid != null){
|
||||||
int tx = unit.tileX(), ty = unit.tileY();
|
Tmp.v1.trns(unit.rotation, 1f);
|
||||||
boolean nearEmpty = !solid.solid(tx, ty);
|
|
||||||
for(Point2 p : Geometry.d4){
|
int tx = World.toTile(unit.x + Tmp.v1.x), ty = World.toTile(unit.y + Tmp.v1.y);
|
||||||
nearEmpty |= !solid.solid(tx + p.x, ty + p.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
//cannot dump on solid blocks
|
//cannot dump on solid blocks
|
||||||
if(!nearEmpty) return false;
|
if(solid.solid(tx, ty)) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//cannnot dump when there's a lot of overlap going on
|
//cannnot dump when there's a lot of overlap going on
|
||||||
|
|||||||
Reference in New Issue
Block a user