From 8576d535bd8d83ae278c4d6acadc6337a3154e7b Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 3 Jul 2020 18:48:31 -0400 Subject: [PATCH] Removed "on" prefix from all remote methods --- .../remote/RemoteWriteGenerator.java | 2 +- core/src/mindustry/ai/BlockIndexer.java | 6 +-- core/src/mindustry/core/Control.java | 2 +- core/src/mindustry/core/Logic.java | 2 +- core/src/mindustry/core/NetClient.java | 40 +++++++++---------- core/src/mindustry/core/NetServer.java | 26 ++++++------ core/src/mindustry/entities/Units.java | 2 +- .../mindustry/entities/comp/BuilderComp.java | 2 +- .../mindustry/entities/comp/BuildingComp.java | 28 ++++++++++++- .../src/mindustry/entities/comp/UnitComp.java | 2 +- core/src/mindustry/input/DesktopInput.java | 6 +-- core/src/mindustry/input/InputHandler.java | 16 ++++---- core/src/mindustry/net/Net.java | 2 +- core/src/mindustry/net/NetConnection.java | 4 +- .../mindustry/ui/fragments/HudFragment.java | 2 +- .../ui/fragments/PlayerListFragment.java | 6 +-- core/src/mindustry/world/Tile.java | 18 ++++----- .../mindustry/world/blocks/BuildBlock.java | 8 ++-- .../world/blocks/distribution/MassDriver.java | 4 +- .../world/blocks/storage/CoreBlock.java | 4 +- .../world/blocks/units/UnitBlock.java | 4 +- .../src/mindustry/server/ServerControl.java | 6 +-- 22 files changed, 108 insertions(+), 84 deletions(-) diff --git a/annotations/src/main/java/mindustry/annotations/remote/RemoteWriteGenerator.java b/annotations/src/main/java/mindustry/annotations/remote/RemoteWriteGenerator.java index f048c23d60..ab80d5b563 100644 --- a/annotations/src/main/java/mindustry/annotations/remote/RemoteWriteGenerator.java +++ b/annotations/src/main/java/mindustry/annotations/remote/RemoteWriteGenerator.java @@ -66,7 +66,7 @@ public class RemoteWriteGenerator{ //create builder MethodSpec.Builder method = MethodSpec.methodBuilder(elem.getSimpleName().toString() + (forwarded ? "__forward" : "")) //add except suffix when forwarding - .addModifiers(Modifier.STATIC, Modifier.SYNCHRONIZED) + .addModifiers(Modifier.STATIC) .returns(void.class); //forwarded methods aren't intended for use, and are not public diff --git a/core/src/mindustry/ai/BlockIndexer.java b/core/src/mindustry/ai/BlockIndexer.java index 36c0c64959..dacdd6e8cb 100644 --- a/core/src/mindustry/ai/BlockIndexer.java +++ b/core/src/mindustry/ai/BlockIndexer.java @@ -210,11 +210,11 @@ public class BlockIndexer{ } public void notifyTileDamaged(Building entity){ - if(damagedTiles[(int)entity.team().id] == null){ - damagedTiles[(int)entity.team().id] = new TileArray(); + if(damagedTiles[entity.team().id] == null){ + damagedTiles[entity.team().id] = new TileArray(); } - TileArray set = damagedTiles[(int)entity.team().id]; + TileArray set = damagedTiles[entity.team().id]; set.add(entity.tile()); } diff --git a/core/src/mindustry/core/Control.java b/core/src/mindustry/core/Control.java index 2863d72f40..dc34511ddd 100644 --- a/core/src/mindustry/core/Control.java +++ b/core/src/mindustry/core/Control.java @@ -111,7 +111,7 @@ public class Control implements ApplicationListener, Loadable{ state.stats.wavesLasted = state.wave; Effects.shake(5, 6, Core.camera.position.x, Core.camera.position.y); //the restart dialog can show info for any number of scenarios - Call.onGameOver(event.winner); + Call.gameOver(event.winner); }); //autohost for pvp maps diff --git a/core/src/mindustry/core/Logic.java b/core/src/mindustry/core/Logic.java index 428aa0fec2..7aad8957a7 100644 --- a/core/src/mindustry/core/Logic.java +++ b/core/src/mindustry/core/Logic.java @@ -294,7 +294,7 @@ public class Logic implements ApplicationListener{ } @Remote(called = Loc.both) - public static void onGameOver(Team winner){ + public static void gameOver(Team winner){ state.stats.wavesLasted = state.wave; ui.restart.show(winner); netClient.setQuiet(); diff --git a/core/src/mindustry/core/NetClient.java b/core/src/mindustry/core/NetClient.java index 15649dafb5..317e74cbbb 100644 --- a/core/src/mindustry/core/NetClient.java +++ b/core/src/mindustry/core/NetClient.java @@ -230,7 +230,7 @@ public class NetClient implements ApplicationListener{ } @Remote(called = Loc.client, variants = Variant.one) - public static void onConnect(String ip, int port){ + public static void connect(String ip, int port){ netClient.disconnectQuietly(); logic.reset(); @@ -238,24 +238,24 @@ public class NetClient implements ApplicationListener{ } @Remote(targets = Loc.client) - public static void onPing(Player player, long time){ - Call.onPingResponse(player.con, time); + public static void ping(Player player, long time){ + Call.pingResponse(player.con, time); } @Remote(variants = Variant.one) - public static void onPingResponse(long time){ + public static void pingResponse(long time){ netClient.ping = Time.timeSinceMillis(time); } @Remote(variants = Variant.one) - public static void onTraceInfo(Player player, TraceInfo info){ + public static void traceInfo(Player player, TraceInfo info){ if(player != null){ ui.traces.show(player, info); } } @Remote(variants = Variant.one, priority = PacketPriority.high) - public static void onKick(KickReason reason){ + public static void kick(KickReason reason){ netClient.disconnectQuietly(); logic.reset(); @@ -270,7 +270,7 @@ public class NetClient implements ApplicationListener{ } @Remote(variants = Variant.one, priority = PacketPriority.high) - public static void onKick(String reason){ + public static void kick(String reason){ netClient.disconnectQuietly(); logic.reset(); ui.showText("$disconnect", reason, Align.left); @@ -296,21 +296,21 @@ public class NetClient implements ApplicationListener{ } @Remote(variants = Variant.both) - public static void onInfoMessage(String message){ + public static void infoMessage(String message){ if(message == null) return; ui.showText("", message); } @Remote(variants = Variant.both) - public static void onInfoPopup(String message, float duration, int align, int top, int left, int bottom, int right){ + public static void infoPopup(String message, float duration, int align, int top, int left, int bottom, int right){ if(message == null) return; ui.showInfoPopup(message, duration, align, top, left, bottom, right); } @Remote(variants = Variant.both) - public static void onLabel(String message, float duration, float worldx, float worldy){ + public static void label(String message, float duration, float worldx, float worldy){ if(message == null) return; ui.showLabel(message, duration, worldx, worldy); @@ -330,19 +330,19 @@ public class NetClient implements ApplicationListener{ }*/ @Remote(variants = Variant.both) - public static void onInfoToast(String message, float duration){ + public static void infoToast(String message, float duration){ if(message == null) return; ui.showInfoToast(message, duration); } @Remote(variants = Variant.both) - public static void onSetRules(Rules rules){ + public static void setRules(Rules rules){ state.rules = rules; } @Remote(variants = Variant.both) - public static void onWorldDataBegin(){ + public static void worldDataBegin(){ Groups.all.clear(); netClient.removed.clear(); logic.reset(); @@ -360,17 +360,17 @@ public class NetClient implements ApplicationListener{ } @Remote(variants = Variant.one) - public static void onPositionSet(float x, float y){ + public static void setPosition(float x, float y){ player.set(x, y); } @Remote - public static void onPlayerDisconnect(int playerid){ + public static void playerDisconnect(int playerid){ Groups.player.removeByID(playerid); } @Remote(variants = Variant.one, priority = PacketPriority.low, unreliable = true) - public static void onEntitySnapshot(short amount, short dataLen, byte[] data){ + public static void entitySnapshot(short amount, short dataLen, byte[] data){ try{ netClient.byteStream.setBytes(net.decompressSnapshot(data, dataLen)); DataInputStream input = netClient.dataStream; @@ -417,7 +417,7 @@ public class NetClient implements ApplicationListener{ } @Remote(variants = Variant.both, priority = PacketPriority.low, unreliable = true) - public static void onBlockSnapshot(short amount, short dataLen, byte[] data){ + public static void blockSnapshot(short amount, short dataLen, byte[] data){ try{ netClient.byteStream.setBytes(net.decompressSnapshot(data, dataLen)); DataInputStream input = netClient.dataStream; @@ -437,7 +437,7 @@ public class NetClient implements ApplicationListener{ } @Remote(variants = Variant.one, priority = PacketPriority.low, unreliable = true) - public static void onStateSnapshot(float waveTime, int wave, int enemies, boolean paused, short coreDataLen, byte[] coreData){ + public static void stateSnapshot(float waveTime, int wave, int enemies, boolean paused, short coreDataLen, byte[] coreData){ try{ if(wave > state.wave){ state.wave = wave; @@ -565,7 +565,7 @@ public class NetClient implements ApplicationListener{ Unit unit = player.dead() ? Nulls.unit : player.unit(); - Call.onClientShapshot(lastSent++, + Call.clientShapshot(lastSent++, unit.x, unit.y, player.unit().aimX(), player.unit().aimY(), unit.rotation, @@ -579,7 +579,7 @@ public class NetClient implements ApplicationListener{ } if(timer.get(1, 60)){ - Call.onPing(Time.millis()); + Call.ping(Time.millis()); } } diff --git a/core/src/mindustry/core/NetServer.java b/core/src/mindustry/core/NetServer.java index 4d0ec6e305..210e4650da 100644 --- a/core/src/mindustry/core/NetServer.java +++ b/core/src/mindustry/core/NetServer.java @@ -162,7 +162,7 @@ public class NetServer implements ApplicationListener{ info.lastName = packet.name; info.id = packet.uuid; admins.save(); - Call.onInfoMessage(con, "You are not whitelisted here."); + Call.infoMessage(con, "You are not whitelisted here."); Log.info("&lcDo &lywhitelist-add @&lc to whitelist the player &lb'@'", packet.uuid, packet.name); con.kick(KickReason.whitelist); return; @@ -453,7 +453,7 @@ public class NetServer implements ApplicationListener{ } player.getInfo().lastSyncTime = Time.millis(); - Call.onWorldDataBegin(player.con); + Call.worldDataBegin(player.con); netServer.sendWorldData(player); } }); @@ -501,7 +501,7 @@ public class NetServer implements ApplicationListener{ if(player.con.hasConnected){ Events.fire(new PlayerLeave(player)); if(Config.showConnectMessages.bool()) Call.sendMessage("[accent]" + player.name + "[accent] has disconnected."); - Call.onPlayerDisconnect(player.id()); + Call.playerDisconnect(player.id()); } if(Config.showConnectMessages.bool()) Log.info("&lm[@] &lc@ has disconnected. &lg&fi(@)", player.uuid(), player.name, reason); @@ -526,7 +526,7 @@ public class NetServer implements ApplicationListener{ } @Remote(targets = Loc.client, unreliable = true) - public static void onClientShapshot( + public static void clientShapshot( Player player, int snapshotID, float x, float y, @@ -633,7 +633,7 @@ public class NetServer implements ApplicationListener{ newx = x; newy = y; }else if(!Mathf.within(x, y, newx, newy, correctDist)){ - Call.onPositionSet(player.con, newx, newy); //teleport and correct position when necessary + Call.setPosition(player.con, newx, newy); //teleport and correct position when necessary } //reset player to previous synced position so it gets interpolated @@ -666,7 +666,7 @@ public class NetServer implements ApplicationListener{ } @Remote(targets = Loc.client, called = Loc.server) - public static void onAdminRequest(Player player, Player other, AdminAction action){ + public static void adminRequest(Player player, Player other, AdminAction action){ if(!player.admin){ Log.warn("ACCESS DENIED: Player @ / @ attempted to perform admin action without proper security access.", @@ -693,9 +693,9 @@ public class NetServer implements ApplicationListener{ }else if(action == AdminAction.trace){ TraceInfo info = new TraceInfo(other.con.address, other.uuid(), other.con.modclient, other.con.mobile); if(player.con != null){ - Call.onTraceInfo(player.con, other, info); + Call.traceInfo(player.con, other, info); }else{ - NetClient.onTraceInfo(other, info); + NetClient.traceInfo(other, info); } Log.info("&lc@ has requested trace info of @.", player.name, other.name); } @@ -785,7 +785,7 @@ public class NetServer implements ApplicationListener{ if(syncStream.size() > maxSnapshotSize){ dataStream.close(); byte[] stateBytes = syncStream.toByteArray(); - Call.onBlockSnapshot(sent, (short)stateBytes.length, net.compressSnapshot(stateBytes)); + Call.blockSnapshot(sent, (short)stateBytes.length, net.compressSnapshot(stateBytes)); sent = 0; syncStream.reset(); } @@ -794,7 +794,7 @@ public class NetServer implements ApplicationListener{ if(sent > 0){ dataStream.close(); byte[] stateBytes = syncStream.toByteArray(); - Call.onBlockSnapshot(sent, (short)stateBytes.length, net.compressSnapshot(stateBytes)); + Call.blockSnapshot(sent, (short)stateBytes.length, net.compressSnapshot(stateBytes)); } } @@ -813,7 +813,7 @@ public class NetServer implements ApplicationListener{ byte[] stateBytes = syncStream.toByteArray(); //write basic state data. - Call.onStateSnapshot(player.con, state.wavetime, state.wave, state.enemies, state.serverPaused, (short)stateBytes.length, net.compressSnapshot(stateBytes)); + Call.stateSnapshot(player.con, state.wavetime, state.wave, state.enemies, state.serverPaused, (short)stateBytes.length, net.compressSnapshot(stateBytes)); viewport.setSize(player.con.viewWidth, player.con.viewHeight).setCenter(player.con.viewX, player.con.viewY); @@ -832,7 +832,7 @@ public class NetServer implements ApplicationListener{ if(syncStream.size() > maxSnapshotSize){ dataStream.close(); byte[] syncBytes = syncStream.toByteArray(); - Call.onEntitySnapshot(player.con, (short)sent, (short)syncBytes.length, net.compressSnapshot(syncBytes)); + Call.entitySnapshot(player.con, (short)sent, (short)syncBytes.length, net.compressSnapshot(syncBytes)); sent = 0; syncStream.reset(); } @@ -842,7 +842,7 @@ public class NetServer implements ApplicationListener{ dataStream.close(); byte[] syncBytes = syncStream.toByteArray(); - Call.onEntitySnapshot(player.con, (short)sent, (short)syncBytes.length, net.compressSnapshot(syncBytes)); + Call.entitySnapshot(player.con, (short)sent, (short)syncBytes.length, net.compressSnapshot(syncBytes)); } } diff --git a/core/src/mindustry/entities/Units.java b/core/src/mindustry/entities/Units.java index ea45bbff6f..0248e33688 100644 --- a/core/src/mindustry/entities/Units.java +++ b/core/src/mindustry/entities/Units.java @@ -17,7 +17,7 @@ public class Units{ private static boolean boolResult; @Remote(called = Loc.server) - public static void onUnitDeath(Unit unit){ + public static void unitDeath(Unit unit){ unit.killed(); } diff --git a/core/src/mindustry/entities/comp/BuilderComp.java b/core/src/mindustry/entities/comp/BuilderComp.java index 7fb4bb4345..d6d67c21bf 100644 --- a/core/src/mindustry/entities/comp/BuilderComp.java +++ b/core/src/mindustry/entities/comp/BuilderComp.java @@ -118,7 +118,7 @@ abstract class BuilderComp implements Unitc{ }else{ if(entity.construct(base(), core, 1f / entity.buildCost * Time.delta() * type().buildSpeed * state.rules.buildSpeedMultiplier, current.hasConfig)){ if(current.hasConfig){ - Call.onTileConfig(null, tile.build, current.config); + Call.tileConfig(null, tile.build, current.config); } } } diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index ebea044ba2..df71b5b800 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -174,12 +174,12 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, public void configure(Object value){ //save last used config block.lastConfig = value; - Call.onTileConfig(player, base(), value); + Call.tileConfig(player, base(), value); } /** Configure from a server. */ public void configureAny(Object value){ - Call.onTileConfig(null, base(), value); + Call.tileConfig(null, base(), value); } /** Deselect this tile from configuration. */ @@ -1128,6 +1128,30 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, return tile.build == base() && !dead(); } + @Replace + @Override + public void kill(){ + Call.tileDestroyed(base()); + } + + @Replace + @Override + public void damage(float damage){ + if(dead()) return; + + if(Mathf.zero(state.rules.blockHealthMultiplier)){ + damage = health + 1; + }else{ + damage /= state.rules.blockHealthMultiplier; + } + + Call.tileDamage(base(), health - handleDamage(damage)); + + if(health <= 0){ + Call.tileDestroyed(base()); + } + } + @Override public void remove(){ if(sound != null){ diff --git a/core/src/mindustry/entities/comp/UnitComp.java b/core/src/mindustry/entities/comp/UnitComp.java index 1702d0bd96..9f151bd11a 100644 --- a/core/src/mindustry/entities/comp/UnitComp.java +++ b/core/src/mindustry/entities/comp/UnitComp.java @@ -262,6 +262,6 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I if(dead || net.client()) return; //deaths are synced; this calls killed() - Call.onUnitDeath(base()); + Call.unitDeath(base()); } } diff --git a/core/src/mindustry/input/DesktopInput.java b/core/src/mindustry/input/DesktopInput.java index e54642bf86..edd418da71 100644 --- a/core/src/mindustry/input/DesktopInput.java +++ b/core/src/mindustry/input/DesktopInput.java @@ -205,7 +205,7 @@ public class DesktopInput extends InputHandler{ if(Core.input.keyDown(Binding.control) && Core.input.keyTap(Binding.select)){ Unit on = selectedUnit(); if(on != null){ - Call.onUnitControl(player, on); + Call.unitControl(player, on); shouldShoot = false; } } @@ -215,7 +215,7 @@ public class DesktopInput extends InputHandler{ updateMovement(player.unit()); if(Core.input.keyDown(Binding.respawn) && !player.unit().spawnedByCore()){ - Call.onUnitClear(player); + Call.unitClear(player); controlledType = null; } } @@ -621,7 +621,7 @@ public class DesktopInput extends InputHandler{ if(unit instanceof Commanderc){ if(Core.input.keyTap(Binding.command)){ - Call.onUnitCommand(player); + Call.unitCommand(player); } } } diff --git a/core/src/mindustry/input/InputHandler.java b/core/src/mindustry/input/InputHandler.java index 2a504d9676..8254e2ba64 100644 --- a/core/src/mindustry/input/InputHandler.java +++ b/core/src/mindustry/input/InputHandler.java @@ -156,7 +156,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ } @Remote(targets = Loc.both, called = Loc.server, forward = true) - public static void onTileTapped(Player player, Building tile){ + public static void tileTapped(Player player, Building tile){ if(tile == null || player == null) return; if(net.server() && (!Units.canInteract(player, tile) || !netServer.admins.allowAction(player, ActionType.tapTile, tile.tile(), action -> {}))) throw new ValidateException(player, "Player cannot tap a tile."); @@ -165,7 +165,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ } @Remote(targets = Loc.both, called = Loc.both, forward = true) - public static void onTileConfig(Player player, Building tile, @Nullable Object value){ + public static void tileConfig(Player player, Building tile, @Nullable Object value){ if(tile == null) return; if(net.server() && (!Units.canInteract(player, tile) || !netServer.admins.allowAction(player, ActionType.configure, tile.tile(), action -> action.config = value))) throw new ValidateException(player, "Player cannot configure a tile."); @@ -174,7 +174,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ } @Remote(targets = Loc.both, called = Loc.server, forward = true) - public static void onUnitControl(Player player, @Nullable Unit unit){ + public static void unitControl(Player player, @Nullable Unit unit){ //clear player unit when they possess a core if((unit instanceof BlockUnitc && ((BlockUnitc)unit).tile() instanceof CoreEntity)){ Fx.spawn.at(player); @@ -193,7 +193,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ } @Remote(targets = Loc.both, called = Loc.server, forward = true) - public static void onUnitClear(Player player){ + public static void unitClear(Player player){ //no free core teleports? if(!player.dead() && player.unit().spawnedByCore) return; @@ -203,7 +203,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ } @Remote(targets = Loc.both, called = Loc.server, forward = true) - public static void onUnitCommand(Player player){ + public static void unitCommand(Player player){ if(player.dead() || !(player.unit() instanceof Commanderc)) return; Commanderc commander = (Commanderc)player.unit(); @@ -263,7 +263,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ Unit unit = Units.closest(player.team(), player.x, player.y, u -> !u.isPlayer() && u.type() == controlledType); if(unit != null){ - Call.onUnitControl(player, unit); + Call.unitControl(player, unit); } } } @@ -277,7 +277,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ if(unit != null){ if(net.client()){ - Call.onUnitControl(player, unit); + Call.unitControl(player, unit); }else{ unit.controller(player); } @@ -695,7 +695,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ //call tapped event if(!consumed && tile.interactable(player.team())){ - Call.onTileTapped(player, tile); + Call.tileTapped(player, tile); } //consume tap event if necessary diff --git a/core/src/mindustry/net/Net.java b/core/src/mindustry/net/Net.java index f99ec4d495..5101d237ee 100644 --- a/core/src/mindustry/net/Net.java +++ b/core/src/mindustry/net/Net.java @@ -138,7 +138,7 @@ public class Net{ */ public void closeServer(){ for(NetConnection con : getConnections()){ - Call.onKick(con, KickReason.serverClose); + Call.kick(con, KickReason.serverClose); } provider.closeServer(); diff --git a/core/src/mindustry/net/NetConnection.java b/core/src/mindustry/net/NetConnection.java index a735be7ba0..d3f6ff051f 100644 --- a/core/src/mindustry/net/NetConnection.java +++ b/core/src/mindustry/net/NetConnection.java @@ -46,7 +46,7 @@ public abstract class NetConnection{ info.lastKicked = Math.max(Time.millis() + 30 * 1000, info.lastKicked); } - Call.onKick(this, reason); + Call.kick(this, reason); Time.runTask(2f, this::close); @@ -66,7 +66,7 @@ public abstract class NetConnection{ info.timesKicked++; info.lastKicked = Math.max(Time.millis() + kickDuration, info.lastKicked); - Call.onKick(this, reason); + Call.kick(this, reason); Time.runTask(2f, this::close); diff --git a/core/src/mindustry/ui/fragments/HudFragment.java b/core/src/mindustry/ui/fragments/HudFragment.java index 57bc460ba8..349aa44bc3 100644 --- a/core/src/mindustry/ui/fragments/HudFragment.java +++ b/core/src/mindustry/ui/fragments/HudFragment.java @@ -652,7 +652,7 @@ public class HudFragment extends Fragment{ private void addPlayButton(Table table){ table.right().button(Icon.play, Styles.righti, 30f, () -> { if(net.client() && player.admin){ - Call.onAdminRequest(player, AdminAction.wave); + Call.adminRequest(player, AdminAction.wave); }else if(inLaunchWave()){ ui.showConfirm("$confirm", "$launch.skip.confirm", () -> !canSkipWave(), () -> state.wavetime = 0f); }else{ diff --git a/core/src/mindustry/ui/fragments/PlayerListFragment.java b/core/src/mindustry/ui/fragments/PlayerListFragment.java index c7f4621e62..3fc60a82e2 100644 --- a/core/src/mindustry/ui/fragments/PlayerListFragment.java +++ b/core/src/mindustry/ui/fragments/PlayerListFragment.java @@ -116,11 +116,11 @@ public class PlayerListFragment extends Fragment{ t.button(Icon.hammer, Styles.clearPartiali, () -> { - ui.showConfirm("$confirm", Core.bundle.format("confirmban", user.name()), () -> Call.onAdminRequest(user, AdminAction.ban)); + ui.showConfirm("$confirm", Core.bundle.format("confirmban", user.name()), () -> Call.adminRequest(user, AdminAction.ban)); }); t.button(Icon.cancel, Styles.clearPartiali, () -> { - ui.showConfirm("$confirm", Core.bundle.format("confirmkick", user.name()), () -> Call.onAdminRequest(user, AdminAction.kick)); + ui.showConfirm("$confirm", Core.bundle.format("confirmkick", user.name()), () -> Call.adminRequest(user, AdminAction.kick)); }); t.row(); @@ -140,7 +140,7 @@ public class PlayerListFragment extends Fragment{ .touchable(() -> net.client() ? Touchable.disabled : Touchable.enabled) .checked(user.admin); - t.button(Icon.zoom, Styles.clearPartiali, () -> Call.onAdminRequest(user, AdminAction.trace)); + t.button(Icon.zoom, Styles.clearPartiali, () -> Call.adminRequest(user, AdminAction.trace)); }).padRight(12).size(bs + 10f, bs); }else if(!user.isLocal() && !user.admin && net.client() && Groups.player.size() >= 3 && player.team() == user.team()){ //votekick diff --git a/core/src/mindustry/world/Tile.java b/core/src/mindustry/world/Tile.java index c47769f7ef..5d4eb340cf 100644 --- a/core/src/mindustry/world/Tile.java +++ b/core/src/mindustry/world/Tile.java @@ -641,19 +641,19 @@ public class Tile implements Position, QuadTreeObject, Displayable{ } @Remote(called = Loc.server, unreliable = true) - public static void onTileDamage(Tile tile, float health){ - if(tile.build != null){ - tile.build.health = health; + public static void tileDamage(Building build, float health){ + if(build == null) return; - if(tile.build.damaged()){ - indexer.notifyTileDamaged(tile.build); - } + build.health = health; + + if(build.damaged()){ + indexer.notifyTileDamaged(build); } } @Remote(called = Loc.server) - public static void onTileDestroyed(Tile tile){ - if(tile.build == null) return; - tile.build.killed(); + public static void tileDestroyed(Building build){ + if(build == null) return; + build.killed(); } } diff --git a/core/src/mindustry/world/blocks/BuildBlock.java b/core/src/mindustry/world/blocks/BuildBlock.java index ab7267ab60..e49f1cdf64 100644 --- a/core/src/mindustry/world/blocks/BuildBlock.java +++ b/core/src/mindustry/world/blocks/BuildBlock.java @@ -48,7 +48,7 @@ public class BuildBlock extends Block{ } @Remote(called = Loc.server) - public static void onDeconstructFinish(Tile tile, Block block, int builderID){ + public static void deconstructFinish(Tile tile, Block block, int builderID){ Team team = tile.team(); Fx.breakBlock.at(tile.drawx(), tile.drawy(), block.size); Events.fire(new BlockBuildEndEvent(tile, Groups.unit.getByID(builderID), team, true)); @@ -57,7 +57,7 @@ public class BuildBlock extends Block{ } @Remote(called = Loc.server) - public static void onConstructFinish(Tile tile, Block block, int builderID, byte rotation, Team team, boolean skipConfig){ + public static void constructFinish(Tile tile, Block block, int builderID, byte rotation, Team team, boolean skipConfig){ if(tile == null) return; float healthf = tile.build.healthf(); tile.setBlock(block, team, rotation); @@ -96,7 +96,7 @@ public class BuildBlock extends Block{ } public static void constructed(Tile tile, Block block, int builderID, byte rotation, Team team, boolean skipConfig){ - Call.onConstructFinish(tile, block, builderID, rotation, team, skipConfig); + Call.constructFinish(tile, block, builderID, rotation, team, skipConfig); tile.build.placed(); Events.fire(new BlockBuildEndEvent(tile, Groups.unit.getByID(builderID), team, false)); @@ -256,7 +256,7 @@ public class BuildBlock extends Block{ builderID = builder.id(); if(progress <= 0 || state.rules.infiniteResources){ - Call.onDeconstructFinish(tile, this.cblock == null ? previous : this.cblock, builderID); + Call.deconstructFinish(tile, this.cblock == null ? previous : this.cblock, builderID); } } diff --git a/core/src/mindustry/world/blocks/distribution/MassDriver.java b/core/src/mindustry/world/blocks/distribution/MassDriver.java index 43d5140be7..9575ae195e 100644 --- a/core/src/mindustry/world/blocks/distribution/MassDriver.java +++ b/core/src/mindustry/world/blocks/distribution/MassDriver.java @@ -53,7 +53,7 @@ public class MassDriver extends Block{ @Override public void drawPlace(int x, int y, int rotation, boolean valid){ - Drawf.dashCircle(x * tilesize, y*tilesize, range, Pal.accent); + Drawf.dashCircle(x * tilesize, y * tilesize, range, Pal.accent); //check if a mass driver is selected while placing this driver if(!control.input.frag.config.isShown()) return; @@ -64,7 +64,7 @@ public class MassDriver extends Block{ float sin = Mathf.absin(Time.time(), 6f, 1f); Tmp.v1.set(x * tilesize + offset(), y * tilesize + offset()).sub(selected.x, selected.y).limit((size / 2f + 1) * tilesize + sin + 0.5f); float x2 = x * tilesize - Tmp.v1.x, y2 = y * tilesize - Tmp.v1.y, - x1 = selected.x + Tmp.v1.x, y1 = selected.y + Tmp.v1.y; + x1 = selected.x + Tmp.v1.x, y1 = selected.y + Tmp.v1.y; int segs = (int)(selected.dst(x * tilesize, y * tilesize) / tilesize); Lines.stroke(4f, Pal.gray); diff --git a/core/src/mindustry/world/blocks/storage/CoreBlock.java b/core/src/mindustry/world/blocks/storage/CoreBlock.java index 04bcc301f0..d61c94b5b1 100644 --- a/core/src/mindustry/world/blocks/storage/CoreBlock.java +++ b/core/src/mindustry/world/blocks/storage/CoreBlock.java @@ -53,7 +53,7 @@ public class CoreBlock extends StorageBlock{ } @Remote(called = Loc.server) - public static void onPlayerSpawn(Tile tile, Player player){ + public static void playerSpawn(Tile tile, Player player){ if(player == null || tile == null) return; CoreEntity entity = tile.bc(); @@ -171,7 +171,7 @@ public class CoreBlock extends StorageBlock{ } public void requestSpawn(Player player){ - Call.onPlayerSpawn(tile, player); + Call.playerSpawn(tile, player); } @Override diff --git a/core/src/mindustry/world/blocks/units/UnitBlock.java b/core/src/mindustry/world/blocks/units/UnitBlock.java index 6056798de3..e8cf5b0903 100644 --- a/core/src/mindustry/world/blocks/units/UnitBlock.java +++ b/core/src/mindustry/world/blocks/units/UnitBlock.java @@ -25,7 +25,7 @@ public class UnitBlock extends PayloadAcceptor{ } @Remote(called = Loc.server) - public static void onUnitBlockSpawn(Tile tile){ + public static void unitBlockSpawn(Tile tile){ if(!(tile.build instanceof UnitBlockEntity)) return; tile.bc().spawned(); } @@ -55,7 +55,7 @@ public class UnitBlock extends PayloadAcceptor{ @Override public void dumpPayload(){ - Call.onUnitBlockSpawn(tile); + Call.unitBlockSpawn(tile); } } } diff --git a/server/src/mindustry/server/ServerControl.java b/server/src/mindustry/server/ServerControl.java index 3630d1a467..48460aa431 100644 --- a/server/src/mindustry/server/ServerControl.java +++ b/server/src/mindustry/server/ServerControl.java @@ -137,7 +137,7 @@ public class ServerControl implements ApplicationListener{ Map map = nextMapOverride != null ? nextMapOverride : maps.getNextMap(lastMode, state.map); nextMapOverride = null; if(map != null){ - Call.onInfoMessage((state.rules.pvp + Call.infoMessage((state.rules.pvp ? "[yellow]The " + event.winner.name + " team is victorious![]" : "[scarlet]Game over![]") + "\nNext selected map:[accent] " + map.name() + "[]" + (map.tags.containsKey("author") && !map.tags.get("author").trim().isEmpty() ? " by[accent] " + map.author() + "[white]" : "") + "." + @@ -395,7 +395,7 @@ public class ServerControl implements ApplicationListener{ } Core.settings.put("globalrules", base.toString()); - Call.onSetRules(state.rules); + Call.setRules(state.rules); } }); @@ -885,7 +885,7 @@ public class ServerControl implements ApplicationListener{ logic.reset(); - Call.onWorldDataBegin(); + Call.worldDataBegin(); run.run(); state.rules = state.map.applyRules(lastMode); logic.play();