diff --git a/core/src/mindustry/entities/Effect.java b/core/src/mindustry/entities/Effect.java index 4d68a8344d..35e75e0078 100644 --- a/core/src/mindustry/entities/Effect.java +++ b/core/src/mindustry/entities/Effect.java @@ -214,7 +214,7 @@ public class Effect{ public static void floorDust(float x, float y, float size){ Tile tile = world.tileWorld(x, y); if(tile != null){ - Color color = tile.floor().mapColor; + Color color = tile.getFloorColor(); Fx.unitLand.at(x, y, size, color); } } @@ -222,7 +222,7 @@ public class Effect{ public static void floorDustAngle(Effect effect, float x, float y, float angle){ Tile tile = world.tileWorld(x, y); if(tile != null){ - Color color = tile.floor().mapColor; + Color color = tile.getFloorColor(); effect.at(x, y, angle, color); } } @@ -280,7 +280,7 @@ public class Effect{ float ox = Angles.trnsx(angle, radius), oy = Angles.trnsy(angle, radius); Tile t = world.tileWorld(x + ox, y + oy); if(t != null){ - Fx.podLandDust.at(t.worldx(), t.worldy(), angle + Mathf.range(30f), Tmp.c1.set(t.floor().mapColor).mul(1.7f + Mathf.range(0.15f))); + Fx.podLandDust.at(t.worldx(), t.worldy(), angle + Mathf.range(30f), Tmp.c1.set(t.getFloorColor()).mul(1.7f + Mathf.range(0.15f))); } } } diff --git a/core/src/mindustry/entities/comp/CrawlComp.java b/core/src/mindustry/entities/comp/CrawlComp.java index 23429ad6dc..0b72857e1a 100644 --- a/core/src/mindustry/entities/comp/CrawlComp.java +++ b/core/src/mindustry/entities/comp/CrawlComp.java @@ -83,7 +83,7 @@ abstract class CrawlComp implements Posc, Rotc, Hitboxc, Unitc{ } if(Mathf.chanceDelta(0.025)){ - Fx.crawlDust.at(t.worldx(), t.worldy(), t.floor().mapColor); + Fx.crawlDust.at(t.worldx(), t.worldy(), t.getFloorColor()); } }else{ solids ++; diff --git a/core/src/mindustry/entities/comp/LegsComp.java b/core/src/mindustry/entities/comp/LegsComp.java index 4b5f2a79f5..becc951f63 100644 --- a/core/src/mindustry/entities/comp/LegsComp.java +++ b/core/src/mindustry/entities/comp/LegsComp.java @@ -1,5 +1,6 @@ package mindustry.entities.comp; +import arc.graphics.*; import arc.math.*; import arc.math.geom.*; import arc.util.*; @@ -12,6 +13,7 @@ import mindustry.game.*; import mindustry.gen.*; import mindustry.graphics.*; import mindustry.type.*; +import mindustry.world.*; import mindustry.world.blocks.*; import mindustry.world.blocks.environment.*; @@ -163,7 +165,10 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Unitc{ l.moving = move; l.stage = moving ? stageF % 1f : Mathf.lerpDelta(l.stage, 0f, 0.1f); - Floor floor = Vars.world.floorWorld(l.base.x, l.base.y); + Tile tile = Vars.world.tileWorld(l.base.x, l.base.y); + Color floorColor = tile == null ? Color.clear : tile.getFloorColor(); + Floor floor = tile == null ? Blocks.air.asFloor() : tile.floor(); + if(floor.isDeep()){ deeps ++; lastDeepFloor = floor; @@ -175,10 +180,10 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Unitc{ if(!move && (moving || !type.legContinuousMove) && i % div == l.group){ if(!headless && !inFogTo(player.team())){ if(floor.isLiquid){ - floor.walkEffect.at(l.base.x, l.base.y, type.rippleScale, floor.mapColor); + floor.walkEffect.at(l.base.x, l.base.y, type.rippleScale, floorColor); floor.walkSound.at(x, y, 1f, floor.walkSoundVolume); }else{ - Fx.unitLandSmall.at(l.base.x, l.base.y, type.rippleScale, floor.mapColor); + Fx.unitLandSmall.at(l.base.x, l.base.y, type.rippleScale, floorColor); type.stepSound.at(l.base.x, l.base.y, type.stepSoundPitch + Mathf.range(type.stepSoundPitchRange), type.stepSoundVolume); } @@ -191,7 +196,6 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Unitc{ if(type.legSplashDamage > 0 && !disarmed){ Damage.damage(team, l.base.x, l.base.y, type.legSplashRange, type.legSplashDamage * state.rules.unitDamage(team), false, true); - var tile = Vars.world.tileWorld(l.base.x, l.base.y); if(tile != null && tile.block().unitMoveBreakable){ ConstructBlock.deconstructFinish(tile, tile.block(), self()); } diff --git a/core/src/mindustry/entities/comp/UnitComp.java b/core/src/mindustry/entities/comp/UnitComp.java index 950e32fa6b..a83aa33f17 100644 --- a/core/src/mindustry/entities/comp/UnitComp.java +++ b/core/src/mindustry/entities/comp/UnitComp.java @@ -676,7 +676,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I if(isFlying() != wasFlying){ if(wasFlying){ if(tile != null){ - Fx.unitLand.at(x, y, floor.isLiquid ? 1f : 0.5f, tile.floor().mapColor); + Fx.unitLand.at(x, y, floor.isLiquid ? 1f : 0.5f, tile.getFloorColor()); } } @@ -685,7 +685,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I if(!type.hovering && isGrounded() && type.emitWalkEffect){ if((splashTimer += Mathf.dst(deltaX(), deltaY())) >= (7f + hitSize()/8f)){ - floor.walkEffect.at(x, y, hitSize() / 8f, floor.mapColor); + floor.walkEffect.at(x, y, hitSize() / 8f, tile != null ? tile.getFloorColor() : floor.mapColor); splashTimer = 0f; if(type.emitWalkSound){ diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index 6cbed7004d..5250ce651d 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -563,6 +563,11 @@ public class Block extends UnlockableContent implements Senseable{ return 0; } + public Color getColor(Tile tile){ + int mc = minimapColor(tile); + return mc == 0 ? mapColor : Tmp.c3.set(mc); + } + public boolean outputsItems(){ return hasItems; } diff --git a/core/src/mindustry/world/Tile.java b/core/src/mindustry/world/Tile.java index eb17c663fb..e20f96290d 100644 --- a/core/src/mindustry/world/Tile.java +++ b/core/src/mindustry/world/Tile.java @@ -2,6 +2,7 @@ package mindustry.world; import arc.*; import arc.func.*; +import arc.graphics.*; import arc.math.*; import arc.math.geom.*; import arc.math.geom.QuadTree.*; @@ -337,6 +338,10 @@ public class Tile implements Position, QuadTreeObject, Displayable{ circle(radius, (x, y) -> cons.get(world.rawTile(x, y))); } + public Color getFloorColor(){ + return floor.getColor(this); + } + public void recacheWall(){ if(!headless && !world.isGenerating()){ renderer.blocks.recacheWall(this);