1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-11-14 03:25:32 +03:00

Editor fixes

This commit is contained in:
Anuken 2020-05-04 10:57:57 -04:00
parent 90505a8e19
commit ea2adbd63b
5 changed files with 42 additions and 5 deletions

View File

@ -38,6 +38,13 @@ public class EditorTile extends Tile{
super.setFloor(type);
}
@Override
public void updateOcclusion(){
super.updateOcclusion();
ui.editor.editor.renderer().updatePoint(x, y);
}
@Override
public void setBlock(Block type, Team team, int rotation){
if(state.isGame()){

View File

@ -0,0 +1,16 @@
package mindustry.entities.def;
import arc.util.ArcAnnotate.*;
import mindustry.annotations.Annotations.*;
import mindustry.world.blocks.payloads.*;
/** An entity that holds a payload. */
@Component
abstract class PayloadComp{
//TODO multiple payloads?
@Nullable Payload payload;
boolean hasPayload(){
return payload != null;
}
}

View File

@ -491,12 +491,13 @@ public class Tile implements Position, QuadTreeObject{
//remove this tile's dangling entities
if(entity.block().isMultiblock()){
int cx = entity.tileX(), cy = entity.tileY();
int size = entity.block().size;
int offsetx = -(size - 1) / 2;
int offsety = -(size - 1) / 2;
for(int dx = 0; dx < size; dx++){
for(int dy = 0; dy < size; dy++){
Tile other = world.tile(x + dx + offsetx, y + dy + offsety);
Tile other = world.tile(cx + dx + offsetx, cy + dy + offsety);
if(other != null){
//reset entity and block *manually* - thus, preChanged() will not be called anywhere else, for multiblocks
if(other != this){ //do not remove own entity so it can be processed in changed()

View File

@ -23,7 +23,7 @@ def hashDirectory = {
ByteBuffer buffer = ByteBuffer.allocate(16)
def files = []
root.eachFileRecurse{ file ->
files += file
if(!file.name.startsWith(".")) files += file
}
files.sort()
@ -48,13 +48,12 @@ task run(dependsOn: classes, type: JavaExec){
jvmArgs("-XstartOnFirstThread", "-Djava.awt.headless=true")
}
spriteHashFile.parentFile.mkdirs()
/*spriteHashFile.parentFile.mkdirs()
String spriteHash = hashDirectory()
if(spriteHashFile.exists() && spriteHashFile.text != spriteHash){
dependsOn ":tools:pack"
}
spriteHashFile.text = spriteHash
spriteHashFile.text = spriteHash*/
if(project.hasProperty("args")){
args Eval.me(project.getProperties()["args"])

View File

@ -269,6 +269,20 @@ public class ApplicationTests{
assertTrue(tank.entity.liquids().current() == Liquids.water, "Tank has no water");
}
@Test
void blockOverlapRemoved(){
world.loadMap(testMap);
state.set(State.playing);
//edge block
world.tile(1, 1).setBlock(Blocks.coreShard);
assertEquals(Blocks.coreShard, world.tile(0, 0).block());
//this should overwrite the block
world.tile(2, 2).setBlock(Blocks.coreShard);
assertEquals(Blocks.air, world.tile(0, 0).block());
}
@Test
void conveyorCrash(){
world.loadMap(testMap);