a revelation

This commit is contained in:
Anuken
2020-01-11 23:41:12 -05:00
19 changed files with 355 additions and 280 deletions

View File

@@ -1,10 +1,11 @@
package mindustry.world;
import arc.struct.*;
import arc.func.*;
import arc.math.*;
import arc.math.geom.*;
import arc.struct.*;
import arc.util.ArcAnnotate.*;
import mindustry.annotations.Annotations.*;
import mindustry.content.*;
import mindustry.entities.traits.*;
import mindustry.entities.type.*;
@@ -215,6 +216,16 @@ public class Tile implements Position, TargetTrait{
}
}
/** remove()-s this tile, except it's synced across the network */
public void removeNet(){
Call.removeTile(this);
}
/** set()-s this tile, except it's synced across the network */
public void setNet(Block block, Team team, int rotation){
Call.setTile(this, block, team, rotation);
}
public byte rotation(){
return rotation;
}
@@ -506,4 +517,16 @@ public class Tile implements Position, TargetTrait{
public String toString(){
return floor.name + ":" + block.name + ":" + overlay + "[" + x + "," + y + "] " + "entity=" + (entity == null ? "null" : (entity.getClass())) + ":" + getTeam();
}
//remote utility methods
@Remote(called = Loc.server)
public static void removeTile(Tile tile){
tile.remove();
}
@Remote(called = Loc.server)
public static void setTile(Tile tile, Block block, Team team, int rotation){
tile.set(block, team, rotation);
}
}

View File

@@ -33,6 +33,7 @@ public class Conveyor extends Block implements Autotiler{
private TextureRegion[][] regions = new TextureRegion[7][4];
public float speed = 0f;
public float displayedSpeed = 0f;
protected Conveyor(String name){
super(name);
@@ -59,7 +60,8 @@ public class Conveyor extends Block implements Autotiler{
@Override
public void setStats(){
super.setStats();
stats.add(BlockStat.itemsMoved, speed * 60 / itemSpace, StatUnit.itemsSecond);
//have to add a custom calculated speed, since the actual movement speed is apparently not linear
stats.add(BlockStat.itemsMoved, displayedSpeed, StatUnit.itemsSecond);
}
@Override

View File

@@ -1,11 +1,11 @@
package mindustry.world.blocks.liquid;
import arc.*;
import arc.struct.*;
import arc.func.*;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.math.geom.*;
import arc.struct.*;
import arc.util.*;
import mindustry.content.*;
import mindustry.entities.traits.BuilderTrait.*;
@@ -13,7 +13,6 @@ import mindustry.entities.type.*;
import mindustry.type.*;
import mindustry.world.*;
import mindustry.world.blocks.*;
import mindustry.world.modules.*;
public class Conduit extends LiquidBlock implements Autotiler{
public final int timerFlow = timers++;
@@ -92,13 +91,12 @@ public class Conduit extends LiquidBlock implements Autotiler{
@Override
public void draw(Tile tile){
ConduitEntity entity = tile.ent();
LiquidModule mod = tile.entity.liquids;
int rotation = tile.rotation() * 90;
Draw.colorl(0.34f);
Draw.rect(botRegions[entity.blendbits], tile.drawx(), tile.drawy(), rotation);
Draw.color(mod.current().color);
Draw.color(tile.entity.liquids.current().color);
Draw.alpha(entity.smoothLiquid);
Draw.rect(botRegions[entity.blendbits], tile.drawx(), tile.drawy(), rotation);
Draw.color();
@@ -109,7 +107,7 @@ public class Conduit extends LiquidBlock implements Autotiler{
@Override
public void update(Tile tile){
ConduitEntity entity = tile.ent();
entity.smoothLiquid = Mathf.lerpDelta(entity.smoothLiquid, entity.liquids.total() / liquidCapacity, 0.05f);
entity.smoothLiquid = Mathf.lerpDelta(entity.smoothLiquid, entity.liquids.currentAmount() / liquidCapacity, 0.05f);
if(tile.entity.liquids.total() > 0.001f && tile.entity.timer.get(timerFlow, 1)){
tryMoveLiquid(tile, tile.getNearby(tile.rotation()), leakResistance, tile.entity.liquids.current());