Tau mech implemented

This commit is contained in:
Anuken
2018-08-22 23:29:14 -04:00
parent 8d9ec206bf
commit 30dd089c8b
29 changed files with 744 additions and 545 deletions
@@ -45,6 +45,7 @@ import static io.anuke.mindustry.Vars.*;
public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTrait{
public static final int timerSync = 2;
public static final int timerAbility = 3;
private static final int timerShootLeft = 0;
private static final int timerShootRight = 1;
private static final float liftoffBoost = 0.2f;
@@ -581,13 +582,14 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
}
if(!ui.chatfrag.chatOpen()){
float baseLerp = mech.getRotationAlpha(this);
if(!isShooting()){
if(!movement.isZero()){
rotation = Mathf.slerpDelta(rotation, movement.angle(), 0.13f);
rotation = Mathf.slerpDelta(rotation, movement.angle(), 0.13f * baseLerp);
}
}else{
float angle = control.input(playerIndex).mouseAngle(x, y);
this.rotation = Mathf.slerpDelta(this.rotation, angle, 0.1f);
this.rotation = Mathf.slerpDelta(this.rotation, angle, 0.1f * baseLerp);
}
}
}
@@ -45,6 +45,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
public UnitInventory inventory = new UnitInventory(this);
public float rotation;
public float hitTime;
protected Interpolator interpolator = new Interpolator();
protected StatusController status = new StatusController();
@@ -52,7 +53,6 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
protected CarryTrait carrier;
protected Vector2 velocity = new Translator(0f, 0.0001f);
protected float hitTime;
protected float drownTime;
@Override
@@ -184,11 +184,13 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
if(tile == null) return false;
tile = tile.target();
if(tile.entity != null && tile.entity.collide(this) && !tile.entity.isDead() && tile.entity.tile.getTeam() != team){
tile.entity.collision(this);
if(tile.entity != null && tile.entity.collide(this) && !tile.entity.isDead() && (type.collidesTeam || tile.entity.tile.getTeam() != team)){
if(tile.entity.getTeam() != team){
tile.entity.collision(this);
}
if(!supressCollision){
type.hit(this);
type.hitTile(this, tile);
remove();
}
@@ -5,6 +5,7 @@ import io.anuke.mindustry.content.StatusEffects;
import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.game.Content;
import io.anuke.mindustry.type.StatusEffect;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.entities.impl.BaseBulletType;
@@ -27,6 +28,8 @@ public abstract class BulletType extends BaseBulletType<Bullet> implements Conte
public boolean syncable;
/**Whether this bullet type collides with tiles.*/
public boolean collidesTiles = true;
/**Whether this bullet type collides with tiles that are of the same team.*/
public boolean collidesTeam = false;
/**Whether this bullet types collides with anything at all.*/
public boolean collides = true;
/**Whether velocity is inherited from the shooter.*/
@@ -51,6 +54,10 @@ public abstract class BulletType extends BaseBulletType<Bullet> implements Conte
return types;
}
public void hitTile(Bullet b, Tile tile){
hit(b);
}
@Override
public void hit(Bullet b, float hitx, float hity){
Effects.effect(hiteffect, hitx, hity, b.angle());
@@ -149,8 +149,8 @@ public class ItemDrop extends SolidEntity implements SaveTrait, SyncTrait, DrawT
int stored = Mathf.clamp(amount / 6, 1, 8);
for(int i = 0; i < stored; i++){
float px = stored == 1 ? 0 : Mathf.randomSeedRange(i + 1, 4f);
float py = stored == 1 ? 0 : Mathf.randomSeedRange(i + 2, 4f);
float px = stored == 1 ? 0 : (int)Mathf.randomSeedRange(i + 1, 4f);
float py = stored == 1 ? 0 : (int)Mathf.randomSeedRange(i + 2, 4f);
Draw.rect(item.region, x + px, y + py, size, size);
}