This commit is contained in:
Anuken
2020-03-31 15:01:22 -04:00
parent f1fd072400
commit 77447c59f6
6 changed files with 4 additions and 61 deletions

View File

@@ -161,7 +161,6 @@ public class World{
* A WorldLoadEvent will be fire.
*/
public void endMapLoad(){
prepareTiles(tiles);
for(Tile tile : tiles){
//remove legacy blocks; they need to stop existing
@@ -393,53 +392,6 @@ public class World{
return dark;
}
/**
* 'Prepares' a tile array by:<br>
* - setting up multiblocks<br>
* - updating occlusion<br>
* Usually used before placing structures on a tile array.
*/
public void prepareTiles(Tiles tiles){
//TODO FIX
/*
//find multiblocks
IntArray multiblocks = new IntArray();
for(Tile tile : tiles){
if(tile.block().isMultiblock()){
multiblocks.add(tile.pos());
}
}
//place multiblocks now
for(int i = 0; i < multiblocks.size; i++){
int pos = multiblocks.get(i);
int x = Point2.x(pos);
int y = Point2.y(pos);
Tile tile = tiles.getn(x, y);
Block result = tile.block();
Team team = tile.team();
int offsetx = -(result.size - 1) / 2;
int offsety = -(result.size - 1) / 2;
for(int dx = 0; dx < result.size; dx++){
for(int dy = 0; dy < result.size; dy++){
int worldx = dx + offsetx + x;
int worldy = dy + offsety + y;
if(!(worldx == x && worldy == y)){
Tile toplace = world.tile(worldx, worldy);
if(toplace != null){
toplace.setBlock(BlockPart.get(dx + offsetx, dy + offsety), team);
}
}
}
}
}*/
}
public interface Raycaster{
boolean accept(int x, int y);
}

View File

@@ -54,7 +54,6 @@ public class MapEditor{
tags.put("steamid", map.file.parent().name());
}
MapIO.loadMap(map, context);
checkLinkedTiles();
renderer.resize(width(), height());
loading = false;
}
@@ -67,12 +66,6 @@ public class MapEditor{
renderer.resize(width(), height());
}
//adds missing blockparts
//TODO remove, may not be necessary with blockpart refactor later
public void checkLinkedTiles(){
//TODO actually remove
}
public void load(Runnable r){
loading = true;
r.run();

View File

@@ -260,8 +260,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
}
}
player.set(world.width() * tilesize/2f, world.height() * tilesize/2f);
//TODO figure out how to kill player
//player.dead(false);
player.clearUnit();
logic.play();
});
}

View File

@@ -807,7 +807,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
public void breakBlock(int x, int y){
Tile tile = world.tile(x, y);
//TODO hacky
if(tile.entity != null) tile = tile.entity.tile();
if(tile != null && tile.entity != null) tile = tile.entity.tile();
player.builder().addBuild(new BuildRequest(tile.x, tile.y));
}

View File

@@ -84,12 +84,11 @@ public abstract class SaveVersion extends SaveFileReader{
lastReadBuild = map.getInt("build", -1);
Map worldmap = maps.byName(map.get("mapname", "\\\\\\"));
Map map1 = worldmap == null ? new Map(StringMap.of(
state.map = worldmap == null ? new Map(StringMap.of(
"name", map.get("mapname", "Unknown"),
"width", 1,
"height", 1
)) : worldmap;
state.map = map1;
}
public void writeMap(DataOutput stream) throws IOException{