mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-03 13:30:25 +07:00
Fixed ammo resupply and shooting not working clientside
This commit is contained in:
parent
30e13259b3
commit
b33dd7e91c
@ -150,6 +150,13 @@ public class RemoteWriteGenerator {
|
||||
String typeName = var.asType().toString();
|
||||
//captialized version of type name for writing primitives
|
||||
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(typeName.equals("boolean")){ //booleans are special
|
||||
@ -170,6 +177,10 @@ public class RemoteWriteGenerator {
|
||||
//add statement for writing it
|
||||
method.addStatement(ser.writeMethod + "(TEMP_BUFFER, " + varName +")");
|
||||
}
|
||||
|
||||
if(writePlayerSkipCheck){ //write end check
|
||||
method.endControlFlow();
|
||||
}
|
||||
}
|
||||
|
||||
//assign packet length
|
||||
|
@ -11,7 +11,6 @@ import io.anuke.mindustry.type.Upgrade;
|
||||
import io.anuke.mindustry.type.Weapon;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
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.ucore.core.Timers;
|
||||
import io.anuke.ucore.entities.Entities;
|
||||
import io.anuke.ucore.entities.EntityPhysics;
|
||||
import io.anuke.ucore.util.Bits;
|
||||
|
||||
import java.io.*;
|
||||
@ -169,6 +170,8 @@ public class NetworkIO {
|
||||
}
|
||||
}
|
||||
|
||||
EntityPhysics.resizeTree(0, 0, width * tilesize, height * tilesize);
|
||||
|
||||
player.reset();
|
||||
state.teams = new TeamInfo();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user