Code cleanup / Tainted water
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 505 B After Width: | Height: | Size: 506 B |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 242 KiB After Width: | Height: | Size: 243 KiB |
|
Before Width: | Height: | Size: 219 KiB After Width: | Height: | Size: 228 KiB |
@@ -35,7 +35,7 @@ public class Blocks implements ContentList{
|
|||||||
public static Block
|
public static Block
|
||||||
|
|
||||||
//environment
|
//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,
|
holostone, rocks, sporerocks, icerocks, cliffs, sporePine, pine, whiteTree, whiteTreeDead, sporeCluster,
|
||||||
iceSnow, sandWater, darksandWater, duneRocks, sandRocks, moss, sporeMoss, shale, shaleRocks, shaleBoulder, grass, salt,
|
iceSnow, sandWater, darksandWater, duneRocks, sandRocks, moss, sporeMoss, shale, shaleRocks, shaleBoulder, grass, salt,
|
||||||
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor5, ignarock, magmarock, hotrock, snowrocks, rock, snowrock,
|
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor5, ignarock, magmarock, hotrock, snowrocks, rock, snowrock,
|
||||||
@@ -114,7 +114,6 @@ public class Blocks implements ContentList{
|
|||||||
}
|
}
|
||||||
|
|
||||||
deepwater = new Floor("deepwater"){{
|
deepwater = new Floor("deepwater"){{
|
||||||
liquidColor = Color.valueOf("4d5ca4");
|
|
||||||
speedMultiplier = 0.2f;
|
speedMultiplier = 0.2f;
|
||||||
variants = 0;
|
variants = 0;
|
||||||
liquidDrop = Liquids.water;
|
liquidDrop = Liquids.water;
|
||||||
@@ -126,7 +125,6 @@ public class Blocks implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
water = new Floor("water"){{
|
water = new Floor("water"){{
|
||||||
liquidColor = Color.valueOf("596ab8");
|
|
||||||
speedMultiplier = 0.5f;
|
speedMultiplier = 0.5f;
|
||||||
variants = 0;
|
variants = 0;
|
||||||
status = StatusEffects.wet;
|
status = StatusEffects.wet;
|
||||||
@@ -136,8 +134,28 @@ public class Blocks implements ContentList{
|
|||||||
cacheLayer = CacheLayer.water;
|
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"){{
|
sandWater = new Floor("sand-water"){{
|
||||||
liquidColor = Color.valueOf("596ab8");
|
|
||||||
speedMultiplier = 0.8f;
|
speedMultiplier = 0.8f;
|
||||||
variants = 0;
|
variants = 0;
|
||||||
status = StatusEffects.wet;
|
status = StatusEffects.wet;
|
||||||
@@ -148,7 +166,6 @@ public class Blocks implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
darksandWater = new Floor("darksand-water"){{
|
darksandWater = new Floor("darksand-water"){{
|
||||||
liquidColor = Color.valueOf("596ab8");
|
|
||||||
speedMultiplier = 0.8f;
|
speedMultiplier = 0.8f;
|
||||||
variants = 0;
|
variants = 0;
|
||||||
status = StatusEffects.wet;
|
status = StatusEffects.wet;
|
||||||
@@ -160,7 +177,6 @@ public class Blocks implements ContentList{
|
|||||||
|
|
||||||
tar = new Floor("tar"){{
|
tar = new Floor("tar"){{
|
||||||
drownTime = 150f;
|
drownTime = 150f;
|
||||||
liquidColor = Color.valueOf("292929");
|
|
||||||
status = StatusEffects.tarred;
|
status = StatusEffects.tarred;
|
||||||
statusDuration = 240f;
|
statusDuration = 240f;
|
||||||
speedMultiplier = 0.19f;
|
speedMultiplier = 0.19f;
|
||||||
@@ -194,7 +210,7 @@ public class Blocks implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
holostone = new Floor("holostone"){{
|
holostone = new Floor("holostone"){{
|
||||||
edgeStyle = "blocky";
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
grass = new Floor("grass"){{
|
grass = new Floor("grass"){{
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ public abstract class GroundUnit extends BaseUnit{
|
|||||||
Floor floor = getFloorOn();
|
Floor floor = getFloorOn();
|
||||||
|
|
||||||
if(floor.isLiquid){
|
if(floor.isLiquid){
|
||||||
Draw.color(Color.WHITE, floor.liquidColor, 0.5f);
|
Draw.color(Color.WHITE, floor.color, 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i : Mathf.signs){
|
for(int i : Mathf.signs){
|
||||||
@@ -126,7 +126,7 @@ public abstract class GroundUnit extends BaseUnit{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(floor.isLiquid){
|
if(floor.isLiquid){
|
||||||
Draw.color(Color.WHITE, floor.liquidColor, drownTime * 0.4f);
|
Draw.color(Color.WHITE, floor.color, drownTime * 0.4f);
|
||||||
}else{
|
}else{
|
||||||
Draw.color(Color.WHITE);
|
Draw.color(Color.WHITE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
|||||||
|
|
||||||
if(!mech.flying){
|
if(!mech.flying){
|
||||||
if(floor.isLiquid){
|
if(floor.isLiquid){
|
||||||
Draw.color(Color.WHITE, floor.liquidColor, 0.5f);
|
Draw.color(Color.WHITE, floor.color, 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
float boostTrnsY = -boostHeat * 3f;
|
float boostTrnsY = -boostHeat * 3f;
|
||||||
@@ -312,7 +312,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(floor.isLiquid){
|
if(floor.isLiquid){
|
||||||
Draw.color(Color.WHITE, floor.liquidColor, drownTime);
|
Draw.color(Color.WHITE, floor.color, drownTime);
|
||||||
}else{
|
}else{
|
||||||
Draw.color(Color.WHITE);
|
Draw.color(Color.WHITE);
|
||||||
}
|
}
|
||||||
@@ -524,7 +524,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
|||||||
if(mech.shake > 1f){
|
if(mech.shake > 1f){
|
||||||
Effects.shake(mech.shake, mech.shake, this);
|
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);
|
mech.onLand(this);
|
||||||
achievedFlight = false;
|
achievedFlight = false;
|
||||||
|
|||||||
@@ -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())){
|
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){
|
if(onLiquid){
|
||||||
@@ -292,7 +292,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
|||||||
if(onLiquid && floor.drownTime > 0){
|
if(onLiquid && floor.drownTime > 0){
|
||||||
drownTime += Time.delta() * 1f / floor.drownTime;
|
drownTime += Time.delta() * 1f / floor.drownTime;
|
||||||
if(Mathf.chance(Time.delta() * 0.05f)){
|
if(Mathf.chance(Time.delta() * 0.05f)){
|
||||||
Effects.effect(floor.drownUpdateEffect, floor.liquidColor, x, y);
|
Effects.effect(floor.drownUpdateEffect, floor.color, x, y);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
drownTime = Mathf.lerpDelta(drownTime, 0f, 0.03f);
|
drownTime = Mathf.lerpDelta(drownTime, 0f, 0.03f);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package io.anuke.mindustry.world.blocks;
|
package io.anuke.mindustry.world.blocks;
|
||||||
|
|
||||||
import io.anuke.arc.Core;
|
import io.anuke.arc.Core;
|
||||||
import io.anuke.arc.graphics.Color;
|
|
||||||
import io.anuke.arc.graphics.g2d.Draw;
|
import io.anuke.arc.graphics.g2d.Draw;
|
||||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.math.Mathf;
|
||||||
@@ -40,8 +39,6 @@ public class Floor extends Block{
|
|||||||
public StatusEffect status = StatusEffects.none;
|
public StatusEffect status = StatusEffects.none;
|
||||||
/** Intensity of applied status effect. */
|
/** Intensity of applied status effect. */
|
||||||
public float statusDuration = 60f;
|
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 */
|
/** liquids that drop from this block, used for pumps */
|
||||||
public Liquid liquidDrop = null;
|
public Liquid liquidDrop = null;
|
||||||
/** item that drops from this block, used for drills */
|
/** 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")};
|
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
|
@Override
|
||||||
public void draw(Tile tile){
|
public void draw(Tile tile){
|
||||||
Mathf.random.setSeed(tile.pos());
|
Mathf.random.setSeed(tile.pos());
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class PowerDistributor extends PowerBlock{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Tile tile){
|
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();
|
tile.entity.power.graph.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ public class PowerGraph{
|
|||||||
closedSet.clear();
|
closedSet.clear();
|
||||||
|
|
||||||
for(Tile other : tile.block().getPowerConnections(tile, outArray1)){
|
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();
|
PowerGraph graph = new PowerGraph();
|
||||||
queue.clear();
|
queue.clear();
|
||||||
queue.addLast(other);
|
queue.addLast(other);
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ public class PowerNode extends PowerBlock{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Tile tile){
|
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
|
@Override
|
||||||
|
|||||||