More drone changes
|
Before Width: | Height: | Size: 372 B After Width: | Height: | Size: 2.9 KiB |
@@ -43,9 +43,11 @@ void main() {
|
|||||||
vec4 c = texture2D(u_texture, v_texCoord.xy);
|
vec4 c = texture2D(u_texture, v_texCoord.xy);
|
||||||
|
|
||||||
if(1.0-abs(coords.x - 0.5)*2.0 < 1.0-u_progress){
|
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){
|
if(c.a > 0.01){
|
||||||
float f = abs(sin(coords.x*2.0 + u_time));
|
float f = abs(sin(coords.x*2.0 + u_time));
|
||||||
if(f > 0.9)
|
if(f > 0.9)
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 709 B After Width: | Height: | Size: 707 B |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 252 KiB After Width: | Height: | Size: 252 KiB |
|
Before Width: | Height: | Size: 220 KiB After Width: | Height: | Size: 220 KiB |
|
Before Width: | Height: | Size: 400 KiB After Width: | Height: | Size: 400 KiB |
|
Before Width: | Height: | Size: 292 KiB After Width: | Height: | Size: 292 KiB |
@@ -1,5 +1,6 @@
|
|||||||
package io.anuke.mindustry.entities.type.base;
|
package io.anuke.mindustry.entities.type.base;
|
||||||
|
|
||||||
|
import io.anuke.arc.math.Mathf;
|
||||||
import io.anuke.arc.util.Structs;
|
import io.anuke.arc.util.Structs;
|
||||||
import io.anuke.mindustry.content.Blocks;
|
import io.anuke.mindustry.content.Blocks;
|
||||||
import io.anuke.mindustry.entities.traits.MinerTrait;
|
import io.anuke.mindustry.entities.traits.MinerTrait;
|
||||||
@@ -133,9 +134,18 @@ public class MinerDrone extends BaseDrone implements MinerTrait{
|
|||||||
updateMining();
|
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
|
@Override
|
||||||
public boolean shouldRotate(){
|
public boolean shouldRotate(){
|
||||||
return false;
|
return isMining();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package io.anuke.mindustry.entities.type.base;
|
package io.anuke.mindustry.entities.type.base;
|
||||||
|
|
||||||
import io.anuke.mindustry.entities.Units;
|
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.type.TileEntity;
|
||||||
import io.anuke.mindustry.entities.units.UnitState;
|
import io.anuke.mindustry.entities.units.UnitState;
|
||||||
import io.anuke.mindustry.world.Pos;
|
import io.anuke.mindustry.world.Pos;
|
||||||
@@ -11,7 +10,7 @@ import java.io.*;
|
|||||||
|
|
||||||
import static io.anuke.mindustry.Vars.world;
|
import static io.anuke.mindustry.Vars.world;
|
||||||
|
|
||||||
public class RepairDrone extends FlyingUnit{
|
public class RepairDrone extends BaseDrone{
|
||||||
public final UnitState repair = new UnitState(){
|
public final UnitState repair = new UnitState(){
|
||||||
|
|
||||||
public void entered(){
|
public void entered(){
|
||||||
@@ -32,12 +31,18 @@ public class RepairDrone extends FlyingUnit{
|
|||||||
//circle spawner if there's nothing to repair
|
//circle spawner if there's nothing to repair
|
||||||
if(getSpawner() != null){
|
if(getSpawner() != null){
|
||||||
target = getSpawner();
|
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
|
@Override
|
||||||
public UnitState getStartState(){
|
public UnitState getStartState(){
|
||||||
return repair;
|
return repair;
|
||||||
|
|||||||
@@ -53,9 +53,11 @@ public class PlacementFragment extends Fragment{
|
|||||||
|
|
||||||
public PlacementFragment(){
|
public PlacementFragment(){
|
||||||
Events.on(WorldLoadEvent.class, event -> {
|
Events.on(WorldLoadEvent.class, event -> {
|
||||||
|
Core.app.post(() -> {
|
||||||
control.input().block = null;
|
control.input().block = null;
|
||||||
rebuild();
|
rebuild();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
Events.on(UnlockEvent.class, event -> {
|
Events.on(UnlockEvent.class, event -> {
|
||||||
if(event.content instanceof Block){
|
if(event.content instanceof Block){
|
||||||
|
|||||||
@@ -148,6 +148,13 @@ public class PowerGraph{
|
|||||||
|
|
||||||
public void update(){
|
public void update(){
|
||||||
if(Core.graphics.getFrameId() == lastFrameUpdated){
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package io.anuke.mindustry.world.blocks.storage;
|
|||||||
|
|
||||||
import io.anuke.annotations.Annotations.Loc;
|
import io.anuke.annotations.Annotations.Loc;
|
||||||
import io.anuke.annotations.Annotations.Remote;
|
import io.anuke.annotations.Annotations.Remote;
|
||||||
import io.anuke.arc.Core;
|
|
||||||
import io.anuke.arc.collection.EnumSet;
|
import io.anuke.arc.collection.EnumSet;
|
||||||
import io.anuke.arc.graphics.g2d.*;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.math.Mathf;
|
||||||
@@ -24,7 +23,6 @@ import io.anuke.mindustry.world.meta.BlockFlag;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class CoreBlock extends StorageBlock{
|
public class CoreBlock extends StorageBlock{
|
||||||
protected TextureRegion topRegion;
|
|
||||||
|
|
||||||
public CoreBlock(String name){
|
public CoreBlock(String name){
|
||||||
super(name);
|
super(name);
|
||||||
@@ -83,23 +81,17 @@ public class CoreBlock extends StorageBlock{
|
|||||||
state.teams.get(tile.getTeam()).cores.add(tile);
|
state.teams.get(tile.getTeam()).cores.add(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load(){
|
|
||||||
super.load();
|
|
||||||
|
|
||||||
topRegion = Core.atlas.find(name + "-top");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Tile tile){
|
public void draw(Tile tile){
|
||||||
CoreEntity entity = tile.entity();
|
CoreEntity entity = tile.entity();
|
||||||
|
|
||||||
Draw.rect(region, tile.drawx(), tile.drawy());
|
Draw.rect(region, tile.drawx(), tile.drawy());
|
||||||
|
|
||||||
if(Core.atlas.isFound(topRegion)){
|
if(entity.heat > 0){
|
||||||
Draw.alpha(entity.heat);
|
Draw.colorl(0.25f);
|
||||||
Draw.rect(topRegion, tile.drawx(), tile.drawy());
|
Lines.stroke(2f * entity.heat);
|
||||||
Draw.color();
|
Lines.poly(tile.drawx(), tile.drawy(), 4, 8f * entity.heat);
|
||||||
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(entity.currentUnit != null){
|
if(entity.currentUnit != null){
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ public class ConsumeModule extends BlockModule{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void update(){
|
public void update(){
|
||||||
|
//everything is valid here
|
||||||
|
if(entity.tile.isEnemyCheat()){
|
||||||
|
valid = optionalValid = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
boolean prevValid = valid();
|
boolean prevValid = valid();
|
||||||
valid = true;
|
valid = true;
|
||||||
optionalValid = true;
|
optionalValid = true;
|
||||||
|
|||||||