Fixed ammo resupply and shooting not working clientside
This commit is contained in:
@@ -150,6 +150,13 @@ public class RemoteWriteGenerator {
|
|||||||
String typeName = var.asType().toString();
|
String typeName = var.asType().toString();
|
||||||
//captialized version of type name for writing primitives
|
//captialized version of type name for writing primitives
|
||||||
String capName = typeName.equals("byte") ? "" : Character.toUpperCase(typeName.charAt(0)) + typeName.substring(1);
|
String capName = typeName.equals("byte") ? "" : Character.toUpperCase(typeName.charAt(0)) + typeName.substring(1);
|
||||||
|
//special case: method can be called from anywhere to anywhere
|
||||||
|
//thus, only write the player when the SERVER is writing data, since the client is the only one who reads that
|
||||||
|
boolean writePlayerSkipCheck = methodEntry.where == Loc.both && methodEntry.local == Loc.both && i == 0;
|
||||||
|
|
||||||
|
if(writePlayerSkipCheck){ //write begin check
|
||||||
|
method.beginControlFlow("if(io.anuke.mindustry.net.Net.server())");
|
||||||
|
}
|
||||||
|
|
||||||
if(Utils.isPrimitive(typeName)) { //check if it's a primitive, and if so write it
|
if(Utils.isPrimitive(typeName)) { //check if it's a primitive, and if so write it
|
||||||
if(typeName.equals("boolean")){ //booleans are special
|
if(typeName.equals("boolean")){ //booleans are special
|
||||||
@@ -170,6 +177,10 @@ public class RemoteWriteGenerator {
|
|||||||
//add statement for writing it
|
//add statement for writing it
|
||||||
method.addStatement(ser.writeMethod + "(TEMP_BUFFER, " + varName +")");
|
method.addStatement(ser.writeMethod + "(TEMP_BUFFER, " + varName +")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(writePlayerSkipCheck){ //write end check
|
||||||
|
method.endControlFlow();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//assign packet length
|
//assign packet length
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import io.anuke.mindustry.type.Upgrade;
|
|||||||
import io.anuke.mindustry.type.Weapon;
|
import io.anuke.mindustry.type.Weapon;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.playerGroup;
|
import static io.anuke.mindustry.Vars.playerGroup;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import io.anuke.mindustry.world.Tile;
|
|||||||
import io.anuke.mindustry.world.blocks.BlockPart;
|
import io.anuke.mindustry.world.blocks.BlockPart;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.entities.Entities;
|
import io.anuke.ucore.entities.Entities;
|
||||||
|
import io.anuke.ucore.entities.EntityPhysics;
|
||||||
import io.anuke.ucore.util.Bits;
|
import io.anuke.ucore.util.Bits;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
@@ -169,6 +170,8 @@ public class NetworkIO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EntityPhysics.resizeTree(0, 0, width * tilesize, height * tilesize);
|
||||||
|
|
||||||
player.reset();
|
player.reset();
|
||||||
state.teams = new TeamInfo();
|
state.teams = new TeamInfo();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user