Cleanup
This commit is contained in:
@@ -161,7 +161,6 @@ public class World{
|
|||||||
* A WorldLoadEvent will be fire.
|
* A WorldLoadEvent will be fire.
|
||||||
*/
|
*/
|
||||||
public void endMapLoad(){
|
public void endMapLoad(){
|
||||||
prepareTiles(tiles);
|
|
||||||
|
|
||||||
for(Tile tile : tiles){
|
for(Tile tile : tiles){
|
||||||
//remove legacy blocks; they need to stop existing
|
//remove legacy blocks; they need to stop existing
|
||||||
@@ -393,53 +392,6 @@ public class World{
|
|||||||
return dark;
|
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{
|
public interface Raycaster{
|
||||||
boolean accept(int x, int y);
|
boolean accept(int x, int y);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ public class MapEditor{
|
|||||||
tags.put("steamid", map.file.parent().name());
|
tags.put("steamid", map.file.parent().name());
|
||||||
}
|
}
|
||||||
MapIO.loadMap(map, context);
|
MapIO.loadMap(map, context);
|
||||||
checkLinkedTiles();
|
|
||||||
renderer.resize(width(), height());
|
renderer.resize(width(), height());
|
||||||
loading = false;
|
loading = false;
|
||||||
}
|
}
|
||||||
@@ -67,12 +66,6 @@ public class MapEditor{
|
|||||||
renderer.resize(width(), height());
|
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){
|
public void load(Runnable r){
|
||||||
loading = true;
|
loading = true;
|
||||||
r.run();
|
r.run();
|
||||||
|
|||||||
@@ -260,8 +260,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
player.set(world.width() * tilesize/2f, world.height() * tilesize/2f);
|
player.set(world.width() * tilesize/2f, world.height() * tilesize/2f);
|
||||||
//TODO figure out how to kill player
|
player.clearUnit();
|
||||||
//player.dead(false);
|
|
||||||
logic.play();
|
logic.play();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -807,7 +807,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
public void breakBlock(int x, int y){
|
public void breakBlock(int x, int y){
|
||||||
Tile tile = world.tile(x, y);
|
Tile tile = world.tile(x, y);
|
||||||
//TODO hacky
|
//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));
|
player.builder().addBuild(new BuildRequest(tile.x, tile.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,12 +84,11 @@ public abstract class SaveVersion extends SaveFileReader{
|
|||||||
lastReadBuild = map.getInt("build", -1);
|
lastReadBuild = map.getInt("build", -1);
|
||||||
|
|
||||||
Map worldmap = maps.byName(map.get("mapname", "\\\\\\"));
|
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"),
|
"name", map.get("mapname", "Unknown"),
|
||||||
"width", 1,
|
"width", 1,
|
||||||
"height", 1
|
"height", 1
|
||||||
)) : worldmap;
|
)) : worldmap;
|
||||||
state.map = map1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeMap(DataOutput stream) throws IOException{
|
public void writeMap(DataOutput stream) throws IOException{
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||||
archash=1b96f9149cce63e7c4b72b5798c58e8f62b1f185
|
archash=50df607c88d697dc42b29b56947cda318f90d71b
|
||||||
|
|||||||
Reference in New Issue
Block a user