Bundles updated / Crash fix
This commit is contained in:
@@ -9,6 +9,7 @@ import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.Floor;
|
||||
import io.anuke.ucore.function.IntPositionConsumer;
|
||||
import io.anuke.ucore.util.Bits;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import static io.anuke.mindustry.Vars.content;
|
||||
import static io.anuke.mindustry.Vars.ui;
|
||||
@@ -82,6 +83,8 @@ public enum EditorTool{
|
||||
MapTileData data;
|
||||
|
||||
public void touched(MapEditor editor, int x, int y){
|
||||
if(!Mathf.inBounds(x, y, editor.getMap().width(), editor.getMap().height())) return;
|
||||
|
||||
if(editor.getDrawBlock().isMultiblock()){
|
||||
//don't fill multiblocks, thanks
|
||||
pencil.touched(editor, x, y);
|
||||
|
||||
@@ -1,10 +1,74 @@
|
||||
package io.anuke.mindustry.world.blocks.defense;
|
||||
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.entities.traits.SyncTrait;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.entities.EntityGroup;
|
||||
import io.anuke.ucore.entities.impl.BaseEntity;
|
||||
import io.anuke.ucore.entities.trait.DrawTrait;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
|
||||
import static io.anuke.mindustry.Vars.bulletGroup;
|
||||
|
||||
public class ForceProjector extends Block {
|
||||
|
||||
public ForceProjector(String name) {
|
||||
super(name);
|
||||
update = true;
|
||||
solid = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
ForceEntity entity = tile.entity();
|
||||
|
||||
if(entity.shield == null){
|
||||
entity.shield = new ShieldEntity(tile);
|
||||
entity.shield.add();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getEntity(){
|
||||
return new ForceEntity();
|
||||
}
|
||||
|
||||
class ForceEntity extends TileEntity{
|
||||
ShieldEntity shield;
|
||||
}
|
||||
|
||||
class ShieldEntity extends BaseEntity implements DrawTrait, SyncTrait{
|
||||
final Tile tile;
|
||||
final ForceProjector block;
|
||||
|
||||
public ShieldEntity(Tile tile){
|
||||
this.tile = tile;
|
||||
this.block = (ForceProjector)tile.block();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityGroup targetGroup(){
|
||||
return bulletGroup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSyncing(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(DataOutput data) throws IOException{}
|
||||
|
||||
@Override
|
||||
public void read(DataInput data, long time) throws IOException{}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user