Power pickup bugfixes

This commit is contained in:
Anuken
2021-11-01 09:41:33 -04:00
parent e1bf1a1b92
commit 0639e3eedb
2 changed files with 9 additions and 5 deletions

View File

@@ -1293,16 +1293,19 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
return true;
}
/** Called right before this building is picked up. */
public void pickedUp(){
}
/** Called right after this building is picked up. */
public void afterPickedUp(){
if(power != null){
if(power.graph != null){
power.graph.removeList(self());
power.graph = new PowerGraph();
}
power.graph = new PowerGraph();
power.links.clear();
power.status = 0f;
}
}
public void removeFromProximity(){

View File

@@ -93,6 +93,7 @@ abstract class PayloadComp implements Posc, Rotc, Hitboxc, Unitc{
void pickup(Building tile){
tile.pickedUp();
tile.tile.remove();
tile.afterPickedUp();
addPayload(new BuildPayload(tile));
Fx.unitPickup.at(tile);
Events.fire(new PickupEvent(self(), tile));