Validate teams with power links

This commit is contained in:
Anuken
2021-02-11 12:03:11 -05:00
parent 4fe5972d89
commit 0350e6bbf4
4 changed files with 5 additions and 4 deletions

View File

@@ -792,6 +792,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
for(Building other : proximity){ for(Building other : proximity){
if(other != null && other.power != null if(other != null && other.power != null
&& other.team == team
&& !(block.consumesPower && other.block.consumesPower && !block.outputsPower && !other.block.outputsPower) && !(block.consumesPower && other.block.consumesPower && !block.outputsPower && !other.block.outputsPower)
&& conductsTo(other) && other.conductsTo(self()) && !power.links.contains(other.pos())){ && conductsTo(other) && other.conductsTo(self()) && !power.links.contains(other.pos())){
out.add(other); out.add(other);
@@ -800,7 +801,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
for(int i = 0; i < power.links.size; i++){ for(int i = 0; i < power.links.size; i++){
Tile link = world.tile(power.links.get(i)); Tile link = world.tile(power.links.get(i));
if(link != null && link.build != null && link.build.power != null) out.add(link.build); if(link != null && link.build != null && link.build.power != null && link.build.team == team) out.add(link.build);
} }
return out; return out;
} }

View File

@@ -98,7 +98,7 @@ public class TractorBeamTurret extends BaseTurret{
any = false; any = false;
//look at target //look at target
if(target != null && target.within(this, range) && target.team() != team && target.checkTarget(targetAir, targetGround) && efficiency() > 0.02f){ if(target != null && target.within(this, range + target.hitSize/2f) && target.team() != team && target.checkTarget(targetAir, targetGround) && efficiency() > 0.02f){
if(!headless){ if(!headless){
control.sound.loop(shootSound, this, shootSoundVolume); control.sound.loop(shootSound, this, shootSoundVolume);
} }

View File

@@ -95,7 +95,7 @@ public class RepairPoint extends Block{
@Override @Override
public void updateTile(){ public void updateTile(){
boolean targetIsBeingRepaired = false; boolean targetIsBeingRepaired = false;
if(target != null && (target.dead() || target.dst(tile) > repairRadius || target.health() >= target.maxHealth())){ if(target != null && (target.dead() || target.dst(tile) - target.hitSize/2f > repairRadius || target.health() >= target.maxHealth())){
target = null; target = null;
}else if(target != null && consValid()){ }else if(target != null && consValid()){
target.heal(repairSpeed * Time.delta * strength * efficiency()); target.heal(repairSpeed * Time.delta * strength * efficiency());

View File

@@ -1,3 +1,3 @@
org.gradle.daemon=true org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=5b04a94d53e279e3af3a2654978fff5ab16e7cb8 archash=d23d0f0b3625ab2d7d97e6c89a773ab6a4ad8434