mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-04 16:09:23 +07:00
Fixed power nodes in multiplayer
This commit is contained in:
parent
84786c12d8
commit
c9178c3f2f
Binary file not shown.
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 5.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 575 KiB After Width: | Height: | Size: 575 KiB |
@ -132,6 +132,11 @@
|
||||
fontColor: white,
|
||||
up: info-banner
|
||||
},
|
||||
discord: {
|
||||
font: default,
|
||||
fontColor: white,
|
||||
up: info-banner
|
||||
},
|
||||
clear-partial: {
|
||||
down: whiteui,
|
||||
up: pane,
|
||||
|
@ -66,6 +66,7 @@ public class MenuFragment extends Fragment{
|
||||
//info icon
|
||||
if(mobile){
|
||||
parent.fill(c -> c.bottom().left().addButton("", "info", ui.about::show).size(84, 45));
|
||||
parent.fill(c -> c.bottom().right().addButton("", "discord", ui.discord::show).size(84, 45));
|
||||
}
|
||||
|
||||
String versionText = "[#ffffffba]" + ((Version.build == -1) ? "[#fc8140aa]custom build" : Version.modifier + " build " + Version.build);
|
||||
|
@ -25,6 +25,7 @@ import io.anuke.mindustry.game.*;
|
||||
import io.anuke.mindustry.gen.*;
|
||||
import io.anuke.mindustry.graphics.*;
|
||||
import io.anuke.mindustry.input.InputHandler.*;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.type.*;
|
||||
import io.anuke.mindustry.ui.*;
|
||||
import io.anuke.mindustry.world.blocks.*;
|
||||
@ -282,6 +283,15 @@ public class Block extends BlockStorage{
|
||||
/** Called after the block is placed by this client. */
|
||||
@CallSuper
|
||||
public void playerPlaced(Tile tile){
|
||||
if(outputsPower && !consumesPower){
|
||||
PowerNode.lastPlaced = tile.pos();
|
||||
}
|
||||
}
|
||||
|
||||
/** Called after the block is placed by anyone. */
|
||||
@CallSuper
|
||||
public void placed(Tile tile){
|
||||
if(Net.client()) return;
|
||||
|
||||
if((consumesPower && !outputsPower) || (!consumesPower && outputsPower)){
|
||||
int range = 10;
|
||||
@ -289,7 +299,7 @@ public class Block extends BlockStorage{
|
||||
Geometry.circle(tile.x, tile.y, range, (x, y) -> {
|
||||
Tile other = world.ltile(x, y);
|
||||
if(other != null && other.block instanceof PowerNode && ((PowerNode)other.block).linkValid(other, tile) && !other.entity.proximity().contains(tile) &&
|
||||
!(outputsPower && tile.entity.proximity().contains(p -> p.entity != null && p.entity.power != null && p.entity.power.graph == other.entity.power.graph))){
|
||||
!(outputsPower && tile.entity.proximity().contains(p -> p.entity != null && p.entity.power != null && p.entity.power.graph == other.entity.power.graph))){
|
||||
tempTiles.add(other);
|
||||
}
|
||||
});
|
||||
@ -298,19 +308,11 @@ public class Block extends BlockStorage{
|
||||
Call.linkPowerNodes(null, tempTiles.first(), tile);
|
||||
}
|
||||
}
|
||||
|
||||
if(outputsPower && !consumesPower){
|
||||
PowerNode.lastPlaced = tile.pos();
|
||||
}
|
||||
}
|
||||
|
||||
public void removed(Tile tile){
|
||||
}
|
||||
|
||||
/** Called after the block is placed by anyone. */
|
||||
public void placed(Tile tile){
|
||||
}
|
||||
|
||||
/** Called every frame a unit is on this tile. */
|
||||
public void unitOn(Tile tile, Unit unit){
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import io.anuke.arc.util.*;
|
||||
import io.anuke.mindustry.entities.type.*;
|
||||
import io.anuke.mindustry.gen.*;
|
||||
import io.anuke.mindustry.graphics.*;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.ui.*;
|
||||
import io.anuke.mindustry.world.*;
|
||||
import io.anuke.mindustry.world.blocks.*;
|
||||
@ -106,6 +107,14 @@ public class PowerNode extends PowerBlock{
|
||||
Call.linkPowerNodes(null, tile, before);
|
||||
}
|
||||
|
||||
lastPlaced = tile.pos();
|
||||
super.playerPlaced(tile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void placed(Tile tile){
|
||||
if(Net.client()) return;
|
||||
|
||||
Predicate<Tile> valid = other -> other != null && other != tile && ((!other.block().outputsPower && other.block().consumesPower) || (other.block().outputsPower && !other.block().consumesPower)) && linkValid(tile, other)
|
||||
&& !other.entity.proximity().contains(tile) && other.entity.power.graph != tile.entity.power.graph;
|
||||
|
||||
@ -120,8 +129,7 @@ public class PowerNode extends PowerBlock{
|
||||
tempTiles.sort(Structs.comparingFloat(t -> t.dst2(tile)));
|
||||
tempTiles.each(valid, other -> Call.linkPowerNodes(null, tile, other));
|
||||
|
||||
lastPlaced = tile.pos();
|
||||
super.playerPlaced(tile);
|
||||
super.placed(tile);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,11 +29,6 @@ public class ThermalGenerator extends PowerGenerator{
|
||||
drawPlaceText(Core.bundle.formatFloat("bar.efficiency", sumAttribute(Attribute.heat, x, y) * 100, 1), x, y, valid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void placed(Tile tile){
|
||||
super.placed(tile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProximityAdded(Tile tile){
|
||||
super.onProximityAdded(tile);
|
||||
|
@ -79,6 +79,7 @@ public class CoreBlock extends StorageBlock{
|
||||
|
||||
@Override
|
||||
public void placed(Tile tile){
|
||||
super.placed(tile);
|
||||
state.teams.get(tile.getTeam()).cores.add(tile);
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ import io.anuke.mindustry.entities.type.Player;
|
||||
import io.anuke.mindustry.game.*;
|
||||
import io.anuke.mindustry.game.EventType.GameOverEvent;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
import io.anuke.mindustry.io.*;
|
||||
import io.anuke.mindustry.io.SaveIO;
|
||||
import io.anuke.mindustry.maps.Map;
|
||||
import io.anuke.mindustry.maps.MapException;
|
||||
import io.anuke.mindustry.net.Administration.PlayerInfo;
|
||||
|
Loading…
Reference in New Issue
Block a user