Skip to content

Commit

Permalink
moment
Browse files Browse the repository at this point in the history
  • Loading branch information
WMF-Industries committed Jan 3, 2024
1 parent 6feb886 commit 8a8d959
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/floodcompat/floodcompat.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import arc.struct.Seq;
import arc.util.*;
import mindustry.content.*;
import mindustry.core.*;
import mindustry.entities.abilities.*;
import mindustry.entities.bullet.*;
import mindustry.game.*;
Expand All @@ -19,7 +20,7 @@
import static mindustry.Vars.*;

public class floodcompat extends Mod{
boolean flood, applied;
boolean flood, applied, enabled;
Ability pulsarAbility, brydeAbility;
public floodcompat(){
Log.info("Flood Compatibility loaded!");
Expand All @@ -29,6 +30,13 @@ public floodcompat(){
brydeAbility = bryde.abilities.first();
});

Events.on(EventType.ClientLoadEvent.class, e -> {
if(Structs.contains(Version.class.getDeclaredFields(), var -> var.getName().equals("foos"))){
ui.showInfo("[accent]Foo's Client [scarlet]detected, [cyan]FloodCompat[] is unnecessary!");
enabled = false;
}else enabled = true;
});

netClient.addPacketHandler("flood", (integer) -> {
if(Strings.canParseInt(integer)){
flood = true;
Expand Down Expand Up @@ -129,10 +137,7 @@ public floodcompat(){
});

Events.on(EventType.WorldLoadEvent.class, e -> {
if(Structs.contains(Version.class.getDeclaredFields(), var -> var.getName().equals("foos"))){
ui.chatfrag.addMessage("[scarlet]Foo's Client detected, FloodCompat is unnecessary!");
return;
}
if(!enabled) return;
// no delay if the client's hosting, that would break stuff!
int delay = net.client() ? 3 : 0;
flood = false;
Expand Down

0 comments on commit 8a8d959

Please sign in to comment.