Class ID mapping

This commit is contained in:
Anuken
2020-02-04 13:57:42 -05:00
parent be50997f94
commit 012421afcb
21 changed files with 106 additions and 63 deletions

View File

@@ -1,18 +0,0 @@
package mindustry.content;
import mindustry.entities.effect.Fire;
import mindustry.entities.effect.Puddle;
import mindustry.entities.type.Player;
import mindustry.ctype.ContentList;
import mindustry.type.TypeID;
public class TypeIDs implements ContentList{
public static TypeID fire, puddle, player;
@Override
public void load(){
fire = new TypeID("fire", Fire::new);
puddle = new TypeID("puddle", Puddle::new);
player = new TypeID("player", Player::new);
}
}

View File

@@ -42,7 +42,6 @@ public class ContentLoader{
new Weathers(),
new Planets(),
new Zones(),
new TypeIDs(),
//these are not really content classes, but this makes initialization easier
new LegacyColorMapper(),

View File

@@ -12,7 +12,6 @@ import mindustry.annotations.Annotations.*;
import mindustry.content.*;
import mindustry.core.GameState.*;
import mindustry.entities.*;
import mindustry.entities.traits.*;
import mindustry.entities.type.*;
import mindustry.gen.*;
import mindustry.entities.units.*;

View File

@@ -3,8 +3,6 @@ package mindustry.entities;
import arc.math.*;
import arc.math.geom.*;
import arc.util.*;
import mindustry.entities.traits.*;
/**
* Class for predicting shoot angles based on velocities of targets.
*/

View File

@@ -55,7 +55,7 @@ public class EntityComps{
@Override
public void controller(UnitController controller){
this.controller = controller;
controller.set(this);
controller.unit(this);
}
@Override
@@ -1291,7 +1291,7 @@ public class EntityComps{
}
@Component
abstract class ShielderComp implements Damagec{
abstract class ShielderComp implements Damagec, Teamc, Posc{
void absorb(){
@@ -1536,7 +1536,7 @@ public class EntityComps{
@Component
@BaseComponent
class EntityComp{
abstract class EntityComp{
private boolean added;
int id;
@@ -1563,5 +1563,8 @@ public class EntityComps{
<T> T as(Class<T> type){
return (T)this;
}
@InternalImpl
abstract int classId();
}
}

View File

@@ -9,7 +9,6 @@ import arc.util.pooling.*;
import mindustry.annotations.Annotations.*;
import mindustry.content.*;
import mindustry.entities.*;
import mindustry.entities.traits.*;
import mindustry.entities.type.*;
import mindustry.game.*;
import mindustry.gen.*;

View File

@@ -17,7 +17,6 @@ import mindustry.content.*;
import mindustry.core.*;
import mindustry.ctype.ContentType;
import mindustry.entities.*;
import mindustry.entities.traits.*;
import mindustry.entities.units.*;
import mindustry.game.*;
import mindustry.gen.*;

View File

@@ -5,7 +5,6 @@ import arc.math.*;
import arc.struct.*;
import arc.util.*;
import mindustry.entities.*;
import mindustry.entities.traits.*;
import mindustry.entities.type.*;
import mindustry.entities.units.*;
import mindustry.game.EventType.*;

View File

@@ -3,10 +3,7 @@ package mindustry.entities.units;
import mindustry.gen.*;
//TODO rename
public abstract class UnitController{
protected Unitc unit;
public void set(Unitc unit){
this.unit = unit;
}
public interface UnitController{
void unit(Unitc unit);
Unitc unit();
}

View File

@@ -3,8 +3,6 @@ package mindustry.type;
import arc.func.*;
import mindustry.ctype.*;
import mindustry.ctype.ContentType;
import mindustry.entities.traits.*;
public class TypeID extends MappableContent{
public final Prov<? extends TypeTrait> constructor;

View File

@@ -7,7 +7,6 @@ import arc.util.ArcAnnotate.*;
import mindustry.content.*;
import mindustry.entities.*;
import mindustry.entities.bullet.*;
import mindustry.entities.traits.*;
import mindustry.gen.*;
public class Weapon{

View File

@@ -4,7 +4,6 @@ import arc.util.ArcAnnotate.*;
import mindustry.annotations.Annotations.*;
import mindustry.ctype.*;
import mindustry.entities.*;
import mindustry.entities.traits.*;
import mindustry.entities.type.*;
import mindustry.type.Weather.*;

View File

@@ -9,7 +9,7 @@ import arc.math.geom.*;
import arc.util.*;
import mindustry.content.*;
import mindustry.entities.*;
import mindustry.entities.type.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.world.*;
import mindustry.world.consumers.*;
@@ -17,7 +17,7 @@ import mindustry.world.meta.*;
import java.io.*;
import static mindustry.Vars.*;
import static mindustry.Vars.tilesize;
public class ForceProjector extends Block{
public final int timerUse = timers++;
@@ -35,12 +35,12 @@ public class ForceProjector extends Block{
private static Tile paramTile;
private static ForceProjector paramBlock;
private static ForceEntity paramEntity;
private static Cons<AbsorbTrait> shieldConsumer = trait -> {
if(trait.canBeAbsorbed() && trait.getTeam() != paramTile.getTeam() && Intersector.isInsideHexagon(trait.getX(), trait.getY(), paramBlock.realRadius(paramEntity) * 2f, paramTile.drawx(), paramTile.drawy())){
private static Cons<Shielderc> shieldConsumer = trait -> {
if(trait.team() != paramTile.getTeam() && Intersector.isInsideHexagon(trait.x(), trait.y(), paramBlock.realRadius(paramEntity) * 2f, paramTile.drawx(), paramTile.drawy())){
trait.absorb();
Fx.absorb.at(trait);
paramEntity.hit = 1f;
paramEntity.buildup += trait.getShieldDamage() * paramEntity.warmup;
paramEntity.buildup += trait.damage() * paramEntity.warmup;
}
};

View File

@@ -8,7 +8,6 @@ import arc.graphics.g2d.*;
import arc.math.*;
import arc.math.geom.*;
import mindustry.content.*;
import mindustry.entities.traits.*;
import mindustry.entities.type.*;
import mindustry.gen.*;
import mindustry.game.EventType.*;

View File

@@ -9,7 +9,6 @@ import arc.math.geom.*;
import arc.util.*;
import arc.util.ArcAnnotate.*;
import mindustry.content.*;
import mindustry.entities.traits.*;
import mindustry.entities.type.*;
import mindustry.gen.*;
import mindustry.game.EventType.*;