mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-10-01 18:50:27 +03:00
Fixed #12603
This commit is contained in:
@@ -52,13 +52,11 @@ abstract class PayloadComp implements Posc, Rotc, Hitboxc, Unitc{
|
||||
}
|
||||
|
||||
for(Payload pay : payloads){
|
||||
//apparently BasedUser doesn't want this and several plugins use it
|
||||
//if(pay instanceof BuildPayload build){
|
||||
// build.build.team = team;
|
||||
//}
|
||||
pay.set(x, y, rotation);
|
||||
pay.update(self(), null);
|
||||
}
|
||||
//remove dead payloads after they explode
|
||||
payloads.removeAll(Payload::isDead);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,6 +38,11 @@ public class BuildPayload implements Payload{
|
||||
build.dropped();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDead(){
|
||||
return build.dead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contentEquals(Payload other){
|
||||
return other instanceof BuildPayload bp && bp.block() == build.block;
|
||||
|
||||
@@ -41,6 +41,11 @@ public interface Payload extends Position{
|
||||
/** update this payload inside a container unit or building. either can be null. */
|
||||
default void update(@Nullable Unit unitHolder, @Nullable Building buildingHolder){}
|
||||
|
||||
/** @return if this payload died for whatever reason (e.g. reactor/combustion generator exploding itself) */
|
||||
default boolean isDead(){
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @return whether this payload was dumped. */
|
||||
default boolean dump(){
|
||||
return false;
|
||||
|
||||
@@ -168,6 +168,9 @@ public class PayloadBlock extends Block{
|
||||
public void updateTile(){
|
||||
if(payload != null){
|
||||
payload.update(null, this);
|
||||
if(payload.isDead()){
|
||||
payload = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -134,9 +134,14 @@ public class PayloadConveyor extends Block{
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
if(item != null){
|
||||
item.update(null, this);
|
||||
if(item.isDead()){
|
||||
item = null;
|
||||
}
|
||||
}
|
||||
|
||||
if(enabled){
|
||||
if(item != null) item.update(null, this);
|
||||
lastInterp = curInterp;
|
||||
curInterp = fract();
|
||||
//rollover skip
|
||||
|
||||
@@ -51,6 +51,9 @@ public class PayloadUnloader extends PayloadLoader{
|
||||
public void updateTile(){
|
||||
if(payload != null){
|
||||
payload.update(null, this);
|
||||
if(payload.isDead()){
|
||||
payload = null;
|
||||
}
|
||||
}
|
||||
lastOutputPower = 0f;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user