mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-28 13:47:32 +07:00
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)){
|
||||
|
||||
Array<NetConnection> connections = new Array<>();
|
||||
Array<NetConnection> connections = Net.getConnections();
|
||||
|
||||
for(int i = 0; i < connections.size; i ++){
|
||||
int id = connections.get(i).id;
|
||||
@ -453,6 +453,7 @@ public class NetServer extends Module{
|
||||
}
|
||||
|
||||
packet.stream = new ByteArrayInputStream(bs.toByteArray());
|
||||
//UCore.log("Sent block update stream to " + client + " / " + packet.stream.available());
|
||||
|
||||
Net.sendStream(client, packet);
|
||||
}
|
||||
|
@ -78,8 +78,8 @@ public class Net{
|
||||
}
|
||||
|
||||
/**Returns a list of all connections IDs.*/
|
||||
public static Array<? extends NetConnection> getConnections(){
|
||||
return serverProvider.getConnections();
|
||||
public static Array<NetConnection> getConnections(){
|
||||
return (Array<NetConnection>)serverProvider.getConnections();
|
||||
}
|
||||
|
||||
/**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));
|
||||
|
||||
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();
|
||||
add(fps).size(-1);
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class DefenseBlocks{
|
||||
repairturret = new RepairTurret("repairturret"){
|
||||
{
|
||||
range = 30;
|
||||
reload = 25f;
|
||||
reload = 20f;
|
||||
health = 60;
|
||||
powerUsed = 0.08f;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import io.anuke.ucore.util.Mathf;
|
||||
import io.anuke.ucore.util.Strings;
|
||||
|
||||
public class RepairTurret extends PowerTurret{
|
||||
float repairPercent = 1f / 150f;
|
||||
protected float repairFrac = 1f / 135f;
|
||||
|
||||
public RepairTurret(String name) {
|
||||
super(name);
|
||||
@ -59,7 +59,7 @@ public class RepairTurret extends PowerTurret{
|
||||
int maxhealth = entity.blockTarget.tile.block().health;
|
||||
|
||||
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)
|
||||
entity.blockTarget.health = maxhealth;
|
||||
|
Reference in New Issue
Block a user