More drone changes

This commit is contained in:
Anuken 2019-06-14 21:06:58 -04:00
parent 89b3d3b670
commit 910dab1896
15 changed files with 44 additions and 20 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 372 B

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

View File

@ -43,9 +43,11 @@ void main() {
vec4 c = texture2D(u_texture, v_texCoord.xy);
if(1.0-abs(coords.x - 0.5)*2.0 < 1.0-u_progress){
c = vec4(0.0);
// c = vec4(0.0);
}
c.a *= u_progress;
if(c.a > 0.01){
float f = abs(sin(coords.x*2.0 + u_time));
if(f > 0.9)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 709 B

After

Width:  |  Height:  |  Size: 707 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 KiB

After

Width:  |  Height:  |  Size: 252 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 KiB

After

Width:  |  Height:  |  Size: 220 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 400 KiB

After

Width:  |  Height:  |  Size: 400 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 KiB

After

Width:  |  Height:  |  Size: 292 KiB

View File

@ -1,5 +1,6 @@
package io.anuke.mindustry.entities.type.base;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.util.Structs;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.entities.traits.MinerTrait;
@ -133,9 +134,18 @@ public class MinerDrone extends BaseDrone implements MinerTrait{
updateMining();
}
@Override
protected void updateRotation(){
if(mineTile != null && shouldRotate() && mineTile.dst(this) < type.range){
rotation = Mathf.slerpDelta(rotation, angleTo(mineTile), 0.3f);
}else{
rotation = Mathf.slerpDelta(rotation, velocity.angle(), 0.3f);
}
}
@Override
public boolean shouldRotate(){
return false;
return isMining();
}
@Override

View File

@ -1,7 +1,6 @@
package io.anuke.mindustry.entities.type.base;
import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.entities.type.FlyingUnit;
import io.anuke.mindustry.entities.type.TileEntity;
import io.anuke.mindustry.entities.units.UnitState;
import io.anuke.mindustry.world.Pos;
@ -11,7 +10,7 @@ import java.io.*;
import static io.anuke.mindustry.Vars.world;
public class RepairDrone extends FlyingUnit{
public class RepairDrone extends BaseDrone{
public final UnitState repair = new UnitState(){
public void entered(){
@ -32,12 +31,18 @@ public class RepairDrone extends FlyingUnit{
//circle spawner if there's nothing to repair
if(getSpawner() != null){
target = getSpawner();
circle(type.range * 0.9f);
circle(type.range * 1.5f, type.speed/2f);
target = null;
}
}
}
};
@Override
public boolean shouldRotate(){
return target != null;
}
@Override
public UnitState getStartState(){
return repair;

View File

@ -53,8 +53,10 @@ public class PlacementFragment extends Fragment{
public PlacementFragment(){
Events.on(WorldLoadEvent.class, event -> {
control.input().block = null;
rebuild();
Core.app.post(() -> {
control.input().block = null;
rebuild();
});
});
Events.on(UnlockEvent.class, event -> {

View File

@ -148,6 +148,13 @@ public class PowerGraph{
public void update(){
if(Core.graphics.getFrameId() == lastFrameUpdated){
return;
}else if(!consumers.isEmpty() && consumers.first().isEnemyCheat()){
//when cheating, just set satisfaction to 1
for(Tile tile : consumers){
tile.entity.power.satisfaction = 1f;
}
return;
}

View File

@ -2,7 +2,6 @@ package io.anuke.mindustry.world.blocks.storage;
import io.anuke.annotations.Annotations.Loc;
import io.anuke.annotations.Annotations.Remote;
import io.anuke.arc.Core;
import io.anuke.arc.collection.EnumSet;
import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.math.Mathf;
@ -24,7 +23,6 @@ import io.anuke.mindustry.world.meta.BlockFlag;
import static io.anuke.mindustry.Vars.*;
public class CoreBlock extends StorageBlock{
protected TextureRegion topRegion;
public CoreBlock(String name){
super(name);
@ -83,23 +81,17 @@ public class CoreBlock extends StorageBlock{
state.teams.get(tile.getTeam()).cores.add(tile);
}
@Override
public void load(){
super.load();
topRegion = Core.atlas.find(name + "-top");
}
@Override
public void draw(Tile tile){
CoreEntity entity = tile.entity();
Draw.rect(region, tile.drawx(), tile.drawy());
if(Core.atlas.isFound(topRegion)){
Draw.alpha(entity.heat);
Draw.rect(topRegion, tile.drawx(), tile.drawy());
Draw.color();
if(entity.heat > 0){
Draw.colorl(0.25f);
Lines.stroke(2f * entity.heat);
Lines.poly(tile.drawx(), tile.drawy(), 4, 8f * entity.heat);
Draw.reset();
}
if(entity.currentUnit != null){

View File

@ -14,6 +14,12 @@ public class ConsumeModule extends BlockModule{
}
public void update(){
//everything is valid here
if(entity.tile.isEnemyCheat()){
valid = optionalValid = true;
return;
}
boolean prevValid = valid();
valid = true;
optionalValid = true;