Fixed units patrolling too quickly / Editor bugfixes
This commit is contained in:
@@ -21,18 +21,21 @@ public enum EditorTool{
|
|||||||
|
|
||||||
Tile tile = editor.tile(x, y);
|
Tile tile = editor.tile(x, y);
|
||||||
|
|
||||||
Block floor = tile.floor(), block = tile.block();
|
|
||||||
byte link = tile.getLinkByte();
|
byte link = tile.getLinkByte();
|
||||||
|
|
||||||
if(block instanceof BlockPart && link != 0){
|
if(tile.block() instanceof BlockPart && link != 0){
|
||||||
x -= (Pack.leftByte(link) - 8);
|
x -= (Pack.leftByte(link) - 8);
|
||||||
y -= (Pack.rightByte(link) - 8);
|
y -= (Pack.rightByte(link) - 8);
|
||||||
|
|
||||||
tile = editor.tile(x, y);
|
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{
|
pencil{
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ public class MapEditor{
|
|||||||
|
|
||||||
if(i == 1){
|
if(i == 1){
|
||||||
tile.setBlock(Blocks.part);
|
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{
|
}else{
|
||||||
byte link = tile.getLinkByte();
|
byte link = tile.getLinkByte();
|
||||||
Block block = tile.block();
|
Block block = tile.block();
|
||||||
|
|||||||
@@ -241,10 +241,14 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!isFlying() && (world.tileWorld(x, y) != null && world.tileWorld(x, y).solid())){
|
||||||
|
kill();
|
||||||
|
}
|
||||||
|
|
||||||
avoidOthers(1.25f);
|
avoidOthers(1.25f);
|
||||||
|
|
||||||
if(spawner != noSpawner && (world.tile(spawner) == null || world.tile(spawner).entity == null)){
|
if(spawner != noSpawner && (world.tile(spawner) == null || world.tile(spawner).entity == null)){
|
||||||
damage(health);
|
kill();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTargeting();
|
updateTargeting();
|
||||||
|
|||||||
@@ -178,9 +178,9 @@ public abstract class GroundUnit extends BaseUnit{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void patrol(){
|
protected void patrol(){
|
||||||
vec.trns(baseRotation, type.speed * Time.delta() * 2);
|
vec.trns(baseRotation, type.speed * Time.delta());
|
||||||
velocity.add(vec.x, vec.y);
|
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);
|
Tile tile = world.tileWorld(x + vec.x, y + vec.y);
|
||||||
if((tile == null || tile.solid() || tile.floor().drownTime > 0) || stuckTime > 10f){
|
if((tile == null || tile.solid() || tile.floor().drownTime > 0) || stuckTime > 10f){
|
||||||
baseRotation += Mathf.sign(id % 2 - 0.5f) * Time.delta() * 3f;
|
baseRotation += Mathf.sign(id % 2 - 0.5f) * Time.delta() * 3f;
|
||||||
|
|||||||
Reference in New Issue
Block a user