mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-08-02 16:09:38 +07:00
Fixed incorrect mode selection, updated TODO
This commit is contained in:
21
TODO.md
21
TODO.md
@ -15,12 +15,12 @@ _(These are not planned in the near future at all, and have been suggested befor
|
|||||||
### Already Suggested
|
### Already Suggested
|
||||||
_(not necessarily planned!)_
|
_(not necessarily planned!)_
|
||||||
- "more blocks" "more turrets" "more content" "more X/Y/Z"
|
- "more blocks" "more turrets" "more content" "more X/Y/Z"
|
||||||
- Multiplayer
|
|
||||||
- Building of units (tanks, drones, _soldiers_, doesn't matter)
|
- Building of units (tanks, drones, _soldiers_, doesn't matter)
|
||||||
- Enemy bases, fighting against AI, capture points
|
- Enemy bases, fighting against AI, capture points
|
||||||
- Co-op of any sort
|
- Co-op of any sort
|
||||||
- Campaign, challenge mode
|
- Campaign, challenge mode
|
||||||
- Multiple cores
|
- PvP mode
|
||||||
|
- Multiple cores, movable cores
|
||||||
- Movable turrets
|
- Movable turrets
|
||||||
- Batteries or storage for anything
|
- Batteries or storage for anything
|
||||||
- Destroy map indestructible blocks
|
- Destroy map indestructible blocks
|
||||||
@ -28,7 +28,7 @@ _(not necessarily planned!)_
|
|||||||
- Steam release
|
- Steam release
|
||||||
- Research system, tech tree, persistent upgrades, upgrades at all
|
- Research system, tech tree, persistent upgrades, upgrades at all
|
||||||
- Missile enemies/turrets/weapons (both homing and non-homing)
|
- Missile enemies/turrets/weapons (both homing and non-homing)
|
||||||
- Better graphics
|
- 'Better graphics'
|
||||||
- Enemies dropping resources
|
- Enemies dropping resources
|
||||||
- Final objectives/non-endless mode
|
- Final objectives/non-endless mode
|
||||||
- Fusion reactor
|
- Fusion reactor
|
||||||
@ -37,7 +37,6 @@ _(not necessarily planned!)_
|
|||||||
- Day/night cycle
|
- Day/night cycle
|
||||||
- Solar panels
|
- Solar panels
|
||||||
- Deflector shields
|
- Deflector shields
|
||||||
- Autosave
|
|
||||||
- Underground blocks
|
- Underground blocks
|
||||||
- Configurable outputs/inputs
|
- Configurable outputs/inputs
|
||||||
- Getting items out of the core
|
- Getting items out of the core
|
||||||
@ -53,24 +52,15 @@ _(not necessarily planned!)_
|
|||||||
- Minimap
|
- Minimap
|
||||||
- Underground conduits
|
- Underground conduits
|
||||||
- More indicators for core damaged/attacked
|
- More indicators for core damaged/attacked
|
||||||
- Delete saves, export saves, import saves
|
|
||||||
- Display playtime in saves
|
- Display playtime in saves
|
||||||
- Edit descriptions for conveyor tunnels to be more clear about how to use them
|
|
||||||
- New map format system to display
|
|
||||||
- Better placement controls, break while placing
|
|
||||||
- Hide UI elements
|
|
||||||
- New liquid conduit system
|
- New liquid conduit system
|
||||||
|
|
||||||
### Major Bugs
|
### Major Bugs
|
||||||
- Black screen when tabbing out on Android
|
- Black screen when tabbing out on Android
|
||||||
- Infinite explosions that destroy blocks
|
|
||||||
- Random map reload when playing, leading to a crash (UI cause?)
|
- Random map reload when playing, leading to a crash (UI cause?)
|
||||||
- Google Payments verify crash
|
- Google Payments verify crash
|
||||||
- Google Payments IllegalArgument crash
|
- Google Payments IllegalArgument crash
|
||||||
|
|
||||||
### Misc
|
|
||||||
- Localization support. Change all in-game strings to localized strings. Check compatibility with GWT and Android libraries.
|
|
||||||
|
|
||||||
### Possible Additions
|
### Possible Additions
|
||||||
- Mech body upgrades
|
- Mech body upgrades
|
||||||
- Uranium extractor / uranium->iron converter
|
- Uranium extractor / uranium->iron converter
|
||||||
@ -83,19 +73,14 @@ _(not necessarily planned!)_
|
|||||||
- Better enemy effects and looks
|
- Better enemy effects and looks
|
||||||
- Homing missile enemies and turrets
|
- Homing missile enemies and turrets
|
||||||
- Reflective shield blocks
|
- Reflective shield blocks
|
||||||
- Tech tree with bonuses to production or turrets
|
|
||||||
- Spawn points changed into enemy bases with hostile turrets
|
- Spawn points changed into enemy bases with hostile turrets
|
||||||
- Unit production
|
- Unit production
|
||||||
|
|
||||||
### Optimization
|
### Optimization
|
||||||
- Look into uses for `IntMap`
|
|
||||||
- Spread updating over multiple frames for large groups of specific tile entities (?)
|
|
||||||
- Optimize enemy + bullet code and check quadtree leaf parameters
|
- Optimize enemy + bullet code and check quadtree leaf parameters
|
||||||
- Check for unnecessary use of `Timers#get()`
|
|
||||||
- Optimize generator laser distribution, especially finding targets
|
- Optimize generator laser distribution, especially finding targets
|
||||||
- Optimize UI
|
- Optimize UI
|
||||||
- Check memory usage and GC, profile
|
- Check memory usage and GC, profile
|
||||||
- Optimize health bars and enemies in general
|
- Optimize health bars and enemies in general
|
||||||
- Make drawing of enemies more efficient (don't call `flush()`?)
|
- Make drawing of enemies more efficient (don't call `flush()`?)
|
||||||
- Look into `NodeRecord` storage for pathfinder, since it's taking 2MB+ of memory!
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#Autogenerated file. Do not modify.
|
#Autogenerated file. Do not modify.
|
||||||
#Tue Feb 13 18:19:15 EST 2018
|
#Wed Feb 14 17:49:43 EST 2018
|
||||||
version=beta
|
version=beta
|
||||||
androidBuildCode=190
|
androidBuildCode=219
|
||||||
name=Mindustry
|
name=Mindustry
|
||||||
code=3.3
|
code=3.3
|
||||||
build=custom build
|
build=custom build
|
||||||
|
@ -20,6 +20,7 @@ import io.anuke.mindustry.resource.Item;
|
|||||||
import io.anuke.mindustry.world.Map;
|
import io.anuke.mindustry.world.Map;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.blocks.ProductionBlocks;
|
import io.anuke.mindustry.world.blocks.ProductionBlocks;
|
||||||
|
import io.anuke.mindustry.world.blocks.types.distribution.Teleporter;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.entities.BaseBulletType;
|
import io.anuke.ucore.entities.BaseBulletType;
|
||||||
import io.anuke.ucore.entities.Entities;
|
import io.anuke.ucore.entities.Entities;
|
||||||
@ -226,14 +227,7 @@ public class NetClient extends Module {
|
|||||||
while (stream.available() > 0) {
|
while (stream.available() > 0) {
|
||||||
int pos = stream.readInt();
|
int pos = stream.readInt();
|
||||||
|
|
||||||
//TODO what if there's no entity? new code
|
Tile tile = world.tile(pos);
|
||||||
Tile tile = world.tile(pos % world.width(), pos / world.width());
|
|
||||||
|
|
||||||
byte times = stream.readByte();
|
|
||||||
|
|
||||||
for (int i = 0; i < times; i++) {
|
|
||||||
tile.entity.timer.getTimes()[i] = stream.readFloat();
|
|
||||||
}
|
|
||||||
|
|
||||||
short data = stream.readShort();
|
short data = stream.readShort();
|
||||||
tile.setPackedData(data);
|
tile.setPackedData(data);
|
||||||
@ -286,6 +280,9 @@ public class NetClient extends Module {
|
|||||||
Tile next = tile.getNearby(packet.rotation);
|
Tile next = tile.getNearby(packet.rotation);
|
||||||
tile.entity.items[packet.itemid] --;
|
tile.entity.items[packet.itemid] --;
|
||||||
next.block().handleItem(Item.getByID(packet.itemid), next, tile);
|
next.block().handleItem(Item.getByID(packet.itemid), next, tile);
|
||||||
|
|
||||||
|
if(tile.block() instanceof Teleporter)
|
||||||
|
Log.info("Recieved dump for teleporter! items: {0}", tile.entity.totalItems());
|
||||||
};
|
};
|
||||||
|
|
||||||
if(threads.isEnabled()){
|
if(threads.isEnabled()){
|
||||||
@ -308,6 +305,21 @@ public class NetClient extends Module {
|
|||||||
r.run();
|
r.run();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Net.handleClient(ItemOffloadPacket.class, packet -> {
|
||||||
|
Runnable r = () -> {
|
||||||
|
Tile tile = world.tile(packet.position);
|
||||||
|
if (tile == null || tile.entity == null) return;
|
||||||
|
Tile next = tile.getNearby(tile.getRotation());
|
||||||
|
next.block().handleItem(Item.getByID(packet.itemid), next, tile);
|
||||||
|
};
|
||||||
|
|
||||||
|
if(threads.isEnabled()){
|
||||||
|
threads.run(r);
|
||||||
|
}else{
|
||||||
|
r.run();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package io.anuke.mindustry.core;
|
package io.anuke.mindustry.core;
|
||||||
|
|
||||||
import com.badlogic.gdx.utils.ByteArray;
|
import com.badlogic.gdx.utils.*;
|
||||||
import com.badlogic.gdx.utils.IntMap;
|
|
||||||
import com.badlogic.gdx.utils.ObjectMap;
|
|
||||||
import com.badlogic.gdx.utils.TimeUtils;
|
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.entities.Player;
|
import io.anuke.mindustry.entities.Player;
|
||||||
import io.anuke.mindustry.entities.SyncEntity;
|
import io.anuke.mindustry.entities.SyncEntity;
|
||||||
@ -12,6 +9,7 @@ import io.anuke.mindustry.io.Platform;
|
|||||||
import io.anuke.mindustry.io.Version;
|
import io.anuke.mindustry.io.Version;
|
||||||
import io.anuke.mindustry.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
import io.anuke.mindustry.net.Net.SendMode;
|
import io.anuke.mindustry.net.Net.SendMode;
|
||||||
|
import io.anuke.mindustry.net.NetConnection;
|
||||||
import io.anuke.mindustry.net.NetworkIO;
|
import io.anuke.mindustry.net.NetworkIO;
|
||||||
import io.anuke.mindustry.net.Packets.*;
|
import io.anuke.mindustry.net.Packets.*;
|
||||||
import io.anuke.mindustry.resource.Upgrade;
|
import io.anuke.mindustry.resource.Upgrade;
|
||||||
@ -24,6 +22,7 @@ import io.anuke.ucore.entities.Entities;
|
|||||||
import io.anuke.ucore.entities.EntityGroup;
|
import io.anuke.ucore.entities.EntityGroup;
|
||||||
import io.anuke.ucore.modules.Module;
|
import io.anuke.ucore.modules.Module;
|
||||||
import io.anuke.ucore.util.Log;
|
import io.anuke.ucore.util.Log;
|
||||||
|
import io.anuke.ucore.util.Mathf;
|
||||||
import io.anuke.ucore.util.Timer;
|
import io.anuke.ucore.util.Timer;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
@ -36,9 +35,11 @@ import static io.anuke.mindustry.Vars.*;
|
|||||||
|
|
||||||
public class NetServer extends Module{
|
public class NetServer extends Module{
|
||||||
private final static float serverSyncTime = 4, itemSyncTime = 10, blockSyncTime = 120;
|
private final static float serverSyncTime = 4, itemSyncTime = 10, blockSyncTime = 120;
|
||||||
|
private final static boolean sendBlockSync = false;
|
||||||
|
|
||||||
private final static int timerEntitySync = 0;
|
private final static int timerEntitySync = 0;
|
||||||
private final static int timerStateSync = 1;
|
private final static int timerStateSync = 1;
|
||||||
|
private final static int timerBlockSync = 2;
|
||||||
|
|
||||||
/**Maps connection IDs to players.*/
|
/**Maps connection IDs to players.*/
|
||||||
private IntMap<Player> connections = new IntMap<>();
|
private IntMap<Player> connections = new IntMap<>();
|
||||||
@ -301,8 +302,8 @@ public class NetServer extends Module{
|
|||||||
Net.send(packet, SendMode.udp);
|
Net.send(packet, SendMode.udp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if(Timers.get("serverBlockSync", blockSyncTime)){
|
if(sendBlockSync && timer.get(timerBlockSync, blockSyncTime)){
|
||||||
|
|
||||||
Array<NetConnection> connections = Net.getConnections();
|
Array<NetConnection> connections = Net.getConnections();
|
||||||
|
|
||||||
@ -316,7 +317,7 @@ public class NetServer extends Module{
|
|||||||
int h = 16;
|
int h = 16;
|
||||||
sendBlockSync(id, x, y, w, h);
|
sendBlockSync(id, x, y, w, h);
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendBlockSync(int client, int x, int y, int viewx, int viewy){
|
public void sendBlockSync(int client, int x, int y, int viewx, int viewy){
|
||||||
@ -334,29 +335,17 @@ public class NetServer extends Module{
|
|||||||
for (int ry = -viewy / 2; ry <= viewy / 2; ry++) {
|
for (int ry = -viewy / 2; ry <= viewy / 2; ry++) {
|
||||||
Tile tile = world.tile(x + rx, y + ry);
|
Tile tile = world.tile(x + rx, y + ry);
|
||||||
|
|
||||||
if (tile == null || tile.entity == null) continue;
|
if (tile == null || tile.entity == null || !tile.block().syncEntity()) continue;
|
||||||
|
|
||||||
stream.writeInt(tile.packedPosition());
|
stream.writeInt(tile.packedPosition());
|
||||||
byte times = 0;
|
|
||||||
|
|
||||||
for(; times < tile.entity.timer.getTimes().length; times ++){
|
|
||||||
if(tile.entity.timer.getTimes()[times] <= 1f){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.writeByte(times);
|
|
||||||
|
|
||||||
for(int i = 0; i < times; i ++){
|
|
||||||
stream.writeFloat(tile.entity.timer.getTimes()[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.writeShort(tile.getPackedData());
|
stream.writeShort(tile.getPackedData());
|
||||||
|
|
||||||
tile.entity.write(stream);
|
tile.entity.write(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.info("Sent {0} bytes of block data.", stream.size());
|
||||||
|
|
||||||
}catch (IOException e){
|
}catch (IOException e){
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.Colors;
|
|||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.badlogic.gdx.graphics.Texture.TextureWrap;
|
import com.badlogic.gdx.graphics.Texture.TextureWrap;
|
||||||
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
|
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
|
||||||
|
import com.badlogic.gdx.math.MathUtils;
|
||||||
import com.badlogic.gdx.math.Rectangle;
|
import com.badlogic.gdx.math.Rectangle;
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
@ -429,7 +430,7 @@ public class Renderer extends RendererModule{
|
|||||||
|
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|
||||||
//draw selected block health
|
//draw selected block bars and info
|
||||||
if(input.recipe == null && !ui.hasMouse()){
|
if(input.recipe == null && !ui.hasMouse()){
|
||||||
Tile tile = world.tileWorld(Graphics.mouseWorld().x, Graphics.mouseWorld().y);
|
Tile tile = world.tileWorld(Graphics.mouseWorld().x, Graphics.mouseWorld().y);
|
||||||
|
|
||||||
@ -444,9 +445,6 @@ public class Renderer extends RendererModule{
|
|||||||
Draw.color();
|
Draw.color();
|
||||||
}
|
}
|
||||||
|
|
||||||
//if(target.entity != null)
|
|
||||||
// drawHealth(target.drawx(), target.drawy() - 3f - target.block().height / 2f * tilesize, target.entity.health, target.entity.tile.block().health);
|
|
||||||
|
|
||||||
if(target.entity != null) {
|
if(target.entity != null) {
|
||||||
int bot = 0, top = 0;
|
int bot = 0, top = 0;
|
||||||
for (BlockBar bar : target.block().bars) {
|
for (BlockBar bar : target.block().bars) {
|
||||||
@ -455,7 +453,7 @@ public class Renderer extends RendererModule{
|
|||||||
|
|
||||||
float value = bar.value.get(target);
|
float value = bar.value.get(target);
|
||||||
|
|
||||||
if(value <= -1f) continue;
|
if(MathUtils.isEqual(value, -1f)) continue;
|
||||||
|
|
||||||
drawBar(bar.color, target.drawx(), target.drawy() + offset, value);
|
drawBar(bar.color, target.drawx(), target.drawy() + offset, value);
|
||||||
|
|
||||||
|
@ -144,4 +144,11 @@ public class NetEvents {
|
|||||||
packet.itemid = (byte)item.id;
|
packet.itemid = (byte)item.id;
|
||||||
Net.send(packet, SendMode.udp);
|
Net.send(packet, SendMode.udp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void handleOffload(Tile tile, Item item){
|
||||||
|
ItemOffloadPacket packet = new ItemOffloadPacket();
|
||||||
|
packet.position = tile.packedPosition();
|
||||||
|
packet.itemid = (byte)item.id;
|
||||||
|
Net.send(packet, SendMode.udp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -523,7 +523,24 @@ public class Packets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ItemAddPacket implements Packet{
|
public static class ItemAddPacket implements Packet, UnimportantPacket{
|
||||||
|
public int position;
|
||||||
|
public byte itemid;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(ByteBuffer buffer) {
|
||||||
|
buffer.putInt(position);
|
||||||
|
buffer.put(itemid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void read(ByteBuffer buffer) {
|
||||||
|
position = buffer.getInt();
|
||||||
|
itemid = buffer.get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ItemOffloadPacket implements Packet{
|
||||||
public int position;
|
public int position;
|
||||||
public byte itemid;
|
public byte itemid;
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@ public class Registrator {
|
|||||||
EntitySpawnPacket.class,
|
EntitySpawnPacket.class,
|
||||||
ItemTransferPacket.class,
|
ItemTransferPacket.class,
|
||||||
ItemAddPacket.class,
|
ItemAddPacket.class,
|
||||||
|
ItemOffloadPacket.class
|
||||||
};
|
};
|
||||||
private static ObjectIntMap<Class<?>> ids = new ObjectIntMap<>();
|
private static ObjectIntMap<Class<?>> ids = new ObjectIntMap<>();
|
||||||
|
|
||||||
|
@ -50,11 +50,11 @@ public class LevelDialog extends FloatingDialog{
|
|||||||
selmode.add("$text.level.mode").padRight(15f);
|
selmode.add("$text.level.mode").padRight(15f);
|
||||||
|
|
||||||
for(GameMode mode : GameMode.values()){
|
for(GameMode mode : GameMode.values()){
|
||||||
TextButton b = Elements.newButton("$mode."+mode.name()+".name", "toggle", ()->{
|
TextButton[] b = {null};
|
||||||
state.mode = mode;
|
b[0] = Elements.newButton("$mode." + mode.name() + ".name", "toggle", () -> state.mode = mode);
|
||||||
});
|
b[0].update(() -> b[0].setChecked(state.mode == mode));
|
||||||
group.add(b);
|
group.add(b[0]);
|
||||||
selmode.add(b).size(130f, 54f);
|
selmode.add(b[0]).size(130f, 54f);
|
||||||
}
|
}
|
||||||
|
|
||||||
content().add(selmode);
|
content().add(selmode);
|
||||||
|
@ -172,6 +172,10 @@ public class Block{
|
|||||||
return new TileEntity();
|
return new TileEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean syncEntity(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tries to put this item into a nearby container, if there are no available
|
* Tries to put this item into a nearby container, if there are no available
|
||||||
* containers, it gets added to the block's inventory.*/
|
* containers, it gets added to the block's inventory.*/
|
||||||
@ -237,7 +241,7 @@ public class Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try offloading an item to a nearby container. Returns true if success.
|
* Try offloading an item to a nearby container in its facing direction. Returns true if success.
|
||||||
*/
|
*/
|
||||||
protected boolean offloadDir(Tile tile, Item item){
|
protected boolean offloadDir(Tile tile, Item item){
|
||||||
Tile other = tile.getNearby(tile.getRotation());
|
Tile other = tile.getNearby(tile.getRotation());
|
||||||
|
@ -72,17 +72,23 @@ public class Conveyor extends Block{
|
|||||||
|
|
||||||
byte rotation = tile.getRotation();
|
byte rotation = tile.getRotation();
|
||||||
|
|
||||||
for(int i = 0; i < entity.convey.size; i ++){
|
try {
|
||||||
ItemPos pos = drawpos.set(entity.convey.get(i), ItemPos.drawShorts);
|
|
||||||
|
|
||||||
if(pos.item == null) continue;
|
for (int i = 0; i < entity.convey.size; i++) {
|
||||||
|
ItemPos pos = drawpos.set(entity.convey.get(i), ItemPos.drawShorts);
|
||||||
|
|
||||||
tr1.trns(rotation * 90, tilesize, 0);
|
if (pos.item == null) continue;
|
||||||
tr2.trns(rotation * 90, -tilesize / 2, pos.x*tilesize/2);
|
|
||||||
|
|
||||||
Draw.rect(pos.item.region,
|
tr1.trns(rotation * 90, tilesize, 0);
|
||||||
tile.x * tilesize + tr1.x * pos.y + tr2.x,
|
tr2.trns(rotation * 90, -tilesize / 2, pos.x * tilesize / 2);
|
||||||
tile.y * tilesize + tr1.y * pos.y + tr2.y, itemSize, itemSize);
|
|
||||||
|
Draw.rect(pos.item.region,
|
||||||
|
tile.x * tilesize + tr1.x * pos.y + tr2.x,
|
||||||
|
tile.y * tilesize + tr1.y * pos.y + tr2.y, itemSize, itemSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch (IndexOutOfBoundsException e){
|
||||||
|
Log.err(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +100,7 @@ public class Conveyor extends Block{
|
|||||||
|
|
||||||
int minremove = Integer.MAX_VALUE;
|
int minremove = Integer.MAX_VALUE;
|
||||||
|
|
||||||
for(int i = 0; i < entity.convey.size; i ++){
|
for(int i = entity.convey.size - 1; i >= 0; i --){
|
||||||
long value = entity.convey.get(i);
|
long value = entity.convey.get(i);
|
||||||
ItemPos pos = pos1.set(value, ItemPos.updateShorts);
|
ItemPos pos = pos1.set(value, ItemPos.updateShorts);
|
||||||
|
|
||||||
@ -171,6 +177,11 @@ public class Conveyor extends Block{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean syncEntity(){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Conveyor data format:
|
* Conveyor data format:
|
||||||
* [0] item ordinal
|
* [0] item ordinal
|
||||||
|
@ -7,6 +7,7 @@ import io.anuke.mindustry.entities.TileEntity;
|
|||||||
import io.anuke.mindustry.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
import io.anuke.mindustry.net.NetEvents;
|
import io.anuke.mindustry.net.NetEvents;
|
||||||
import io.anuke.mindustry.resource.Item;
|
import io.anuke.mindustry.resource.Item;
|
||||||
|
import io.anuke.mindustry.world.BlockBar;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.blocks.types.PowerBlock;
|
import io.anuke.mindustry.world.blocks.types.PowerBlock;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
@ -46,6 +47,8 @@ public class Teleporter extends PowerBlock{
|
|||||||
solid = true;
|
solid = true;
|
||||||
health = 80;
|
health = 80;
|
||||||
powerCapacity = 30f;
|
powerCapacity = 30f;
|
||||||
|
|
||||||
|
bars.add(new BlockBar(Color.RED, true, tile -> tile.entity.totalItems() / 4f));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -135,7 +138,6 @@ public class Teleporter extends PowerBlock{
|
|||||||
Array<Tile> links = findLinks(tile);
|
Array<Tile> links = findLinks(tile);
|
||||||
|
|
||||||
if(links.size > 0){
|
if(links.size > 0){
|
||||||
|
|
||||||
if(Net.server() || !Net.active()){
|
if(Net.server() || !Net.active()){
|
||||||
Tile target = links.random();
|
Tile target = links.random();
|
||||||
target.entity.addItem(item, 1);
|
target.entity.addItem(item, 1);
|
||||||
@ -169,7 +171,7 @@ public class Teleporter extends PowerBlock{
|
|||||||
if(other.block() instanceof Teleporter){
|
if(other.block() instanceof Teleporter){
|
||||||
if(other.<TeleporterEntity>entity().color != entity.color){
|
if(other.<TeleporterEntity>entity().color != entity.color){
|
||||||
removal.add(other);
|
removal.add(other);
|
||||||
}else if(other.entity.totalItems() == 0){
|
}else if(other.entity.totalItems() <= 0){
|
||||||
returns.add(other);
|
returns.add(other);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
Reference in New Issue
Block a user