mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-03 22:21:17 +07:00
Misc bugfixes
This commit is contained in:
parent
79e079671c
commit
fbe45aba74
@ -856,8 +856,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
boolean omni = unit.type.omniMovement;
|
||||
boolean allowHealing = type.canHeal;
|
||||
boolean validHealTarget = allowHealing && target instanceof Building && ((Building)target).isValid() && target.team() == unit.team &&
|
||||
((Building)target).damaged() && target.within(unit, type.range);
|
||||
boolean validHealTarget = allowHealing && target instanceof Building b && b.isValid() && target.team() == unit.team && b.damaged() && target.within(unit, type.range);
|
||||
boolean boosted = (unit instanceof Mechc && unit.isFlying());
|
||||
|
||||
//reset target if:
|
||||
@ -912,13 +911,8 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
unit.vel.approachDelta(Vec2.ZERO, unit.speed() * type.accel / 2f);
|
||||
}
|
||||
|
||||
float expansion = 3f;
|
||||
|
||||
unit.hitbox(rect);
|
||||
rect.x -= expansion;
|
||||
rect.y -= expansion;
|
||||
rect.width += expansion * 2f;
|
||||
rect.height += expansion * 2f;
|
||||
rect.grow(6f);
|
||||
|
||||
player.boosting = collisions.overlapsTile(rect) || !unit.within(targetPos, 85f);
|
||||
|
||||
@ -927,7 +921,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
}else{
|
||||
unit.moveAt(Tmp.v2.trns(unit.rotation, movement.len()));
|
||||
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;
|
||||
rotate = true;
|
||||
configurable = true;
|
||||
//make sure to display large units.
|
||||
clipSize = 120;
|
||||
|
||||
config(Block.class, (PayloadSourceBuild build, Block block) -> {
|
||||
if(canProduce(block) && build.block != block){
|
||||
@ -45,6 +47,13 @@ public class PayloadSource extends PayloadBlock{
|
||||
build.scl = 0f;
|
||||
}
|
||||
});
|
||||
|
||||
configClear((PayloadSourceBuild build) -> {
|
||||
build.block = null;
|
||||
build.unit = null;
|
||||
build.payload = null;
|
||||
build.scl = 0f;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,6 +19,8 @@ public class PayloadVoid extends PayloadBlock{
|
||||
update = true;
|
||||
rotate = false;
|
||||
size = 3;
|
||||
//make sure to display large units.
|
||||
clipSize = 120;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4,10 +4,10 @@ import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.util.*;
|
||||
import arc.util.io.*;
|
||||
import mindustry.*;
|
||||
import mindustry.core.*;
|
||||
import mindustry.entities.EntityCollisions.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.game.EventType.*;
|
||||
@ -69,14 +69,12 @@ public class UnitPayload implements Payload{
|
||||
//check if unit can be dumped here
|
||||
SolidPred solid = unit.solidity();
|
||||
if(solid != null){
|
||||
int tx = unit.tileX(), ty = unit.tileY();
|
||||
boolean nearEmpty = !solid.solid(tx, ty);
|
||||
for(Point2 p : Geometry.d4){
|
||||
nearEmpty |= !solid.solid(tx + p.x, ty + p.y);
|
||||
}
|
||||
Tmp.v1.trns(unit.rotation, 1f);
|
||||
|
||||
int tx = World.toTile(unit.x + Tmp.v1.x), ty = World.toTile(unit.y + Tmp.v1.y);
|
||||
|
||||
//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
|
||||
|
Loading…
Reference in New Issue
Block a user