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

 Conflicts:
	core/assets/bundles/bundle_ko.properties
	core/src/mindustry/type/UnitType.java
This commit is contained in:
Anuken
2021-11-22 10:12:48 -05:00
42 changed files with 8369 additions and 1504 deletions

View File

@@ -30,7 +30,7 @@ public class EnergyFieldAbility extends Ability{
public int maxTargets = 25;
public float healPercent = 2.5f;
public float layer = Layer.bullet - 0.001f, blinkScl = 20f;
public float layer = Layer.bullet - 0.001f, blinkScl = 20f, blinkSize = 0.1f;
public float effectRadius = 5f, sectorRad = 0.14f, rotateSpeed = 0.5f;
public int sectors = 5;
public Color color = Pal.heal;
@@ -60,7 +60,7 @@ public class EnergyFieldAbility extends Ability{
Draw.color(color);
Tmp.v1.trns(unit.rotation - 90, x, y).add(unit.x, unit.y);
float rx = Tmp.v1.x, ry = Tmp.v1.y;
float orbRadius = effectRadius * (1f + Mathf.absin(blinkScl, 0.1f));
float orbRadius = effectRadius * (1f + Mathf.absin(blinkScl, blinkSize));
Fill.circle(rx, ry, orbRadius);
Draw.color();

View File

@@ -474,6 +474,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
return block.unloadable;
}
public boolean canResupply(){
return block.allowResupply;
}
public boolean payloadCheck(int conveyorRotation){
return block.rotate && (rotation + 2) % 4 == conveyorRotation;
}

View File

@@ -228,7 +228,12 @@ public class JsonIO{
Item item = Vars.content.getByName(ContentType.item, str);
Liquid liquid = Vars.content.getByName(ContentType.liquid, str);
Block block = Vars.content.getByName(ContentType.block, str);
return item != null ? item : liquid == null ? block : liquid;
UnitType unit = Vars.content.getByName(ContentType.unit, str);
return
item != null ? item :
block != null ? block :
liquid != null ? liquid :
unit;
}
});

View File

@@ -121,6 +121,8 @@ public class UnitType extends UnlockableContent{
public boolean canDrown = true, naval = false;
public float drownTimeMultiplier = 1f;
public float engineOffset = 5f, engineSize = 2.5f;
public @Nullable Color engineColor = null;
public Color engineColorInner = Color.white;
public Seq<UnitEngine> engines = new Seq<>();
public float strafePenalty = 0.5f;
public float hitSize = 6f;
@@ -803,13 +805,13 @@ public class UnitType extends UnlockableContent{
trail.draw(unit.team.color, (engineSize + Mathf.absin(Time.time, 2f, engineSize / 4f) * scale) * trailScl);
}
Draw.color(unit.team.color);
Draw.color(engineColor == null ? unit.team.color : engineColor);
Fill.circle(
unit.x + Angles.trnsx(unit.rotation + 180, offset),
unit.y + Angles.trnsy(unit.rotation + 180, offset),
(engineSize + Mathf.absin(Time.time, 2f, engineSize / 4f)) * scale
);
Draw.color(Color.white);
Draw.color(engineColorInner);
Fill.circle(
unit.x + Angles.trnsx(unit.rotation + 180, offset - 1f),
unit.y + Angles.trnsy(unit.rotation + 180, offset - 1f),

View File

@@ -46,7 +46,7 @@ public class ItemAmmoType implements AmmoType{
float range = unit.hitSize + this.range;
Building build = Units.closestBuilding(unit.team, unit.x, unit.y, range, u -> u.block.allowResupply && u.items.has(item));
Building build = Units.closestBuilding(unit.team, unit.x, unit.y, range, u -> u.canResupply() && u.items.has(item));
if(build != null){
Fx.itemTransfer.at(build.x, build.y, ammoPerItem / 2f, item.color, unit);

View File

@@ -145,12 +145,18 @@ public class Unloader extends Block{
}
//sort so it gives full priority to blocks that can give but not receive (stackConveyors and Storage), and then by load, and then by last use
possibleBlocks.sort(Structs.comps(
Structs.comparingBool(e -> e.building.block.highUnloadPriority),
possibleBlocks.sort(
Structs.comps(
Structs.comparingFloat(e -> e.loadFactor),
Structs.comparingInt(e -> -lastUsed[e.index])
)));
Structs.comps(
Structs.comparingBool(e -> e.building.block.highUnloadPriority && !e.canLoad),
Structs.comparingBool(e -> e.canUnload && !e.canLoad)
),
Structs.comps(
Structs.comparingFloat(e -> e.loadFactor),
Structs.comparingInt(e -> -lastUsed[e.index])
)
)
);
ContainerStat dumpingFrom = null;
ContainerStat dumpingTo = null;
@@ -177,7 +183,7 @@ public class Unloader extends Block{
}
//trade the items
if(dumpingFrom != null && dumpingTo != null && (dumpingFrom.loadFactor != dumpingTo.loadFactor || dumpingFrom.building.block.highUnloadPriority)){
if(dumpingFrom != null && dumpingTo != null && (dumpingFrom.loadFactor != dumpingTo.loadFactor || !dumpingFrom.canLoad)){
dumpingTo.building.handleItem(this, item);
dumpingFrom.building.removeStack(item, 1);
lastUsed[dumpingFrom.index] = 0;