Fixed units patrolling too quickly / Editor bugfixes

This commit is contained in:
Anuken
2019-03-16 13:25:50 -04:00
parent 91741ec29c
commit 22fadab3b3
4 changed files with 15 additions and 8 deletions

View File

@@ -21,18 +21,21 @@ public enum EditorTool{
Tile tile = editor.tile(x, y);
Block floor = tile.floor(), block = tile.block();
byte link = tile.getLinkByte();
if(block instanceof BlockPart && link != 0){
if(tile.block() instanceof BlockPart && link != 0){
x -= (Pack.leftByte(link) - 8);
y -= (Pack.rightByte(link) - 8);
tile = editor.tile(x, y);
block = tile.block();
}
editor.drawBlock = block == Blocks.air ? tile.ore() == Blocks.air ? floor : tile.ore() : block;
//do not.
if(tile.block() instanceof BlockPart){
return;
}
editor.drawBlock = tile.block() == Blocks.air ? tile.ore() == Blocks.air ? tile.floor() : tile.ore() : tile.block();
}
},
pencil{

View File

@@ -176,7 +176,7 @@ public class MapEditor{
if(i == 1){
tile.setBlock(Blocks.part);
tile.setLinked((byte)(dx + offsetx), (byte)(dy + offsety));
tile.setLinkByte(Pack.byteByte((byte) (dx + offsetx + 8), (byte) (dy + offsety + 8)));
}else{
byte link = tile.getLinkByte();
Block block = tile.block();

View File

@@ -241,10 +241,14 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
return;
}
if(!isFlying() && (world.tileWorld(x, y) != null && world.tileWorld(x, y).solid())){
kill();
}
avoidOthers(1.25f);
if(spawner != noSpawner && (world.tile(spawner) == null || world.tile(spawner).entity == null)){
damage(health);
kill();
}
updateTargeting();

View File

@@ -178,9 +178,9 @@ public abstract class GroundUnit extends BaseUnit{
}
protected void patrol(){
vec.trns(baseRotation, type.speed * Time.delta() * 2);
vec.trns(baseRotation, type.speed * Time.delta());
velocity.add(vec.x, vec.y);
vec.trns(baseRotation, type.hitsizeTile);
vec.trns(baseRotation, type.hitsizeTile * 3);
Tile tile = world.tileWorld(x + vec.x, y + vec.y);
if((tile == null || tile.solid() || tile.floor().drownTime > 0) || stuckTime > 10f){
baseRotation += Mathf.sign(id % 2 - 0.5f) * Time.delta() * 3f;