Refactored almost every class, somehow didn't break game yet
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
package io.anuke.mindustry.entities;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.entities.BulletEntity;
|
||||
import io.anuke.ucore.entities.Entity;
|
||||
import io.anuke.ucore.entities.SolidEntity;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class Bullet extends BulletEntity{
|
||||
public boolean absorbed = false;
|
||||
@@ -36,7 +35,7 @@ public class Bullet extends BulletEntity{
|
||||
|
||||
int tilex = Mathf.scl2(x, tilesize);
|
||||
int tiley = Mathf.scl2(y, tilesize);
|
||||
Tile tile = Vars.world.tile(tilex, tiley);
|
||||
Tile tile = world.tile(tilex, tiley);
|
||||
TileEntity targetEntity = null;
|
||||
|
||||
if(tile != null){
|
||||
@@ -61,7 +60,7 @@ public class Bullet extends BulletEntity{
|
||||
|
||||
super.update();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean collides(SolidEntity other){
|
||||
if(owner instanceof TileEntity && other instanceof Player)
|
||||
@@ -82,7 +81,7 @@ public class Bullet extends BulletEntity{
|
||||
|
||||
@Override
|
||||
public Bullet add(){
|
||||
return super.add(Vars.bulletGroup);
|
||||
return super.add(bulletGroup);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package io.anuke.mindustry.entities;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.net.NetEvents;
|
||||
import io.anuke.mindustry.resource.Mech;
|
||||
import io.anuke.mindustry.resource.Weapon;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.ucore.core.*;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Inputs;
|
||||
import io.anuke.ucore.core.Settings;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.entities.SolidEntity;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
@@ -46,7 +49,7 @@ public class Player extends SyncEntity{
|
||||
|
||||
@Override
|
||||
public void damage(int amount){
|
||||
if(!Vars.debug && !isAndroid)
|
||||
if(!debug && !isAndroid)
|
||||
super.damage(amount);
|
||||
}
|
||||
|
||||
@@ -54,7 +57,7 @@ public class Player extends SyncEntity{
|
||||
public boolean collides(SolidEntity other){
|
||||
if(other instanceof Bullet){
|
||||
Bullet b = (Bullet)other;
|
||||
if(!Vars.logic.friendlyFire && b.owner instanceof Player){
|
||||
if(!state.friendlyFire && b.owner instanceof Player){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -67,7 +70,7 @@ public class Player extends SyncEntity{
|
||||
if(isLocal){
|
||||
remove();
|
||||
if(Net.active()){
|
||||
Vars.netClient.handlePlayerDeath();
|
||||
NetEvents.handlePlayerDeath();
|
||||
}
|
||||
|
||||
Effects.effect(Fx.explosion, this);
|
||||
@@ -77,7 +80,7 @@ public class Player extends SyncEntity{
|
||||
|
||||
//TODO respawning doesn't work properly for multiplayer at all
|
||||
if(isLocal) {
|
||||
Vars.control.setRespawnTime(respawnduration);
|
||||
control.setRespawnTime(respawnduration);
|
||||
ui.hudfrag.fadeRespawn(true);
|
||||
}
|
||||
}
|
||||
@@ -91,7 +94,7 @@ public class Player extends SyncEntity{
|
||||
set(-9999, -9999);
|
||||
Timers.run(respawnduration, () -> {
|
||||
heal();
|
||||
set(logic.getSpawnX(), logic.getSpawnY());
|
||||
set(world.getSpawnX(), world.getSpawnY());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -101,8 +104,8 @@ public class Player extends SyncEntity{
|
||||
angle = Mathf.lerpAngDelta(angle, targetAngle, 0.2f);
|
||||
}
|
||||
|
||||
if((Vars.debug && (!Vars.showPlayer || !Vars.showUI)) || (isAndroid && isLocal) ) return;
|
||||
boolean snap = Vars.snapCamera && Settings.getBool("smoothcam") && Settings.getBool("pixelate") && isLocal;
|
||||
if((debug && (!showPlayer || !showUI)) || (isAndroid && isLocal) ) return;
|
||||
boolean snap = snapCamera && Settings.getBool("smoothcam") && Settings.getBool("pixelate") && isLocal;
|
||||
|
||||
String part = isAndroid ? "ship" : "mech";
|
||||
|
||||
@@ -128,7 +131,7 @@ public class Player extends SyncEntity{
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
if(!isLocal || isAndroid || Vars.ui.chatfrag.chatOpen()){
|
||||
if(!isLocal || isAndroid || ui.chatfrag.chatOpen()){
|
||||
if(!isDead() && !isLocal) interpolate();
|
||||
return;
|
||||
}
|
||||
@@ -174,7 +177,7 @@ public class Player extends SyncEntity{
|
||||
|
||||
vector.limit(speed);
|
||||
|
||||
if(!Vars.noclip){
|
||||
if(!noclip){
|
||||
move(vector.x*Timers.delta(), vector.y*Timers.delta());
|
||||
}else{
|
||||
x += vector.x*Timers.delta();
|
||||
@@ -189,13 +192,13 @@ public class Player extends SyncEntity{
|
||||
this.angle = Mathf.lerpAngDelta(this.angle, angle, 0.1f);
|
||||
}
|
||||
|
||||
x = Mathf.clamp(x, 0, Vars.world.width() * Vars.tilesize);
|
||||
y = Mathf.clamp(y, 0, Vars.world.height() * Vars.tilesize);
|
||||
x = Mathf.clamp(x, 0, world.width() * tilesize);
|
||||
y = Mathf.clamp(y, 0, world.height() * tilesize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Player add(){
|
||||
return add(Vars.control.playerGroup);
|
||||
return add(playerGroup);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package io.anuke.mindustry.entities;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.entities.enemies.Enemy;
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.net.NetEvents;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.ProductionBlocks;
|
||||
import io.anuke.mindustry.world.blocks.types.Wall;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
@@ -19,6 +18,9 @@ import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import static io.anuke.mindustry.Vars.tileGroup;
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
public class TileEntity extends Entity{
|
||||
private static final boolean friendlyFire = false;
|
||||
|
||||
@@ -64,14 +66,11 @@ public class TileEntity extends Entity{
|
||||
}
|
||||
|
||||
public void onDeath(boolean force){
|
||||
if(Net.active() && Net.server()){
|
||||
Vars.netServer.handleBlockDestroyed(this);
|
||||
if(Net.server()){
|
||||
NetEvents.handleBlockDestroyed(this);
|
||||
}
|
||||
|
||||
if(!Net.active() || Net.server() || force){
|
||||
if(tile.block() == ProductionBlocks.core){
|
||||
Vars.control.coreDestroyed();
|
||||
}
|
||||
|
||||
if(!dead) {
|
||||
dead = true;
|
||||
@@ -79,7 +78,7 @@ public class TileEntity extends Entity{
|
||||
|
||||
block.onDestroyed(tile);
|
||||
|
||||
Vars.world.removeBlock(tile);
|
||||
world.removeBlock(tile);
|
||||
remove();
|
||||
}
|
||||
}
|
||||
@@ -96,8 +95,8 @@ public class TileEntity extends Entity{
|
||||
health -= amount;
|
||||
if(health <= 0) onDeath();
|
||||
|
||||
if(Net.active() && Net.server()){
|
||||
Vars.netServer.handleBlockDamaged(this);
|
||||
if(Net.server()){
|
||||
NetEvents.handleBlockDamaged(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,6 +149,6 @@ public class TileEntity extends Entity{
|
||||
|
||||
@Override
|
||||
public TileEntity add(){
|
||||
return add(Vars.control.tileGroup);
|
||||
return add(tileGroup);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package io.anuke.mindustry.entities.effect;
|
||||
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
@@ -16,6 +15,8 @@ import io.anuke.ucore.util.Angles;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
import io.anuke.ucore.util.Physics;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class DamageArea{
|
||||
private static Rectangle rect = new Rectangle();
|
||||
|
||||
@@ -59,14 +60,14 @@ public class DamageArea{
|
||||
}
|
||||
};
|
||||
|
||||
Entities.getNearby(Vars.control.enemyGroup, rect, cons);
|
||||
if(Vars.control.isFriendlyFire()) Entities.getNearby(Vars.control.playerGroup, rect, cons);
|
||||
Entities.getNearby(enemyGroup, rect, cons);
|
||||
if(state.friendlyFire) Entities.getNearby(playerGroup, rect, cons);
|
||||
}
|
||||
|
||||
public static void damageEntities(float x, float y, float radius, int damage){
|
||||
damage(true, x, y, radius, damage);
|
||||
|
||||
for(Player player : Vars.control.playerGroup.all()){
|
||||
for(Player player : playerGroup.all()){
|
||||
if(player.isAndroid) continue;
|
||||
int amount = calculateDamage(x, y, player.x, player.y, radius, damage);
|
||||
player.damage(amount);
|
||||
@@ -84,12 +85,12 @@ public class DamageArea{
|
||||
};
|
||||
|
||||
if(enemies){
|
||||
Entities.getNearby(Vars.control.enemyGroup, x, y, radius*2, cons);
|
||||
Entities.getNearby(enemyGroup, x, y, radius*2, cons);
|
||||
}else{
|
||||
int trad = (int)(radius / Vars.tilesize);
|
||||
int trad = (int)(radius / tilesize);
|
||||
for(int dx = -trad; dx <= trad; dx ++){
|
||||
for(int dy= -trad; dy <= trad; dy ++){
|
||||
Tile tile = Vars.world.tile(Mathf.scl2(x, Vars.tilesize) + dx, Mathf.scl2(y, Vars.tilesize) + dy);
|
||||
Tile tile = world.tile(Mathf.scl2(x, tilesize) + dx, Mathf.scl2(y, tilesize) + dy);
|
||||
if(tile != null && tile.entity != null && Vector2.dst(dx, dy, 0, 0) <= trad){
|
||||
int amount = calculateDamage(x, y, tile.worldx(), tile.worldy(), radius, damage);
|
||||
tile.entity.damage(amount);
|
||||
@@ -97,7 +98,7 @@ public class DamageArea{
|
||||
}
|
||||
}
|
||||
|
||||
Entities.getNearby(Vars.control.playerGroup, x, y, radius*2, cons);
|
||||
Entities.getNearby(playerGroup, x, y, radius*2, cons);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.types.PowerAcceptor;
|
||||
@@ -29,15 +29,15 @@ public class EMP extends TimedEntity{
|
||||
|
||||
lifetime = 30f;
|
||||
|
||||
int worldx = Mathf.scl2(x, Vars.tilesize);
|
||||
int worldy = Mathf.scl2(y, Vars.tilesize);
|
||||
int worldx = Mathf.scl2(x, tilesize);
|
||||
int worldy = Mathf.scl2(y, tilesize);
|
||||
|
||||
array.clear();
|
||||
|
||||
for(int dx = -radius; dx <= radius; dx ++){
|
||||
for(int dy = -radius; dy <= radius; dy ++){
|
||||
if(Vector2.dst(dx, dy, 0, 0) < radius){
|
||||
Tile tile = Vars.world.tile(worldx + dx, worldy + dy);
|
||||
Tile tile = world.tile(worldx + dx, worldy + dy);
|
||||
|
||||
if(tile != null && tile.block().destructible){
|
||||
array.add(tile);
|
||||
@@ -80,12 +80,12 @@ public class EMP extends TimedEntity{
|
||||
}
|
||||
|
||||
for(int i = 0; i < 14 - targets.size; i ++){
|
||||
Angles.translation(Mathf.randomSeed(i + id*77)*360f, radius * Vars.tilesize);
|
||||
Angles.translation(Mathf.randomSeed(i + id*77)*360f, radius * tilesize);
|
||||
drawLine(x + Angles.x(), y + Angles.y());
|
||||
}
|
||||
|
||||
Lines.stroke(fract()*2f);
|
||||
Lines.poly(x, y, 34, radius * Vars.tilesize);
|
||||
Lines.poly(x, y, 34, radius * tilesize);
|
||||
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
package io.anuke.mindustry.entities.effect;
|
||||
|
||||
import com.badlogic.gdx.math.Interpolation;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.entities.enemies.Enemy;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.types.defense.ShieldBlock;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.entities.BulletEntity;
|
||||
import io.anuke.ucore.entities.Entities;
|
||||
import io.anuke.ucore.entities.Entity;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import static io.anuke.mindustry.Vars.bulletGroup;
|
||||
import static io.anuke.mindustry.Vars.shieldGroup;
|
||||
|
||||
public class Shield extends Entity{
|
||||
public boolean active;
|
||||
public boolean hitPlayers = false;
|
||||
@@ -52,7 +53,7 @@ public class Shield extends Entity{
|
||||
|
||||
ShieldBlock block = (ShieldBlock)tile.block();
|
||||
|
||||
Entities.getNearby(Vars.control.bulletGroup, x, y, block.shieldRadius * 2*uptime + 10, entity->{
|
||||
Entities.getNearby(bulletGroup, x, y, block.shieldRadius * 2*uptime + 10, entity->{
|
||||
BulletEntity bullet = (BulletEntity)entity;
|
||||
if((bullet.owner instanceof Enemy || hitPlayers)){
|
||||
|
||||
@@ -85,7 +86,7 @@ public class Shield extends Entity{
|
||||
|
||||
@Override
|
||||
public Shield add(){
|
||||
return super.add(Vars.control.shieldGroup);
|
||||
return super.add(shieldGroup);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.ObjectSet;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
import io.anuke.mindustry.entities.enemies.Enemy;
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
@@ -44,7 +44,7 @@ public class TeslaOrb extends Entity{
|
||||
break;
|
||||
}
|
||||
|
||||
Array<SolidEntity> enemies = Entities.getNearby(Vars.control.enemyGroup, curx, cury, range*2f);
|
||||
Array<SolidEntity> enemies = Entities.getNearby(enemyGroup, curx, cury, range*2f);
|
||||
|
||||
for(SolidEntity entity : enemies){
|
||||
if(entity.distanceTo(curx, cury) < range && !hit.contains((Enemy)entity)){
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package io.anuke.mindustry.entities.enemies;
|
||||
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.entities.Bullet;
|
||||
import io.anuke.mindustry.entities.BulletType;
|
||||
import io.anuke.mindustry.entities.SyncEntity;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.net.NetEvents;
|
||||
import io.anuke.ucore.entities.Entity;
|
||||
import io.anuke.ucore.entities.SolidEntity;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
@@ -14,6 +14,8 @@ import io.anuke.ucore.util.Timer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import static io.anuke.mindustry.Vars.enemyGroup;
|
||||
|
||||
public class Enemy extends SyncEntity {
|
||||
public final EnemyType type;
|
||||
|
||||
@@ -88,7 +90,7 @@ public class Enemy extends SyncEntity {
|
||||
|
||||
@Override
|
||||
public Enemy add(){
|
||||
return add(Vars.enemyGroup);
|
||||
return add(enemyGroup);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -130,14 +132,14 @@ public class Enemy extends SyncEntity {
|
||||
|
||||
public void shoot(BulletType bullet, float rotation){
|
||||
|
||||
if(!(Net.active() && Net.client())) {
|
||||
if(!(Net.client())) {
|
||||
Angles.translation(angle + rotation, type.length);
|
||||
Bullet out = new Bullet(bullet, this, x + Angles.x(), y + Angles.y(), this.angle + rotation).add();
|
||||
out.damage = (int) ((bullet.damage * (1 + (tier - 1) * 1f)) * Vars.multiplier);
|
||||
out.damage = (int) ((bullet.damage * (1 + (tier - 1) * 1f)));
|
||||
type.onShoot(this, bullet, rotation);
|
||||
|
||||
if(Net.active() && Net.server()){
|
||||
Vars.netServer.handleBullet(bullet, this, x + Angles.x(), y + Angles.y(), this.angle + rotation, (short)out.damage);
|
||||
if(Net.server()){
|
||||
NetEvents.handleBullet(bullet, this, x + Angles.x(), y + Angles.y(), this.angle + rotation, (short)out.damage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,20 +3,20 @@ package io.anuke.mindustry.entities.enemies;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.entities.BulletType;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.graphics.Shaders;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.net.NetEvents;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.entities.Entities;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
import io.anuke.ucore.util.Strings;
|
||||
import io.anuke.ucore.util.Tmp;
|
||||
@@ -220,7 +220,7 @@ public class EnemyType {
|
||||
public void updateShooting(Enemy enemy){
|
||||
float reload = this.reload / Math.max(enemy.tier / 1.5f, 1f);
|
||||
|
||||
if(enemy.timer.get(timerReload, reload * multiplier)){
|
||||
if(enemy.timer.get(timerReload, reload)){
|
||||
shoot(enemy);
|
||||
}
|
||||
}
|
||||
@@ -233,8 +233,8 @@ public class EnemyType {
|
||||
public void onShoot(Enemy enemy, BulletType type, float rotation){}
|
||||
|
||||
public void onDeath(Enemy enemy){
|
||||
if(Net.active() && Net.server()){
|
||||
netServer.handleEnemyDeath(enemy);
|
||||
if(Net.server()){
|
||||
NetEvents.handleEnemyDeath(enemy);
|
||||
}
|
||||
|
||||
Effects.effect(Fx.explosion, enemy);
|
||||
@@ -249,7 +249,7 @@ public class EnemyType {
|
||||
if(enemy.spawner != null){
|
||||
enemy.spawner.spawned --;
|
||||
}else{
|
||||
Vars.control.enemyDeath(); //TODO
|
||||
state.enemies --;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package io.anuke.mindustry.entities.enemies.types;
|
||||
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
import io.anuke.mindustry.entities.Bullet;
|
||||
import io.anuke.mindustry.entities.BulletType;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
@@ -31,7 +30,7 @@ public class BlastType extends EnemyType {
|
||||
|
||||
if(enemy.target instanceof TileEntity){
|
||||
TileEntity e = (TileEntity)enemy.target;
|
||||
range = (e.tile.block().width * Vars.tilesize) /2f + 8f;
|
||||
range = (e.tile.block().width * tilesize) /2f + 8f;
|
||||
offset.set(e.tile.block().getPlaceOffset());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.anuke.mindustry.entities.enemies.types;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
import io.anuke.mindustry.entities.BulletType;
|
||||
import io.anuke.mindustry.entities.enemies.Enemy;
|
||||
import io.anuke.mindustry.entities.enemies.EnemyType;
|
||||
@@ -30,8 +30,8 @@ public class FortressType extends EnemyType {
|
||||
|
||||
@Override
|
||||
public void move(Enemy enemy){
|
||||
if(enemy.distanceTo(Vars.world.getCore().worldx(),
|
||||
Vars.world.getCore().worldy()) <= 90f){
|
||||
if(enemy.distanceTo(world.getCore().worldx(),
|
||||
world.getCore().worldy()) <= 90f){
|
||||
|
||||
if(Timers.get(this, "spawn", spawnTime) && enemy.spawned < maxSpawn){
|
||||
Angles.translation(enemy.angle, 20f);
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
package io.anuke.mindustry.entities.enemies.types;
|
||||
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.entities.Bullet;
|
||||
import io.anuke.mindustry.entities.BulletType;
|
||||
import io.anuke.mindustry.entities.enemies.Enemy;
|
||||
import io.anuke.mindustry.entities.enemies.EnemyType;
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.graphics.Shaders;
|
||||
import io.anuke.ucore.core.*;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.entities.Entities;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Hue;
|
||||
import io.anuke.ucore.graphics.Shapes;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
|
||||
import static io.anuke.mindustry.Vars.enemyGroup;
|
||||
|
||||
public class HealerType extends EnemyType {
|
||||
|
||||
public HealerType() {
|
||||
@@ -46,7 +48,7 @@ public class HealerType extends EnemyType {
|
||||
@Override
|
||||
public void updateTargeting(Enemy enemy, boolean nearCore){
|
||||
if(enemy.timer.get(timerTarget, 15)){
|
||||
enemy.target = Entities.getClosest(Vars.control.enemyGroup,
|
||||
enemy.target = Entities.getClosest(enemyGroup,
|
||||
enemy.x, enemy.y, range, e -> e instanceof Enemy && e != enemy && ((Enemy)e).healthfrac() < 1f);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
package io.anuke.mindustry.entities.enemies.types;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.entities.enemies.Enemy;
|
||||
import io.anuke.mindustry.entities.enemies.EnemyType;
|
||||
import io.anuke.mindustry.entities.enemies.EnemyTypes;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Lines;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import static io.anuke.mindustry.Vars.control;
|
||||
|
||||
public class TargetType extends EnemyType {
|
||||
|
||||
public TargetType(){
|
||||
@@ -42,7 +42,7 @@ public class TargetType extends EnemyType {
|
||||
|
||||
Draw.color(Color.YELLOW);
|
||||
|
||||
if(Vars.control.getTutorial().showTarget()){
|
||||
if(control.tutorial().showTarget()){
|
||||
Lines.spikes(enemy.x, enemy.y, 11f + Mathf.sin(Timers.time(), 7f, 1f), 4f, 8, Timers.time());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user