Core player shield / Bundles updated
This commit is contained in:
@@ -12,7 +12,7 @@ import io.anuke.ucore.util.Mathf;
|
||||
|
||||
public class BulletFx extends FxList implements ContentList{
|
||||
public static Effect hitBulletSmall, hitBulletBig, hitFlameSmall, hitLiquid, hitLaser, hitLancer, despawn, flakExplosion, blastExplosion, plasticExplosion,
|
||||
artilleryTrail, incendTrail, missileTrail;
|
||||
artilleryTrail, incendTrail, missileTrail, absorb;
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
@@ -190,6 +190,13 @@ public class BulletFx extends FxList implements ContentList{
|
||||
Fill.circle(e.x, e.y, e.rotation * e.fout());
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
absorb = new Effect(12, e -> {
|
||||
Draw.color(Palette.accent);
|
||||
Lines.stroke(2f * e.fout());
|
||||
Lines.circle(e.x, e.y, 5f * e.fout());
|
||||
Draw.reset();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -130,12 +130,13 @@ public class Logic extends Module{
|
||||
if(!Entities.defaultGroup().isEmpty())
|
||||
throw new RuntimeException("Do not add anything to the default group!");
|
||||
|
||||
Entities.update(bulletGroup);
|
||||
|
||||
for(EntityGroup group : unitGroups){
|
||||
Entities.update(group);
|
||||
}
|
||||
Entities.update(puddleGroup);
|
||||
Entities.update(tileGroup);
|
||||
Entities.update(bulletGroup);
|
||||
Entities.update(fireGroup);
|
||||
Entities.update(playerGroup);
|
||||
Entities.update(itemGroup);
|
||||
|
||||
@@ -8,12 +8,14 @@ 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;
|
||||
@@ -31,10 +33,8 @@ import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
|
||||
import static io.anuke.mindustry.Vars.bulletGroup;
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
//TODO utterly broken
|
||||
public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncTrait{
|
||||
private static Array<SolidTrait> entities = new Array<>();
|
||||
private static Rectangle rect = new Rectangle();
|
||||
@@ -47,15 +47,11 @@ public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncT
|
||||
private Color color = Palette.lancerLaser;
|
||||
private SeedRandom random = new SeedRandom();
|
||||
|
||||
/**
|
||||
* For pooling use only. Do not call directly!
|
||||
*/
|
||||
/**For pooling use only. Do not call directly!*/
|
||||
public Lightning(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a lighting branch at a location. Use Team.none to damage everyone.
|
||||
*/
|
||||
/**Create a lighting branch at a location. Use Team.none to damage everyone.*/
|
||||
public static void create(Team team, Effect effect, Color color, float damage, float x, float y, float targetAngle, int length){
|
||||
Call.createLighting(lastSeed++, team, effect, color, damage, x, y, targetAngle, length);
|
||||
}
|
||||
@@ -64,6 +60,9 @@ 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);
|
||||
|
||||
//TODO hacky workaround
|
||||
if(checkShield(team, x, y)) return;
|
||||
|
||||
l.x = x;
|
||||
l.y = y;
|
||||
l.random.setSeed(seed);
|
||||
@@ -84,9 +83,10 @@ 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(30f);
|
||||
|
||||
angle += Mathf.range(30f);
|
||||
rect.setSize(attractRange).setCenter(x, y);
|
||||
|
||||
Units.getNearbyEnemies(team, rect, entity -> {
|
||||
@@ -130,6 +130,21 @@ 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;
|
||||
|
||||
@@ -26,6 +26,7 @@ public enum GameMode{
|
||||
|
||||
public boolean infiniteResources, disableWaveTimer, disableWaves, hidden, autoSpawn, isPvp;
|
||||
public float enemyCoreBuildRadius = 400f;
|
||||
public float enemyCoreShieldRadius = 140f;
|
||||
public float respawnTime = 60 * 4;
|
||||
|
||||
public String description(){
|
||||
|
||||
@@ -11,6 +11,7 @@ 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;
|
||||
@@ -75,6 +76,25 @@ 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
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.nio.ByteBuffer;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
/** Class for specifying read/write methods for code generation.*/
|
||||
@SuppressWarnings("unused")
|
||||
public class TypeIO{
|
||||
|
||||
@WriteClass(Player.class)
|
||||
|
||||
@@ -5,11 +5,13 @@ 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;
|
||||
@@ -25,6 +27,7 @@ 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;
|
||||
@@ -178,6 +181,17 @@ 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.supressCollision();
|
||||
bullet.remove();
|
||||
}
|
||||
});
|
||||
|
||||
if(entity.currentUnit != null){
|
||||
if(!entity.currentUnit.isDead()){
|
||||
entity.currentUnit = null;
|
||||
@@ -232,6 +246,7 @@ public class CoreBlock extends StorageBlock{
|
||||
|
||||
public class CoreEntity extends TileEntity implements SpawnerTrait{
|
||||
public Unit currentUnit;
|
||||
public float shieldHeat;
|
||||
int droneID = -1;
|
||||
boolean solid = true;
|
||||
float warmup;
|
||||
|
||||
Reference in New Issue
Block a user