Bugfixes
Before Width: | Height: | Size: 334 B After Width: | Height: | Size: 533 B |
Before Width: | Height: | Size: 556 B After Width: | Height: | Size: 262 B |
Before Width: | Height: | Size: 431 B After Width: | Height: | Size: 686 B |
Before Width: | Height: | Size: 762 KiB After Width: | Height: | Size: 762 KiB |
Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 128 KiB |
@ -5,7 +5,7 @@ import mindustry.gen.*;
|
|||||||
|
|
||||||
class AllDefs{
|
class AllDefs{
|
||||||
|
|
||||||
@GroupDef(Entityc.class)
|
@GroupDef(value = Entityc.class, mapping = true)
|
||||||
class all{
|
class all{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ public class Team implements Comparable<Team>{
|
|||||||
public final static Team
|
public final static Team
|
||||||
derelict = new Team(0, "derelict", Color.valueOf("4d4e58")),
|
derelict = new Team(0, "derelict", Color.valueOf("4d4e58")),
|
||||||
sharded = new Team(1, "sharded", Pal.accent.cpy()),
|
sharded = new Team(1, "sharded", Pal.accent.cpy()),
|
||||||
crux = new Team(2, "crux", Color.valueOf("e82d2d")),
|
crux = new Team(2, "crux", Color.valueOf("f25555")),
|
||||||
green = new Team(3, "green", Color.valueOf("4dd98b")),
|
green = new Team(3, "green", Color.valueOf("4dd98b")),
|
||||||
purple = new Team(4, "purple", Color.valueOf("9a4bdf")),
|
purple = new Team(4, "purple", Color.valueOf("9a4bdf")),
|
||||||
blue = new Team(5, "blue", Color.royal.cpy());
|
blue = new Team(5, "blue", Color.royal.cpy());
|
||||||
|
@ -93,7 +93,7 @@ public class MinimapRenderer implements Disposable{
|
|||||||
|
|
||||||
Draw.mixcol(unit.team().color, 1f);
|
Draw.mixcol(unit.team().color, 1f);
|
||||||
float scale = Scl.scl(1f) / 2f * scaling * 32f;
|
float scale = Scl.scl(1f) / 2f * scaling * 32f;
|
||||||
Draw.rect(unit.type().region, x + rx, y + ry, scale, scale, unit.rotation() - 90);
|
Draw.rect(unit.type().icon(Cicon.full), x + rx, y + ry, scale, scale, unit.rotation() - 90);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|
||||||
//only disable player names in multiplayer
|
//only disable player names in multiplayer
|
||||||
|
@ -185,7 +185,7 @@ public class UnitType extends UnlockableContent{
|
|||||||
public void drawEngine(Unitc unit){
|
public void drawEngine(Unitc unit){
|
||||||
if(!unit.isFlying()) return;
|
if(!unit.isFlying()) return;
|
||||||
|
|
||||||
Draw.color(engineColor);
|
Draw.color(unit.team().color, Color.white, 0f);
|
||||||
Fill.circle(
|
Fill.circle(
|
||||||
unit.x() + Angles.trnsx(unit.rotation() + 180, engineOffset),
|
unit.x() + Angles.trnsx(unit.rotation() + 180, engineOffset),
|
||||||
unit.y() + Angles.trnsy(unit.rotation() + 180, engineOffset),
|
unit.y() + Angles.trnsy(unit.rotation() + 180, engineOffset),
|
||||||
|
@ -509,42 +509,39 @@ public class Block extends UnlockableContent{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void initEntity(){
|
protected void initEntity(){
|
||||||
|
//attempt to find the first declared class and use it as the entity type
|
||||||
|
try{
|
||||||
|
Class<?> current = getClass();
|
||||||
|
|
||||||
|
if(current.isAnonymousClass()){
|
||||||
|
current = current.getSuperclass();
|
||||||
|
}
|
||||||
|
|
||||||
|
while(entityType == null && Block.class.isAssignableFrom(current)){
|
||||||
|
//first class that is subclass of Tilec
|
||||||
|
Class<?> type = Structs.find(current.getDeclaredClasses(), t -> Tilec.class.isAssignableFrom(t) && !t.isInterface());
|
||||||
|
if(type != null){
|
||||||
|
//these are inner classes, so they have an implicit parameter generated
|
||||||
|
Constructor<? extends Tilec> cons = (Constructor<? extends Tilec>)type.getDeclaredConstructor(type.getDeclaringClass());
|
||||||
|
entityType = () -> {
|
||||||
|
try{
|
||||||
|
return cons.newInstance(this);
|
||||||
|
}catch(Exception e){
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//scan through every superclass looking for it
|
||||||
|
current = current.getSuperclass();
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch(Throwable ignored){
|
||||||
|
}
|
||||||
|
|
||||||
if(entityType == null){
|
if(entityType == null){
|
||||||
|
//assign default value
|
||||||
//attempt to find the first declared class and use it as the entity type
|
entityType = TileEntity::create;
|
||||||
try{
|
|
||||||
Class<?> current = getClass();
|
|
||||||
|
|
||||||
if(current.isAnonymousClass()){
|
|
||||||
current = current.getSuperclass();
|
|
||||||
}
|
|
||||||
|
|
||||||
while(entityType == null && Block.class.isAssignableFrom(current)){
|
|
||||||
//first class that is subclass of Tilec
|
|
||||||
Class<?> type = Structs.find(current.getDeclaredClasses(), t -> Tilec.class.isAssignableFrom(t) && !t.isInterface());
|
|
||||||
if(type != null){
|
|
||||||
//these are inner classes, so they have an implicit parameter generated
|
|
||||||
Constructor<? extends Tilec> cons = (Constructor<? extends Tilec>)type.getDeclaredConstructor(type.getDeclaringClass());
|
|
||||||
entityType = () -> {
|
|
||||||
try{
|
|
||||||
return cons.newInstance(this);
|
|
||||||
}catch(Exception e){
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
//scan through every superclass looking for it
|
|
||||||
current = current.getSuperclass();
|
|
||||||
}
|
|
||||||
|
|
||||||
}catch(Throwable ignored){
|
|
||||||
}
|
|
||||||
|
|
||||||
if(entityType == null){
|
|
||||||
//assign default value
|
|
||||||
entityType = TileEntity::create;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ import mindustry.world.blocks.payloads.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
//TODO rename
|
|
||||||
public class PayloadConveyor extends Block{
|
public class PayloadConveyor extends Block{
|
||||||
public float moveTime = 70f;
|
public float moveTime = 70f;
|
||||||
public TextureRegion topRegion, edgeRegion;
|
public TextureRegion topRegion, edgeRegion;
|
||||||
@ -103,6 +102,7 @@ public class PayloadConveyor extends Block{
|
|||||||
//trigger update forward
|
//trigger update forward
|
||||||
next.updateTile();
|
next.updateTile();
|
||||||
|
|
||||||
|
//TODO add self to queue of next conveyor, then check if this conveyor was selected next frame - selection happens deterministically
|
||||||
if(next.acceptPayload(this, item)){
|
if(next.acceptPayload(this, item)){
|
||||||
//move forward.
|
//move forward.
|
||||||
next.handlePayload(this, item);
|
next.handlePayload(this, item);
|
||||||
@ -110,7 +110,7 @@ public class PayloadConveyor extends Block{
|
|||||||
}
|
}
|
||||||
}else if(!blocked){
|
}else if(!blocked){
|
||||||
//dump item forward
|
//dump item forward
|
||||||
float trnext = size * tilesize / 2f, cx = Geometry.d4(rotation()).x, cy = Geometry.d4(rotation()).y, rot = rotation() * 90;
|
float trnext = size * tilesize / 2f, cx = Geometry.d4(rotation()).x, cy = Geometry.d4(rotation()).y;
|
||||||
|
|
||||||
if(item.dump(x + cx * trnext, y + cy * trnext, rotation() * 90)){
|
if(item.dump(x + cx * trnext, y + cy * trnext, rotation() * 90)){
|
||||||
item = null;
|
item = null;
|
||||||
|