Compare commits

...

2 Commits
v126 ... v126.1

Author SHA1 Message Date
Anuken
07d11f02d8 Fixed #4869 2021-03-05 22:16:29 -05:00
Anuken
fce30e6ae5 Sync based on system time 2021-03-05 17:22:44 -05:00
6 changed files with 27 additions and 6 deletions

View File

@@ -190,7 +190,7 @@ public class NetClient implements ApplicationListener{
public static void sendChatMessage(Player player, String message){ public static void sendChatMessage(Player player, String message){
//do not receive chat messages from clients that are too young or not registered //do not receive chat messages from clients that are too young or not registered
if(Time.timeSinceMillis(player.con.connectTime) < 500 || !player.con.hasConnected || !player.isAdded()) return; if(net.server() && player != null && (Time.timeSinceMillis(player.con.connectTime) < 500 || !player.con.hasConnected || !player.isAdded())) return;
if(message.length() > maxTextLength){ if(message.length() > maxTextLength){
throw new ValidateException(player, "Player has sent a message above the text limit."); throw new ValidateException(player, "Player has sent a message above the text limit.");

View File

@@ -35,8 +35,8 @@ import static mindustry.Vars.*;
public class NetServer implements ApplicationListener{ public class NetServer implements ApplicationListener{
/** note that snapshots are compressed, so the max snapshot size here is above the typical UDP safe limit */ /** note that snapshots are compressed, so the max snapshot size here is above the typical UDP safe limit */
private static final int maxSnapshotSize = 800, timerBlockSync = 0; private static final int maxSnapshotSize = 800, timerBlockSync = 0, serverSyncTime = 200;
private static final float serverSyncTime = 12, blockSyncTime = 60 * 6; private static final float blockSyncTime = 60 * 6;
private static final FloatBuffer fbuffer = FloatBuffer.allocate(20); private static final FloatBuffer fbuffer = FloatBuffer.allocate(20);
private static final Vec2 vector = new Vec2(); private static final Vec2 vector = new Vec2();
private static final Rect viewport = new Rect(); private static final Rect viewport = new Rect();
@@ -967,9 +967,11 @@ public class NetServer implements ApplicationListener{
return; return;
} }
NetConnection connection = player.con; var connection = player.con;
if(!player.timer(0, serverSyncTime) || !connection.hasConnected) return; if(Time.timeSinceMillis(connection.syncTime) < serverSyncTime || !connection.hasConnected) return;
connection.syncTime = Time.millis();
try{ try{
writeEntitySnapshot(player); writeEntitySnapshot(player);

View File

@@ -164,7 +164,6 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
pay.payloads().peek() instanceof BuildPayload p2 ? p2.block() : null) : null; pay.payloads().peek() instanceof BuildPayload p2 ? p2.block() : null) : null;
default -> noSensed; default -> noSensed;
}; };
} }
@Override @Override

View File

@@ -92,6 +92,16 @@ public class ContentParser{
readFields(result, data); readFields(result, data);
return result; return result;
}); });
put(Weather.class, (type, data) -> {
if(data.isString()){
return field(Weathers.class, data);
}
var bc = resolve(data.getString("type", ""), ParticleWeather.class);
data.remove("type");
Weather result = make(bc);
readFields(result, data);
return result;
});
put(DrawBlock.class, (type, data) -> { put(DrawBlock.class, (type, data) -> {
if(data.isString()){ if(data.isString()){
//try to instantiate //try to instantiate

View File

@@ -18,6 +18,7 @@ public abstract class NetConnection{
public boolean mobile, modclient; public boolean mobile, modclient;
public @Nullable Player player; public @Nullable Player player;
public boolean kicked = false; public boolean kicked = false;
public long syncTime;
/** When this connection was established. */ /** When this connection was established. */
public long connectTime = Time.millis(); public long connectTime = Time.millis();

View File

@@ -0,0 +1,9 @@
[This is a truncated changelog, see Github for full notes]
- Various minor bugfixes
- Made water extractor use metaglass for building, to be consistent with pumps
- Added automatic conveyor/conduit bridging over obstacles
- Added 'defender' AI for Oct; follows nearby units
- Cores can now replace most transport blocks; turrets can now replace each other
- Improved bridge & power node linking previews
- Buffed Segment & Vela
- Logic: More hints