mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-22 04:28:27 +07:00
Removed core bullet shield / Drill ore-count
This commit is contained in:
parent
75fae9454d
commit
b19f3ff8cf
@ -16,12 +16,14 @@ public class Items implements ContentList{
|
||||
type = ItemType.material;
|
||||
hardness = 1;
|
||||
cost = 0.6f;
|
||||
genOre = true;
|
||||
}};
|
||||
|
||||
lead = new Item("lead", Color.valueOf("8c7fa9")){{
|
||||
type = ItemType.material;
|
||||
hardness = 1;
|
||||
cost = 0.9f;
|
||||
genOre = true;
|
||||
}};
|
||||
|
||||
densealloy = new Item("dense-alloy", Color.valueOf("b2c6d2")){{
|
||||
@ -33,12 +35,14 @@ public class Items implements ContentList{
|
||||
explosiveness = 0.2f;
|
||||
flammability = 0.5f;
|
||||
hardness = 2;
|
||||
genOre = true;
|
||||
}};
|
||||
|
||||
titanium = new Item("titanium", Color.valueOf("8da1e3")){{
|
||||
type = ItemType.material;
|
||||
hardness = 3;
|
||||
cost = 1.1f;
|
||||
genOre = true;
|
||||
}};
|
||||
|
||||
thorium = new Item("thorium", Color.valueOf("f9a3c7")){{
|
||||
@ -47,6 +51,7 @@ public class Items implements ContentList{
|
||||
hardness = 4;
|
||||
radioactivity = 0.5f;
|
||||
cost = 1.4f;
|
||||
genOre = true;
|
||||
}};
|
||||
|
||||
stone = new Item("stone", Color.valueOf("777777")){{
|
||||
|
@ -1,12 +1,12 @@
|
||||
package io.anuke.mindustry.content.blocks;
|
||||
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.Floor;
|
||||
import io.anuke.mindustry.world.blocks.OreBlock;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
import static io.anuke.mindustry.Vars.content;
|
||||
|
||||
public class OreBlocks extends BlockList{
|
||||
private static final ObjectMap<Item, ObjectMap<Block, Block>> oreBlockMap = new ObjectMap<>();
|
||||
@ -20,9 +20,9 @@ public class OreBlocks extends BlockList{
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
Item[] ores = {Items.copper, Items.lead, Items.coal, Items.titanium, Items.thorium};
|
||||
|
||||
for(Item item : ores){
|
||||
for(Item item : content.items()){
|
||||
if(!item.genOre) continue;
|
||||
ObjectMap<Block, Block> map = new ObjectMap<>();
|
||||
oreBlockMap.put(item, map);
|
||||
|
||||
|
@ -8,14 +8,12 @@ import com.badlogic.gdx.utils.Pool.Poolable;
|
||||
import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.mindustry.content.StatusEffects;
|
||||
import io.anuke.mindustry.content.fx.BulletFx;
|
||||
import io.anuke.mindustry.entities.Units;
|
||||
import io.anuke.mindustry.entities.traits.SyncTrait;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.storage.CoreBlock.CoreEntity;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Effects.Effect;
|
||||
import io.anuke.ucore.entities.EntityGroup;
|
||||
@ -33,7 +31,8 @@ import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
import static io.anuke.mindustry.Vars.bulletGroup;
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncTrait{
|
||||
private static Array<SolidTrait> entities = new Array<>();
|
||||
@ -61,9 +60,6 @@ public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncT
|
||||
public static void createLighting(int seed, Team team, Effect effect, Color color, float damage, float x, float y, float targetAngle, int length){
|
||||
Lightning l = Pooling.obtain(Lightning.class, Lightning::new);
|
||||
|
||||
//TODO hacky workaround
|
||||
if(checkShield(team, x, y)) return;
|
||||
|
||||
l.x = x;
|
||||
l.y = y;
|
||||
l.random.setSeed(seed);
|
||||
@ -84,7 +80,6 @@ public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncT
|
||||
float fx = x, fy = y;
|
||||
float x2 = x + Angles.trnsx(angle, step);
|
||||
float y2 = y + Angles.trnsy(angle, step);
|
||||
if(checkShield(team, x2, y2)) break;
|
||||
float fangle = angle;
|
||||
|
||||
angle += Mathf.range(15f);
|
||||
@ -131,21 +126,6 @@ public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncT
|
||||
l.add();
|
||||
}
|
||||
|
||||
private static boolean checkShield(Team team, float x, float y){
|
||||
if(team != Team.none){
|
||||
for(Team enemy : state.teams.enemiesOf(team)) {
|
||||
for (Tile core : state.teams.get(enemy).cores) {
|
||||
if(core.distanceTo(x, y) <= state.mode.enemyCoreShieldRadius){
|
||||
core.<CoreEntity>entity().shieldHeat = 1f;
|
||||
Effects.effect(BulletFx.absorb, x, y);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSyncing(){
|
||||
return false;
|
||||
|
@ -23,13 +23,11 @@ public enum GameMode{
|
||||
isPvp = true;
|
||||
hidden = true;
|
||||
enemyCoreBuildRadius = 600f;
|
||||
enemyCoreShieldRadius = 0f;
|
||||
respawnTime = 60 * 10;
|
||||
}};
|
||||
|
||||
public boolean infiniteResources, disableWaveTimer, disableWaves, hidden, enemyCheat, isPvp, showPads;
|
||||
public float enemyCoreBuildRadius = 400f;
|
||||
public float enemyCoreShieldRadius = 140f;
|
||||
public float respawnTime = 60 * 4;
|
||||
|
||||
public String description(){
|
||||
|
@ -11,7 +11,6 @@ import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.input.InputHandler;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.storage.CoreBlock.CoreEntity;
|
||||
import io.anuke.mindustry.world.meta.BlockBar;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
@ -77,24 +76,6 @@ public class OverlayRenderer{
|
||||
}
|
||||
}
|
||||
|
||||
for(Team enemy : state.teams.enemiesOf(player.getTeam())){
|
||||
synchronized (Tile.tileSetLock){
|
||||
for(Tile core : state.teams.get(enemy).cores){
|
||||
CoreEntity entity = core.entity();
|
||||
|
||||
if(entity.shieldHeat > 0.01f){
|
||||
Draw.alpha(1f);
|
||||
Draw.tint(Color.DARK_GRAY);
|
||||
Lines.stroke(entity.shieldHeat * 2f);
|
||||
Lines.poly(core.drawx(), core.drawy() - 2, 200, state.mode.enemyCoreShieldRadius);
|
||||
Draw.tint(Palette.accent, enemy.color, 1f-entity.shieldHeat);
|
||||
Lines.poly(core.drawx(), core.drawy(), 200, state.mode.enemyCoreShieldRadius);
|
||||
}
|
||||
entity.shieldHeat = Mathf.lerpDelta(entity.shieldHeat, 0f, 0.1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Draw.reset();
|
||||
|
||||
//draw selected block bars and info
|
||||
|
@ -36,6 +36,8 @@ public class Item extends UnlockableContent implements Comparable<Item>{
|
||||
* 1 cost = 1 tick added to build time
|
||||
*/
|
||||
public float cost = 3f;
|
||||
/**Whether this item has ores generated for it.*/
|
||||
public boolean genOre = false;
|
||||
|
||||
public Item(String name, Color color){
|
||||
this.name = name;
|
||||
|
@ -123,7 +123,7 @@ public class Block extends BaseBlock {
|
||||
/**Populates the array with all blocks that produce this content.*/
|
||||
public static void getByProduction(Array<Block> arr, Content result){
|
||||
arr.clear();
|
||||
for(Block block : content.<Block>getBy(ContentType.block)){
|
||||
for(Block block : content.blocks()){
|
||||
if(block.produces.get() == result){
|
||||
arr.add(block);
|
||||
}
|
||||
|
@ -77,11 +77,11 @@ public class Tile implements PosTrait, TargetTrait{
|
||||
}
|
||||
|
||||
public byte getBlockID(){
|
||||
return (byte) wall.id;
|
||||
return wall.id;
|
||||
}
|
||||
|
||||
public byte getFloorID(){
|
||||
return (byte) floor.id;
|
||||
return floor.id;
|
||||
}
|
||||
|
||||
/** Return relative rotation to a coordinate. Returns -1 if the coordinate is not near this tile. */
|
||||
|
@ -35,6 +35,7 @@ import java.io.IOException;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class BuildBlock extends Block{
|
||||
|
||||
public BuildBlock(String name){
|
||||
super(name);
|
||||
update = true;
|
||||
|
@ -3,6 +3,7 @@ package io.anuke.mindustry.world.blocks.production;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.ObjectIntMap;
|
||||
import io.anuke.mindustry.content.Liquids;
|
||||
import io.anuke.mindustry.content.fx.BlockFx;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
@ -21,12 +22,15 @@ import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import static io.anuke.mindustry.Vars.content;
|
||||
public class Drill extends Block{
|
||||
protected final static float hardnessDrillMultiplier = 50f;
|
||||
protected final int timerDump = timers++;
|
||||
|
||||
protected final Array<Tile> drawTiles = new Array<>();
|
||||
protected final ObjectIntMap<Item> oreCount = new ObjectIntMap<>();
|
||||
protected final Array<Item> itemArray = new Array<>();
|
||||
|
||||
/**Maximum tier of blocks this drill can mine.*/
|
||||
protected int tier;
|
||||
@ -143,30 +147,28 @@ public class Drill extends Block{
|
||||
DrillEntity entity = tile.entity();
|
||||
|
||||
if(entity.dominantItem == null){
|
||||
boolean foundDominant = false;
|
||||
oreCount.clear();
|
||||
itemArray.clear();
|
||||
|
||||
for(Tile other : tile.getLinkedTiles(tempTiles)){
|
||||
if(isValid(other)){
|
||||
Item drop = getDrop(other);
|
||||
|
||||
if(!foundDominant){
|
||||
entity.dominantItem = drop;
|
||||
foundDominant = true;
|
||||
}else if(entity.dominantItem != drop && drop.id < entity.dominantItem.id){
|
||||
entity.dominantItem = drop;
|
||||
}
|
||||
oreCount.getAndIncrement(getDrop(other), 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
for(Tile other : tile.getLinkedTiles(tempTiles)){
|
||||
if(isValid(other) && getDrop(other) == entity.dominantItem){
|
||||
entity.dominantItems ++;
|
||||
}
|
||||
for(Item item : oreCount.keys()){
|
||||
itemArray.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
if(entity.dominantItem == null){
|
||||
return;
|
||||
itemArray.sort((item1, item2) -> Integer.compare(oreCount.get(item1, 0), oreCount.get(item2, 0)));
|
||||
itemArray.sort((item1, item2) -> item1.genOre && !item2.genOre ? 1 : item1.genOre == item2.genOre ? 0 : -1);
|
||||
|
||||
if(itemArray.size == 0){
|
||||
return;
|
||||
}
|
||||
|
||||
entity.dominantItem = itemArray.peek();
|
||||
entity.dominantItems = oreCount.get(itemArray.peek(), 0);
|
||||
}
|
||||
|
||||
float totalHardness = entity.dominantItems * entity.dominantItem.hardness;
|
||||
|
@ -5,13 +5,11 @@ import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.content.UnitTypes;
|
||||
import io.anuke.mindustry.content.fx.BulletFx;
|
||||
import io.anuke.mindustry.content.fx.Fx;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.entities.Unit;
|
||||
import io.anuke.mindustry.entities.Units;
|
||||
import io.anuke.mindustry.entities.bullet.Bullet;
|
||||
import io.anuke.mindustry.entities.traits.SpawnerTrait;
|
||||
import io.anuke.mindustry.entities.units.BaseUnit;
|
||||
import io.anuke.mindustry.entities.units.UnitType;
|
||||
@ -27,7 +25,6 @@ import io.anuke.mindustry.world.meta.BlockFlag;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.entities.EntityPhysics;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Lines;
|
||||
import io.anuke.ucore.util.EnumSet;
|
||||
@ -37,7 +34,8 @@ import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
import static io.anuke.mindustry.Vars.state;
|
||||
import static io.anuke.mindustry.Vars.unitGroups;
|
||||
|
||||
public class CoreBlock extends StorageBlock{
|
||||
protected float droneRespawnDuration = 60 * 6;
|
||||
@ -188,16 +186,6 @@ public class CoreBlock extends StorageBlock{
|
||||
Call.setCoreSolid(tile, true);
|
||||
}
|
||||
|
||||
EntityPhysics.getNearby(bulletGroup, tile.drawx(), tile.drawy(), state.mode.enemyCoreShieldRadius*2f, e -> {
|
||||
if(e.distanceTo(tile) > state.mode.enemyCoreShieldRadius) return;
|
||||
Bullet bullet = (Bullet)e;
|
||||
if(bullet.getOwner() instanceof Player && bullet.getTeam() != tile.getTeam()){
|
||||
Effects.effect(BulletFx.absorb, bullet);
|
||||
entity.shieldHeat = 1f;
|
||||
bullet.absorb();
|
||||
}
|
||||
});
|
||||
|
||||
if(entity.currentUnit != null){
|
||||
if(!entity.currentUnit.isDead()){
|
||||
entity.currentUnit = null;
|
||||
|
Loading…
Reference in New Issue
Block a user