Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -45,7 +45,7 @@ import static io.anuke.mindustry.Vars.*;
|
||||
public class NetClient extends Module{
|
||||
private final static float dataTimeout = 60 * 18;
|
||||
private final static float playerSyncTime = 2;
|
||||
private final static float viewScale = 1.75f;
|
||||
public final static float viewScale = 2f;
|
||||
|
||||
private Timer timer = new Timer(5);
|
||||
/**Whether the client is currently connecting.*/
|
||||
|
||||
@@ -494,7 +494,7 @@ public class NetServer extends Module{
|
||||
//check for syncable groups
|
||||
for(EntityGroup<?> group : Entities.getAllGroups()){
|
||||
if(group.isEmpty() || !(group.all().get(0) instanceof SyncTrait)) continue;
|
||||
//clipping is done by represntatives
|
||||
//clipping is done by representatives
|
||||
SyncTrait represent = (SyncTrait) group.all().get(0);
|
||||
|
||||
//make sure mapping is enabled for this group
|
||||
|
||||
@@ -809,6 +809,12 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
|
||||
//region read and write methods
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isClipped(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSave(DataOutput stream) throws IOException{
|
||||
stream.writeBoolean(isLocal);
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package io.anuke.mindustry.entities.traits;
|
||||
|
||||
import io.anuke.mindustry.core.NetClient;
|
||||
import io.anuke.mindustry.net.Interpolator;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.entities.trait.Entity;
|
||||
import io.anuke.ucore.util.Tmp;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
@@ -24,8 +27,20 @@ public interface SyncTrait extends Entity, TypeTrait{
|
||||
|
||||
/**Interpolate entity position only. Override if you need to interpolate rotations or other values.*/
|
||||
default void interpolate(){
|
||||
if(getInterpolator() == null)
|
||||
if(getInterpolator() == null){
|
||||
throw new RuntimeException("This entity must have an interpolator to interpolate()!");
|
||||
}
|
||||
|
||||
if(isClipped()){
|
||||
//move off screen when no longer in bounds
|
||||
if(!Tmp.r1.setSize(
|
||||
Core.camera.viewportWidth * Core.camera.zoom * NetClient.viewScale,
|
||||
Core.camera.viewportHeight * Core.camera.zoom * NetClient.viewScale)
|
||||
.setCenter(Core.camera.position.x, Core.camera.position.y).contains(getX(), getY())){
|
||||
set(-99999f, -99999f);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
getInterpolator().update();
|
||||
|
||||
|
||||
@@ -28,6 +28,10 @@ public class PowerModule extends BlockModule{
|
||||
if(Float.isNaN(amount)){
|
||||
amount = 0f;
|
||||
}
|
||||
// Workaround: If power went negative for some reason, at least fix it when reloading the map
|
||||
if(amount < 0f){
|
||||
amount = 0f;
|
||||
}
|
||||
|
||||
short amount = stream.readShort();
|
||||
for(int i = 0; i < amount; i++){
|
||||
|
||||
Reference in New Issue
Block a user