This commit is contained in:
Anuken
2026-01-02 18:12:56 -05:00
parent 189ee293d3
commit 58b6c994d5
6 changed files with 24 additions and 10 deletions

View File

@@ -214,7 +214,7 @@ public class Effect{
public static void floorDust(float x, float y, float size){ public static void floorDust(float x, float y, float size){
Tile tile = world.tileWorld(x, y); Tile tile = world.tileWorld(x, y);
if(tile != null){ if(tile != null){
Color color = tile.floor().mapColor; Color color = tile.getFloorColor();
Fx.unitLand.at(x, y, size, color); 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){ public static void floorDustAngle(Effect effect, float x, float y, float angle){
Tile tile = world.tileWorld(x, y); Tile tile = world.tileWorld(x, y);
if(tile != null){ if(tile != null){
Color color = tile.floor().mapColor; Color color = tile.getFloorColor();
effect.at(x, y, angle, color); effect.at(x, y, angle, color);
} }
} }
@@ -280,7 +280,7 @@ public class Effect{
float ox = Angles.trnsx(angle, radius), oy = Angles.trnsy(angle, radius); float ox = Angles.trnsx(angle, radius), oy = Angles.trnsy(angle, radius);
Tile t = world.tileWorld(x + ox, y + oy); Tile t = world.tileWorld(x + ox, y + oy);
if(t != null){ 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)));
} }
} }
} }

View File

@@ -83,7 +83,7 @@ abstract class CrawlComp implements Posc, Rotc, Hitboxc, Unitc{
} }
if(Mathf.chanceDelta(0.025)){ 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{ }else{
solids ++; solids ++;

View File

@@ -1,5 +1,6 @@
package mindustry.entities.comp; package mindustry.entities.comp;
import arc.graphics.*;
import arc.math.*; import arc.math.*;
import arc.math.geom.*; import arc.math.geom.*;
import arc.util.*; import arc.util.*;
@@ -12,6 +13,7 @@ import mindustry.game.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.type.*; import mindustry.type.*;
import mindustry.world.*;
import mindustry.world.blocks.*; import mindustry.world.blocks.*;
import mindustry.world.blocks.environment.*; import mindustry.world.blocks.environment.*;
@@ -163,7 +165,10 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Unitc{
l.moving = move; l.moving = move;
l.stage = moving ? stageF % 1f : Mathf.lerpDelta(l.stage, 0f, 0.1f); 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()){ if(floor.isDeep()){
deeps ++; deeps ++;
lastDeepFloor = floor; lastDeepFloor = floor;
@@ -175,10 +180,10 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Unitc{
if(!move && (moving || !type.legContinuousMove) && i % div == l.group){ if(!move && (moving || !type.legContinuousMove) && i % div == l.group){
if(!headless && !inFogTo(player.team())){ if(!headless && !inFogTo(player.team())){
if(floor.isLiquid){ 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); floor.walkSound.at(x, y, 1f, floor.walkSoundVolume);
}else{ }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); 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){ if(type.legSplashDamage > 0 && !disarmed){
Damage.damage(team, l.base.x, l.base.y, type.legSplashRange, type.legSplashDamage * state.rules.unitDamage(team), false, true); 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){ if(tile != null && tile.block().unitMoveBreakable){
ConstructBlock.deconstructFinish(tile, tile.block(), self()); ConstructBlock.deconstructFinish(tile, tile.block(), self());
} }

View File

@@ -676,7 +676,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
if(isFlying() != wasFlying){ if(isFlying() != wasFlying){
if(wasFlying){ if(wasFlying){
if(tile != null){ 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(!type.hovering && isGrounded() && type.emitWalkEffect){
if((splashTimer += Mathf.dst(deltaX(), deltaY())) >= (7f + hitSize()/8f)){ 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; splashTimer = 0f;
if(type.emitWalkSound){ if(type.emitWalkSound){

View File

@@ -563,6 +563,11 @@ public class Block extends UnlockableContent implements Senseable{
return 0; return 0;
} }
public Color getColor(Tile tile){
int mc = minimapColor(tile);
return mc == 0 ? mapColor : Tmp.c3.set(mc);
}
public boolean outputsItems(){ public boolean outputsItems(){
return hasItems; return hasItems;
} }

View File

@@ -2,6 +2,7 @@ package mindustry.world;
import arc.*; import arc.*;
import arc.func.*; import arc.func.*;
import arc.graphics.*;
import arc.math.*; import arc.math.*;
import arc.math.geom.*; import arc.math.geom.*;
import arc.math.geom.QuadTree.*; 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))); circle(radius, (x, y) -> cons.get(world.rawTile(x, y)));
} }
public Color getFloorColor(){
return floor.getColor(this);
}
public void recacheWall(){ public void recacheWall(){
if(!headless && !world.isGenerating()){ if(!headless && !world.isGenerating()){
renderer.blocks.recacheWall(this); renderer.blocks.recacheWall(this);