Skip to content

Commit

Permalink
v0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
WMF-Industries committed Oct 6, 2024
1 parent 72e3062 commit 08acf03
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions assets/mod.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ displayName: "[cyan]FloodCompat"
name: "[cyan]FloodCompat"
author: "io community"
main: "floodcompat.floodcompat"
description: "Reduces desyncs & applies flood changes on join. [v0.5]"
version: "0.5"
description: "Reduces desyncs & applies flood changes on join. [v0.6]"
version: "0.6"
minGameVersion: 146
java: true
hidden: true
13 changes: 9 additions & 4 deletions src/floodcompat/floodcompat.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import arc.struct.ObjectSet;
import arc.struct.Seq;
import arc.util.*;
import mindustry.ai.UnitCommand;
import mindustry.content.*;
import mindustry.core.*;
import mindustry.entities.abilities.*;
Expand Down Expand Up @@ -34,6 +35,10 @@ public floodcompat(){
Log.info("Flood Compatibility loaded!");

Events.on(EventType.ContentInitEvent.class, e -> {
var cmds = new UnitCommand[]{UnitCommand.moveCommand, UnitCommand.boostCommand, UnitCommand.mineCommand};
pulsar.commands = cmds;
quasar.commands = cmds;

pulsarAbility = pulsar.abilities.first();
brydeAbility = bryde.abilities.first();
});
Expand All @@ -57,9 +62,7 @@ public floodcompat(){
state.rules.revealedBlocks.addAll(Blocks.coreShard, Blocks.scrapWall, Blocks.scrapWallLarge, Blocks.scrapWallHuge, Blocks.scrapWallGigantic);

Seq.with(scrapWall, titaniumWall, thoriumWall).each(w -> w.solid = false);
Seq.with(berylliumWall, tungstenWall, carbideWall).each(w -> {
w.insulated = w.absorbLasers = true;
});
Seq.with(berylliumWall, tungstenWall, carbideWall).each(w -> w.absorbLasers = true);
((Wall) phaseWall).chanceDeflect = 0;
((Wall) surgeWall).lightningChance = 0;
((Wall) reinforcedSurgeWall).lightningChance = 0;
Expand Down Expand Up @@ -205,11 +208,13 @@ public floodcompat(){
});

Events.on(EventType.WorldLoadEvent.class, e -> {
allTiles.clear();

// no delay if the client's hosting, that would break stuff!
int delay = net.client() ? 3 : 0;
flood = false;

if(delay > 0) Call.serverPacketReliable("flood", "0.5");
if(delay > 0) Call.serverPacketReliable("flood", "0.6");
Timer.schedule(() -> {
// this is for cleanup only
if(!flood && enabled){
Expand Down

0 comments on commit 08acf03

Please sign in to comment.