mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-17 14:51:15 -08:00
Removed NetEvents class / Added unused patrol command
This commit is contained in:
parent
d9eb4c1296
commit
2f7073bbe4
6 changed files with 950 additions and 989 deletions
BIN
core/assets-raw/sprites/effects/command-patrol.png
Normal file
BIN
core/assets-raw/sprites/effects/command-patrol.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 182 B |
File diff suppressed because it is too large
Load diff
Binary file not shown.
|
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 99 KiB |
|
|
@ -5,9 +5,11 @@ import com.badlogic.gdx.graphics.Color;
|
|||
import com.badlogic.gdx.utils.Base64Coder;
|
||||
import com.badlogic.gdx.utils.IntSet;
|
||||
import com.badlogic.gdx.utils.TimeUtils;
|
||||
import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.PacketPriority;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.annotations.Annotations.Variant;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
|
|
@ -21,6 +23,7 @@ import io.anuke.mindustry.net.Net.SendMode;
|
|||
import io.anuke.mindustry.net.NetworkIO;
|
||||
import io.anuke.mindustry.net.Packets.*;
|
||||
import io.anuke.mindustry.net.TraceInfo;
|
||||
import io.anuke.mindustry.net.ValidateException;
|
||||
import io.anuke.mindustry.world.modules.InventoryModule;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.core.Settings;
|
||||
|
|
@ -133,6 +136,32 @@ public class NetClient extends Module{
|
|||
});
|
||||
}
|
||||
|
||||
@Remote(called = Loc.server, targets = Loc.both, forward = true)
|
||||
public static void sendMessage(Player player, String message){
|
||||
if(message.length() > maxTextLength){
|
||||
throw new ValidateException(player, "Player has sent a message above the text limit.");
|
||||
}
|
||||
|
||||
Log.info("&y{0}: &lb{1}", (player == null || player.name == null ? "" : player.name), message);
|
||||
|
||||
if(Vars.ui != null){
|
||||
Vars.ui.chatfrag.addMessage(message, player == null ? null : colorizeName(player.id, player.name));
|
||||
}
|
||||
}
|
||||
|
||||
@Remote(called = Loc.server, variants = Variant.both, forward = true)
|
||||
public static void sendMessage(String message){
|
||||
if(Vars.ui != null){
|
||||
Vars.ui.chatfrag.addMessage(message, null);
|
||||
}
|
||||
}
|
||||
|
||||
private static String colorizeName(int id, String name){
|
||||
Player player = playerGroup.getByID(id);
|
||||
if(name == null || player == null) return null;
|
||||
return "[#" + player.color.toString().toUpperCase() + "]" + name;
|
||||
}
|
||||
|
||||
@Remote(variants = Variant.one, priority = PacketPriority.high)
|
||||
public static void onKick(KickReason reason){
|
||||
netClient.disconnectQuietly();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
package io.anuke.mindustry.entities.units;
|
||||
|
||||
public enum UnitCommand{
|
||||
attack, retreat
|
||||
attack, retreat, patrol
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
package io.anuke.mindustry.net;
|
||||
|
||||
import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.annotations.Annotations.Variant;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.ucore.util.Log;
|
||||
|
||||
import static io.anuke.mindustry.Vars.maxTextLength;
|
||||
import static io.anuke.mindustry.Vars.playerGroup;
|
||||
|
||||
public class NetEvents{
|
||||
|
||||
@Remote(called = Loc.server, targets = Loc.both, forward = true)
|
||||
public static void sendMessage(Player player, String message){
|
||||
if(message.length() > maxTextLength){
|
||||
throw new ValidateException(player, "Player has sent a message above the text limit.");
|
||||
}
|
||||
|
||||
Log.info("&y{0}: &lb{1}", (player == null || player.name == null ? "" : player.name), message);
|
||||
|
||||
if(Vars.ui != null){
|
||||
Vars.ui.chatfrag.addMessage(message, player == null ? null : colorizeName(player.id, player.name));
|
||||
}
|
||||
}
|
||||
|
||||
@Remote(called = Loc.server, variants = Variant.both, forward = true)
|
||||
public static void sendMessage(String message){
|
||||
if(Vars.ui != null){
|
||||
Vars.ui.chatfrag.addMessage(message, null);
|
||||
}
|
||||
}
|
||||
|
||||
private static String colorizeName(int id, String name){
|
||||
Player player = playerGroup.getByID(id);
|
||||
if(name == null || player == null) return null;
|
||||
return "[#" + player.color.toString().toUpperCase() + "]" + name;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue