Fixed block sync not activating for multiplayer
This commit is contained in:
@@ -395,7 +395,7 @@ public class NetServer extends Module{
|
|||||||
|
|
||||||
if(Timers.get("serverBlockSync", blockSyncTime)){
|
if(Timers.get("serverBlockSync", blockSyncTime)){
|
||||||
|
|
||||||
Array<NetConnection> connections = new Array<>();
|
Array<NetConnection> connections = Net.getConnections();
|
||||||
|
|
||||||
for(int i = 0; i < connections.size; i ++){
|
for(int i = 0; i < connections.size; i ++){
|
||||||
int id = connections.get(i).id;
|
int id = connections.get(i).id;
|
||||||
@@ -453,6 +453,7 @@ public class NetServer extends Module{
|
|||||||
}
|
}
|
||||||
|
|
||||||
packet.stream = new ByteArrayInputStream(bs.toByteArray());
|
packet.stream = new ByteArrayInputStream(bs.toByteArray());
|
||||||
|
//UCore.log("Sent block update stream to " + client + " / " + packet.stream.available());
|
||||||
|
|
||||||
Net.sendStream(client, packet);
|
Net.sendStream(client, packet);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,8 +78,8 @@ public class Net{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**Returns a list of all connections IDs.*/
|
/**Returns a list of all connections IDs.*/
|
||||||
public static Array<? extends NetConnection> getConnections(){
|
public static Array<NetConnection> getConnections(){
|
||||||
return serverProvider.getConnections();
|
return (Array<NetConnection>)serverProvider.getConnections();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**Send an object to all connected clients, or to the server if this is a client.*/
|
/**Send an object to all connected clients, or to the server if this is a client.*/
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public class HudFragment implements Fragment{
|
|||||||
visible(() -> !GameState.is(State.menu));
|
visible(() -> !GameState.is(State.menu));
|
||||||
|
|
||||||
Label fps = new Label(() -> (Settings.getBool("fps") ? (Gdx.graphics.getFramesPerSecond() + " FPS") +
|
Label fps = new Label(() -> (Settings.getBool("fps") ? (Gdx.graphics.getFramesPerSecond() + " FPS") +
|
||||||
(Net.active() && !Vars.gwt ? " / Ping: " + Net.getPing() : "") : ""));
|
(Net.active() && !Vars.gwt && !Net.server() ? " / Ping: " + Net.getPing() : "") : ""));
|
||||||
row();
|
row();
|
||||||
add(fps).size(-1);
|
add(fps).size(-1);
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class DefenseBlocks{
|
|||||||
repairturret = new RepairTurret("repairturret"){
|
repairturret = new RepairTurret("repairturret"){
|
||||||
{
|
{
|
||||||
range = 30;
|
range = 30;
|
||||||
reload = 25f;
|
reload = 20f;
|
||||||
health = 60;
|
health = 60;
|
||||||
powerUsed = 0.08f;
|
powerUsed = 0.08f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import io.anuke.ucore.util.Mathf;
|
|||||||
import io.anuke.ucore.util.Strings;
|
import io.anuke.ucore.util.Strings;
|
||||||
|
|
||||||
public class RepairTurret extends PowerTurret{
|
public class RepairTurret extends PowerTurret{
|
||||||
float repairPercent = 1f / 150f;
|
protected float repairFrac = 1f / 135f;
|
||||||
|
|
||||||
public RepairTurret(String name) {
|
public RepairTurret(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
@@ -59,7 +59,7 @@ public class RepairTurret extends PowerTurret{
|
|||||||
int maxhealth = entity.blockTarget.tile.block().health;
|
int maxhealth = entity.blockTarget.tile.block().health;
|
||||||
|
|
||||||
if(entity.timer.get(timerReload, reload) && Angles.angleDist(target, entity.rotation) < shootCone){
|
if(entity.timer.get(timerReload, reload) && Angles.angleDist(target, entity.rotation) < shootCone){
|
||||||
entity.blockTarget.health += maxhealth * repairPercent;
|
entity.blockTarget.health += maxhealth * repairFrac;
|
||||||
|
|
||||||
if(entity.blockTarget.health > maxhealth)
|
if(entity.blockTarget.health > maxhealth)
|
||||||
entity.blockTarget.health = maxhealth;
|
entity.blockTarget.health = maxhealth;
|
||||||
|
|||||||
Reference in New Issue
Block a user