Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features

This commit is contained in:
Anuken
2021-10-12 12:36:20 -04:00
80 changed files with 2247 additions and 187 deletions

View File

@@ -108,7 +108,7 @@ public class Damage{
furthest = null;
boolean found = world.raycast(b.tileX(), b.tileY(), World.toTile(b.x + Tmp.v1.x), World.toTile(b.y + Tmp.v1.y),
(x, y) -> (furthest = world.tile(x, y)) != null && furthest.team() != b.team && furthest.block().absorbLasers);
(x, y) -> (furthest = world.tile(x, y)) != null && furthest.team() != b.team && (furthest.build != null && furthest.build.absorbLasers()));
return found && furthest != null ? Math.max(6f, b.dst(furthest.worldx(), furthest.worldy())) : length;
}

View File

@@ -53,7 +53,7 @@ public class Lightning{
world.raycastEach(World.toTile(from.getX()), World.toTile(from.getY()), World.toTile(to.getX()), World.toTile(to.getY()), (wx, wy) -> {
Tile tile = world.tile(wx, wy);
if(tile != null && tile.block().insulated && tile.team() != team){
if(tile != null && (tile.build != null && tile.build.isInsulated()) && tile.team() != team){
bhit = true;
//snap it instead of removing
lines.get(lines.size - 1).set(wx * tilesize, wy * tilesize);

View File

@@ -1241,6 +1241,14 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
return amount;
}
public boolean absorbLasers(){
return block.absorbLasers;
}
public boolean isInsulated(){
return block.insulated;
}
public boolean collide(Bullet other){
return true;
}

View File

@@ -9,7 +9,6 @@ import arc.util.*;
import arc.util.pooling.*;
import mindustry.annotations.Annotations.*;
import mindustry.content.*;
import mindustry.core.*;
import mindustry.entities.units.*;
import mindustry.game.EventType.*;
import mindustry.game.*;
@@ -310,10 +309,15 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
Draw.z(z);
}
/** @return name with a markup color prefix */
String coloredName(){
return "[#" + color.toString().toUpperCase() + "]" + name;
}
void sendMessage(String text){
if(isLocal()){
if(ui != null){
ui.chatfrag.addMessage(text, null);
ui.chatfrag.addMessage(text);
}
}else{
Call.sendMessage(con, text, null, null);
@@ -321,16 +325,16 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
}
void sendMessage(String text, Player from){
sendMessage(text, from, NetClient.colorizeName(from.id(), from.name));
sendMessage(text, from, null);
}
void sendMessage(String text, Player from, String fromName){
void sendMessage(String text, Player from, String unformatted){
if(isLocal()){
if(ui != null){
ui.chatfrag.addMessage(text, fromName);
ui.chatfrag.addMessage(text);
}
}else{
Call.sendMessage(con, text, fromName, from);
Call.sendMessage(con, text, unformatted, from);
}
}

View File

@@ -88,7 +88,7 @@ abstract class WaterMoveComp implements Posc, Velc, Hitboxc, Flyingc, Unitc{
@Replace
public float floorSpeedMultiplier(){
Floor on = isFlying() ? Blocks.air.asFloor() : floorOn();
return (on.isDeep() ? 1.3f : 1f) * speedMultiplier;
return (on.shallow ? 1f : 1.3f) * speedMultiplier;
}
public boolean onLiquid(){