mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-16 18:58:01 +07:00
Removed unnecessary unit types
This commit is contained in:
@ -17,7 +17,7 @@ public class UnitTypes implements ContentList{
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
draug = new UnitType("draug", Draug::new){{
|
||||
draug = new UnitType("draug", MinerDrone::new){{
|
||||
flying = true;
|
||||
drag = 0.01f;
|
||||
speed = 0.3f;
|
||||
@ -32,7 +32,7 @@ public class UnitTypes implements ContentList{
|
||||
}};
|
||||
}};
|
||||
|
||||
spirit = new UnitType("spirit", Spirit::new){{
|
||||
spirit = new UnitType("spirit", RepairDrone::new){{
|
||||
flying = true;
|
||||
drag = 0.01f;
|
||||
speed = 0.42f;
|
||||
@ -53,7 +53,7 @@ public class UnitTypes implements ContentList{
|
||||
}};
|
||||
}};
|
||||
|
||||
phantom = new UnitType("phantom", Phantom::new){{
|
||||
phantom = new UnitType("phantom", BuilderDrone::new){{
|
||||
flying = true;
|
||||
drag = 0.01f;
|
||||
mass = 2f;
|
||||
@ -76,7 +76,7 @@ public class UnitTypes implements ContentList{
|
||||
}};
|
||||
}};
|
||||
|
||||
dagger = new UnitType("dagger", Dagger::new){{
|
||||
dagger = new UnitType("dagger", GroundUnit::new){{
|
||||
maxVelocity = 1.1f;
|
||||
speed = 0.2f;
|
||||
drag = 0.4f;
|
||||
@ -92,7 +92,7 @@ public class UnitTypes implements ContentList{
|
||||
}};
|
||||
}};
|
||||
|
||||
crawler = new UnitType("crawler", Crawler::new){{
|
||||
crawler = new UnitType("crawler", GroundUnit::new){{
|
||||
maxVelocity = 1.27f;
|
||||
speed = 0.285f;
|
||||
drag = 0.4f;
|
||||
@ -123,7 +123,7 @@ public class UnitTypes implements ContentList{
|
||||
}};
|
||||
}};
|
||||
|
||||
titan = new UnitType("titan", Titan::new){{
|
||||
titan = new UnitType("titan", GroundUnit::new){{
|
||||
maxVelocity = 0.8f;
|
||||
speed = 0.22f;
|
||||
drag = 0.4f;
|
||||
@ -145,7 +145,7 @@ public class UnitTypes implements ContentList{
|
||||
}};
|
||||
}};
|
||||
|
||||
fortress = new UnitType("fortress", Fortress::new){{
|
||||
fortress = new UnitType("fortress", GroundUnit::new){{
|
||||
maxVelocity = 0.78f;
|
||||
speed = 0.15f;
|
||||
drag = 0.4f;
|
||||
@ -167,7 +167,7 @@ public class UnitTypes implements ContentList{
|
||||
}};
|
||||
}};
|
||||
|
||||
eruptor = new UnitType("eruptor", Eruptor::new){{
|
||||
eruptor = new UnitType("eruptor", GroundUnit::new){{
|
||||
maxVelocity = 0.81f;
|
||||
speed = 0.16f;
|
||||
drag = 0.4f;
|
||||
@ -189,7 +189,7 @@ public class UnitTypes implements ContentList{
|
||||
}};
|
||||
}};
|
||||
|
||||
chaosArray = new UnitType("chaos-array", Dagger::new){{
|
||||
chaosArray = new UnitType("chaos-array", GroundUnit::new){{
|
||||
maxVelocity = 0.68f;
|
||||
speed = 0.12f;
|
||||
drag = 0.4f;
|
||||
@ -213,7 +213,7 @@ public class UnitTypes implements ContentList{
|
||||
}};
|
||||
}};
|
||||
|
||||
eradicator = new UnitType("eradicator", Dagger::new){{
|
||||
eradicator = new UnitType("eradicator", GroundUnit::new){{
|
||||
maxVelocity = 0.68f;
|
||||
speed = 0.12f;
|
||||
drag = 0.4f;
|
||||
@ -238,7 +238,7 @@ public class UnitTypes implements ContentList{
|
||||
}};
|
||||
}};
|
||||
|
||||
wraith = new UnitType("wraith", Wraith::new){{
|
||||
wraith = new UnitType("wraith", FlyingUnit::new){{
|
||||
speed = 0.3f;
|
||||
maxVelocity = 1.9f;
|
||||
drag = 0.01f;
|
||||
@ -257,7 +257,7 @@ public class UnitTypes implements ContentList{
|
||||
}};
|
||||
}};
|
||||
|
||||
ghoul = new UnitType("ghoul", Ghoul::new){{
|
||||
ghoul = new UnitType("ghoul", FlyingUnit::new){{
|
||||
health = 220;
|
||||
speed = 0.2f;
|
||||
maxVelocity = 1.4f;
|
||||
@ -281,7 +281,7 @@ public class UnitTypes implements ContentList{
|
||||
}};
|
||||
}};
|
||||
|
||||
revenant = new UnitType("revenant", Revenant::new){{
|
||||
revenant = new UnitType("revenant", HoverUnit::new){{
|
||||
health = 1000;
|
||||
mass = 5f;
|
||||
hitsize = 20f;
|
||||
@ -312,7 +312,7 @@ public class UnitTypes implements ContentList{
|
||||
}};
|
||||
}};
|
||||
|
||||
lich = new UnitType("lich", Revenant::new){{
|
||||
lich = new UnitType("lich", HoverUnit::new){{
|
||||
health = 6000;
|
||||
mass = 20f;
|
||||
hitsize = 40f;
|
||||
@ -345,7 +345,7 @@ public class UnitTypes implements ContentList{
|
||||
}};
|
||||
}};
|
||||
|
||||
reaper = new UnitType("reaper", Revenant::new){{
|
||||
reaper = new UnitType("reaper", HoverUnit::new){{
|
||||
health = 11000;
|
||||
mass = 30f;
|
||||
hitsize = 56f;
|
||||
|
@ -1,4 +0,0 @@
|
||||
package io.anuke.mindustry.entities.type.base;
|
||||
|
||||
public class Crawler extends GroundUnit{
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
package io.anuke.mindustry.entities.type.base;
|
||||
|
||||
public class Dagger extends GroundUnit{
|
||||
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
package io.anuke.mindustry.entities.type.base;
|
||||
|
||||
public class Draug extends MinerDrone{
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
package io.anuke.mindustry.entities.type.base;
|
||||
|
||||
public class Eruptor extends GroundUnit{
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
package io.anuke.mindustry.entities.type.base;
|
||||
|
||||
public class Fortress extends GroundUnit{
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
package io.anuke.mindustry.entities.type.base;
|
||||
|
||||
public class Ghoul extends FlyingUnit{
|
||||
|
||||
}
|
@ -5,7 +5,7 @@ import io.anuke.arc.math.Angles;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
import io.anuke.mindustry.entities.Units;
|
||||
|
||||
public class Revenant extends FlyingUnit{
|
||||
public class HoverUnit extends FlyingUnit{
|
||||
|
||||
@Override
|
||||
public void drawWeapons(){
|
@ -1,5 +0,0 @@
|
||||
package io.anuke.mindustry.entities.type.base;
|
||||
|
||||
public class Phantom extends BuilderDrone{
|
||||
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
package io.anuke.mindustry.entities.type.base;
|
||||
|
||||
public class Spirit extends RepairDrone{
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
package io.anuke.mindustry.entities.type.base;
|
||||
|
||||
public class Titan extends GroundUnit{
|
||||
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
package io.anuke.mindustry.entities.type.base;
|
||||
|
||||
public class Wraith extends FlyingUnit{
|
||||
|
||||
}
|
@ -12,6 +12,60 @@ Latest data: [build 81]
|
||||
0 = Player
|
||||
1 = Fire
|
||||
2 = Puddle
|
||||
3 = MinerDrone
|
||||
4 = RepairDrone
|
||||
5 = BuilderDrone
|
||||
6 = GroundUnit
|
||||
7 = GroundUnit
|
||||
8 = GroundUnit
|
||||
9 = GroundUnit
|
||||
10 = GroundUnit
|
||||
11 = FlyingUnit
|
||||
12 = FlyingUnit
|
||||
13 = Revenant
|
||||
|
||||
Before removal of lightining/bullet: [build 80]
|
||||
|
||||
0 = Player
|
||||
1 = Fire
|
||||
2 = Puddle
|
||||
3 = Bullet
|
||||
4 = Lightning
|
||||
5 = MinerDrone
|
||||
6 = RepairDrone
|
||||
7 = BuilderDrone
|
||||
8 = GroundUnit
|
||||
9 = GroundUnit
|
||||
10 = GroundUnit
|
||||
11 = GroundUnit
|
||||
12 = GroundUnit
|
||||
13 = FlyingUnit
|
||||
14 = FlyingUnit
|
||||
15 = Revenant
|
||||
|
||||
Before addition of new units: [build 79 and below]
|
||||
|
||||
0 = Player
|
||||
1 = Fire
|
||||
2 = Puddle
|
||||
3 = Bullet
|
||||
4 = Lightning
|
||||
5 = RepairDrone
|
||||
6 = GroundUnit
|
||||
7 = GroundUnit
|
||||
8 = GroundUnit
|
||||
9 = GroundUnit
|
||||
10 = GroundUnit
|
||||
11 = FlyingUnit
|
||||
12 = FlyingUnit
|
||||
13 = BuilderDrone
|
||||
14 = Revenant
|
||||
*/
|
||||
public class LegacyTypeTable{
|
||||
/*
|
||||
0 = Player
|
||||
1 = Fire
|
||||
2 = Puddle
|
||||
3 = Draug
|
||||
4 = Spirit
|
||||
5 = Phantom
|
||||
@ -23,97 +77,59 @@ Latest data: [build 81]
|
||||
11 = Wraith
|
||||
12 = Ghoul
|
||||
13 = Revenant
|
||||
|
||||
Before removal of lightining/bullet: [build 80]
|
||||
|
||||
0 = Player
|
||||
1 = Fire
|
||||
2 = Puddle
|
||||
3 = Bullet
|
||||
4 = Lightning
|
||||
5 = Draug
|
||||
6 = Spirit
|
||||
7 = Phantom
|
||||
8 = Dagger
|
||||
9 = Crawler
|
||||
10 = Titan
|
||||
11 = Fortress
|
||||
12 = Eruptor
|
||||
13 = Wraith
|
||||
14 = Ghoul
|
||||
15 = Revenant
|
||||
|
||||
Before addition of new units: [build 79 and below]
|
||||
|
||||
0 = Player
|
||||
1 = Fire
|
||||
2 = Puddle
|
||||
3 = Bullet
|
||||
4 = Lightning
|
||||
5 = Spirit
|
||||
6 = Dagger
|
||||
7 = Crawler
|
||||
8 = Titan
|
||||
9 = Fortress
|
||||
10 = Eruptor
|
||||
11 = Wraith
|
||||
12 = Ghoul
|
||||
13 = Phantom
|
||||
14 = Revenant
|
||||
*/
|
||||
public class LegacyTypeTable{
|
||||
*/
|
||||
private static final Prov[] build81Table = {
|
||||
Player::new,
|
||||
Fire::new,
|
||||
Puddle::new,
|
||||
Draug::new,
|
||||
Spirit::new,
|
||||
Phantom::new,
|
||||
Dagger::new,
|
||||
Crawler::new,
|
||||
Titan::new,
|
||||
Fortress::new,
|
||||
Eruptor::new,
|
||||
Wraith::new,
|
||||
Ghoul::new,
|
||||
Revenant::new
|
||||
MinerDrone::new,
|
||||
RepairDrone::new,
|
||||
BuilderDrone::new,
|
||||
GroundUnit::new,
|
||||
GroundUnit::new,
|
||||
GroundUnit::new,
|
||||
GroundUnit::new,
|
||||
GroundUnit::new,
|
||||
FlyingUnit::new,
|
||||
FlyingUnit::new,
|
||||
HoverUnit::new
|
||||
};
|
||||
|
||||
private static final Prov[] build80Table = {
|
||||
Player::new,
|
||||
Fire::new,
|
||||
Puddle::new,
|
||||
Bullet::new, //TODO reading these may crash
|
||||
Bullet::new,
|
||||
Lightning::new,
|
||||
Draug::new,
|
||||
Spirit::new,
|
||||
Phantom::new,
|
||||
Dagger::new,
|
||||
Crawler::new,
|
||||
Titan::new,
|
||||
Fortress::new,
|
||||
Eruptor::new,
|
||||
Wraith::new,
|
||||
Ghoul::new,
|
||||
Revenant::new
|
||||
MinerDrone::new,
|
||||
RepairDrone::new,
|
||||
BuilderDrone::new,
|
||||
GroundUnit::new,
|
||||
GroundUnit::new,
|
||||
GroundUnit::new,
|
||||
GroundUnit::new,
|
||||
GroundUnit::new,
|
||||
FlyingUnit::new,
|
||||
FlyingUnit::new,
|
||||
HoverUnit::new
|
||||
};
|
||||
|
||||
private static final Prov[] build79Table = {
|
||||
Player::new,
|
||||
Fire::new,
|
||||
Puddle::new,
|
||||
Bullet::new, //TODO reading these may crash
|
||||
Bullet::new,
|
||||
Lightning::new,
|
||||
Spirit::new,
|
||||
Dagger::new,
|
||||
Crawler::new,
|
||||
Titan::new,
|
||||
Fortress::new,
|
||||
Eruptor::new,
|
||||
Wraith::new,
|
||||
Ghoul::new,
|
||||
Phantom::new,
|
||||
Revenant::new
|
||||
RepairDrone::new,
|
||||
GroundUnit::new,
|
||||
GroundUnit::new,
|
||||
GroundUnit::new,
|
||||
GroundUnit::new,
|
||||
GroundUnit::new,
|
||||
FlyingUnit::new,
|
||||
FlyingUnit::new,
|
||||
BuilderDrone::new,
|
||||
HoverUnit::new
|
||||
};
|
||||
|
||||
public static Prov[] getTable(int build){
|
||||
|
@ -36,6 +36,19 @@ import java.lang.reflect.*;
|
||||
public class ContentParser{
|
||||
private static final boolean ignoreUnknownFields = true;
|
||||
private ObjectMap<Class<?>, ContentType> contentTypes = new ObjectMap<>();
|
||||
private StringMap legacyUnitMap = StringMap.of(
|
||||
"Dagger", "GroundUnit",
|
||||
"Eruptor", "GroundUnit",
|
||||
"Titan", "GroundUnit",
|
||||
"Fortress", "GroundUnit",
|
||||
"Crawler", "GroundUnit",
|
||||
"Revenant", "HoverUnit",
|
||||
"Draug", "MinerDrone",
|
||||
"Phantom", "BuilderDrone",
|
||||
"Spirit", "RepairDrone",
|
||||
"Wraith", "FlyingUnit",
|
||||
"Ghoul", "FlyingUnit"
|
||||
);
|
||||
private ObjectMap<Class<?>, FieldParser> classParsers = new ObjectMap<Class<?>, FieldParser>(){{
|
||||
put(Effect.class, (type, data) -> field(Fx.class, data));
|
||||
put(StatusEffect.class, (type, data) -> field(StatusEffects.class, data));
|
||||
@ -260,8 +273,14 @@ public class ContentParser{
|
||||
ContentType.unit, (TypeParser<UnitType>)(mod, name, value) -> {
|
||||
readBundle(ContentType.unit, name, value);
|
||||
|
||||
Class<BaseUnit> type = resolve(getType(value), "io.anuke.mindustry.entities.type.base");
|
||||
UnitType unit = new UnitType(mod + "-" + name, supply(type));
|
||||
UnitType unit;
|
||||
if(locate(ContentType.unit, name) == null){
|
||||
Class<BaseUnit> type = resolve(legacyUnitMap.get(Strings.capitalize(getType(value)), getType(value)), "io.anuke.mindustry.entities.type.base");
|
||||
unit = new UnitType(mod + "-" + name, supply(type));
|
||||
}else{
|
||||
unit = locate(ContentType.unit, name);
|
||||
}
|
||||
|
||||
currentContent = unit;
|
||||
read(() -> readFields(unit, value, true));
|
||||
|
||||
|
@ -16,8 +16,7 @@ import io.anuke.mindustry.ui.*;
|
||||
|
||||
public class UnitType extends UnlockableContent{
|
||||
public @NonNull TypeID typeID;
|
||||
public @NonNull
|
||||
Prov<? extends BaseUnit> constructor;
|
||||
public @NonNull Prov<? extends BaseUnit> constructor;
|
||||
|
||||
public float health = 60;
|
||||
public float hitsize = 7f;
|
||||
@ -49,7 +48,7 @@ public class UnitType extends UnlockableContent{
|
||||
create(mainConstructor);
|
||||
}
|
||||
|
||||
public <T extends BaseUnit> UnitType(String name){
|
||||
public UnitType(String name){
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
@ -289,8 +289,8 @@ public class ApplicationTests{
|
||||
void buildingOverlap(){
|
||||
initBuilding();
|
||||
|
||||
Phantom d1 = (Phantom)UnitTypes.phantom.create(Team.sharded);
|
||||
Phantom d2 = (Phantom)UnitTypes.phantom.create(Team.sharded);
|
||||
BuilderDrone d1 = (BuilderDrone)UnitTypes.phantom.create(Team.sharded);
|
||||
BuilderDrone d2 = (BuilderDrone)UnitTypes.phantom.create(Team.sharded);
|
||||
|
||||
d1.set(10f, 20f);
|
||||
d2.set(10f, 20f);
|
||||
@ -311,8 +311,8 @@ public class ApplicationTests{
|
||||
void buildingDestruction(){
|
||||
initBuilding();
|
||||
|
||||
Phantom d1 = (Phantom)UnitTypes.phantom.create(Team.sharded);
|
||||
Phantom d2 = (Phantom)UnitTypes.phantom.create(Team.sharded);
|
||||
BuilderDrone d1 = (BuilderDrone)UnitTypes.phantom.create(Team.sharded);
|
||||
BuilderDrone d2 = (BuilderDrone)UnitTypes.phantom.create(Team.sharded);
|
||||
|
||||
d1.set(10f, 20f);
|
||||
d2.set(10f, 20f);
|
||||
|
Reference in New Issue
Block a user