Replacement method bugfixes
This commit is contained in:
@@ -572,6 +572,8 @@ public class EntityProcess extends BaseProcessor{
|
|||||||
//implement each definition
|
//implement each definition
|
||||||
for(EntityDefinition def : definitions){
|
for(EntityDefinition def : definitions){
|
||||||
|
|
||||||
|
ObjectSet<String> methodNames = def.components.flatMap(type -> type.methods().map(Smethod::simpleString)).<String>as().asSet();
|
||||||
|
|
||||||
//get interface for each component
|
//get interface for each component
|
||||||
for(Stype comp : def.components){
|
for(Stype comp : def.components){
|
||||||
|
|
||||||
@@ -588,8 +590,8 @@ public class EntityProcess extends BaseProcessor{
|
|||||||
for(Smethod method : inter.methods()){
|
for(Smethod method : inter.methods()){
|
||||||
String var = method.name();
|
String var = method.name();
|
||||||
FieldSpec field = Array.with(def.builder.fieldSpecs).find(f -> f.name.equals(var));
|
FieldSpec field = Array.with(def.builder.fieldSpecs).find(f -> f.name.equals(var));
|
||||||
//make sure it's a real variable AND that the component doesn't already implement it with custom logic
|
//make sure it's a real variable AND that the component doesn't already implement it somewhere with custom logic
|
||||||
if(field == null || comp.methods().contains(m -> m.simpleString().equals(method.simpleString()))) continue;
|
if(field == null || methodNames.contains(method.simpleString())) continue;
|
||||||
|
|
||||||
//getter
|
//getter
|
||||||
if(!method.isVoid()){
|
if(!method.isVoid()){
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package mindustry.entities.comp;
|
|||||||
|
|
||||||
import arc.util.ArcAnnotate.*;
|
import arc.util.ArcAnnotate.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
|
||||||
import static mindustry.Vars.tilesize;
|
import static mindustry.Vars.tilesize;
|
||||||
@@ -29,4 +30,14 @@ abstract class BlockUnitComp implements Unitc{
|
|||||||
public void damage(float v, boolean b){
|
public void damage(float v, boolean b){
|
||||||
tile.damage(v, b);
|
tile.damage(v, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Replace
|
||||||
|
public boolean dead(){
|
||||||
|
return tile.dead();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Replace
|
||||||
|
public void team(Team team){
|
||||||
|
tile.team(team);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user