Cleanup
This commit is contained in:
@@ -75,7 +75,7 @@ public class TractorBeamTurret extends Block{
|
||||
}
|
||||
|
||||
//look at target
|
||||
if(target != null && target.within(this, range) && target.team() != team && target.type().flying && efficiency() > 0.01f){
|
||||
if(target != null && target.within(this, range) && target.team() != team && target.type.flying && efficiency() > 0.01f){
|
||||
any = true;
|
||||
float dest = angleTo(target);
|
||||
rotation = Angles.moveToward(rotation, dest, rotateSpeed * edelta());
|
||||
|
||||
@@ -43,7 +43,7 @@ public class UnitPayload implements Payload{
|
||||
|
||||
@Override
|
||||
public boolean dump(){
|
||||
if(!Units.canCreate(unit.team, unit.type())){
|
||||
if(!Units.canCreate(unit.team, unit.type)){
|
||||
deactiveTime = 1f;
|
||||
return false;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class UnitPayload implements Payload{
|
||||
@Override
|
||||
public void draw(){
|
||||
Drawf.shadow(unit.x, unit.y, 20);
|
||||
Draw.rect(unit.type().icon(Cicon.full), unit.x, unit.y, unit.rotation - 90);
|
||||
Draw.rect(unit.type.icon(Cicon.full), unit.x, unit.y, unit.rotation - 90);
|
||||
|
||||
//draw warning
|
||||
if(deactiveTime > 0){
|
||||
|
||||
@@ -90,7 +90,7 @@ public class Reconstructor extends UnitBlock{
|
||||
return this.payload == null
|
||||
&& relativeTo(source) != rotation
|
||||
&& payload instanceof UnitPayload
|
||||
&& hasUpgrade(((UnitPayload)payload).unit.type());
|
||||
&& hasUpgrade(((UnitPayload)payload).unit.type);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,9 +114,9 @@ public class Reconstructor extends UnitBlock{
|
||||
if(constructing() && hasArrived()){
|
||||
Draw.draw(Layer.blockOver, () -> {
|
||||
Draw.alpha(1f - progress/ constructTime);
|
||||
Draw.rect(payload.unit.type().icon(Cicon.full), x, y, rotdeg() - 90);
|
||||
Draw.rect(payload.unit.type.icon(Cicon.full), x, y, rotdeg() - 90);
|
||||
Draw.reset();
|
||||
Drawf.construct(this, upgrade(payload.unit.type()), rotdeg() - 90f, progress / constructTime, speedScl, time);
|
||||
Drawf.construct(this, upgrade(payload.unit.type), rotdeg() - 90f, progress / constructTime, speedScl, time);
|
||||
});
|
||||
}else{
|
||||
Draw.z(Layer.blockOver);
|
||||
@@ -135,7 +135,7 @@ public class Reconstructor extends UnitBlock{
|
||||
|
||||
if(payload != null){
|
||||
//check if offloading
|
||||
if(!hasUpgrade(payload.unit.type())){
|
||||
if(!hasUpgrade(payload.unit.type)){
|
||||
moveOutPayload();
|
||||
}else{ //update progress
|
||||
if(moveInPayload()){
|
||||
@@ -146,7 +146,7 @@ public class Reconstructor extends UnitBlock{
|
||||
|
||||
//upgrade the unit
|
||||
if(progress >= constructTime){
|
||||
payload.unit = upgrade(payload.unit.type()).create(payload.unit.team());
|
||||
payload.unit = upgrade(payload.unit.type).create(payload.unit.team());
|
||||
progress = 0;
|
||||
Effect.shake(2f, 3f, this);
|
||||
Fx.producesmoke.at(this);
|
||||
@@ -168,12 +168,12 @@ public class Reconstructor extends UnitBlock{
|
||||
public UnitType unit(){
|
||||
if(payload == null) return null;
|
||||
|
||||
UnitType t = upgrade(payload.unit.type());
|
||||
UnitType t = upgrade(payload.unit.type);
|
||||
return t != null && t.unlockedNow() ? t : null;
|
||||
}
|
||||
|
||||
public boolean constructing(){
|
||||
return payload != null && hasUpgrade(payload.unit.type());
|
||||
return payload != null && hasUpgrade(payload.unit.type);
|
||||
}
|
||||
|
||||
public boolean hasUpgrade(UnitType type){
|
||||
|
||||
@@ -65,10 +65,10 @@ public class ResupplyPoint extends Block{
|
||||
public static boolean resupply(Team team, float x, float y, float range, float ammoAmount, Color ammoColor, Boolf<Unit> valid){
|
||||
if(!state.rules.unitAmmo) return false;
|
||||
|
||||
Unit unit = Units.closest(team, x, y, range, u -> u.type().ammoType instanceof ItemAmmoType && u.ammo <= u.type().ammoCapacity - ammoAmount && valid.get(u));
|
||||
Unit unit = Units.closest(team, x, y, range, u -> u.type.ammoType instanceof ItemAmmoType && u.ammo <= u.type.ammoCapacity - ammoAmount && valid.get(u));
|
||||
if(unit != null){
|
||||
Fx.itemTransfer.at(x, y, ammoAmount / 2f, ammoColor, unit);
|
||||
unit.ammo = Math.min(unit.ammo + ammoAmount, unit.type().ammoCapacity);
|
||||
unit.ammo = Math.min(unit.ammo + ammoAmount, unit.type.ammoCapacity);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user