Added unit death scorch effects, more bugfixes

This commit is contained in:
Anuken 2018-06-23 12:30:54 -04:00
parent a4edf827c8
commit 8f2aae6065
17 changed files with 661 additions and 531 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 117 KiB

View File

@ -62,7 +62,7 @@ public class Recipes implements ContentList{
//POWER //POWER
new Recipe(power, PowerBlocks.powernode, new ItemStack(Items.tungsten, 2), new ItemStack(Items.lead, 6)); new Recipe(power, PowerBlocks.powernode, new ItemStack(Items.tungsten, 2), new ItemStack(Items.lead, 6));
new Recipe(power, PowerBlocks.powernodelarge, new ItemStack(Items.carbide, 5), new ItemStack(Items.lead, 20), new ItemStack(Items.silicon, 6)); new Recipe(power, PowerBlocks.powernodelarge, new ItemStack(Items.carbide, 10), new ItemStack(Items.lead, 20), new ItemStack(Items.silicon, 6));
new Recipe(power, PowerBlocks.battery, new ItemStack(Items.tungsten, 8), new ItemStack(Items.lead, 30), new ItemStack(Items.silicon, 4)); new Recipe(power, PowerBlocks.battery, new ItemStack(Items.tungsten, 8), new ItemStack(Items.lead, 30), new ItemStack(Items.silicon, 4));
new Recipe(power, PowerBlocks.batteryLarge, new ItemStack(Items.carbide, 16), new ItemStack(Items.tungsten, 16), new ItemStack(Items.lead, 80), new ItemStack(Items.silicon, 20)); new Recipe(power, PowerBlocks.batteryLarge, new ItemStack(Items.carbide, 16), new ItemStack(Items.tungsten, 16), new ItemStack(Items.lead, 80), new ItemStack(Items.silicon, 20));
new Recipe(power, PowerBlocks.combustiongenerator, new ItemStack(Items.tungsten, 30), new ItemStack(Items.lead, 30)); new Recipe(power, PowerBlocks.combustiongenerator, new ItemStack(Items.tungsten, 30), new ItemStack(Items.lead, 30));

View File

@ -10,6 +10,7 @@ import io.anuke.annotations.Annotations.Loc;
import io.anuke.annotations.Annotations.Remote; import io.anuke.annotations.Annotations.Remote;
import io.anuke.mindustry.Vars; import io.anuke.mindustry.Vars;
import io.anuke.mindustry.entities.effect.ItemDrop; import io.anuke.mindustry.entities.effect.ItemDrop;
import io.anuke.mindustry.entities.effect.ScorchDecal;
import io.anuke.mindustry.entities.traits.BuilderTrait; import io.anuke.mindustry.entities.traits.BuilderTrait;
import io.anuke.mindustry.entities.traits.CarriableTrait; import io.anuke.mindustry.entities.traits.CarriableTrait;
import io.anuke.mindustry.entities.traits.CarryTrait; import io.anuke.mindustry.entities.traits.CarryTrait;
@ -222,6 +223,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
float explosiveness = 2f + (player.inventory.hasItem() ? player.inventory.getItem().item.explosiveness * player.inventory.getItem().amount : 0f); float explosiveness = 2f + (player.inventory.hasItem() ? player.inventory.getItem().item.explosiveness * player.inventory.getItem().amount : 0f);
float flammability = (player.inventory.hasItem() ? player.inventory.getItem().item.flammability * player.inventory.getItem().amount : 0f); float flammability = (player.inventory.hasItem() ? player.inventory.getItem().item.flammability * player.inventory.getItem().amount : 0f);
Damage.dynamicExplosion(player.x, player.y, flammability, explosiveness, 0f, player.getSize()/2f, Palette.darkFlame); Damage.dynamicExplosion(player.x, player.y, flammability, explosiveness, 0f, player.getSize()/2f, Palette.darkFlame);
ScorchDecal.create(player.x, player.y);
Effects.sound("die", player); Effects.sound("die", player);
player.onDeath(); player.onDeath();
} }

View File

@ -11,17 +11,8 @@ import io.anuke.ucore.util.Mathf;
import static io.anuke.mindustry.Vars.groundEffectGroup; import static io.anuke.mindustry.Vars.groundEffectGroup;
/**Class for creating block rubble on the ground.*/ /**Class for creating block rubble on the ground.*/
public class Rubble extends TimedEntity implements BelowLiquidTrait, DrawTrait { public abstract class Decal extends TimedEntity implements BelowLiquidTrait, DrawTrait {
private static final Color color = Color.valueOf("52504e"); private static final Color color = Color.valueOf("52504e");
private int size;
/**Creates a rubble effect at a position. Provide a block size to use.*/
public static void create(float x, float y, int size){
Rubble rubble = new Rubble();
rubble.size = size;
rubble.set(x, y);
rubble.add();
}
@Override @Override
public float lifetime() { public float lifetime() {
@ -30,15 +21,8 @@ public class Rubble extends TimedEntity implements BelowLiquidTrait, DrawTrait {
@Override @Override
public void draw(){ public void draw(){
String region = "rubble-" + size + "-" + Mathf.randomSeed(id, 0, 1);
if(!Draw.hasRegion(region)){
remove();
return;
}
Draw.color(color.r, color.g, color.b, 1f-Mathf.curve(fin(), 0.98f)); Draw.color(color.r, color.g, color.b, 1f-Mathf.curve(fin(), 0.98f));
Draw.rect(region, x, y, Mathf.randomSeed(id, 0, 4) * 90); drawDecal();
Draw.color(); Draw.color();
} }
@ -46,4 +30,6 @@ public class Rubble extends TimedEntity implements BelowLiquidTrait, DrawTrait {
public EntityGroup targetGroup() { public EntityGroup targetGroup() {
return groundEffectGroup; return groundEffectGroup;
} }
abstract void drawDecal();
} }

View File

@ -123,7 +123,7 @@ public class ItemDrop extends SolidEntity implements SaveTrait, SyncTrait, DrawT
@Override @Override
public void draw() { public void draw() {
float size = itemSize * (1f - sinktime/sinkLifetime); float size = itemSize * (1f - sinktime/sinkLifetime) * (1f-Mathf.curve(fin(), 0.98f));
Tile tile = world.tileWorld(x, y); Tile tile = world.tileWorld(x, y);

View File

@ -0,0 +1,28 @@
package io.anuke.mindustry.entities.effect;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Mathf;
public class RubbleDecal extends Decal {
private int size;
/**Creates a rubble effect at a position. Provide a block size to use.*/
public static void create(float x, float y, int size){
RubbleDecal decal = new RubbleDecal();
decal.size = size;
decal.set(x, y);
decal.add();
}
@Override
public void drawDecal(){
String region = "rubble-" + size + "-" + Mathf.randomSeed(id, 0, 1);
if(!Draw.hasRegion(region)){
remove();
return;
}
Draw.rect(region, x, y, Mathf.randomSeed(id, 0, 4) * 90);
}
}

View File

@ -0,0 +1,41 @@
package io.anuke.mindustry.entities.effect;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
import static io.anuke.mindustry.Vars.world;
public class ScorchDecal extends Decal {
private static final int scorches = 5;
private static final TextureRegion[] regions = new TextureRegion[scorches];
public static void create(float x, float y){
if(regions[0] == null){
for (int i = 0; i < regions.length; i++) {
regions[i] = Draw.region("scorch" + (i+1));
}
}
Tile tile = world.tileWorld(x, y);
if(tile == null || tile.floor().liquidDrop != null) return;
ScorchDecal decal = new ScorchDecal();
decal.set(x, y);
decal.add();
}
@Override
public void drawDecal(){
for (int i = 0; i < 5; i++) {
TextureRegion region = regions[Mathf.randomSeed(id - i, 0, scorches-1)];
float rotation = Mathf.randomSeed(id + i, 0, 360);
float space = 1.5f + Mathf.randomSeed(id + i + 1, 0, 20)/10f;
Draw.grect(region, x + Angles.trnsx(rotation, space), y + Angles.trnsy(rotation, space), rotation - 90);
}
}
}

View File

@ -8,6 +8,7 @@ import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.Unit; import io.anuke.mindustry.entities.Unit;
import io.anuke.mindustry.entities.Units; import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.entities.bullet.Bullet; import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.effect.ScorchDecal;
import io.anuke.mindustry.entities.traits.TargetTrait; import io.anuke.mindustry.entities.traits.TargetTrait;
import io.anuke.mindustry.game.Team; import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.gen.CallEntity; import io.anuke.mindustry.gen.CallEntity;
@ -319,6 +320,7 @@ public abstract class BaseUnit extends Unit{
unit.onSuperDeath(); unit.onSuperDeath();
UnitDrops.dropItems(unit); UnitDrops.dropItems(unit);
ScorchDecal.create(unit.x, unit.y);
Effects.effect(ExplosionFx.explosion, unit); Effects.effect(ExplosionFx.explosion, unit);
Effects.shake(2f, 2f, unit); Effects.shake(2f, 2f, unit);

View File

@ -11,8 +11,9 @@ import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.Unit; import io.anuke.mindustry.entities.Unit;
import io.anuke.mindustry.entities.bullet.Bullet; import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.effect.Decal;
import io.anuke.mindustry.entities.effect.Puddle; import io.anuke.mindustry.entities.effect.Puddle;
import io.anuke.mindustry.entities.effect.Rubble; import io.anuke.mindustry.entities.effect.RubbleDecal;
import io.anuke.mindustry.game.Content; import io.anuke.mindustry.game.Content;
import io.anuke.mindustry.game.UnlockableContent; import io.anuke.mindustry.game.UnlockableContent;
import io.anuke.mindustry.graphics.CacheLayer; import io.anuke.mindustry.graphics.CacheLayer;
@ -322,7 +323,7 @@ public class Block extends BaseBlock implements UnlockableContent{
Damage.dynamicExplosion(x, y, flammability, explosiveness, power, tilesize * size/2f, tempColor); Damage.dynamicExplosion(x, y, flammability, explosiveness, power, tilesize * size/2f, tempColor);
if(!tile.floor().solid && !tile.floor().isLiquid){ if(!tile.floor().solid && !tile.floor().isLiquid){
Rubble.create(tile.drawx(), tile.drawy(), size); RubbleDecal.create(tile.drawx(), tile.drawy(), size);
} }
} }

View File

@ -8,7 +8,7 @@ import io.anuke.mindustry.content.fx.Fx;
import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.Unit; import io.anuke.mindustry.entities.Unit;
import io.anuke.mindustry.entities.effect.Rubble; import io.anuke.mindustry.entities.effect.RubbleDecal;
import io.anuke.mindustry.entities.traits.BuilderTrait.BuildRequest; import io.anuke.mindustry.entities.traits.BuilderTrait.BuildRequest;
import io.anuke.mindustry.game.Team; import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.gen.CallBlocks; import io.anuke.mindustry.gen.CallBlocks;
@ -69,7 +69,7 @@ public class BreakBlock extends Block {
Effects.effect(ExplosionFx.blockExplosionSmoke, tile); Effects.effect(ExplosionFx.blockExplosionSmoke, tile);
if(!tile.floor().solid && !tile.floor().isLiquid){ if(!tile.floor().solid && !tile.floor().isLiquid){
Rubble.create(tile.drawx(), tile.drawy(), size); RubbleDecal.create(tile.drawx(), tile.drawy(), size);
} }
} }

View File

@ -7,7 +7,7 @@ import io.anuke.mindustry.content.fx.ExplosionFx;
import io.anuke.mindustry.content.fx.Fx; import io.anuke.mindustry.content.fx.Fx;
import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.effect.Rubble; import io.anuke.mindustry.entities.effect.RubbleDecal;
import io.anuke.mindustry.entities.traits.BuilderTrait.BuildRequest; import io.anuke.mindustry.entities.traits.BuilderTrait.BuildRequest;
import io.anuke.mindustry.game.Team; import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.gen.CallBlocks; import io.anuke.mindustry.gen.CallBlocks;
@ -74,7 +74,7 @@ public class BuildBlock extends Block {
Effects.effect(ExplosionFx.blockExplosionSmoke, tile); Effects.effect(ExplosionFx.blockExplosionSmoke, tile);
if(!tile.floor().solid && !tile.floor().isLiquid){ if(!tile.floor().solid && !tile.floor().isLiquid){
Rubble.create(tile.drawx(), tile.drawy(), size); RubbleDecal.create(tile.drawx(), tile.drawy(), size);
} }
} }