This commit is contained in:
Anuken
2022-11-13 09:35:48 -05:00
parent 7d695784d1
commit 4c51b97667
34 changed files with 266 additions and 257 deletions

View File

@@ -225,7 +225,7 @@ public class NetClient implements ApplicationListener{
if(net.server() && player != null && player.con != null && (Time.timeSinceMillis(player.con.connectTime) < 500 || !player.con.hasConnected || !player.isAdded())) return;
//detect and kick for foul play
if(player != null && player.con != null && !player.con.chatRate.allow(2000, 20)){
if(player != null && player.con != null && !player.con.chatRate.allow(2000, Config.chatSpamLimit.num())){
player.con.kick(KickReason.kick);
netServer.admins.blacklistDos(player.con.address);
return;

View File

@@ -171,8 +171,7 @@ abstract class PayloadComp implements Posc, Rotc, Hitboxc, Unitc{
int tx = World.toTile(x - tile.block.offset), ty = World.toTile(y - tile.block.offset);
Tile on = Vars.world.tile(tx, ty);
if(on != null && Build.validPlace(tile.block, tile.team, tx, ty, tile.rotation, false)){
int rot = (int)((rotation + 45f) / 90f) % 4;
payload.place(on, rot);
payload.place(on, tile.rotation);
Events.fire(new PayloadDropEvent(self(), tile));
if(getControllerName() != null){

View File

@@ -415,7 +415,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
@Remote(targets = Loc.both, called = Loc.server)
public static void requestDropPayload(Player player, float x, float y){
if(player == null || net.client()) return;
if(player == null || net.client() || player.dead()) return;
Payloadc pay = (Payloadc)player.unit();
@@ -1579,7 +1579,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
public void add(){
Core.input.getInputProcessors().remove(i -> i instanceof InputHandler || (i instanceof GestureDetector && ((GestureDetector)i).getListener() instanceof InputHandler));
Core.input.addProcessor(detector = new GestureDetector(20, 0.5f, 0.3f, 0.15f, this));
Core.input.addProcessor(detector = new GestureDetector(20, 0.5f, 0.45f, 0.15f, this));
Core.input.addProcessor(this);
if(Core.scene != null){
Table table = (Table)Core.scene.find("inputTable");

View File

@@ -65,6 +65,7 @@ public class Administration{
addActionFilter(action -> {
if(action.type != ActionType.breakBlock &&
action.type != ActionType.placeBlock &&
action.type != ActionType.commandUnits &&
Config.antiSpam.bool()){
Ratekeeper rate = action.player.getInfo().rate;
@@ -487,6 +488,7 @@ public class Administration{
messageRateLimit = new Config("messageRateLimit", "Message rate limit in seconds. 0 to disable.", 0),
messageSpamKick = new Config("messageSpamKick", "How many times a player must send a message before the cooldown to get kicked. 0 to disable.", 3),
packetSpamLimit = new Config("packetSpamLimit", "Limit for packet count sent within 3sec that will lead to a blacklist + kick.", 300),
chatSpamLimit = new Config("packetSpamLimit", "Limit for chat packet count sent within 2sec that will lead to a blacklist + kick. Not the same as a rate limit.", 20),
socketInput = new Config("socketInput", "Allows a local application to control this server through a local TCP socket.", false, "socket", () -> Events.fire(Trigger.socketConfigChanged)),
socketInputPort = new Config("socketInputPort", "The port for socket input.", 6859, () -> Events.fire(Trigger.socketConfigChanged)),
socketInputAddress = new Config("socketInputAddress", "The bind address for socket input.", "localhost", () -> Events.fire(Trigger.socketConfigChanged)),

View File

@@ -53,6 +53,13 @@ public class LaserTurret extends PowerTurret{
return bullets.any() || isActive() || isShooting();
}
@Override
public void placed(){
super.placed();
reloadCounter = reload;
}
@Override
public void updateTile(){
super.updateTile();

View File

@@ -350,6 +350,7 @@ public class Conveyor extends Block implements Autotiler{
public boolean acceptItem(Building source, Item item){
if(len >= capacity) return false;
Tile facing = Edges.getFacingEdge(source.tile, tile);
if(facing == null) return false;
int direction = Math.abs(facing.relativeTo(tile.x, tile.y) - rotation);
return (((direction == 0) && minitem >= itemSpace) || ((direction % 2 == 1) && minitem > 0.7f)) && !(source.block.rotate && next == source);
}