Merge remote-tracking branch 'upstream/master'

This commit is contained in:
LeoDog896 2020-09-25 10:55:04 -04:00
commit 35e4f696aa
14 changed files with 39 additions and 20 deletions

View file

@ -72,8 +72,6 @@ public class Vars implements Loadable{
public static final int maxTextLength = 150;
/** max player name length in bytes */
public static final int maxNameLength = 40;
/** shadow color for turrets */
public static final float turretShadowColor = Color.toFloatBits(0, 0, 0, 0.22f);
/** displayed item size when ingame. */
public static final float itemSize = 5f;
/** units outside of this bound will die instantly */

View file

@ -208,6 +208,7 @@ public class Blocks implements ContentList{
liquidDrop = Liquids.slag;
isLiquid = true;
cacheLayer = CacheLayer.slag;
attributes.set(Attribute.heat, 0.85f);
}};
stone = new Floor("stone");
@ -1142,6 +1143,7 @@ public class Blocks implements ContentList{
powerProduction = 1.8f;
generateEffect = Fx.redgeneratespark;
size = 2;
floating = true;
}};
steamGenerator = new BurnerGenerator("steam-generator"){{

View file

@ -935,7 +935,7 @@ public class UnitTypes implements ContentList{
drag = 0.016f;
flying = true;
range = 140f;
hitSize = 18f;
hitSize = 20f;
lowAltitude = true;
armor = 5f;

View file

@ -84,6 +84,18 @@ public class Drawf{
Draw.color();
}
public static void shadow(TextureRegion region, float x, float y, float rotation){
Draw.color(Pal.shadow);
Draw.rect(region, x, y, rotation);
Draw.color();
}
public static void shadow(TextureRegion region, float x, float y){
Draw.color(Pal.shadow);
Draw.rect(region, x, y);
Draw.color();
}
public static void dashCircle(float x, float y, float rad, Color color){
Lines.stroke(3f, Pal.gray);
Lines.dashCircle(x, y, rad);

View file

@ -47,6 +47,7 @@ public class Pal{
darkishGray = new Color(0.3f, 0.3f, 0.3f, 1f),
darkerGray = new Color(0.2f, 0.2f, 0.2f, 1f),
darkestGray = new Color(0.1f, 0.1f, 0.1f, 1f),
shadow = new Color(0, 0, 0, 0.22f),
ammo = Color.valueOf("ff8947"),
rubble = Color.valueOf("1c1817"),

View file

@ -34,7 +34,7 @@ import mindustry.world.consumers.*;
import static mindustry.Vars.*;
public class UnitType extends UnlockableContent{
public static final float shadowTX = -12, shadowTY = -13, shadowColor = Color.toFloatBits(0, 0, 0, 0.22f), outlineSpace = 0.01f;
public static final float shadowTX = -12, shadowTY = -13, outlineSpace = 0.01f;
private static final Vec2 legOffset = new Vec2();
/** If true, the unit is always at elevation 1. */
@ -409,7 +409,7 @@ public class UnitType extends UnlockableContent{
}
public void drawShadow(Unit unit){
Draw.color(shadowColor);
Draw.color(Pal.shadow);
float e = Math.max(unit.elevation, visualElevation);
Draw.rect(shadowRegion, unit.x + shadowTX * e, unit.y + shadowTY * e, unit.rotation - 90);
Draw.color();
@ -594,7 +594,7 @@ public class UnitType extends UnlockableContent{
if(leg.moving && visualElevation > 0){
float scl = visualElevation;
float elev = Mathf.slope(1f - leg.stage) * scl;
Draw.color(shadowColor);
Draw.color(Pal.shadow);
Draw.rect(footRegion, leg.base.x + shadowTX * elev, leg.base.y + shadowTY * elev, position.angleTo(leg.base));
Draw.color();
}

View file

@ -112,9 +112,7 @@ public class PointDefenseTurret extends Block{
@Override
public void draw(){
Draw.rect(baseRegion, x, y);
Draw.color(Vars.turretShadowColor);
Draw.rect(region, x - (size / 2f), y - (size / 2f), rotation - 90);
Draw.color();
Drawf.shadow(region, x - (size / 2f), y - (size / 2f), rotation - 90);
Draw.rect(region, x, y, rotation - 90);
}

View file

@ -107,9 +107,7 @@ public class TractorBeamTurret extends Block{
@Override
public void draw(){
Draw.rect(baseRegion, x, y);
Draw.color(Vars.turretShadowColor);
Draw.rect(region, x - (size / 2f), y - (size / 2f), rotation - 90);
Draw.color();
Drawf.shadow(region, x - (size / 2f), y - (size / 2f), rotation - 90);
Draw.rect(region, x, y, rotation - 90);
//draw laser if applicable

View file

@ -11,7 +11,6 @@ import arc.struct.*;
import arc.util.ArcAnnotate.*;
import arc.util.*;
import arc.util.io.*;
import mindustry.*;
import mindustry.annotations.Annotations.*;
import mindustry.content.*;
import mindustry.entities.*;
@ -203,9 +202,7 @@ public abstract class Turret extends Block{
tr2.trns(rotation, -recoil);
Draw.color(Vars.turretShadowColor);
Draw.rect(region, x + tr2.x - (size / 2f), y + tr2.y - (size / 2f), rotation - 90);
Draw.color();
Drawf.shadow(region, x + tr2.x - (size / 2f), y + tr2.y - (size / 2f), rotation - 90);
drawer.get(this);
if(heatRegion != Core.atlas.find("error")){

View file

@ -188,6 +188,9 @@ public class MassDriver extends Block{
Draw.z(Layer.turret);
Drawf.shadow(region,
x + Angles.trnsx(rotation + 180f, reload * knockback) - (size / 2),
y + Angles.trnsy(rotation + 180f, reload * knockback) - (size / 2), rotation - 90);
Draw.rect(region,
x + Angles.trnsx(rotation + 180f, reload * knockback),
y + Angles.trnsy(rotation + 180f, reload * knockback), rotation - 90);

View file

@ -22,7 +22,7 @@ public class ThermalGenerator extends PowerGenerator{
public void setStats(){
super.setStats();
stats.add(BlockStat.tiles, attribute);
stats.add(BlockStat.tiles, attribute, floating);
}
@Override

View file

@ -6,6 +6,7 @@ import arc.math.*;
import arc.math.geom.*;
import arc.struct.*;
import arc.util.*;
import mindustry.*;
import mindustry.annotations.Annotations.*;
import mindustry.entities.*;
import mindustry.gen.*;
@ -70,6 +71,7 @@ public class RepairPoint extends Block{
Draw.rect(baseRegion, x, y);
Draw.z(Layer.turret);
Drawf.shadow(region, x - (size / 2), y - (size / 2), rotation - 90);
Draw.rect(region, x, y, rotation - 90);
if(target != null && Angles.angleDist(angleTo(target), rotation) < 30f){

View file

@ -130,7 +130,7 @@ public class UnitFactory extends UnitBlock{
Seq<UnitType> units = Seq.with(plans).map(u -> u.unit).filter(u -> u.unlockedNow());
if(units.any()){
ItemSelection.buildTable(table, units, () -> currentPlan == -1 ? null : plans[currentPlan].unit, unit -> configure(units.indexOf(unit)));
ItemSelection.buildTable(table, units, () -> currentPlan == -1 ? null : plans[currentPlan].unit, unit -> configure(Structs.indexOf(plans, u -> u.unit == unit)));
}else{
table.table(Styles.black3, t -> t.add("@none").color(Color.lightGray));
}

View file

@ -38,12 +38,20 @@ public class BlockStats{
}
public void add(BlockStat stat, Attribute attr){
add(stat, attr, 1f);
add(stat, attr, false, 1f);
}
public void add(BlockStat stat, Attribute attr, float scale){
add(stat, attr, false, scale);
}
public void add(BlockStat stat, Attribute attr, boolean floating){
add(stat, attr, floating, 1f);
}
public void add(BlockStat stat, Attribute attr, boolean floating, float scale){
for(Block block : Vars.content.blocks()){
if(!block.isFloor() || block.asFloor().attributes.get(attr) == 0) continue;
if(!block.isFloor() || block.asFloor().attributes.get(attr) == 0 || (block.asFloor().isLiquid && !floating)) continue;
add(stat, new FloorEfficiencyValue(block.asFloor(), block.asFloor().attributes.get(attr) * scale));
}
}