Code cleanup / Tainted water

This commit is contained in:
Anuken
2019-03-22 19:16:15 -04:00
parent e4f226a9c5
commit a4f558c77a
15 changed files with 1217 additions and 1129 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 505 B

After

Width:  |  Height:  |  Size: 506 B

File diff suppressed because it is too large Load Diff

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: 242 KiB

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 KiB

After

Width:  |  Height:  |  Size: 228 KiB

View File

@ -35,7 +35,7 @@ public class Blocks implements ContentList{
public static Block
//environment
air, part, spawn, deepwater, water, tar, stone, craters, charr, sand, darksand, ice, snow,
air, part, spawn, deepwater, water, taintedWater, tar, stone, craters, charr, sand, darksand, ice, snow, darksandTaintedWater,
holostone, rocks, sporerocks, icerocks, cliffs, sporePine, pine, whiteTree, whiteTreeDead, sporeCluster,
iceSnow, sandWater, darksandWater, duneRocks, sandRocks, moss, sporeMoss, shale, shaleRocks, shaleBoulder, grass, salt,
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor5, ignarock, magmarock, hotrock, snowrocks, rock, snowrock,
@ -114,7 +114,6 @@ public class Blocks implements ContentList{
}
deepwater = new Floor("deepwater"){{
liquidColor = Color.valueOf("4d5ca4");
speedMultiplier = 0.2f;
variants = 0;
liquidDrop = Liquids.water;
@ -126,7 +125,6 @@ public class Blocks implements ContentList{
}};
water = new Floor("water"){{
liquidColor = Color.valueOf("596ab8");
speedMultiplier = 0.5f;
variants = 0;
status = StatusEffects.wet;
@ -136,8 +134,28 @@ public class Blocks implements ContentList{
cacheLayer = CacheLayer.water;
}};
taintedWater = new Floor("tainted-water"){{
speedMultiplier = 0.17f;
variants = 0;
status = StatusEffects.wet;
statusDuration = 140f;
drownTime = 120f;
liquidDrop = Liquids.water;
isLiquid = true;
cacheLayer = CacheLayer.water;
}};
darksandTaintedWater = new Floor("darksand-tainted-water"){{
speedMultiplier = 0.75f;
variants = 0;
status = StatusEffects.wet;
statusDuration = 60f;
liquidDrop = Liquids.water;
isLiquid = true;
cacheLayer = CacheLayer.water;
}};
sandWater = new Floor("sand-water"){{
liquidColor = Color.valueOf("596ab8");
speedMultiplier = 0.8f;
variants = 0;
status = StatusEffects.wet;
@ -148,7 +166,6 @@ public class Blocks implements ContentList{
}};
darksandWater = new Floor("darksand-water"){{
liquidColor = Color.valueOf("596ab8");
speedMultiplier = 0.8f;
variants = 0;
status = StatusEffects.wet;
@ -160,7 +177,6 @@ public class Blocks implements ContentList{
tar = new Floor("tar"){{
drownTime = 150f;
liquidColor = Color.valueOf("292929");
status = StatusEffects.tarred;
statusDuration = 240f;
speedMultiplier = 0.19f;
@ -194,7 +210,7 @@ public class Blocks implements ContentList{
}};
holostone = new Floor("holostone"){{
edgeStyle = "blocky";
}};
grass = new Floor("grass"){{

View File

@ -115,7 +115,7 @@ public abstract class GroundUnit extends BaseUnit{
Floor floor = getFloorOn();
if(floor.isLiquid){
Draw.color(Color.WHITE, floor.liquidColor, 0.5f);
Draw.color(Color.WHITE, floor.color, 0.5f);
}
for(int i : Mathf.signs){
@ -126,7 +126,7 @@ public abstract class GroundUnit extends BaseUnit{
}
if(floor.isLiquid){
Draw.color(Color.WHITE, floor.liquidColor, drownTime * 0.4f);
Draw.color(Color.WHITE, floor.color, drownTime * 0.4f);
}else{
Draw.color(Color.WHITE);
}

View File

@ -292,7 +292,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
if(!mech.flying){
if(floor.isLiquid){
Draw.color(Color.WHITE, floor.liquidColor, 0.5f);
Draw.color(Color.WHITE, floor.color, 0.5f);
}
float boostTrnsY = -boostHeat * 3f;
@ -312,7 +312,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
}
if(floor.isLiquid){
Draw.color(Color.WHITE, floor.liquidColor, drownTime);
Draw.color(Color.WHITE, floor.color, drownTime);
}else{
Draw.color(Color.WHITE);
}
@ -524,7 +524,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
if(mech.shake > 1f){
Effects.shake(mech.shake, mech.shake, this);
}
Effects.effect(Fx.unitLand, tile.floor().liquidColor == null ? tile.floor().color : tile.floor().color, x, y, tile.floor().isLiquid ? 1f : 0.5f);
Effects.effect(Fx.unitLand, tile.floor().color, x, y, tile.floor().isLiquid ? 1f : 0.5f);
}
mech.onLand(this);
achievedFlight = false;

View File

@ -278,7 +278,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
}
if(onLiquid && velocity.len() > 0.4f && Mathf.chance((velocity.len() * floor.speedMultiplier) * 0.06f * Time.delta())){
Effects.effect(floor.walkEffect, floor.liquidColor, x, y);
Effects.effect(floor.walkEffect, floor.color, x, y);
}
if(onLiquid){
@ -292,7 +292,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
if(onLiquid && floor.drownTime > 0){
drownTime += Time.delta() * 1f / floor.drownTime;
if(Mathf.chance(Time.delta() * 0.05f)){
Effects.effect(floor.drownUpdateEffect, floor.liquidColor, x, y);
Effects.effect(floor.drownUpdateEffect, floor.color, x, y);
}
}else{
drownTime = Mathf.lerpDelta(drownTime, 0f, 0.03f);

View File

@ -1,7 +1,6 @@
package io.anuke.mindustry.world.blocks;
import io.anuke.arc.Core;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.TextureRegion;
import io.anuke.arc.math.Mathf;
@ -40,8 +39,6 @@ public class Floor extends Block{
public StatusEffect status = StatusEffects.none;
/** Intensity of applied status effect. */
public float statusDuration = 60f;
/** Color of this floor's liquid. Used for tinting sprites. */
public Color liquidColor;
/** liquids that drop from this block, used for pumps */
public Liquid liquidDrop = null;
/** item that drops from this block, used for drills */
@ -95,15 +92,6 @@ public class Floor extends Block{
return new TextureRegion[]{Core.atlas.find(Core.atlas.has(name) ? name : name + "1")};
}
@Override
public void init(){
super.init();
if(isLiquid && liquidColor == null){
throw new RuntimeException("All liquids must define a liquidColor! Problematic block: " + name);
}
}
@Override
public void draw(Tile tile){
Mathf.random.setSeed(tile.pos());

View File

@ -13,7 +13,7 @@ public class PowerDistributor extends PowerBlock{
@Override
public void update(Tile tile){
if(tile.entity != null && tile.entity.power != null && tile.entity.power.graph != null){
if(tile.entity.power.graph != null){
tile.entity.power.graph.update();
}
}

View File

@ -229,7 +229,7 @@ public class PowerGraph{
closedSet.clear();
for(Tile other : tile.block().getPowerConnections(tile, outArray1)){
if(other.entity.power == null || other.entity.power.graph != null){ continue; }
if(other.entity.power == null || other.entity.power.graph != null) continue;
PowerGraph graph = new PowerGraph();
queue.clear();
queue.addLast(other);

View File

@ -125,7 +125,7 @@ public class PowerNode extends PowerBlock{
@Override
public void update(Tile tile){
if(tile.entity != null && tile.entity.power != null && tile.entity.power.graph != null) tile.entity.power.graph.update();
if(tile.entity.power.graph != null) tile.entity.power.graph.update();
}
@Override