mirror of
https://github.com/Anuken/Mindustry.git
synced 2024-11-11 14:56:10 +03:00
Added variable to control block syncing
This commit is contained in:
parent
a79dfe29ef
commit
dbd84103cb
@ -217,7 +217,7 @@ setting.sensitivity.name=Controller Sensitivity
|
||||
setting.saveinterval.name=Autosave Interval
|
||||
setting.seconds={0} Seconds
|
||||
setting.fullscreen.name=Fullscreen
|
||||
setting.multithread.name=Multithreading [scarlet](extremely unstable!)
|
||||
setting.multithread.name=Multithreading [scarlet](unstable!)
|
||||
setting.fps.name=Show FPS
|
||||
setting.vsync.name=VSync
|
||||
setting.lasers.name=Show Power Lasers
|
||||
|
@ -1,5 +1,5 @@
|
||||
#Autogenerated file. Do not modify.
|
||||
#Sat Feb 17 14:39:13 EST 2018
|
||||
#Sat Feb 17 20:42:58 EST 2018
|
||||
version=beta
|
||||
androidBuildCode=235
|
||||
name=Mindustry
|
||||
|
@ -28,6 +28,8 @@ public class Vars{
|
||||
public static final boolean android = (Gdx.app.getType() == ApplicationType.Android) || testAndroid;
|
||||
//shorthand for whether or not this is running on GWT
|
||||
public static final boolean gwt = (Gdx.app.getType() == ApplicationType.WebGL);
|
||||
//whether to send block state change events to players
|
||||
public static final boolean syncBlockState = false;
|
||||
//how far away from the player blocks can be placed
|
||||
public static final float placerange = 66;
|
||||
//respawn time in frames
|
||||
|
@ -498,8 +498,7 @@ public class Renderer extends RendererModule{
|
||||
public void drawBar(Color color, float x, float y, float fraction){
|
||||
fraction = Mathf.clamp(fraction);
|
||||
|
||||
if(fraction > 0)
|
||||
fraction = Mathf.clamp(fraction + 0.2f, 0.24f, 1f);
|
||||
if(fraction > 0) fraction = Mathf.clamp(fraction + 0.2f, 0.24f, 1f);
|
||||
|
||||
float len = 3;
|
||||
|
||||
|
@ -21,6 +21,7 @@ import io.anuke.ucore.util.Bundles;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import static io.anuke.mindustry.Vars.state;
|
||||
import static io.anuke.mindustry.Vars.syncBlockState;
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
|
||||
public class Block{
|
||||
@ -180,7 +181,7 @@ public class Block{
|
||||
* Tries to put this item into a nearby container, if there are no available
|
||||
* containers, it gets added to the block's inventory.*/
|
||||
public void offloadNear(Tile tile, Item item){
|
||||
if(Net.client()){
|
||||
if(Net.client() && syncBlockState){
|
||||
handleItem(item, tile, tile);
|
||||
return;
|
||||
}
|
||||
@ -193,7 +194,7 @@ public class Block{
|
||||
if(other != null && other.block().acceptItem(item, other, tile)){
|
||||
other.block().handleItem(item, other, tile);
|
||||
tile.setDump((byte)((i+1)%4));
|
||||
if(Net.server()) NetEvents.handleTransfer(tile, i, item);
|
||||
if(Net.server() && syncBlockState) NetEvents.handleTransfer(tile, i, item);
|
||||
return;
|
||||
}
|
||||
i++;
|
||||
@ -212,7 +213,7 @@ public class Block{
|
||||
* Try dumping any item near the tile. -1 = any direction
|
||||
*/
|
||||
protected boolean tryDump(Tile tile, int direction, Item todump){
|
||||
if(Net.client()) return false;
|
||||
if(Net.client() && syncBlockState) return false;
|
||||
|
||||
int i = tile.getDump()%4;
|
||||
|
||||
@ -228,7 +229,7 @@ public class Block{
|
||||
other.block().handleItem(item, other, tile);
|
||||
tile.entity.removeItem(item, 1);
|
||||
tile.setDump((byte)((i+1)%4));
|
||||
if(Net.server()) NetEvents.handleTransfer(tile, (byte)i, item);
|
||||
if(Net.server() && syncBlockState) NetEvents.handleTransfer(tile, (byte)i, item);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,8 @@ import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import static io.anuke.mindustry.Vars.syncBlockState;
|
||||
|
||||
public class Teleporter extends PowerBlock{
|
||||
public static final Color[] colorArray = {Color.ROYAL, Color.ORANGE, Color.SCARLET, Color.FOREST,
|
||||
Color.PURPLE, Color.GOLD, Color.PINK, Color.BLACK};
|
||||
@ -130,7 +132,7 @@ public class Teleporter extends PowerBlock{
|
||||
Array<Tile> links = findLinks(tile, item);
|
||||
|
||||
if(links.size > 0){
|
||||
if(Net.server() || !Net.active()){
|
||||
if(!syncBlockState || Net.server() || !Net.active()){
|
||||
Tile target = links.random();
|
||||
target.block().offloadNear(target, item);
|
||||
}
|
||||
@ -181,7 +183,7 @@ public class Teleporter extends PowerBlock{
|
||||
}
|
||||
|
||||
for(Tile remove : removal)
|
||||
teleporters[entity.color].remove(remove);
|
||||
teleporters[entity.color].remove(remove);
|
||||
|
||||
return returns;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user