Merged current master and fixed conflicts

This commit is contained in:
Timmeey86
2018-12-09 22:40:33 +01:00
20 changed files with 149 additions and 48 deletions

View File

@@ -83,7 +83,7 @@ public class Items implements ContentList{
}};
biomatter = new Item("biomatter", Color.valueOf("648b55")){{
flammability = 0.4f;
flammability = 0.55f;
fluxiness = 0.3f;
}};

View File

@@ -26,7 +26,7 @@ public class Liquids implements ContentList{
lava = new Liquid("lava", Color.valueOf("e37341")){
{
temperature = 0.8f;
temperature = 1f;
viscosity = 0.8f;
tier = 2;
effect = StatusEffects.melting;

View File

@@ -123,6 +123,7 @@ public class Mechs implements ContentList{
speed = 0.44f;
drag = 0.35f;
boostSpeed = 0.8f;
canHeal = true;
weapon = Weapons.healBlaster;
armor = 15f;
trailColorTo = Palette.heal;
@@ -287,8 +288,8 @@ public class Mechs implements ContentList{
trident = new Mech("trident-ship", true){
{
drillPower = 2;
speed = 0.12f;
drag = 0.035f;
speed = 0.14f;
drag = 0.034f;
mass = 2.5f;
turnCursor = false;
armor = 20f;

View File

@@ -152,7 +152,7 @@ public class Weapons implements ContentList{
bomberTrident = new Weapon("bomber"){{
length = 0f;
width = 2f;
reload = 9f;
reload = 8f;
shots = 2;
roundrobin = true;
ejectEffect = Fx.none;

View File

@@ -192,9 +192,9 @@ public class CraftingBlocks extends BlockList implements ContentList{
biomatterCompressor = new Compressor("biomattercompressor"){{
liquidCapacity = 60f;
itemCapacity = 50;
craftTime = 25f;
craftTime = 20f;
outputLiquid = Liquids.oil;
outputLiquidAmount = 1.5f;
outputLiquidAmount = 2.5f;
size = 2;
health = 320;
hasLiquids = true;

View File

@@ -99,13 +99,13 @@ public class ProductionBlocks extends BlockList implements ContentList{
cultivator = new Cultivator("cultivator"){{
result = Items.biomatter;
drillTime = 260;
drillTime = 200;
size = 2;
hasLiquids = true;
hasPower = true;
consumes.powerDirect(0.08f);
consumes.liquid(Liquids.water, 0.2f);
consumes.liquid(Liquids.water, 0.15f);
}};
}

View File

@@ -27,7 +27,7 @@ public class StorageBlocks extends BlockList implements ContentList{
}};
unloader = new SortedUnloader("unloader"){{
speed = 12f;
speed = 7f;
}};
}
}

View File

@@ -69,7 +69,7 @@ public class TurretBlocks extends BlockList implements ContentList{
inaccuracy = 5f;
shootCone = 50f;
shootEffect = ShootFx.shootLiquid;
range = 70f;
range = 90f;
health = 360;
drawer = (tile, entity) -> {

View File

@@ -334,7 +334,7 @@ public class TurretBullets extends BulletList implements ContentList{
lifetime = 200f;
despawneffect = BlockFx.smeltsmoke;
hiteffect = BulletFx.hitBulletBig;
drag = 0.01f;
drag = 0.005f;
}
@Override

View File

@@ -645,7 +645,8 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
}
protected void updateFlying(){
if(Units.invalidateTarget(target, this)){
if(Units.invalidateTarget(target, this) && !(target instanceof TileEntity && ((TileEntity) target).damaged() && target.getTeam() == team &&
mech.canHeal && distanceTo(target) < getWeapon().getAmmo().getRange())){
target = null;
}
@@ -726,11 +727,22 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
isShooting = false;
if(Settings.getBool("autotarget")){
target = Units.getClosestTarget(team, x, y, getWeapon().getAmmo().getRange());
if(mech.canHeal && target == null){
target = Geometry.findClosest(x, y, world.indexer.getDamaged(Team.blue));
if(target != null && distanceTo(target) > getWeapon().getAmmo().getRange()){
target = null;
}else if(target != null){
target = ((Tile)target).entity;
}
}
if(target != null){
setMineTile(null);
}
}
}else if(target.isValid()){
}else if(target.isValid() || (target instanceof TileEntity && ((TileEntity) target).damaged() && target.getTeam() == team &&
mech.canHeal && distanceTo(target) < getWeapon().getAmmo().getRange())){
//rotate toward and shoot the target
if(mech.turnCursor){
rotation = Mathf.slerpDelta(rotation, angleTo(target), 0.2f);

View File

@@ -2,6 +2,7 @@ package io.anuke.mindustry.entities.traits;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Queue;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.content.blocks.Blocks;
@@ -29,9 +30,7 @@ import io.anuke.ucore.graphics.Fill;
import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.graphics.Shapes;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Geometry;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Translator;
import java.io.DataInput;
import java.io.DataOutput;
@@ -47,6 +46,7 @@ public interface BuilderTrait extends Entity{
//these are not instance variables!
float placeDistance = 150f;
float mineDistance = 70f;
Array<BuildRequest> removal = new Array<>();
/**Returns the queue for storing build requests.*/
Queue<BuildRequest> getPlaceQueue();
@@ -171,6 +171,19 @@ public interface BuilderTrait extends Entity{
* This includes mining.
*/
default void updateBuilding(Unit unit){
//remove already completed build requests
removal.clear();
for(BuildRequest request : getPlaceQueue()){
if((request.breaking && world.tile(request.x, request.y).block() == Blocks.air) ||
(!request.breaking && world.tile(request.x, request.y).block() == request.recipe.result)){
removal.add(request);
}
}
for(BuildRequest req : removal){
getPlaceQueue().removeValue(req, true);
}
BuildRequest current = getCurrentRequest();
//update mining here
@@ -373,5 +386,18 @@ public interface BuilderTrait extends Entity{
this.recipe = Recipe.getByResult(world.tile(x, y).block());
this.breaking = true;
}
@Override
public String toString(){
return "BuildRequest{" +
"x=" + x +
", y=" + y +
", rotation=" + rotation +
", recipe=" + recipe +
", breaking=" + breaking +
", progress=" + progress +
", initialized=" + initialized +
'}';
}
}
}

View File

@@ -352,7 +352,7 @@ public class Drone extends FlyingUnit implements BuilderTrait{
@Override
public boolean canCreateBlocks(){
return false;
return true;
}
@Override

View File

@@ -96,6 +96,9 @@ public class MobileInput extends InputHandler implements GestureListener{
TileEntity entity = tile.entity;
player.setMineTile(null);
player.target = entity;
}else if(tile != null && player.mech.canHeal && tile.entity != null && tile.getTeam() == player.getTeam() && tile.entity.damaged()){
player.setMineTile(null);
player.target = tile.entity;
}
}
}

View File

@@ -14,7 +14,7 @@ import java.util.zip.InflaterInputStream;
import static io.anuke.mindustry.Vars.*;
public class SaveIO{
public static final IntArray breakingVersions = IntArray.with(47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58);
public static final IntArray breakingVersions = IntArray.with(47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 63);
public static final IntMap<SaveFileVersion> versions = new IntMap<>();
public static final Array<SaveFileVersion> versionArray = Array.with(
new Save16()

View File

@@ -34,6 +34,7 @@ public class Mech extends UnlockableContent{
public Color trailColorTo = Palette.boostTo;
public int itemCapacity = 30;
public boolean turnCursor = true;
public boolean canHeal = false;
public float weaponOffsetX, weaponOffsetY;
public Weapon weapon = Weapons.blaster;

View File

@@ -45,9 +45,9 @@ public class Build{
for(int dx = 0; dx < previous.size; dx++){
for(int dy = 0; dy < previous.size; dy++){
int worldx = dx + offsetx + x;
int worldy = dy + offsety + y;
if(!(worldx == x && worldy == y)){
int worldx = dx + offsetx + tile.x;
int worldy = dy + offsety + tile.y;
if(!(worldx == tile.x && worldy == tile.y)){
Tile toplace = world.tile(worldx, worldy);
if(toplace != null){
toplace.setLinked((byte) (dx + offsetx), (byte) (dy + offsety));

View File

@@ -1,16 +1,8 @@
package io.anuke.mindustry.world.blocks.distribution;
import io.anuke.mindustry.type.Liquid;
import io.anuke.mindustry.world.Tile;
public class LiquidTank extends LiquidRouter{
public LiquidTank(String name){
super(name);
}
@Override
public boolean canDumpLiquid(Tile tile, Tile to, Liquid liquid){
return super.canDumpLiquid(tile, to, liquid) && !(to.block() instanceof LiquidTank);
}
}

View File

@@ -46,7 +46,8 @@ public class PowerNode extends PowerBlock{
@Remote(targets = Loc.both, called = Loc.server, forward = true)
public static void linkPowerNodes(Player player, Tile tile, Tile other){
if(tile.entity.power == null || !((PowerNode)tile.block()).linkValid(tile, other)) return;
if(tile.entity.power == null || !((PowerNode)tile.block()).linkValid(tile, other)
|| tile.entity.power.links.size >= ((PowerNode)tile.block()).maxNodes) return;
TileEntity entity = tile.entity();