Revenant sprite / Training mode / Mine transfer range / Drone heal buff

This commit is contained in:
Anuken
2018-09-16 14:05:43 -04:00
parent 7d8782f3dc
commit 097228066a
22 changed files with 109 additions and 54 deletions

View File

@@ -35,6 +35,8 @@ public class Vars{
public static final String crashReportURL = "http://mindustry.us.to/report";
//time between waves in frames (on normal mode)
public static final float wavespace = 60 * 60 * 1.5f;
public static final float mineTransferRange = 300f;
//set ridiculously high for now
public static final float coreBuildRange = 999999f;
//team of the player by default

View File

@@ -35,7 +35,7 @@ public class Recipes implements ContentList{
new Recipe(defense, DefenseBlocks.surgeWallLarge, new ItemStack(Items.surgealloy, 12 * 4));
//projectors
new Recipe(defense, DefenseBlocks.mendProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.densealloy, 150), new ItemStack(Items.titanium, 50), new ItemStack(Items.silicon, 250));
new Recipe(defense, DefenseBlocks.mendProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.densealloy, 150), new ItemStack(Items.titanium, 50), new ItemStack(Items.silicon, 180));
new Recipe(defense, DefenseBlocks.overdriveProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.densealloy, 150), new ItemStack(Items.titanium, 150), new ItemStack(Items.silicon, 250));
new Recipe(defense, DefenseBlocks.forceProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.densealloy, 150), new ItemStack(Items.titanium, 150), new ItemStack(Items.silicon, 250));
@@ -54,8 +54,8 @@ public class Recipes implements ContentList{
new Recipe(weapon, TurretBlocks.ripple, new ItemStack(Items.copper, 300), new ItemStack(Items.densealloy, 220), new ItemStack(Items.thorium, 120));
new Recipe(weapon, TurretBlocks.cyclone, new ItemStack(Items.copper, 400), new ItemStack(Items.densealloy, 400), new ItemStack(Items.surgealloy, 200), new ItemStack(Items.plastanium, 150));
new Recipe(weapon, TurretBlocks.fuse, new ItemStack(Items.copper, 450), new ItemStack(Items.densealloy, 450), new ItemStack(Items.surgealloy, 250));
new Recipe(weapon, TurretBlocks.spectre, new ItemStack(Items.copper, 700), new ItemStack(Items.densealloy, 600), new ItemStack(Items.surgealloy, 400), new ItemStack(Items.plastanium, 350), new ItemStack(Items.thorium, 400));
new Recipe(weapon, TurretBlocks.meltdown, new ItemStack(Items.copper, 500), new ItemStack(Items.lead, 700), new ItemStack(Items.densealloy, 500), new ItemStack(Items.surgealloy, 600), new ItemStack(Items.silicon, 550));
new Recipe(weapon, TurretBlocks.spectre, new ItemStack(Items.copper, 700), new ItemStack(Items.densealloy, 600), new ItemStack(Items.surgealloy, 500), new ItemStack(Items.plastanium, 350), new ItemStack(Items.thorium, 500));
new Recipe(weapon, TurretBlocks.meltdown, new ItemStack(Items.copper, 500), new ItemStack(Items.lead, 700), new ItemStack(Items.densealloy, 600), new ItemStack(Items.surgealloy, 650), new ItemStack(Items.silicon, 650));
//DISTRIBUTION
new Recipe(distribution, DistributionBlocks.conveyor, new ItemStack(Items.copper, 1));

View File

@@ -8,7 +8,7 @@ import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.type.ContentType;
public class UnitTypes implements ContentList{
public static UnitType drone, alphaDrone, dagger, interceptor, monsoon, titan, fortress, fabricator;
public static UnitType drone, alphaDrone, dagger, wraith, monsoon, revenant, titan, fortress, fabricator;
@Override
public void load(){
@@ -18,7 +18,7 @@ public class UnitTypes implements ContentList{
speed = 0.2f;
maxVelocity = 0.8f;
range = 50f;
healSpeed = 0.05f;
healSpeed = 0.25f;
health = 60;
}};
@@ -46,7 +46,7 @@ public class UnitTypes implements ContentList{
drag = 0.4f;
range = 40f;
weapon = Weapons.chainBlaster;
health = 180;
health = 150;
}};
titan = new UnitType("titan", Titan.class, Titan::new){{
@@ -55,7 +55,7 @@ public class UnitTypes implements ContentList{
drag = 0.4f;
range = 10f;
weapon = Weapons.flamethrower;
health = 500;
health = 440;
}};
fortress = new UnitType("fortress", Fortress.class, Fortress::new){{
@@ -63,11 +63,11 @@ public class UnitTypes implements ContentList{
speed = 0.18f;
drag = 0.4f;
range = 10f;
weapon = Weapons.flamethrower;
weapon = Weapons.artillery;
health = 500;
}};
interceptor = new UnitType("interceptor", Interceptor.class, Interceptor::new){{
wraith = new UnitType("wraith", Wraith.class, Wraith::new){{
speed = 0.3f;
maxVelocity = 1.9f;
drag = 0.01f;
@@ -85,6 +85,15 @@ public class UnitTypes implements ContentList{
weapon = Weapons.bomber;
}};
revenant = new UnitType("revenant", Revenant.class, Revenant::new){{
health = 250;
speed = 0.2f;
maxVelocity = 1.4f;
drag = 0.01f;
isFlying = true;
weapon = Weapons.bomber;
}};
fabricator = new UnitType("fabricator", Fabricator.class, Fabricator::new){{
isFlying = true;
drag = 0.01f;
@@ -95,7 +104,7 @@ public class UnitTypes implements ContentList{
health = 220;
buildPower = 0.9f;
minePower = 1.1f;
healSpeed = 0.09f;
healSpeed = 0.55f;
toMine = ObjectSet.with(Items.lead, Items.copper, Items.titanium);
}};
}

View File

@@ -7,7 +7,8 @@ import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.type.Weapon;
public class Weapons implements ContentList{
public static Weapon blaster, blasterSmall, glaiveBlaster, droneBlaster, healBlaster, chainBlaster, shockgun, sapper, swarmer, bomber, bomberTrident, flakgun, flamethrower, missiles;
public static Weapon blaster, blasterSmall, glaiveBlaster, droneBlaster, healBlaster, chainBlaster, shockgun,
sapper, swarmer, bomber, bomberTrident, flakgun, flamethrower, missiles, artillery;
@Override
public void load(){
@@ -119,6 +120,15 @@ public class Weapons implements ContentList{
ammo = AmmoTypes.flamerThermite;
}};
artillery = new Weapon("artillery"){{
length = 1f;
reload = 60f;
roundrobin = true;
recoil = 1f;
ejectEffect = ShootFx.shellEjectMedium;
ammo = AmmoTypes.artilleryExplosive;
}};
sapper = new Weapon("sapper"){{
length = 1.5f;
reload = 12f;

View File

@@ -12,7 +12,7 @@ public class StorageBlocks extends BlockList implements ContentList{
@Override
public void load(){
core = new CoreBlock("core"){{
health = 800;
health = 1400;
}};
vault = new Vault("vault"){{

View File

@@ -30,8 +30,8 @@ public class UnitBlocks extends BlockList implements ContentList{
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 70), new ItemStack(Items.lead, 80), new ItemStack(Items.titanium, 80)});
}};
interceptorPad = new UnitPad("interceptor-pad"){{
type = UnitTypes.interceptor;
interceptorPad = new UnitPad("wraith-pad"){{
type = UnitTypes.wraith;
produceTime = 1800;
size = 2;
consumes.power(0.1f);

View File

@@ -169,7 +169,6 @@ public class UI extends SceneModule{
content = new ContentInfoDialog();
sectors = new SectorsDialog();
missions = new MissionDialog();
graph = new UnlockGraphDialog();
Group group = Core.scene.getRoot();

View File

@@ -24,10 +24,7 @@ import io.anuke.ucore.graphics.Draw;
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 io.anuke.ucore.util.*;
import java.io.DataInput;
import java.io.DataOutput;
@@ -246,12 +243,18 @@ public interface BuilderTrait extends Entity{
Item item = tile.floor().drops.item;
unit.rotation = Mathf.slerpDelta(unit.rotation, unit.angleTo(tile.worldx(), tile.worldy()), 0.4f);
if(core.items.get(item) < core.tile.block().getMaximumAccepted(core.tile, item) &&
Mathf.chance(Timers.delta() * (0.06 - item.hardness * 0.01) * getMinePower())){
if(Mathf.chance(Timers.delta() * (0.06 - item.hardness * 0.01) * getMinePower())){
Call.transferItemTo(item, 1,
tile.worldx() + Mathf.range(tilesize / 2f),
tile.worldy() + Mathf.range(tilesize / 2f), core.tile);
if(unit.distanceTo(core) < mineTransferRange && core.items.get(item) < core.tile.block().getMaximumAccepted(core.tile, item)){
Call.transferItemTo(item, 1,
tile.worldx() + Mathf.range(tilesize / 2f),
tile.worldy() + Mathf.range(tilesize / 2f), core.tile);
}else if(unit.inventory.canAcceptItem(item)){
Call.transferItemToUnit(item,
tile.worldx() + Mathf.range(tilesize / 2f),
tile.worldy() + Mathf.range(tilesize / 2f),
unit);
}
}
if(Mathf.chance(0.06 * Timers.delta())){

View File

@@ -41,7 +41,7 @@ public class UnitType extends UnlockableContent{
public float carryWeight = 1f;
public int itemCapacity = 30;
public ObjectSet<Item> toMine = ObjectSet.with(Items.lead, Items.copper);
public float buildPower = 0.3f, minePower = 0.7f, healSpeed = 0.1f;
public float buildPower = 0.3f, minePower = 0.7f, healSpeed = 2f;
public Weapon weapon = Weapons.blaster;
public float weaponOffsetX, weaponOffsetY;
public Color trailColor = Color.valueOf("ffa665");

View File

@@ -3,6 +3,7 @@ package io.anuke.mindustry.entities.units.types;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.Queue;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.fx.BlockFx;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.entities.effect.ItemDrop;
@@ -23,6 +24,7 @@ import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.BuildBlock;
import io.anuke.mindustry.world.blocks.BuildBlock.BuildEntity;
import io.anuke.mindustry.world.meta.BlockFlag;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Events;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.entities.EntityGroup;
@@ -43,6 +45,7 @@ import static io.anuke.mindustry.Vars.*;
public class Drone extends FlyingUnit implements BuilderTrait{
protected static float discoverRange = 120f;
protected static boolean initialized;
protected static int timerRepairEffect = timerIndex++;
protected Item targetItem;
protected Tile mineTile;
@@ -116,8 +119,11 @@ public class Drone extends FlyingUnit implements BuilderTrait{
circle(type.range);
}else{
TileEntity entity = (TileEntity) target;
entity.health += type.healSpeed * Timers.delta();
entity.health = Mathf.clamp(entity.health, 0, entity.tile.block().health);
entity.healBy(type.healSpeed * entity.tile.block().health / 100f * Timers.delta());
if(timer.get(timerRepairEffect, 30)){
Effects.effect(BlockFx.healBlockFull, Palette.heal, entity.x, entity.y, entity.tile.block().size);
}
}
}
},

View File

@@ -0,0 +1,6 @@
package io.anuke.mindustry.entities.units.types;
import io.anuke.mindustry.entities.units.FlyingUnit;
public class Revenant extends FlyingUnit{
}

View File

@@ -2,6 +2,6 @@ package io.anuke.mindustry.entities.units.types;
import io.anuke.mindustry.entities.units.FlyingUnit;
public class Interceptor extends FlyingUnit{
public class Wraith extends FlyingUnit{
}

View File

@@ -3,7 +3,8 @@ package io.anuke.mindustry.game;
import io.anuke.ucore.util.Bundles;
public enum Difficulty{
easy(1.2f, 1.5f),
training(3f, 3f),
easy(1.4f, 1.5f),
normal(1f, 1f),
hard(0.5f, 0.75f),
insane(0.25f, 0.5f);

View File

@@ -16,7 +16,7 @@ public class Waves{
unitScaling = 1;
}},
new SpawnGroup(UnitTypes.interceptor){{
new SpawnGroup(UnitTypes.wraith){{
begin = 12;
end = 14;
}},
@@ -69,7 +69,7 @@ public class Waves{
effect = StatusEffects.overdrive;
}},
new SpawnGroup(UnitTypes.interceptor){{
new SpawnGroup(UnitTypes.wraith){{
begin = 16;
unitScaling = 2;
spacing = 2;
@@ -124,7 +124,7 @@ public class Waves{
max = 8;
}},
new SpawnGroup(UnitTypes.interceptor){{
new SpawnGroup(UnitTypes.wraith){{
begin = 50;
unitAmount = 4;
unitScaling = 3;

View File

@@ -106,7 +106,7 @@ public class PausedDialog extends FloatingDialog{
content().row();
content().addRowImageTextButton("$text.load", "icon-load", isize, load::show).disabled(b -> Net.active());
content().addRowImageTextButton("$text.host", "icon-host", isize, ui.host::show).disabled(b -> Net.active());
content().addRowImageTextButton("$text.hostserver.mobile", "icon-host", isize, ui.host::show).disabled(b -> Net.active());
content().addRowImageTextButton("$text.quit", "icon-quit", isize, () -> {
ui.showConfirm("$text.confirm", "$text.quit.confirm", () -> {
if(Net.client()) netClient.disconnectQuietly();

View File

@@ -128,7 +128,7 @@ public class MenuFragment extends Fragment{
out.add(new MenuButton("icon-menu", "$text.changelog.title", ui.changelog::show));
out.add(new MenuButton("icon-unlocks", "$text.unlocks", ui.graph::show));
out.add(new MenuButton("icon-unlocks", "$text.unlocks", ui.unlocks::show));
out.row();

View File

@@ -16,6 +16,10 @@ import io.anuke.ucore.graphics.Hue;
import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.util.Mathf;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import static io.anuke.mindustry.Vars.tilesize;
import static io.anuke.mindustry.Vars.world;
@@ -126,5 +130,17 @@ public class MendProjector extends Block{
float heat;
float charge;
float phaseHeat;
@Override
public void write(DataOutputStream stream) throws IOException{
stream.writeFloat(heat);
stream.writeFloat(phaseHeat);
}
@Override
public void read(DataInputStream stream) throws IOException{
heat = stream.readFloat();
phaseHeat = stream.readFloat();
}
}
}

View File

@@ -16,6 +16,10 @@ import io.anuke.ucore.graphics.Hue;
import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.util.Mathf;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import static io.anuke.mindustry.Vars.tilesize;
import static io.anuke.mindustry.Vars.world;
@@ -127,5 +131,17 @@ public class OverdriveProjector extends Block{
float heat;
float charge;
float phaseHeat;
@Override
public void write(DataOutputStream stream) throws IOException{
stream.writeFloat(heat);
stream.writeFloat(phaseHeat);
}
@Override
public void read(DataInputStream stream) throws IOException{
heat = stream.readFloat();
phaseHeat = stream.readFloat();
}
}
}

View File

@@ -185,24 +185,16 @@ public class Conveyor extends Block{
float centerDstScl = 3f;
float tx = Geometry.d4[tile.getRotation()].x, ty = Geometry.d4[tile.getRotation()].y;
float min;
float centerx = 0f, centery = 0f;
if(Math.abs(tx) > Math.abs(ty)){
float rx = tile.worldx() - tx / 2f * tilesize;
min = Mathf.clamp((unit.x - rx) * tx / tilesize);
centery = Mathf.clamp((tile.worldy() - unit.y) / centerDstScl, -centerSpeed, centerSpeed);
if(Math.abs(tile.worldy() - unit.y) < 1f) centery = 0f;
}else{
float ry = tile.worldy() - ty / 2f * tilesize;
min = Mathf.clamp((unit.y - ry) * ty / tilesize);
centerx = Mathf.clamp((tile.worldx() - unit.x) / centerDstScl, -centerSpeed, centerSpeed);
if(Math.abs(tile.worldx() - unit.x) < 1f) centerx = 0f;
}
entity.minCarry = Math.min(entity.minCarry, min);
entity.carrying += unit.getMass();
if(entity.convey.size * itemSpace < 0.9f){
unit.getVelocity().add((tx * speed + centerx) * entity.delta(), (ty * speed + centery) * entity.delta());
}
@@ -215,7 +207,6 @@ public class Conveyor extends Block{
entity.minitem = 1f;
int minremove = Integer.MAX_VALUE;
float speed = Math.max(this.speed - (1f - (carryCapacity - entity.carrying) / carryCapacity), 0f);
for(int i = entity.convey.size - 1; i >= 0; i--){
long value = entity.convey.get(i);
@@ -228,9 +219,6 @@ public class Conveyor extends Block{
}
float nextpos = (i == entity.convey.size - 1 ? 100f : pos2.set(entity.convey.get(i + 1), ItemPos.updateShorts).y) - itemSpace;
if(entity.minCarry >= pos.y && entity.minCarry <= nextpos){
nextpos = entity.minCarry;
}
float maxmove = Math.min(nextpos - pos.y, speed * entity.delta());
if(maxmove > minmove){
@@ -260,9 +248,6 @@ public class Conveyor extends Block{
entity.clogHeat = Mathf.lerpDelta(entity.clogHeat, 0f, 1f);
}
entity.carrying = 0f;
entity.minCarry = 2f;
if(entity.items.total() == 0){
entity.sleep();
}else{
@@ -366,9 +351,6 @@ public class Conveyor extends Block{
ConveyorEntity entity = tile.entity();
Array<Object> arr = super.getDebugInfo(tile);
arr.addAll(Array.with(
"mincarry", entity.minCarry,
"minitem", entity.minCarry,
"carrying", entity.carrying,
"clogHeat", entity.clogHeat,
"sleeping", entity.isSleeping()
));
@@ -384,8 +366,6 @@ public class Conveyor extends Block{
LongArray convey = new LongArray();
float minitem = 1;
float carrying;
float minCarry = 2f;
int blendshadowrot = -1;
int blendbits;

View File

@@ -162,6 +162,11 @@ public class CoreBlock extends StorageBlock{
}
}
@Override
public int getMaximumAccepted(Tile tile, Item item){
return itemCapacity;
}
@Override
public boolean acceptItem(Item item, Tile tile, Tile source){
return tile.entity.items.get(item) < itemCapacity && item.type == ItemType.material;