Implemented dirium, finished new turret, multiple bugfixes

This commit is contained in:
Anuken
2017-09-19 00:49:55 -04:00
parent 537641c8a3
commit 28bb82ef4b
32 changed files with 204 additions and 81 deletions

View File

@@ -79,7 +79,7 @@ project(":core") {
apply plugin: "java" apply plugin: "java"
dependencies { dependencies {
compile 'com.github.anuken:ucore:532dc82873' compile 'com.github.anuken:ucore:779c75e1b2'
compile "com.badlogicgames.gdx:gdx:$gdxVersion" compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-ai:1.8.1" compile "com.badlogicgames.gdx:gdx-ai:1.8.1"
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

View File

@@ -202,42 +202,42 @@ blocks/grassedge
index: -1 index: -1
blocks/iron1 blocks/iron1
rotate: false rotate: false
xy: 80, 11 xy: 80, 1
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/iron2 blocks/iron2
rotate: false rotate: false
xy: 80, 1 xy: 90, 11
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/iron3 blocks/iron3
rotate: false rotate: false
xy: 90, 11 xy: 90, 1
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/irondrill blocks/irondrill
rotate: false rotate: false
xy: 90, 1 xy: 100, 11
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/ironwall blocks/ironwall
rotate: false rotate: false
xy: 100, 11 xy: 100, 1
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/junction blocks/junction
rotate: false rotate: false
xy: 100, 1 xy: 110, 11
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
@@ -272,28 +272,28 @@ blocks/mortarturret
index: -1 index: -1
blocks/mossblock blocks/mossblock
rotate: false rotate: false
xy: 110, 1 xy: 120, 11
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/mossstone blocks/mossstone
rotate: false rotate: false
xy: 110, 1 xy: 120, 11
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/omnidrill blocks/omnidrill
rotate: false rotate: false
xy: 120, 11 xy: 120, 1
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/pump blocks/pump
rotate: false rotate: false
xy: 130, 11 xy: 130, 1
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
@@ -307,35 +307,35 @@ blocks/repairturret
index: -1 index: -1
blocks/rock blocks/rock
rotate: false rotate: false
xy: 130, 1 xy: 140, 11
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/rock2 blocks/rock2
rotate: false rotate: false
xy: 140, 11 xy: 140, 1
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/rock2shadow blocks/rock2shadow
rotate: false rotate: false
xy: 140, 1 xy: 150, 11
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/rockshadow blocks/rockshadow
rotate: false rotate: false
xy: 150, 11 xy: 150, 1
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/router blocks/router
rotate: false rotate: false
xy: 150, 1 xy: 160, 11
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
@@ -356,21 +356,21 @@ blocks/shotgunturret
index: -1 index: -1
blocks/shrub blocks/shrub
rotate: false rotate: false
xy: 160, 11 xy: 160, 1
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/shrubshadow blocks/shrubshadow
rotate: false rotate: false
xy: 160, 1 xy: 170, 11
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/smelter blocks/smelter
rotate: false rotate: false
xy: 170, 11 xy: 170, 1
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
@@ -384,21 +384,21 @@ blocks/sniperturret
index: -1 index: -1
blocks/steelconveyor blocks/steelconveyor
rotate: false rotate: false
xy: 170, 1 xy: 180, 11
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/steelconveyormove blocks/steelconveyormove
rotate: false rotate: false
xy: 180, 11 xy: 180, 1
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/steelwall blocks/steelwall
rotate: false rotate: false
xy: 180, 1 xy: 190, 11
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
@@ -412,49 +412,49 @@ blocks/stone
index: -1 index: -1
blocks/stone1 blocks/stone1
rotate: false rotate: false
xy: 190, 11 xy: 190, 1
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/stone2 blocks/stone2
rotate: false rotate: false
xy: 190, 1 xy: 200, 13
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/stone3 blocks/stone3
rotate: false rotate: false
xy: 200, 13 xy: 200, 3
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/stoneblock blocks/stoneblock
rotate: false rotate: false
xy: 200, 3 xy: 210, 13
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/stoneblock2 blocks/stoneblock2
rotate: false rotate: false
xy: 210, 13 xy: 210, 3
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/stoneblock3 blocks/stoneblock3
rotate: false rotate: false
xy: 210, 3 xy: 220, 13
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/stonedrill blocks/stonedrill
rotate: false rotate: false
xy: 220, 13 xy: 220, 3
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
@@ -468,42 +468,42 @@ blocks/stoneedge
index: -1 index: -1
blocks/stonewall blocks/stonewall
rotate: false rotate: false
xy: 220, 3 xy: 230, 13
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/titanium1 blocks/titanium1
rotate: false rotate: false
xy: 230, 13 xy: 230, 3
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/titanium2 blocks/titanium2
rotate: false rotate: false
xy: 230, 3 xy: 240, 13
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/titanium3 blocks/titanium3
rotate: false rotate: false
xy: 240, 13 xy: 240, 3
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/titaniumdrill blocks/titaniumdrill
rotate: false rotate: false
xy: 240, 3 xy: 250, 13
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blocks/titaniumwall blocks/titaniumwall
rotate: false rotate: false
xy: 250, 13 xy: 250, 3
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
@@ -517,7 +517,7 @@ blocks/turret
index: -1 index: -1
blocks/water blocks/water
rotate: false rotate: false
xy: 250, 3 xy: 260, 13
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
@@ -566,7 +566,7 @@ enemies/firemech
index: -1 index: -1
enemies/mech1 enemies/mech1
rotate: false rotate: false
xy: 110, 11 xy: 110, 1
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
@@ -578,34 +578,41 @@ icon-coal
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
icon-iron icon-dirium
rotate: false rotate: false
xy: 469, 23 xy: 469, 23
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
icon-steel icon-iron
rotate: false rotate: false
xy: 479, 23 xy: 479, 23
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
icon-stone icon-steel
rotate: false rotate: false
xy: 489, 23 xy: 489, 23
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
icon-titanium icon-stone
rotate: false rotate: false
xy: 499, 23 xy: 499, 23
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
icon-titanium
rotate: false
xy: 80, 11
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
laser laser
rotate: false rotate: false
xy: 77, 5 xy: 77, 5
@@ -622,35 +629,35 @@ laserend
index: -1 index: -1
player player
rotate: false rotate: false
xy: 120, 1 xy: 130, 11
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
weapon-blaster weapon-blaster
rotate: false rotate: false
xy: 260, 13 xy: 260, 3
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
weapon-flamethrower weapon-flamethrower
rotate: false rotate: false
xy: 260, 3 xy: 270, 13
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
weapon-multigun weapon-multigun
rotate: false rotate: false
xy: 270, 13 xy: 270, 3
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0
index: -1 index: -1
weapon-trishot weapon-trishot
rotate: false rotate: false
xy: 270, 3 xy: 280, 13
size: 8, 8 size: 8, 8
orig: 8, 8 orig: 8, 8
offset: 0, 0 offset: 0, 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

@@ -59,6 +59,8 @@ public class Control extends ControlModule{
Inputs.addProcessor(new AndroidInput()); Inputs.addProcessor(new AndroidInput());
} }
Effects.setShakeFalloff(10000f);
Draw.addSurface("shadow", Core.cameraScale); Draw.addSurface("shadow", Core.cameraScale);
atlas = new Atlas("sprites.atlas"); atlas = new Atlas("sprites.atlas");
@@ -215,7 +217,7 @@ public class Control extends ControlModule{
} }
public void coreDestroyed(){ public void coreDestroyed(){
Effects.shake(5, 6); Effects.shake(5, 6, camera.position.x, camera.position.y);
Sounds.play("corexplode"); Sounds.play("corexplode");
Tile core = World.core; Tile core = World.core;
for(int i = 0; i < 16; i ++){ for(int i = 0; i < 16; i ++){
@@ -306,7 +308,7 @@ public class Control extends ControlModule{
} }
if(Inputs.keyDown(Keys.SPACE)){ if(Inputs.keyDown(Keys.SPACE)){
Effects.shake(6, 4); Effects.shake(6, 4, Graphics.mouseWorld().x, Graphics.mouseWorld().y);
} }
if(Inputs.keyDown(Keys.Y)){ if(Inputs.keyDown(Keys.Y)){

View File

@@ -7,12 +7,29 @@ import com.badlogic.gdx.graphics.Color;
import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.Draw;
import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Effects;
import io.anuke.ucore.graphics.Hue; import io.anuke.ucore.graphics.Hue;
import io.anuke.ucore.util.Angles;
public class EffectLoader{ public class EffectLoader{
static Color lightRed = Hue.mix(Color.WHITE, Color.FIREBRICK, 0.1f); static Color lightRed = Hue.mix(Color.WHITE, Color.FIREBRICK, 0.1f);
public static void create(){ public static void create(){
Effects.create("shellsmoke", 21, e -> {
Angles.randLenVectors(e.id, 8, 1f + e.ifract()*16f, (x, y)->{
float size = 2f+e.fract()*5f;
Draw.color(Color.LIGHT_GRAY, Color.DARK_GRAY, e.ifract());
Draw.rect("circle", e.x + x, e.y + y, size, size);
Draw.reset();
});
});
Effects.create("shellexplosion", 15, e -> {
Draw.thickness(1.3f - e.ifract());
Draw.color(Hue.mix(Color.WHITE, Color.ORANGE, e.ifract()));
Draw.circle(e.x, e.y, 1f + e.ifract() * 7f);
Draw.reset();
});
Effects.create("place", 16, e -> { Effects.create("place", 16, e -> {
Draw.thickness(3f - e.ifract() * 2f); Draw.thickness(3f - e.ifract() * 2f);
Draw.square(e.x, e.y, Vars.tilesize / 2f + e.ifract() * 3f); Draw.square(e.x, e.y, Vars.tilesize / 2f + e.ifract() * 3f);
@@ -54,6 +71,13 @@ public class EffectLoader{
Draw.reset(); Draw.reset();
}); });
Effects.create("laserhit", 10, e -> {
Draw.thickness(1f);
Draw.color(Hue.mix(Color.WHITE, Color.SKY, e.ifract()));
Draw.spikes(e.x, e.y, e.ifract() * 2f, 2, 6);
Draw.reset();
});
Effects.create("shoot", 8, e -> { Effects.create("shoot", 8, e -> {
Draw.thickness(1f); Draw.thickness(1f);
Draw.color(Hue.mix(Color.WHITE, Color.GOLD, e.ifract())); Draw.color(Hue.mix(Color.WHITE, Color.GOLD, e.ifract()));

View File

@@ -4,11 +4,19 @@ import com.badlogic.gdx.graphics.Color;
import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.Draw;
import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.entities.BaseBulletType; import io.anuke.ucore.entities.BaseBulletType;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
public abstract class BulletType extends BaseBulletType<Bullet>{ public abstract class BulletType extends BaseBulletType<Bullet>{
public static final BulletType public static final BulletType
none = new BulletType(0f, 0){
public void draw(Bullet b){
}
},
stone = new BulletType(1.5f, 2){ stone = new BulletType(1.5f, 2){
public void draw(Bullet b){ public void draw(Bullet b){
Draw.color("gray"); Draw.color("gray");
@@ -30,6 +38,52 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
Draw.reset(); Draw.reset();
} }
}, },
shell = new BulletType(1.1f, 110){
{
lifetime = 110f;
}
public void draw(Bullet b){
float rad = 8f;
Draw.color(Color.GRAY);
Draw.rect("circle", b.x, b.y, rad, rad);
rad += Mathf.sin(Timers.time(), 3f, 1f);
Draw.color(Color.ORANGE);
Draw.rect("circle", b.x, b.y, rad/1.7f, rad/1.7f);
Draw.reset();
}
public void update(Bullet b){
if(Timers.get(b, "smoke", 7)){
Effects.effect("smoke", b.x + Mathf.range(2), b.y + Mathf.range(2));
}
}
public void despawned(Bullet b){
removed(b);
}
public void removed(Bullet b){
Effects.shake(3f, 3f, b);
Effects.effect("shellsmoke", b);
Effects.effect("shellexplosion", b);
Angles.circle(20, f->{
Angles.translation(f, 5f);
new Bullet(shellshot, b.owner, b.x + Angles.x(), b.y + Angles.y(), f).add();
});
}
},
shellshot = new BulletType(1.5f, 5){
{
lifetime = 7f;
}
public void draw(Bullet b){
// Draw.color("orange");
// Draw.rect("bullet", b.x, b.y, b.angle());
// Draw.reset();
}
},
small = new BulletType(1.5f, 1){ small = new BulletType(1.5f, 1){
public void draw(Bullet b){ public void draw(Bullet b){
Draw.color("orange"); Draw.color("orange");

View File

@@ -33,7 +33,7 @@ public class Player extends DestructibleEntity{
public void onDeath(){ public void onDeath(){
remove(); remove();
Effects.effect("explosion", this); Effects.effect("explosion", this);
Effects.shake(4f, 5f); Effects.shake(4f, 5f, this);
Effects.sound("die", this); Effects.sound("die", this);
Vars.control.setRespawnTime(respawnduration); Vars.control.setRespawnTime(respawnduration);

View File

@@ -49,7 +49,7 @@ public class TileEntity extends Entity{
} }
tile.setBlock(Blocks.air); tile.setBlock(Blocks.air);
Effects.shake(4f, 4f); Effects.shake(4f, 4f, this);
Effects.effect("explosion", this); Effects.effect("explosion", this);
Effects.sound("break", this); Effects.sound("break", this);

View File

@@ -104,7 +104,7 @@ public class Enemy extends DestructibleEntity{
@Override @Override
public void onDeath(){ public void onDeath(){
Effects.effect("explosion", this); Effects.effect("explosion", this);
Effects.shake(3f, 4f); Effects.shake(3f, 4f, this);
Effects.sound("explosion", this); Effects.sound("explosion", this);
remove(); remove();
dead = true; dead = true;

View File

@@ -1,5 +1,5 @@
package io.anuke.mindustry.resource; package io.anuke.mindustry.resource;
public enum Item{ public enum Item{
stone, iron, coal, steel, titanium, hypanium; stone, iron, coal, steel, titanium, dirium;
} }

View File

@@ -26,7 +26,7 @@ public enum Recipe{
flameturret(defense, WeaponBlocks.flameturret, stack(Item.iron, 25), stack(Item.steel, 18)), flameturret(defense, WeaponBlocks.flameturret, stack(Item.iron, 25), stack(Item.steel, 18)),
sniperturret(defense, WeaponBlocks.sniperturret, stack(Item.iron, 30), stack(Item.steel, 20)), sniperturret(defense, WeaponBlocks.sniperturret, stack(Item.iron, 30), stack(Item.steel, 20)),
laserturret(defense, WeaponBlocks.laserturret, stack(Item.steel, 20), stack(Item.titanium, 20)), laserturret(defense, WeaponBlocks.laserturret, stack(Item.steel, 20), stack(Item.titanium, 20)),
mortarturret(defense, WeaponBlocks.mortarturret, stack(Item.steel, 25), stack(Item.titanium, 25)), mortarturret(defense, WeaponBlocks.mortarturret, stack(Item.steel, 40), stack(Item.titanium, 30)),
healturret(defense, WeaponBlocks.repairturret, stack(Item.iron, 45)), healturret(defense, WeaponBlocks.repairturret, stack(Item.iron, 45)),
megahealturret(defense, WeaponBlocks.megarepairturret, stack(Item.iron, 30), stack(Item.steel, 40)), megahealturret(defense, WeaponBlocks.megarepairturret, stack(Item.iron, 30), stack(Item.steel, 40)),

View File

@@ -145,12 +145,12 @@ public class ProductionBlocks{
{ {
health = 90; health = 90;
requirements = new Item[]{Item.titanium, Item.steel}; requirements = new Item[]{Item.titanium, Item.steel};
result = Item.hypanium; result = Item.dirium;
} }
@Override @Override
public String description(){ public String description(){
return "Takes in steel + titanium, outputs hypanium."; return "Takes in steel + titanium, outputs dirium.";
} }
}, },

View File

@@ -1,9 +1,12 @@
package io.anuke.mindustry.world.blocks; package io.anuke.mindustry.world.blocks;
import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.entities.BulletType; import io.anuke.mindustry.entities.BulletType;
import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.types.LaserTurret;
import io.anuke.mindustry.world.blocks.types.RepairTurret; import io.anuke.mindustry.world.blocks.types.RepairTurret;
import io.anuke.mindustry.world.blocks.types.Turret; import io.anuke.mindustry.world.blocks.types.Turret;
import io.anuke.ucore.core.Timers; import io.anuke.ucore.core.Timers;
@@ -102,25 +105,27 @@ public class WeaponBlocks{
//TODO //TODO
mortarturret = new Turret("mortarturret"){ mortarturret = new Turret("mortarturret"){
{ {
rotatespeed = 0.1f;
formalName = "flak turret"; formalName = "flak turret";
range = 120; range = 120;
reload = 120f; reload = 120f;
bullet = BulletType.sniper; bullet = BulletType.shell;
ammo = Item.coal; ammo = Item.stone;
health = 110; health = 110;
} }
}, },
//TODO //TODO
laserturret = new Turret("laserturret"){ laserturret = new LaserTurret("laserturret"){
{ {
beamColor = Color.SKY;
formalName = "laser turret"; formalName = "laser turret";
range = 60; range = 60;
reload = 40f; reload = 4f;
bullet = BulletType.sniper; damage = 9;
ammo = Item.coal; ammo = Item.stone;
health = 110; health = 110;
} }
}, },

View File

@@ -41,6 +41,13 @@ public class Crafter extends Block{
@Override @Override
public boolean accept(Item item, Tile dest, Tile source){ public boolean accept(Item item, Tile dest, Tile source){
return item == Item.iron || item == Item.coal; boolean craft = false;
for(Item req : requirements){
if(item == req){
craft = true;
break;
}
}
return craft;
} }
} }

View File

@@ -8,32 +8,43 @@ import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.Draw;
import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Timers; import io.anuke.ucore.core.Timers;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Tmp; import io.anuke.ucore.util.Tmp;
public class LaserTurret extends Turret{ public class LaserTurret extends Turret{
protected Color beamColor = Color.WHITE.cpy(); protected Color beamColor = Color.WHITE.cpy();
protected String hiteffect = "hit"; protected String hiteffect = "laserhit";
protected int damage = 4; protected int damage = 4;
protected float cone = 15f;
public LaserTurret(String name) { public LaserTurret(String name) {
super(name); super(name);
} }
@Override
public String description(){
return "[turretinfo]Ammo: "+(ammo==null ? "N/A" : ammo.name())+"\nRange: " + (int)range + "\nDamage: " + damage;
}
@Override @Override
public void shoot(Tile tile){ public void shoot(Tile tile){
TurretEntity entity = tile.entity(); TurretEntity entity = tile.entity();
Enemy enemy = entity.target; Enemy enemy = entity.target;
enemy.damage(damage); if(Angles.angleDist(entity.rotation, Angles.angle(tile.worldx(), tile.worldy(), enemy.x, enemy.y)) < cone){
Effects.effect(hiteffect, enemy.x + Mathf.range(3), enemy.y + Mathf.range(3)); enemy.damage(damage);
Effects.effect(hiteffect, enemy.x + Mathf.range(3), enemy.y + Mathf.range(3));
}
} }
@Override @Override
public void drawOver(Tile tile){ public void drawOver(Tile tile){
TurretEntity entity = tile.entity(); TurretEntity entity = tile.entity();
if(entity.target != null){ if(entity.target != null &&
Angles.angleDist(entity.rotation, Angles.angle(tile.worldx(), tile.worldy(), entity.target.x, entity.target.y)) <= cone){
float x = tile.worldx(), y = tile.worldy(); float x = tile.worldx(), y = tile.worldy();
float x2 = entity.target.x, y2 = entity.target.y; float x2 = entity.target.x, y2 = entity.target.y;
@@ -50,9 +61,11 @@ public class LaserTurret extends Turret{
Draw.line(x, y, x2, y2); Draw.line(x, y, x2, y2);
Draw.thickness(1f); Draw.thickness(1f);
Draw.rect("circle", x2, y2, 5f, 5f); Draw.rect("circle", x2, y2, 5f, 5f);
Draw.reset();
} }
Draw.reset();
super.drawOver(tile); super.drawOver(tile);
} }
} }

View File

@@ -20,16 +20,20 @@ public class RepairTurret extends Turret{
public void update(Tile tile){ public void update(Tile tile){
TurretEntity entity = tile.entity(); TurretEntity entity = tile.entity();
if(Timers.get(entity, "target", targetInterval)){ if(Timers.get(entity, "blocktarget", targetInterval)){
entity.blockTarget = World.findTileTarget(tile.worldx(), tile.worldy(), tile, range, true); entity.blockTarget = World.findTileTarget(tile.worldx(), tile.worldy(), tile, range, true);
} }
if(entity.target != null){ if(entity.blockTarget != null){
float target = entity.angleTo(entity.target); float target = entity.angleTo(entity.blockTarget);
entity.rotation = Mathf.slerp(entity.rotation, target, 0.16f*Timers.delta()); entity.rotation = Mathf.slerp(entity.rotation, target, 0.16f*Timers.delta());
if(Timers.get(tile, reload) && Angles.angleDist(target, entity.rotation) < 10){ if(Timers.get(tile, "reload", reload) && Angles.angleDist(target, entity.rotation) < shootCone){
entity.target.health++; entity.blockTarget.health++;
if(entity.blockTarget.health > entity.blockTarget.health)
entity.blockTarget.health = entity.blockTarget.maxhealth;
} }
} }
} }
@@ -43,7 +47,7 @@ public class RepairTurret extends Turret{
public void drawOver(Tile tile){ public void drawOver(Tile tile){
TurretEntity entity = tile.entity(); TurretEntity entity = tile.entity();
if(entity.blockTarget != null){ if(entity.blockTarget != null && Angles.angleDist(entity.angleTo(entity.blockTarget), entity.rotation) < 10){
float x = tile.worldx(), y = tile.worldy(); float x = tile.worldx(), y = tile.worldy();
float x2 = entity.blockTarget.x, y2 = entity.blockTarget.y; float x2 = entity.blockTarget.x, y2 = entity.blockTarget.y;

View File

@@ -28,10 +28,12 @@ public class Turret extends Block{
protected float range = 50f; protected float range = 50f;
protected float reload = 10f; protected float reload = 10f;
protected String shootsound = "shoot"; protected String shootsound = "shoot";
protected BulletType bullet; protected BulletType bullet = BulletType.iron;
protected Item ammo; protected Item ammo;
protected int ammoMultiplier = 20; protected int ammoMultiplier = 20;
protected int maxammo = 400; protected int maxammo = 400;
protected float rotatespeed = 0.2f;
protected float shootCone = 8f;
public Turret(String name) { public Turret(String name) {
super(name); super(name);
@@ -68,7 +70,7 @@ public class Turret extends Block{
@Override @Override
public void drawPlace(int x, int y, boolean valid){ public void drawPlace(int x, int y, boolean valid){
//TODO? //TODO?
//Draw.color(Color.PURPLE); Draw.color(Color.PURPLE);
Draw.thick(1f); Draw.thick(1f);
Draw.dashcircle(x*Vars.tilesize, y*Vars.tilesize, range); Draw.dashcircle(x*Vars.tilesize, y*Vars.tilesize, range);
} }
@@ -92,22 +94,27 @@ public class Turret extends Block{
entity.removeItem(ammo, 1); entity.removeItem(ammo, 1);
} }
if(entity.target != null && entity.target.isDead())
entity.target = null;
if(entity.ammo > 0){ if(entity.ammo > 0){
if(Timers.get(entity, "target", targetInterval)){ if(Timers.get(entity, "target", targetInterval)){
entity.target = (Enemy)Entities.getClosest(tile.worldx(), tile.worldy(), range, e->{ entity.target = (Enemy)Entities.getClosest(tile.worldx(), tile.worldy(), range, e->{
return e instanceof Enemy; return e instanceof Enemy && !((Enemy)e).isDead();
}); });
} }
if(entity.target != null){ if(entity.target != null){
entity.rotation = MathUtils.lerpAngleDeg(entity.rotation,
Angles.predictAngle(tile.worldx(), tile.worldy(), float targetRot = Angles.predictAngle(tile.worldx(), tile.worldy(),
entity.target.x, entity.target.y, entity.target.xvelocity, entity.target.yvelocity, bullet.speed), entity.target.x, entity.target.y, entity.target.xvelocity, entity.target.yvelocity, bullet.speed);
0.2f*Timers.delta());
entity.rotation = MathUtils.lerpAngleDeg(entity.rotation, targetRot,
rotatespeed*Timers.delta());
float reload = Vars.multiplier*this.reload; float reload = Vars.multiplier*this.reload;
if(Timers.get(tile, reload)){ if(Angles.angleDist(entity.rotation, targetRot) < shootCone && Timers.get(tile, "reload", reload)){
Effects.sound(shootsound, entity); Effects.sound(shootsound, entity);
shoot(tile); shoot(tile);
entity.ammo --; entity.ammo --;

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 KiB