mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-10 07:47:25 +07:00
Added shock mines
This commit is contained in:
BIN
core/assets-raw/sprites/blocks/defense/shock-mine.png
Normal file
BIN
core/assets-raw/sprites/blocks/defense/shock-mine.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 200 B |
BIN
core/assets-raw/sprites/blocks/extra/shadow-shock-mine.png
Normal file
BIN
core/assets-raw/sprites/blocks/extra/shadow-shock-mine.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 159 B |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 98 KiB |
@ -128,7 +128,7 @@ public class BlockIndexer{
|
||||
for(int ty = ry * structQuadrantSize; ty < (ry + 1) * structQuadrantSize && ty < world.height(); ty++){
|
||||
Tile other = world.tile(tx, ty);
|
||||
|
||||
if(other == null || other.entity == null || other.getTeam() != team || !pred.test(other)) continue;
|
||||
if(other == null || other.entity == null || other.getTeam() != team || !pred.test(other) || !other.block().targetable) continue;
|
||||
|
||||
TileEntity e = other.entity;
|
||||
|
||||
@ -233,7 +233,7 @@ public class BlockIndexer{
|
||||
TeamData data = state.teams.get(team);
|
||||
|
||||
//fast-set this quadrant to 'occupied' if the tile just placed is already of this team
|
||||
if(tile.getTeam() == data.team && tile.entity != null){
|
||||
if(tile.getTeam() == data.team && tile.entity != null && tile.block().targetable){
|
||||
structQuadrants[data.team.ordinal()].set(index);
|
||||
continue; //no need to process futher
|
||||
}
|
||||
|
@ -37,6 +37,10 @@ public class Recipes implements ContentList{
|
||||
//projectors
|
||||
new Recipe(defense, DefenseBlocks.mendProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.densealloy, 150), new ItemStack(Items.titanium, 150), new ItemStack(Items.silicon, 250));
|
||||
|
||||
//extra blocks
|
||||
new Recipe(defense, DefenseBlocks.shockMine, new ItemStack(Items.lead, 50), new ItemStack(Items.silicon, 25))
|
||||
.setDependencies(Items.blastCompound);
|
||||
|
||||
//TURRETS
|
||||
new Recipe(weapon, TurretBlocks.duo, new ItemStack(Items.copper, 40));
|
||||
new Recipe(weapon, TurretBlocks.scorch, new ItemStack(Items.copper, 50), new ItemStack(Items.densealloy, 20));
|
||||
|
@ -10,7 +10,7 @@ import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.production.*;
|
||||
|
||||
public class CraftingBlocks extends BlockList implements ContentList{
|
||||
public static Block smelter, arcsmelter, siliconsmelter, plastaniumCompressor, phaseWeaver, alloySmelter, alloyfuser,
|
||||
public static Block smelter, arcsmelter, siliconsmelter, plastaniumCompressor, phaseWeaver, alloySmelter,
|
||||
pyratiteMixer, blastMixer,
|
||||
cryofluidmixer, melter, separator, centrifuge, biomatterCompressor, pulverizer, solidifier, incinerator;
|
||||
|
||||
@ -84,27 +84,14 @@ public class CraftingBlocks extends BlockList implements ContentList{
|
||||
alloySmelter = new PowerSmelter("alloy-smelter"){{
|
||||
craftEffect = BlockFx.smeltsmoke;
|
||||
result = Items.surgealloy;
|
||||
craftTime = 50f;
|
||||
craftTime = 75f;
|
||||
size = 2;
|
||||
|
||||
useFlux = true;
|
||||
fluxNeeded = 4;
|
||||
fluxNeeded = 3;
|
||||
|
||||
consumes.power(0.4f);
|
||||
consumes.items(new ItemStack[]{new ItemStack(Items.titanium, 2), new ItemStack(Items.lead, 4), new ItemStack(Items.silicon, 3), new ItemStack(Items.copper, 2)});
|
||||
}};
|
||||
|
||||
alloyfuser = new PowerSmelter("alloy-fuser"){{
|
||||
craftEffect = BlockFx.smeltsmoke;
|
||||
result = Items.surgealloy;
|
||||
craftTime = 30f;
|
||||
size = 3;
|
||||
|
||||
useFlux = true;
|
||||
fluxNeeded = 4;
|
||||
|
||||
consumes.items(new ItemStack[]{new ItemStack(Items.titanium, 3), new ItemStack(Items.lead, 4), new ItemStack(Items.silicon, 3), new ItemStack(Items.plastanium, 2)});
|
||||
consumes.power(0.4f);
|
||||
consumes.items(new ItemStack[]{new ItemStack(Items.titanium, 2), new ItemStack(Items.lead, 4), new ItemStack(Items.silicon, 3), new ItemStack(Items.copper, 3)});
|
||||
}};
|
||||
|
||||
cryofluidmixer = new LiquidMixer("cryofluidmixer"){{
|
||||
|
@ -8,7 +8,7 @@ import io.anuke.mindustry.world.blocks.defense.*;
|
||||
|
||||
public class DefenseBlocks extends BlockList implements ContentList{
|
||||
public static Block copperWall, copperWallLarge, compositeWall, compositeWallLarge, thoriumWall, thoriumWallLarge, door, doorLarge,
|
||||
phaseWall, phaseWallLarge, surgeWall, surgeWallLarge, mendProjector;
|
||||
phaseWall, phaseWallLarge, surgeWall, surgeWallLarge, mendProjector, shockMine;
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
@ -76,5 +76,13 @@ public class DefenseBlocks extends BlockList implements ContentList{
|
||||
size = 2;
|
||||
consumes.item(Items.phasematter).optional(true);
|
||||
}};
|
||||
|
||||
shockMine = new ShockMine("shock-mine"){{
|
||||
health = 40;
|
||||
damage = 10;
|
||||
tileDamage = 5f;
|
||||
length = 10;
|
||||
tendrils = 6;
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
|
||||
public void update(){
|
||||
super.update();
|
||||
|
||||
if(type.hitTiles && collidesTiles() && !supressCollision && !initialized){
|
||||
if(type.hitTiles && collidesTiles() && !supressCollision && initialized){
|
||||
world.raycastEach(world.toTile(lastPosition().x), world.toTile(lastPosition().y), world.toTile(x), world.toTile(y), (x, y) -> {
|
||||
|
||||
Tile tile = world.tile(x, y);
|
||||
|
@ -36,8 +36,8 @@ public class Recipe implements UnlockableContent{
|
||||
//the only gamemode in which the recipe shows up
|
||||
public boolean isPad;
|
||||
|
||||
private Block[] dependencies;
|
||||
private Recipe[] recipeDependencies;
|
||||
private UnlockableContent[] dependencies;
|
||||
private Block[] blockDependencies;
|
||||
|
||||
public Recipe(Category category, Block result, ItemStack... requirements){
|
||||
this.id = lastid++;
|
||||
@ -175,19 +175,23 @@ public class Recipe implements UnlockableContent{
|
||||
|
||||
@Override
|
||||
public UnlockableContent[] getDependencies(){
|
||||
if(dependencies == null){
|
||||
return null;
|
||||
}else if(recipeDependencies == null){
|
||||
recipeDependencies = new Recipe[dependencies.length];
|
||||
for(int i = 0; i < recipeDependencies.length; i++){
|
||||
recipeDependencies[i] = Recipe.getByResult(dependencies[i]);
|
||||
if(blockDependencies != null && dependencies == null){
|
||||
dependencies = new UnlockableContent[blockDependencies.length];
|
||||
for(int i = 0; i < dependencies.length; i++){
|
||||
dependencies[i] = Recipe.getByResult(blockDependencies[i]);
|
||||
}
|
||||
return dependencies;
|
||||
}
|
||||
return recipeDependencies;
|
||||
return dependencies;
|
||||
}
|
||||
|
||||
public Recipe setDependencies(Block... blocks){
|
||||
this.dependencies = blocks;
|
||||
public Recipe setDependencies(UnlockableContent... dependencies){
|
||||
this.dependencies = dependencies;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Recipe setDependencies(Block... dependencies){
|
||||
this.blockDependencies = dependencies;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -107,6 +107,8 @@ public class Block extends BaseBlock implements Content{
|
||||
public float viewRange = 10;
|
||||
/**Whether the top icon is outlined, like a turret.*/
|
||||
public boolean turretIcon = false;
|
||||
/**Whether units target this block.*/
|
||||
public boolean targetable = true;
|
||||
|
||||
protected Array<Tile> tempTiles = new Array<>();
|
||||
protected Color tempColor = new Color();
|
||||
|
@ -0,0 +1,55 @@
|
||||
package io.anuke.mindustry.world.blocks.defense;
|
||||
|
||||
import io.anuke.mindustry.content.fx.BulletFx;
|
||||
import io.anuke.mindustry.entities.Unit;
|
||||
import io.anuke.mindustry.entities.effect.Lightning;
|
||||
import io.anuke.mindustry.graphics.Layer;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Fill;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
public class ShockMine extends Block{
|
||||
protected int timerDamage = timers ++;
|
||||
|
||||
protected float cooldown = 80f;
|
||||
protected float tileDamage = 4f;
|
||||
protected float damage = 10;
|
||||
protected int length = 10;
|
||||
protected int tendrils = 6;
|
||||
|
||||
public ShockMine(String name){
|
||||
super(name);
|
||||
update = false;
|
||||
destructible = true;
|
||||
solid = false;
|
||||
shadow = "shadow-shock-mine";
|
||||
targetable = false;
|
||||
layer = Layer.overlay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawLayer(Tile tile){
|
||||
super.draw(tile);
|
||||
Draw.color(tile.getTeam().color);
|
||||
Draw.alpha(0.22f);
|
||||
Fill.rect(tile.drawx(), tile.drawy(), 2f, 2f);
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
//nope
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unitOn(Tile tile, Unit unit){
|
||||
if(unit.getTeam() != tile.getTeam() && tile.entity.timer.get(timerDamage, cooldown)){
|
||||
for(int i = 0; i < tendrils; i++){
|
||||
Lightning.create(tile.getTeam(), BulletFx.hitLancer, tile.getTeam().color, damage, tile.drawx(), tile.drawy(), Mathf.random(360f), length);
|
||||
}
|
||||
tile.entity.damage(tileDamage);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user