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()