mirror of
https://github.com/Anuken/Mindustry.git
synced 2024-11-11 14:56:10 +03:00
Added 2x2 door, fixed bugs with multiblocks and iteractables
This commit is contained in:
parent
704ee097f3
commit
597c5161e3
BIN
core/assets-raw/sprites/blocks/door-large-icon.png
Normal file
BIN
core/assets-raw/sprites/blocks/door-large-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 253 B |
BIN
core/assets-raw/sprites/blocks/door-large-open.png
Normal file
BIN
core/assets-raw/sprites/blocks/door-large-open.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 428 B |
BIN
core/assets-raw/sprites/blocks/door-large.png
Normal file
BIN
core/assets-raw/sprites/blocks/door-large.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 397 B |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 53 KiB |
@ -228,6 +228,18 @@ public class Fx{
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
dooropenlarge = new Effect(10, e -> {
|
||||
Draw.thickness(e.fract() * 1.6f);
|
||||
Draw.square(e.x, e.y, Vars.tilesize + e.ifract() * 2f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
doorcloselarge = new Effect(10, e -> {
|
||||
Draw.thickness(e.fract() * 1.6f);
|
||||
Draw.square(e.x, e.y, Vars.tilesize + e.fract() * 2f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
purify = new Effect(10, e -> {
|
||||
Draw.color(Color.ROYAL, Color.GRAY, e.ifract());
|
||||
Draw.thickness(2f);
|
||||
|
@ -62,8 +62,9 @@ public class Input{
|
||||
}
|
||||
|
||||
}else if(Inputs.buttonUp(Buttons.LEFT)){
|
||||
if(cursor != null && cursor.block() instanceof Configurable){
|
||||
Vars.ui.showConfig(cursor);
|
||||
Tile linked = cursor.isLinked() ? cursor.getLinked() : cursor;
|
||||
if(linked != null && linked.block() instanceof Configurable){
|
||||
Vars.ui.showConfig(linked);
|
||||
}else if(!Vars.ui.hasConfigMouse()){
|
||||
Vars.ui.hideConfig();
|
||||
}
|
||||
@ -98,7 +99,7 @@ public class Input{
|
||||
|
||||
public static boolean onConfigurable(){
|
||||
Tile tile = Vars.world.tile(tilex(), tiley());
|
||||
return tile != null && tile.block() instanceof Configurable;
|
||||
return tile != null && (tile.block() instanceof Configurable || (tile.isLinked() && tile.getLinked().block() instanceof Configurable));
|
||||
}
|
||||
|
||||
public static int tilex(){
|
||||
|
@ -18,6 +18,7 @@ public enum Recipe{
|
||||
titaniumwalllarge(defense, DefenseBlocks.titaniumwalllarge, stack(Item.titanium, 8)),
|
||||
duriumwalllarge(defense, DefenseBlocks.diriumwalllarge, stack(Item.dirium, 8)),
|
||||
door(defense, DefenseBlocks.door, stack(Item.steel, 3), stack(Item.iron, 3)),
|
||||
largedoor(defense, DefenseBlocks.largedoor, stack(Item.steel, 3*4), stack(Item.iron, 3*4)),
|
||||
titaniumshieldwall(defense, DefenseBlocks.titaniumshieldwall, stack(Item.titanium, 2)),
|
||||
|
||||
conveyor(distribution, DistributionBlocks.conveyor, stack(Item.stone, 1)),
|
||||
|
@ -301,10 +301,6 @@ public class World extends Module{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(tile.block() != type && type.canReplace(tile.block())){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(type.isMultiblock()){
|
||||
int offsetx = -(type.width-1)/2;
|
||||
int offsety = -(type.height-1)/2;
|
||||
@ -318,6 +314,9 @@ public class World extends Module{
|
||||
}
|
||||
return true;
|
||||
}else{
|
||||
if(tile.block() != type && type.canReplace(tile.block()) && tile.block().isMultiblock() == type.isMultiblock()){
|
||||
return true;
|
||||
}
|
||||
return tile != null && tile.block() == Blocks.air;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.world.blocks;
|
||||
|
||||
import io.anuke.mindustry.entities.effect.Fx;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.types.Wall;
|
||||
import io.anuke.mindustry.world.blocks.types.defense.*;
|
||||
@ -96,7 +97,17 @@ public class DefenseBlocks{
|
||||
}
|
||||
},
|
||||
door = new Door("door"){{
|
||||
fullDescription = "A block than can be opened and closed by clicking it.";
|
||||
fullDescription = "A block than can be opened and closed by tapping it.";
|
||||
description = "Opens and closes.\n[interact]Tap to toggle";
|
||||
health = 90;
|
||||
}},
|
||||
largedoor = new Door("door-large"){{
|
||||
formalName = "large door";
|
||||
fullDescription = "A block than can be opened and closed by tapping it.";
|
||||
description = "Opens and closes.\n[interact]Tap to toggle";
|
||||
openfx = Fx.dooropenlarge;
|
||||
closefx = Fx.doorcloselarge;
|
||||
health = 90*4;
|
||||
width = height = 2;
|
||||
}};
|
||||
}
|
||||
|
@ -11,8 +11,7 @@ public class BlockPart extends Block implements PowerAcceptor, LiquidAcceptor{
|
||||
|
||||
public BlockPart() {
|
||||
super("blockpart");
|
||||
//TODO note: all block parts are solid, which means you can't have non-solid multiblocks
|
||||
solid = true;
|
||||
solid = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -20,6 +19,11 @@ public class BlockPart extends Block implements PowerAcceptor, LiquidAcceptor{
|
||||
//do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolidFor(Tile tile){
|
||||
return tile.getLinked().solid() || tile.getLinked().block().isSolidFor(tile.getLinked());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleItem(Item item, Tile tile, Tile source){
|
||||
tile.getLinked().block().handleItem(item, tile.getLinked(), source);
|
||||
|
@ -38,10 +38,12 @@ public class Door extends Wall implements Configurable{
|
||||
public void draw(Tile tile){
|
||||
DoorEntity entity = tile.entity();
|
||||
|
||||
Vector2 offset = getPlaceOffset();
|
||||
|
||||
if(!entity.open){
|
||||
Draw.rect(name, tile.worldx(), tile.worldy());
|
||||
Draw.rect(name, tile.worldx() + offset.x, tile.worldy() + offset.y);
|
||||
}else{
|
||||
Draw.rect(name + "-open", tile.worldx(), tile.worldy());
|
||||
Draw.rect(name + "-open", tile.worldx() + offset.x, tile.worldy() + offset.y);
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,7 +57,7 @@ public class Door extends Wall implements Configurable{
|
||||
public void buildTable(Tile tile, Table table){
|
||||
DoorEntity entity = tile.entity();
|
||||
|
||||
if(anyEntities(tile) && !entity.open){
|
||||
if(anyEntities(tile) && entity.open){
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user