mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-08 01:43:59 +07:00
Payload unit destroy on derelict
This commit is contained in:
parent
8b2b5d4682
commit
c0e4c9c5b5
@ -8,6 +8,7 @@ import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.ai.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
@ -359,6 +360,10 @@ public class Teams{
|
||||
//TODO this may cause a lot of packet spam, optimize?
|
||||
Call.setTeam(build, Team.derelict);
|
||||
|
||||
if(build.getPayload() instanceof UnitPayload){
|
||||
Call.destroyPayload(build);
|
||||
}
|
||||
|
||||
if(Mathf.chance(0.25)){
|
||||
Time.run(Mathf.random(0f, 60f * 6f), build::kill);
|
||||
}
|
||||
@ -425,6 +430,14 @@ public class Teams{
|
||||
}
|
||||
}
|
||||
|
||||
@Remote(called = Loc.server, unreliable = true)
|
||||
public static void destroyPayload(Building build){
|
||||
if(build != null && build.getPayload() instanceof UnitPayload && build.takePayload() instanceof UnitPayload unit){
|
||||
unit.dump();
|
||||
unit.unit.killed();
|
||||
}
|
||||
}
|
||||
|
||||
/** Represents a block made by this team that was destroyed somewhere on the map.
|
||||
* This does not include deconstructed blocks.*/
|
||||
public static class BlockPlan{
|
||||
|
Loading…
Reference in New Issue
Block a user