Cleared unit timeouts on reset

This commit is contained in:
Anuken
2024-01-15 12:59:21 -05:00
parent 931c03945d
commit 944797f8e1

View File

@@ -14,6 +14,7 @@ import mindustry.core.*;
import mindustry.ctype.*;
import mindustry.entities.*;
import mindustry.game.*;
import mindustry.game.EventType.*;
import mindustry.game.MapObjectives.*;
import mindustry.game.Teams.*;
import mindustry.gen.*;
@@ -64,6 +65,10 @@ public class LExecutor{
//yes, this is a minor memory leak, but it's probably not significant enough to matter
protected static IntFloatMap unitTimeouts = new IntFloatMap();
static{
Events.on(ResetEvent.class, e -> unitTimeouts.clear());
}
boolean timeoutDone(Unit unit, float delay){
return Time.time >= unitTimeouts.get(unit.id) + delay;
}