diff --git a/core/assets/scripts/global.js b/core/assets/scripts/global.js index 37b756544e..bcc2247d9f 100755 --- a/core/assets/scripts/global.js +++ b/core/assets/scripts/global.js @@ -191,6 +191,7 @@ const PlayEvent = Packages.mindustry.game.EventType.PlayEvent const DisposeEvent = Packages.mindustry.game.EventType.DisposeEvent const ServerLoadEvent = Packages.mindustry.game.EventType.ServerLoadEvent const ClientCreateEvent = Packages.mindustry.game.EventType.ClientCreateEvent +const SaveWriteEvent = Packages.mindustry.game.EventType.SaveWriteEvent const SaveLoadEvent = Packages.mindustry.game.EventType.SaveLoadEvent const MapPublishEvent = Packages.mindustry.game.EventType.MapPublishEvent const MapMakeEvent = Packages.mindustry.game.EventType.MapMakeEvent diff --git a/core/src/mindustry/core/Renderer.java b/core/src/mindustry/core/Renderer.java index 5ba0320cde..61e44b011e 100644 --- a/core/src/mindustry/core/Renderer.java +++ b/core/src/mindustry/core/Renderer.java @@ -299,6 +299,7 @@ public class Renderer implements ApplicationListener{ Draw.draw(Layer.overlayUI, overlays::drawTop); Draw.draw(Layer.space, this::drawLanding); + Events.fire(Trigger.drawOver); blocks.drawBlocks(); Groups.draw.draw(Drawc::draw); diff --git a/core/src/mindustry/game/EventType.java b/core/src/mindustry/game/EventType.java index 91055acf87..ce55dc5ca0 100644 --- a/core/src/mindustry/game/EventType.java +++ b/core/src/mindustry/game/EventType.java @@ -33,6 +33,7 @@ public class EventType{ socketConfigChanged, update, draw, + drawOver, preDraw, postDraw, uiDrawBegin, @@ -50,6 +51,7 @@ public class EventType{ public static class ResizeEvent{} public static class MapMakeEvent{} public static class MapPublishEvent{} + public static class SaveWriteEvent{} public static class SaveLoadEvent{} public static class ClientCreateEvent{} public static class ServerLoadEvent{} @@ -503,7 +505,7 @@ public class EventType{ this.player = player; } } - + public static class PlayerBanEvent{ @Nullable public final Player player; @@ -514,7 +516,7 @@ public class EventType{ this.uuid = uuid; } } - + public static class PlayerUnbanEvent{ @Nullable public final Player player; @@ -525,7 +527,7 @@ public class EventType{ this.uuid = uuid; } } - + public static class PlayerIpBanEvent{ public final String ip; @@ -533,7 +535,7 @@ public class EventType{ this.ip = ip; } } - + public static class PlayerIpUnbanEvent{ public final String ip; @@ -541,6 +543,5 @@ public class EventType{ this.ip = ip; } } - -} +} diff --git a/core/src/mindustry/io/SaveIO.java b/core/src/mindustry/io/SaveIO.java index 0f38a05063..570afca073 100644 --- a/core/src/mindustry/io/SaveIO.java +++ b/core/src/mindustry/io/SaveIO.java @@ -113,13 +113,17 @@ public class SaveIO{ public static void write(OutputStream os, StringMap tags){ try(DataOutputStream stream = new DataOutputStream(os)){ + SaveVersion ver = getVersion(); + stream.write(header); - stream.writeInt(getVersion().version); + stream.writeInt(ver.version); if(tags == null){ - getVersion().write(stream); + ver.write(stream); }else{ - getVersion().write(stream, tags); + ver.write(stream, tags); } + + Events.fire(new SaveWriteEvent()); }catch(Throwable e){ throw new RuntimeException(e); }