mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-13 00:05:23 +07:00
Removed static block layer / Minor bugfixes
This commit is contained in:
parent
be9ea33aa4
commit
0b7decbfdd
@ -155,7 +155,7 @@ public class Renderer extends RendererModule{
|
||||
setCamera(position.x + 0.0001f, position.y + 0.0001f);
|
||||
}
|
||||
|
||||
clampCamera(-tilesize / 2f, -tilesize / 2f + 1, world.width() * tilesize - tilesize / 2f, world.height() * tilesize - tilesize / 2f);
|
||||
//clampCamera(-tilesize / 2f, -tilesize / 2f + 1, world.width() * tilesize - tilesize / 2f, world.height() * tilesize - tilesize / 2f);
|
||||
|
||||
float prex = camera.position.x, prey = camera.position.y;
|
||||
updateShake(0.75f);
|
||||
|
@ -228,7 +228,7 @@ public class UI extends SceneModule{
|
||||
}
|
||||
|
||||
public void loadLogic(String text, Runnable call){
|
||||
loadfrag.show();
|
||||
loadfrag.show(text);
|
||||
Timers.runTask(7f, () -> {
|
||||
threads.run(() -> {
|
||||
call.run();
|
||||
|
@ -6,7 +6,6 @@ import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.StaticBlock;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
@ -68,23 +67,22 @@ public class BlockRenderer{
|
||||
tile.block().drawShadow(tile);
|
||||
}
|
||||
|
||||
if(!(block instanceof StaticBlock)){
|
||||
if(block != Blocks.air){
|
||||
if(!expanded){
|
||||
addRequest(tile, Layer.block);
|
||||
if(block != Blocks.air){
|
||||
if(!expanded){
|
||||
addRequest(tile, Layer.block);
|
||||
}
|
||||
|
||||
if(block.expanded || !expanded){
|
||||
if(block.layer != null && block.isLayer(tile)){
|
||||
addRequest(tile, block.layer);
|
||||
}
|
||||
|
||||
if(block.expanded || !expanded){
|
||||
if(block.layer != null && block.isLayer(tile)){
|
||||
addRequest(tile, block.layer);
|
||||
}
|
||||
|
||||
if(block.layer2 != null && block.isLayer2(tile)){
|
||||
addRequest(tile, block.layer2);
|
||||
}
|
||||
if(block.layer2 != null && block.isLayer2(tile)){
|
||||
addRequest(tile, block.layer2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -95,12 +93,6 @@ public class BlockRenderer{
|
||||
Graphics.flushSurface();
|
||||
Draw.color();
|
||||
|
||||
Graphics.end();
|
||||
floorRenderer.beginDraw();
|
||||
floorRenderer.drawLayer(CacheLayer.walls);
|
||||
floorRenderer.endDraw();
|
||||
Graphics.begin();
|
||||
|
||||
Sort.instance().sort(requests.items, 0, requestidx);
|
||||
iterateidx = 0;
|
||||
}
|
||||
|
@ -53,8 +53,7 @@ public enum CacheLayer{
|
||||
endShader(Shaders.space);
|
||||
}
|
||||
},
|
||||
normal,
|
||||
walls;
|
||||
normal;
|
||||
|
||||
public void begin(){
|
||||
|
||||
|
@ -10,7 +10,6 @@ import com.badlogic.gdx.utils.IntSet;
|
||||
import com.badlogic.gdx.utils.IntSet.IntSetIterator;
|
||||
import com.badlogic.gdx.utils.ObjectSet;
|
||||
import io.anuke.mindustry.game.EventType.WorldLoadGraphicsEvent;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.core.Events;
|
||||
@ -94,7 +93,7 @@ public class FloorRenderer{
|
||||
drawnLayers.clear();
|
||||
drawnLayerSet.clear();
|
||||
|
||||
//preliminary layer check:
|
||||
//preliminary layer check
|
||||
for(int x = -crangex; x <= crangex; x++){
|
||||
for(int y = -crangey; y <= crangey; y++){
|
||||
int worldx = Mathf.scl(camera.position.x, chunksize * tilesize) + x;
|
||||
@ -106,7 +105,7 @@ public class FloorRenderer{
|
||||
Chunk chunk = cache[worldx][worldy];
|
||||
|
||||
//loop through all layers, and add layer index if it exists
|
||||
for(int i = 0; i < layers - 1; i++){
|
||||
for(int i = 0; i < layers; i++){
|
||||
if(chunk.caches[i] != -1){
|
||||
drawnLayerSet.add(i);
|
||||
}
|
||||
@ -191,7 +190,6 @@ public class FloorRenderer{
|
||||
|
||||
private void cacheChunk(int cx, int cy){
|
||||
Chunk chunk = cache[cx][cy];
|
||||
//long time = TimeUtils.nanoTime();
|
||||
|
||||
ObjectSet<CacheLayer> used = new ObjectSet<>();
|
||||
|
||||
@ -199,8 +197,7 @@ public class FloorRenderer{
|
||||
for(int tiley = cy * chunksize; tiley < (cy + 1) * chunksize; tiley++){
|
||||
Tile tile = world.tile(tilex, tiley);
|
||||
if(tile != null){
|
||||
used.add(tile.block().cacheLayer == CacheLayer.walls ?
|
||||
CacheLayer.walls : tile.floor().cacheLayer);
|
||||
used.add(tile.floor().cacheLayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -208,8 +205,6 @@ public class FloorRenderer{
|
||||
for(CacheLayer layer : used){
|
||||
cacheChunkLayer(cx, cy, chunk, layer);
|
||||
}
|
||||
|
||||
// Log.info("Time to cache a chunk: {0}", TimeUtils.timeSinceNanos(time) / 1000000f);
|
||||
}
|
||||
|
||||
private void cacheChunkLayer(int cx, int cy, Chunk chunk, CacheLayer layer){
|
||||
@ -222,16 +217,11 @@ public class FloorRenderer{
|
||||
Tile tile = world.tile(tilex, tiley);
|
||||
if(tile == null) continue;
|
||||
|
||||
if(tile.floor().cacheLayer == layer && tile.block().cacheLayer != CacheLayer.walls){
|
||||
if(tile.floor().cacheLayer == layer){
|
||||
tile.floor().draw(tile);
|
||||
}else if(tile.floor().cacheLayer.ordinal() < layer.ordinal() && tile.block().cacheLayer != CacheLayer.walls && layer != CacheLayer.walls){
|
||||
}else if(tile.floor().cacheLayer.ordinal() < layer.ordinal()){
|
||||
tile.floor().drawNonLayer(tile);
|
||||
}
|
||||
|
||||
if(tile.block().cacheLayer == layer && layer == CacheLayer.walls){
|
||||
Block block = tile.block();
|
||||
block.draw(tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,41 +4,28 @@ import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.IntMap;
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
import com.badlogic.gdx.utils.TimeUtils;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.BlockPart;
|
||||
import io.anuke.mindustry.world.blocks.Floor;
|
||||
import io.anuke.mindustry.world.blocks.Rock;
|
||||
import io.anuke.mindustry.world.blocks.StaticBlock;
|
||||
import io.anuke.ucore.core.Settings;
|
||||
|
||||
import static io.anuke.mindustry.Vars.headless;
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
public class Administration{
|
||||
public static final int defaultMaxBrokenBlocks = 15;
|
||||
public static final int defaultBreakCooldown = 1000 * 15;
|
||||
|
||||
/**
|
||||
* All player info. Maps UUIDs to info. This persists throughout restarts.
|
||||
*/
|
||||
/**All player info. Maps UUIDs to info. This persists throughout restarts.*/
|
||||
private ObjectMap<String, PlayerInfo> playerInfo = new ObjectMap<>();
|
||||
/**
|
||||
* Maps UUIDs to trace infos. This is wiped when a player logs off.
|
||||
*/
|
||||
/**Maps UUIDs to trace infos. This is wiped when a player logs off.*/
|
||||
private ObjectMap<String, TraceInfo> traceInfo = new ObjectMap<>();
|
||||
/**
|
||||
* Maps packed coordinates to logs for that coordinate
|
||||
*/
|
||||
/** Maps packed coordinates to logs for that coordinate*/
|
||||
private IntMap<Array<EditLog>> editLogs = new IntMap<>();
|
||||
|
||||
private Array<String> bannedIPs = new Array<>();
|
||||
|
||||
public Administration(){
|
||||
Settings.defaultList(
|
||||
"antigrief", false,
|
||||
"antigrief-max", defaultMaxBrokenBlocks,
|
||||
"antigrief-cooldown", defaultBreakCooldown
|
||||
"antigrief", false,
|
||||
"antigrief-max", defaultMaxBrokenBlocks,
|
||||
"antigrief-cooldown", defaultBreakCooldown
|
||||
);
|
||||
|
||||
load();
|
||||
@ -76,18 +63,6 @@ public class Administration{
|
||||
return editLogs;
|
||||
}
|
||||
|
||||
public void logEdit(int x, int y, Player player, Block block, int rotation, EditLog.EditAction action){
|
||||
if(block instanceof BlockPart || block instanceof Rock || block instanceof Floor || block instanceof StaticBlock)
|
||||
return;
|
||||
if(editLogs.containsKey(x + y * world.width())){
|
||||
editLogs.get(x + y * world.width()).add(new EditLog(player.name, block, rotation, action));
|
||||
}else{
|
||||
Array<EditLog> logs = new Array<>();
|
||||
logs.add(new EditLog(player.name, block, rotation, action));
|
||||
editLogs.put(x + y * world.width(), logs);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public void rollbackWorld(int rollbackTimes) {
|
||||
for(IntMap.Entry<Array<EditLog>> editLog : editLogs.entries()) {
|
||||
|
@ -1,13 +0,0 @@
|
||||
package io.anuke.mindustry.world.blocks;
|
||||
|
||||
import io.anuke.mindustry.graphics.CacheLayer;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
|
||||
public class StaticBlock extends Block{
|
||||
|
||||
public StaticBlock(String name){
|
||||
super(name);
|
||||
cacheLayer = CacheLayer.walls;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user