stuff and things
This commit is contained in:
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 38 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 29 KiB |
@@ -12,6 +12,7 @@ import io.anuke.mindustry.game.*;
|
|||||||
import io.anuke.mindustry.game.Teams.*;
|
import io.anuke.mindustry.game.Teams.*;
|
||||||
import io.anuke.mindustry.type.*;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.world.*;
|
import io.anuke.mindustry.world.*;
|
||||||
|
import io.anuke.mindustry.world.blocks.*;
|
||||||
import io.anuke.mindustry.world.meta.*;
|
import io.anuke.mindustry.world.meta.*;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
@@ -118,7 +119,7 @@ public class BlockIndexer{
|
|||||||
|
|
||||||
ObjectSet<Tile> set = damagedTiles[team.ordinal()];
|
ObjectSet<Tile> set = damagedTiles[team.ordinal()];
|
||||||
for(Tile tile : set){
|
for(Tile tile : set){
|
||||||
if(tile.entity == null || tile.entity.getTeam() != team || !tile.entity.damaged()){
|
if((tile.entity == null || tile.entity.getTeam() != team || !tile.entity.damaged()) && !(tile.block() instanceof BuildBlock)){
|
||||||
returnArray.add(tile);
|
returnArray.add(tile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import io.anuke.mindustry.net.NetConnection;
|
|||||||
import io.anuke.mindustry.type.*;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.blocks.Floor;
|
import io.anuke.mindustry.world.blocks.*;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
@@ -638,7 +638,8 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void updateTouch(){
|
protected void updateTouch(){
|
||||||
if(Units.invalidateTarget(target, this) && !(target instanceof TileEntity && ((TileEntity)target).damaged() && target.isValid() && target.getTeam() == team && mech.canHeal && dst(target) < getWeapon().bullet.range())){
|
if(Units.invalidateTarget(target, this) &&
|
||||||
|
!(target instanceof TileEntity && ((TileEntity)target).damaged() && target.isValid() && target.getTeam() == team && mech.canHeal && dst(target) < getWeapon().bullet.range() && !(((TileEntity)target).block instanceof BuildBlock))){
|
||||||
target = null;
|
target = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import io.anuke.arc.util.*;
|
|||||||
|
|
||||||
/** Controls playback of multiple music tracks.*/
|
/** Controls playback of multiple music tracks.*/
|
||||||
public class MusicControl{
|
public class MusicControl{
|
||||||
private static final float finTime = 80f, foutTime = 80f;
|
private static final float finTime = 120f, foutTime = 120f;
|
||||||
private @Nullable Music current;
|
private @Nullable Music current;
|
||||||
private float fade;
|
private float fade;
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ public class Pal{
|
|||||||
lightFlame = Color.valueOf("ffdd55"),
|
lightFlame = Color.valueOf("ffdd55"),
|
||||||
darkFlame = Color.valueOf("db401c"),
|
darkFlame = Color.valueOf("db401c"),
|
||||||
|
|
||||||
|
power2 = Color.valueOf("ff9f6c"),
|
||||||
|
|
||||||
lightPyraFlame = Color.valueOf("ffb855"),
|
lightPyraFlame = Color.valueOf("ffb855"),
|
||||||
darkPyraFlame = Color.valueOf("db661c"),
|
darkPyraFlame = Color.valueOf("db661c"),
|
||||||
|
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ public abstract class BasicGenerator extends RandomGenerator{
|
|||||||
int offsetX = x - 4, offsetY = y + 23;
|
int offsetX = x - 4, offsetY = y + 23;
|
||||||
for(int i = ores.size - 1; i >= 0; i--){
|
for(int i = ores.size - 1; i >= 0; i--){
|
||||||
Block entry = ores.get(i);
|
Block entry = ores.get(i);
|
||||||
if(Math.abs(0.5f - sim.octaveNoise2D(2, 0.7, 1f / (50 + i * 2), offsetX, offsetY + i*999)) > 0.23f &&
|
if(Math.abs(0.5f - sim.octaveNoise2D(2, 0.7, 1f / (40 + i * 2), offsetX, offsetY + i*999)) > 0.26f &&
|
||||||
Math.abs(0.5f - sim2.octaveNoise2D(1, 1, 1f / (40 + i * 4), offsetX, offsetY - i*999)) > 0.32f){
|
Math.abs(0.5f - sim2.octaveNoise2D(1, 1, 1f / (30 + i * 4), offsetX, offsetY - i*999)) > 0.37f){
|
||||||
ore = entry;
|
ore = entry;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -276,7 +276,8 @@ public class Block extends BlockStorage{
|
|||||||
tempTiles.clear();
|
tempTiles.clear();
|
||||||
Geometry.circle(tile.x, tile.y, range, (x, y) -> {
|
Geometry.circle(tile.x, tile.y, range, (x, y) -> {
|
||||||
Tile other = world.ltile(x, y);
|
Tile other = world.ltile(x, y);
|
||||||
if(other != null && other.block instanceof PowerNode && ((PowerNode)other.block).linkValid(other, tile)){
|
if(other != null && other.block instanceof PowerNode && ((PowerNode)other.block).linkValid(other, tile) && !other.entity.proximity().contains(tile) &&
|
||||||
|
!tile.entity.proximity().contains(p -> p.entity != null && p.entity.power != null && p.entity.power.graph == other.entity.power.graph)){
|
||||||
tempTiles.add(other);
|
tempTiles.add(other);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class MendProjector extends Block{
|
|||||||
|
|
||||||
entity.phaseHeat = Mathf.lerpDelta(entity.phaseHeat, Mathf.num(entity.cons.optionalValid()), 0.1f);
|
entity.phaseHeat = Mathf.lerpDelta(entity.phaseHeat, Mathf.num(entity.cons.optionalValid()), 0.1f);
|
||||||
|
|
||||||
if(entity.cons.optionalValid() && entity.timer.get(timerUse, useTime)){
|
if(entity.cons.optionalValid() && entity.timer.get(timerUse, useTime) && entity.power.satisfaction > 0){
|
||||||
entity.cons.trigger();
|
entity.cons.trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class OverdriveProjector extends Block{
|
|||||||
|
|
||||||
entity.phaseHeat = Mathf.lerpDelta(entity.phaseHeat, Mathf.num(entity.cons.optionalValid()), 0.1f);
|
entity.phaseHeat = Mathf.lerpDelta(entity.phaseHeat, Mathf.num(entity.cons.optionalValid()), 0.1f);
|
||||||
|
|
||||||
if(entity.timer.get(timerUse, useTime)){
|
if(entity.timer.get(timerUse, useTime) && entity.power.satisfaction > 0){
|
||||||
entity.cons.trigger();
|
entity.cons.trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public class PowerGraph{
|
|||||||
private final ObjectSet<Tile> all = new ObjectSet<>();
|
private final ObjectSet<Tile> all = new ObjectSet<>();
|
||||||
|
|
||||||
private final WindowedMean powerBalance = new WindowedMean(60);
|
private final WindowedMean powerBalance = new WindowedMean(60);
|
||||||
|
private float lastPowerProduced, lastPowerNeeded;
|
||||||
|
|
||||||
private long lastFrameUpdated = -1;
|
private long lastFrameUpdated = -1;
|
||||||
private final int graphID;
|
private final int graphID;
|
||||||
@@ -37,6 +38,23 @@ public class PowerGraph{
|
|||||||
return powerBalance.getMean();
|
return powerBalance.getMean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getLastPowerNeeded(){
|
||||||
|
return lastPowerNeeded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getLastPowerProduced(){
|
||||||
|
return lastPowerProduced;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getSatisfaction(){
|
||||||
|
if(Mathf.isZero(lastPowerProduced)){
|
||||||
|
return 0f;
|
||||||
|
}else if(Mathf.isZero(lastPowerNeeded)){
|
||||||
|
return 1f;
|
||||||
|
}
|
||||||
|
return Mathf.clamp(lastPowerProduced / lastPowerNeeded);
|
||||||
|
}
|
||||||
|
|
||||||
public float getPowerProduced(){
|
public float getPowerProduced(){
|
||||||
float powerProduced = 0f;
|
float powerProduced = 0f;
|
||||||
for(Tile producer : producers){
|
for(Tile producer : producers){
|
||||||
@@ -164,6 +182,9 @@ public class PowerGraph{
|
|||||||
float powerNeeded = getPowerNeeded();
|
float powerNeeded = getPowerNeeded();
|
||||||
float powerProduced = getPowerProduced();
|
float powerProduced = getPowerProduced();
|
||||||
|
|
||||||
|
lastPowerNeeded = powerNeeded;
|
||||||
|
lastPowerProduced = powerProduced;
|
||||||
|
|
||||||
powerBalance.addValue((powerProduced - powerNeeded) / Time.delta());
|
powerBalance.addValue((powerProduced - powerNeeded) / Time.delta());
|
||||||
|
|
||||||
if(consumers.size == 0 && producers.size == 0 && batteries.size == 0){
|
if(consumers.size == 0 && producers.size == 0 && batteries.size == 0){
|
||||||
|
|||||||
@@ -107,7 +107,8 @@ public class PowerNode extends PowerBlock{
|
|||||||
|
|
||||||
Geometry.circle(tile.x, tile.y, (int)(laserRange + 1), (x, y) -> {
|
Geometry.circle(tile.x, tile.y, (int)(laserRange + 1), (x, y) -> {
|
||||||
Tile other = world.ltile(x, y);
|
Tile other = world.ltile(x, y);
|
||||||
if(other != null && other != tile && ((!other.block().outputsPower && other.block().consumesPower) || (other.block().outputsPower && !other.block().consumesPower)) && linkValid(tile, other)){
|
if(other != null && other != tile && ((!other.block().outputsPower && other.block().consumesPower) || (other.block().outputsPower && !other.block().consumesPower)) && linkValid(tile, other)
|
||||||
|
&& !other.entity.proximity().contains(tile) && other.entity.power.graph != tile.entity.power.graph){
|
||||||
Call.linkPowerNodes(null, tile, other);
|
Call.linkPowerNodes(null, tile, other);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -255,8 +256,10 @@ public class PowerNode extends PowerBlock{
|
|||||||
x2 += t2.x;
|
x2 += t2.x;
|
||||||
y2 += t2.y;
|
y2 += t2.y;
|
||||||
|
|
||||||
Draw.color(Pal.powerLight, Color.WHITE, Mathf.absin(Time.time(), 8f, 0.3f) + 0.2f);
|
float fract = 1f-tile.entity.power.graph.getSatisfaction();
|
||||||
Drawf.laser(laser, laserEnd, x1, y1, x2, y2, 0.6f);
|
|
||||||
|
Draw.color(Color.WHITE, Pal.powerLight, fract*0.86f + Mathf.absin(3f, 0.1f));
|
||||||
|
Drawf.laser(laser, laserEnd, x1, y1, x2, y2, 0.4f);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user