Skip to content

Commit

Permalink
Merge branch 'Anuken:master' into TMP
Browse files Browse the repository at this point in the history
  • Loading branch information
SITUVNgcd authored Aug 3, 2024
2 parents 0bb33ac + e0c455b commit abf3456
Show file tree
Hide file tree
Showing 82 changed files with 566 additions and 343 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript{
}

dependencies{
classpath 'com.android.tools.build:gradle:8.5.0'
classpath 'com.android.tools.build:gradle:8.2.2'
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -851,89 +851,6 @@ public void process(RoundEnvironment env) throws Exception{
for(TypeSpec.Builder b : baseClasses){
write(b, imports.toSeq());
}

//TODO nulls were an awful idea
//store nulls
TypeSpec.Builder nullsBuilder = TypeSpec.classBuilder("Nulls").addModifiers(Modifier.PUBLIC).addModifiers(Modifier.FINAL);
//TODO should be dynamic
ObjectSet<String> nullList = ObjectSet.with("unit");

//create mock types of all components
for(Stype interf : allInterfaces){
//indirect interfaces to implement methods for
Seq<Stype> dependencies = interf.allInterfaces().add(interf);
Seq<Smethod> methods = dependencies.flatMap(Stype::methods);
methods.sortComparing(Object::toString);

//optionally add superclass
Stype superclass = dependencies.map(this::interfaceToComp).find(s -> s != null && s.annotation(Component.class).base());
//use the base type when the interface being emulated has a base
TypeName type = superclass != null && interfaceToComp(interf).annotation(Component.class).base() ? tname(baseName(superclass)) : interf.tname();

//used method signatures
ObjectSet<String> signatures = new ObjectSet<>();

//create null builder
String baseName = interf.name().substring(0, interf.name().length() - 1);

//prevent Nulls bloat
if(!nullList.contains(Strings.camelize(baseName))){
continue;
}

String className = "Null" + baseName;
TypeSpec.Builder nullBuilder = TypeSpec.classBuilder(className)
.addModifiers(Modifier.FINAL);

skipDeprecated(nullBuilder);

nullBuilder.addSuperinterface(interf.tname());
if(superclass != null) nullBuilder.superclass(tname(baseName(superclass)));

for(Smethod method : methods){
String signature = method.toString();
if(!signatures.add(signature)) continue;

Stype compType = interfaceToComp(method.type());
MethodSpec.Builder builder = MethodSpec.overriding(method.e).addModifiers(Modifier.PUBLIC, Modifier.FINAL);
int index = 0;
for(ParameterSpec spec : builder.parameters){
Reflect.set(spec, "name", "arg" + index++);
}
builder.addAnnotation(OverrideCallSuper.class); //just in case

if(!method.isVoid()){
String methodName = method.name();
switch(methodName){
case "isNull":
builder.addStatement("return true");
break;
case "id":
builder.addStatement("return -1");
break;
case "toString":
builder.addStatement("return $S", className);
break;
default:
Svar variable = compType == null || method.params().size > 0 ? null : compType.fields().find(v -> v.name().equals(methodName));
String desc = variable == null ? null : variable.descString();
if(variable == null || !varInitializers.containsKey(desc)){
builder.addStatement("return " + getDefault(method.ret().toString()));
}else{
String init = varInitializers.get(desc);
builder.addStatement("return " + (init.equals("{}") ? "new " + variable.mirror().toString() : "") + init);
}
}
}
nullBuilder.addMethod(builder.build());
}

nullsBuilder.addField(FieldSpec.builder(type, Strings.camelize(baseName)).initializer("new " + className + "()").addModifiers(Modifier.FINAL, Modifier.STATIC, Modifier.PUBLIC).build());

write(nullBuilder, imports.toSeq());
}

write(nullsBuilder);
}
}

Expand Down
3 changes: 2 additions & 1 deletion core/assets/bundles/bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2376,13 +2376,14 @@ lst.setrate = Set processor execution speed in instructions/tick.
lst.fetch = Lookup units, cores, players or buildings by index.\nIndices start at 0 and end at their returned count.
lst.packcolor = Pack [0, 1] RGBA components into a single number for drawing or rule-setting.
lst.setrule = Set a game rule.
lst.flushmessage = Display a message on the screen from the text buffer.\nWill wait until the previous message finishes.
lst.flushmessage = Display a message on the screen from the text buffer.\nIf the success result variable is [accent]@wait[],\nwill wait until the previous message finishes.\nOtherwise, outputs whether displaying the message succeeded.
lst.cutscene = Manipulate the player camera.
lst.setflag = Set a global flag that can be read by all processors.
lst.getflag = Check if a global flag is set.
lst.setprop = Sets a property of a unit or building.
lst.effect = Create a particle effect.
lst.sync = Sync a variable across the network.\nLimited to 20 times a second per variable.
lst.playsound = Plays a sound.\nVolume and pan can be a global value, or calculated based on position.
lst.makemarker = Create a new logic marker in the world.\nAn ID to identify this marker must be provided.\nMarkers currently limited to 20,000 per world.
lst.setmarker = Set a property for a marker.\nThe ID used must be the same as in the Make Marker instruction.\n[accent]null []values are ignored.
lst.localeprint = Add map locale property value to the text buffer.\nTo set map locale bundles in map editor, check [accent]Map Info > Locale Bundles[].\nIf client is a mobile device, tries to print a property ending in ".mobile" first.
Expand Down
1 change: 1 addition & 0 deletions core/assets/bundles/bundle_be.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2329,6 +2329,7 @@ lst.getflag = Check if a global flag is set.
lst.setprop = Sets a property of a unit or building.
lst.effect = Create a particle effect.
lst.sync = Sync a variable across the network.\nOnly invoked 10 times a second at most.
lst.playsound = Plays a sound.\nVolume and pan can be a global value, or calculated based on position.
lst.makemarker = Create a new logic marker in the world.\nAn ID to identify this marker must be provided.\nMarkers currently limited to 20,000 per world.
lst.setmarker = Set a property for a marker.\nThe ID used must be the same as in the Make Marker instruction.
lst.localeprint = Add map locale property value to the text buffer.\nTo set map locale bundles in map editor, check [accent]Map Info > Locale Bundles[].\nIf client is a mobile device, tries to print a property ending in ".mobile" first.
Expand Down
1 change: 1 addition & 0 deletions core/assets/bundles/bundle_bg.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2343,6 +2343,7 @@ lst.getflag = Check if a global flag is set.
lst.setprop = Sets a property of a unit or building.
lst.effect = Create a particle effect.
lst.sync = Sync a variable across the network.\nOnly invoked 10 times a second at most.
lst.playsound = Plays a sound.\nVolume and pan can be a global value, or calculated based on position.
lst.makemarker = Create a new logic marker in the world.\nAn ID to identify this marker must be provided.\nMarkers currently limited to 20,000 per world.
lst.setmarker = Set a property for a marker.\nThe ID used must be the same as in the Make Marker instruction.
lst.localeprint = Add map locale property value to the text buffer.\nTo set map locale bundles in map editor, check [accent]Map Info > Locale Bundles[].\nIf client is a mobile device, tries to print a property ending in ".mobile" first.
Expand Down
7 changes: 4 additions & 3 deletions core/assets/bundles/bundle_ca.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1121,8 +1121,8 @@ category.items = Elements
category.crafting = Entrada/Sortida
category.function = Funcionament
category.optional = Millores opcionals
setting.alwaysmusic.name = Always Play Music
setting.alwaysmusic.description = When enabled, music will always play on loop in-game.\nWhen disabled, it only plays at random intervals.
setting.alwaysmusic.name = Reprodueix música sempre
setting.alwaysmusic.description = Quan està activat, la música es reproduirà en bucle durant les partides.\nQuan està desactivat, només es reproduirà a intervals aleatoris.
setting.skipcoreanimation.name = Omet l’animació del llançament i aterratge del nucli
setting.landscape.name = Bloca el paisatge
setting.shadows.name = Ombres
Expand Down Expand Up @@ -2353,6 +2353,7 @@ lst.getflag = Obtén un senyal global.
lst.setprop = Estableix una propietat d’una unitat o estructura.
lst.effect = Crea un efecte de partícula.
lst.sync = Sincronitza una variable a través de la xarxa.\nS’invoca com a molt 10 vegades per segon.
lst.playsound = Plays a sound.\nVolume and pan can be a global value, or calculated based on position.
lst.makemarker = Crea una marca lògica al món.\nS’ha de donar un ID per a identificar-la.\nEs poden establir fins a 20.000 marcadors per món.
lst.setmarker = Estableix una propietat per a la marca.\nL’ID que es faci servir ha de ser el mateix que el de la instrucció de crear la marca.
lst.localeprint = Afegeix el valor d’una propietat de la traducció d’un mapa a la cua d’impressió.\nPer a establir paquets de traducció de mapes a l’editor de mapes, comproveu [accent]Informació del mapa > Paquets de traducció[].\nSi el client és un dispositiu mòbil, primer intenta imprimir una propietat que acabi en «.mobile».
Expand Down Expand Up @@ -2400,7 +2401,7 @@ lenum.shoot = Dispara a una posició.
lenum.shootp = Dispara a una unitat/bloc tenint en compte la seva velocitat a l’hora d’apuntar.
lenum.config = Configuració de l’estructura, com ara el classificador.
lenum.enabled = Retorna si el bloc està activat.
laccess.currentammotype = Current ammo item/liquid of a turret.
laccess.currentammotype = Líquid o element de munició actual de la torreta.

laccess.color = Color de l’il·luminador.
laccess.controller = Controlador de la unitat. Si es controla per processador, retorna el processador.\nAltrament, retorna la mateixa unitat.
Expand Down
1 change: 1 addition & 0 deletions core/assets/bundles/bundle_cs.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2348,6 +2348,7 @@ lst.getflag = Check if a global flag is set.
lst.setprop = Sets a property of a unit or building.
lst.effect = Create a particle effect.
lst.sync = Sync a variable across the network.\nOnly invoked 10 times a second at most.
lst.playsound = Plays a sound.\nVolume and pan can be a global value, or calculated based on position.
lst.makemarker = Create a new logic marker in the world.\nAn ID to identify this marker must be provided.\nMarkers currently limited to 20,000 per world.
lst.setmarker = Set a property for a marker.\nThe ID used must be the same as in the Make Marker instruction.
lst.localeprint = Add map locale property value to the text buffer.\nTo set map locale bundles in map editor, check [accent]Map Info > Locale Bundles[].\nIf client is a mobile device, tries to print a property ending in ".mobile" first.
Expand Down
1 change: 1 addition & 0 deletions core/assets/bundles/bundle_da.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2329,6 +2329,7 @@ lst.getflag = Check if a global flag is set.
lst.setprop = Sets a property of a unit or building.
lst.effect = Create a particle effect.
lst.sync = Sync a variable across the network.\nOnly invoked 10 times a second at most.
lst.playsound = Plays a sound.\nVolume and pan can be a global value, or calculated based on position.
lst.makemarker = Create a new logic marker in the world.\nAn ID to identify this marker must be provided.\nMarkers currently limited to 20,000 per world.
lst.setmarker = Set a property for a marker.\nThe ID used must be the same as in the Make Marker instruction.
lst.localeprint = Add map locale property value to the text buffer.\nTo set map locale bundles in map editor, check [accent]Map Info > Locale Bundles[].\nIf client is a mobile device, tries to print a property ending in ".mobile" first.
Expand Down
1 change: 1 addition & 0 deletions core/assets/bundles/bundle_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2378,6 +2378,7 @@ lst.getflag = Überprüfe, ob eine Flag gesetzt ist.
lst.setprop = Setzt eine Eigenschaft einer Einheit oder eines Blockes.
lst.effect = Create a particle effect.
lst.sync = Sync a variable across the network.\nOnly invoked 10 times a second at most.
lst.playsound = Plays a sound.\nVolume and pan can be a global value, or calculated based on position.
lst.makemarker = Create a new logic marker in the world.\nAn ID to identify this marker must be provided.\nMarkers currently limited to 20,000 per world.
lst.setmarker = Set a property for a marker.\nThe ID used must be the same as in the Make Marker instruction.
lst.localeprint = Add map locale property value to the text buffer.\nTo set map locale bundles in map editor, check [accent]Map Info > Locale Bundles[].\nIf client is a mobile device, tries to print a property ending in ".mobile" first.
Expand Down
1 change: 1 addition & 0 deletions core/assets/bundles/bundle_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2371,6 +2371,7 @@ lst.getflag = Comprueba si se ha establecido una etiqueta global.
lst.setprop = Sets a property of a unit or building.
lst.effect = Create a particle effect.
lst.sync = Sync a variable across the network.\nOnly invoked 10 times a second at most.
lst.playsound = Plays a sound.\nVolume and pan can be a global value, or calculated based on position.
lst.makemarker = Create a new logic marker in the world.\nAn ID to identify this marker must be provided.\nMarkers currently limited to 20,000 per world.
lst.setmarker = Set a property for a marker.\nThe ID used must be the same as in the Make Marker instruction.
lst.localeprint = Add map locale property value to the text buffer.\nTo set map locale bundles in map editor, check [accent]Map Info > Locale Bundles[].\nIf client is a mobile device, tries to print a property ending in ".mobile" first.
Expand Down
1 change: 1 addition & 0 deletions core/assets/bundles/bundle_et.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2331,6 +2331,7 @@ lst.getflag = Check if a global flag is set.
lst.setprop = Sets a property of a unit or building.
lst.effect = Create a particle effect.
lst.sync = Sync a variable across the network.\nOnly invoked 10 times a second at most.
lst.playsound = Plays a sound.\nVolume and pan can be a global value, or calculated based on position.
lst.makemarker = Create a new logic marker in the world.\nAn ID to identify this marker must be provided.\nMarkers currently limited to 20,000 per world.
lst.setmarker = Set a property for a marker.\nThe ID used must be the same as in the Make Marker instruction.
lst.localeprint = Add map locale property value to the text buffer.\nTo set map locale bundles in map editor, check [accent]Map Info > Locale Bundles[].\nIf client is a mobile device, tries to print a property ending in ".mobile" first.
Expand Down
1 change: 1 addition & 0 deletions core/assets/bundles/bundle_eu.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2333,6 +2333,7 @@ lst.getflag = Check if a global flag is set.
lst.setprop = Sets a property of a unit or building.
lst.effect = Create a particle effect.
lst.sync = Sync a variable across the network.\nOnly invoked 10 times a second at most.
lst.playsound = Plays a sound.\nVolume and pan can be a global value, or calculated based on position.
lst.makemarker = Create a new logic marker in the world.\nAn ID to identify this marker must be provided.\nMarkers currently limited to 20,000 per world.
lst.setmarker = Set a property for a marker.\nThe ID used must be the same as in the Make Marker instruction.
lst.localeprint = Add map locale property value to the text buffer.\nTo set map locale bundles in map editor, check [accent]Map Info > Locale Bundles[].\nIf client is a mobile device, tries to print a property ending in ".mobile" first.
Expand Down
1 change: 1 addition & 0 deletions core/assets/bundles/bundle_fi.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2334,6 +2334,7 @@ lst.getflag = Tarkista, onko globaali tunniste asetettu.
lst.setprop = Sets a property of a unit or building.
lst.effect = Create a particle effect.
lst.sync = Sync a variable across the network.\nOnly invoked 10 times a second at most.
lst.playsound = Plays a sound.\nVolume and pan can be a global value, or calculated based on position.
lst.makemarker = Create a new logic marker in the world.\nAn ID to identify this marker must be provided.\nMarkers currently limited to 20,000 per world.
lst.setmarker = Set a property for a marker.\nThe ID used must be the same as in the Make Marker instruction.
lst.localeprint = Add map locale property value to the text buffer.\nTo set map locale bundles in map editor, check [accent]Map Info > Locale Bundles[].\nIf client is a mobile device, tries to print a property ending in ".mobile" first.
Expand Down
1 change: 1 addition & 0 deletions core/assets/bundles/bundle_fil.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2330,6 +2330,7 @@ lst.getflag = Check if a global flag is set.
lst.setprop = Sets a property of a unit or building.
lst.effect = Create a particle effect.
lst.sync = Sync a variable across the network.\nOnly invoked 10 times a second at most.
lst.playsound = Plays a sound.\nVolume and pan can be a global value, or calculated based on position.
lst.makemarker = Create a new logic marker in the world.\nAn ID to identify this marker must be provided.\nMarkers currently limited to 20,000 per world.
lst.setmarker = Set a property for a marker.\nThe ID used must be the same as in the Make Marker instruction.
lst.localeprint = Add map locale property value to the text buffer.\nTo set map locale bundles in map editor, check [accent]Map Info > Locale Bundles[].\nIf client is a mobile device, tries to print a property ending in ".mobile" first.
Expand Down
1 change: 1 addition & 0 deletions core/assets/bundles/bundle_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2378,6 +2378,7 @@ lst.getflag = Vérifie si une variable globale est présente.
lst.setprop = Change une propriété d'une unité ou d'un bâtiment.
lst.effect = Crée un effet de particules.
lst.sync = Synchronise une variable dans le réseau.\nLimité à 20 fois par seconde et par variable.
lst.playsound = Plays a sound.\nVolume and pan can be a global value, or calculated based on position.
lst.makemarker = Crée un marqueur dans le monde.\nUn ID pour identifier le marqueur doit être donné.\nLes marqueurs sont limités à 20,000 par monde.
lst.setmarker = Change une propriété d'un marqueur.\nL'ID utilisé doit être le même que celui de l'instruction "Make Marker".
lst.localeprint = Add map locale property value to the text buffer.\nTo set map locale bundles in map editor, check [accent]Map Info > Locale Bundles[].\nIf client is a mobile device, tries to print a property ending in ".mobile" first.
Expand Down
Loading

0 comments on commit abf3456

Please sign in to comment.