mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-25 05:51:47 -08:00
Replacement method bugfixes
This commit is contained in:
parent
aae6d2038b
commit
08af9aaa02
2 changed files with 15 additions and 2 deletions
|
|
@ -572,6 +572,8 @@ public class EntityProcess extends BaseProcessor{
|
|||
//implement each definition
|
||||
for(EntityDefinition def : definitions){
|
||||
|
||||
ObjectSet<String> methodNames = def.components.flatMap(type -> type.methods().map(Smethod::simpleString)).<String>as().asSet();
|
||||
|
||||
//get interface for each component
|
||||
for(Stype comp : def.components){
|
||||
|
||||
|
|
@ -588,8 +590,8 @@ public class EntityProcess extends BaseProcessor{
|
|||
for(Smethod method : inter.methods()){
|
||||
String var = method.name();
|
||||
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
|
||||
if(field == null || comp.methods().contains(m -> m.simpleString().equals(method.simpleString()))) continue;
|
||||
//make sure it's a real variable AND that the component doesn't already implement it somewhere with custom logic
|
||||
if(field == null || methodNames.contains(method.simpleString())) continue;
|
||||
|
||||
//getter
|
||||
if(!method.isVoid()){
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package mindustry.entities.comp;
|
|||
|
||||
import arc.util.ArcAnnotate.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
import static mindustry.Vars.tilesize;
|
||||
|
|
@ -29,4 +30,14 @@ abstract class BlockUnitComp implements Unitc{
|
|||
public void damage(float v, boolean b){
|
||||
tile.damage(v, b);
|
||||
}
|
||||
|
||||
@Replace
|
||||
public boolean dead(){
|
||||
return tile.dead();
|
||||
}
|
||||
|
||||
@Replace
|
||||
public void team(Team team){
|
||||
tile.team(team);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue