Implemented ammo ressuplying
This commit is contained in:
@@ -63,8 +63,7 @@ public class NetEvents {
|
||||
|
||||
public static void handleWeaponSwitch(){
|
||||
WeaponSwitchPacket packet = new WeaponSwitchPacket();
|
||||
packet.left = Vars.player.weaponLeft.id;
|
||||
packet.right = Vars.player.weaponRight.id;
|
||||
packet.weapon = Vars.player.weapon.id;
|
||||
packet.playerid = Vars.player.id;
|
||||
Net.send(packet, SendMode.tcp);
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ public class NetworkIO {
|
||||
control.upgrades().getWeapons().add(Upgrade.getByID(stream.readByte()));
|
||||
}
|
||||
|
||||
player.weaponLeft = player.weaponRight = control.upgrades().getWeapons().peek();
|
||||
player.weapon = control.upgrades().getWeapons().peek();
|
||||
|
||||
Entities.clear();
|
||||
player.id = pid;
|
||||
|
||||
@@ -376,20 +376,18 @@ public class Packets {
|
||||
|
||||
public static class WeaponSwitchPacket implements Packet{
|
||||
public int playerid;
|
||||
public byte left, right;
|
||||
public byte weapon;
|
||||
|
||||
@Override
|
||||
public void write(ByteBuffer buffer) {
|
||||
buffer.putInt(playerid);
|
||||
buffer.put(left);
|
||||
buffer.put(right);
|
||||
buffer.put(weapon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(ByteBuffer buffer) {
|
||||
playerid = buffer.getInt();
|
||||
left = buffer.get();
|
||||
right = buffer.get();
|
||||
weapon = buffer.get();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user