Fix loop sound persisting after the payload carrier is removed. (#8034)
* Properly remove units and blocks in the case that the carrier dies * added = false --------- Co-authored-by: Anuken <arnukren@gmail.com>
This commit is contained in:
@@ -2089,6 +2089,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
|
||||
@Override
|
||||
public void remove(){
|
||||
stopSound();
|
||||
}
|
||||
|
||||
public void stopSound(){
|
||||
if(sound != null){
|
||||
sound.stop();
|
||||
}
|
||||
|
||||
@@ -61,6 +61,13 @@ abstract class PayloadComp implements Posc, Rotc, Hitboxc, Unitc{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(){
|
||||
for(Payload pay : payloads){
|
||||
pay.remove();
|
||||
}
|
||||
payloads.clear();
|
||||
}
|
||||
|
||||
public void destroy(){
|
||||
if(Vars.state.rules.unitPayloadsExplode) payloads.each(Payload::destroyed);
|
||||
}
|
||||
|
||||
@@ -82,6 +82,11 @@ public class BuildPayload implements Payload{
|
||||
return build.block.size * tilesize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(){
|
||||
build.stopSound();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Writes write){
|
||||
write.b(payloadBlock);
|
||||
|
||||
@@ -75,6 +75,8 @@ public interface Payload extends Position{
|
||||
return y();
|
||||
}
|
||||
|
||||
default void remove(){}
|
||||
|
||||
static void write(@Nullable Payload payload, Writes write){
|
||||
if(payload == null){
|
||||
write.bool(false);
|
||||
|
||||
Reference in New Issue
Block a user