Unit status cleanup

This commit is contained in:
Anuken
2020-04-26 23:24:05 -04:00
parent f6bf229b0a
commit 2f3c098b50
21 changed files with 57 additions and 71 deletions

View File

@@ -118,6 +118,7 @@ public class EntityProcess extends BaseProcessor{
signatures.add(method.e.toString());
inter.addMethod(MethodSpec.methodBuilder(method.name())
.addJavadoc(method.doc() == null ? "" : method.doc())
.addExceptions(method.thrownt())
.addTypeVariables(method.typeVariables().map(TypeVariableName::get))
.returns(method.ret().toString().equals("void") ? TypeName.VOID : method.retn())
@@ -165,18 +166,6 @@ public class EntityProcess extends BaseProcessor{
Log.debug("");
}
/*
//generate special render layer interfaces
for(DrawLayer layer : DrawLayer.values()){
//create the DrawLayer interface that entities need to implement
String name = "DrawLayer" + Strings.capitalize(layer.name()) + "c";
TypeSpec.Builder inter = TypeSpec.interfaceBuilder(name)
.addSuperinterface(tname(packageName + ".Entityc"))
.addSuperinterface(tname(packageName + ".Drawc"))
.addModifiers(Modifier.PUBLIC).addAnnotation(EntityInterface.class);
inter.addMethod(MethodSpec.methodBuilder("draw" + Strings.capitalize(layer.name())).addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT).build());
write(inter);
}*/
}else if(round == 2){ //round 2: get component classes and generate interfaces for them
//parse groups
@@ -187,17 +176,6 @@ public class EntityProcess extends BaseProcessor{
groupDefs.add(new GroupDefinition(group.name(), ClassName.bestGuess(packageName + "." + interfaceName(types.first())), types, an.spatial(), an.mapping(), collides));
}
/*
//add special generated groups
for(DrawLayer layer : DrawLayer.values()){
String name = "DrawLayer" + Strings.capitalize(layer.name()) + "c";
//create group definition with no components directly
GroupDefinition def = new GroupDefinition(layer.name(), ClassName.bestGuess(packageName + "." + name), Array.with(), false, false, new Array<>(0));
//add manual inclusions of entities to be added to this group
def.manualInclusions.addAll(allDefs.select(s -> allComponents(s).contains(comp -> comp.interfaces().contains(in -> in.name().equals(name)))));
groupDefs.add(def);
}*/
ObjectMap<String, Selement> usedNames = new ObjectMap<>();
ObjectMap<Selement, ObjectSet<String>> extraNames = new ObjectMap<>();
@@ -424,7 +402,6 @@ public class EntityProcess extends BaseProcessor{
TypeSpec.Builder groupsBuilder = TypeSpec.classBuilder("Groups").addModifiers(Modifier.PUBLIC);
MethodSpec.Builder groupInit = MethodSpec.methodBuilder("init").addModifiers(Modifier.PUBLIC, Modifier.STATIC);
for(GroupDefinition group : groupDefs){
//Stype ctype = group.components.first();
//class names for interface/group
ClassName itype = group.baseType;
ClassName groupc = ClassName.bestGuess("mindustry.entities.EntityGroup");
@@ -463,14 +440,6 @@ public class EntityProcess extends BaseProcessor{
}
}
/*
for(DrawLayer layer : DrawLayer.values()){
MethodSpec.Builder groupDraw = MethodSpec.methodBuilder("draw" + Strings.capitalize(layer.name()))
.addModifiers(Modifier.PUBLIC, Modifier.STATIC);
groupDraw.addStatement("$L.draw($L::$L)", layer.name(), "DrawLayer" + Strings.capitalize(layer.name()) + "c", "draw" + Strings.capitalize(layer.name()));
groupsBuilder.addMethod(groupDraw.build());
}*/
groupsBuilder.addMethod(groupResize.build());
groupsBuilder.addMethod(groupUpdate.build());

View File

@@ -1,6 +1,7 @@
package mindustry.annotations.util;
import arc.struct.Array;
import arc.util.ArcAnnotate.*;
import com.squareup.javapoet.*;
import com.sun.tools.javac.code.Attribute.*;
import mindustry.annotations.*;
@@ -18,7 +19,7 @@ public class Selement<T extends Element>{
this.e = e;
}
public String doc(){
public @Nullable String doc(){
return BaseProcessor.elementu.getDocComment(e);
}