Implemented 'deep' unplaceable floor blocks
This commit is contained in:
@@ -37,6 +37,7 @@ public class Blocks {
|
||||
}},
|
||||
|
||||
deepwater = new Floor("deepwater") {{
|
||||
placeableOn = false;
|
||||
liquidColor = Color.valueOf("546bb3");
|
||||
speedMultiplier = 0.2f;
|
||||
variants = 0;
|
||||
|
||||
@@ -236,7 +236,11 @@ public class Player extends Unit{
|
||||
|
||||
dashing = Inputs.keyDown("dash");
|
||||
|
||||
float speed = dashing ? (debug ? Player.dashSpeed * 5f : Player.dashSpeed) : Player.speed;
|
||||
float speed = dashing ? (debug ? Player.dashSpeed * 5f : Player.dashSpeed) : Player.speed ;
|
||||
|
||||
float carrySlowdown = 0.3f;
|
||||
|
||||
speed *= ((1f-carrySlowdown) + (inventory.hasItem() ? (float)inventory.getItem().amount/inventory.capacity(): 1f) * carrySlowdown);
|
||||
|
||||
if(health < maxhealth && timer.get(timerRegen, 20))
|
||||
health ++;
|
||||
|
||||
@@ -60,6 +60,8 @@ public class Block extends BaseBlock {
|
||||
public boolean breakable;
|
||||
/**whether this block can be drowned in*/
|
||||
public boolean liquid;
|
||||
/**whether this floor can be placed on.*/
|
||||
public boolean placeableOn = true;
|
||||
/**time it takes to break*/
|
||||
public float breaktime = 18;
|
||||
/**tile entity health*/
|
||||
|
||||
@@ -132,14 +132,14 @@ public class Placement {
|
||||
for(int dx = 0; dx < type.size; dx ++){
|
||||
for(int dy = 0; dy < type.size; dy ++){
|
||||
Tile other = world.tile(x + dx + offsetx, y + dy + offsety);
|
||||
if(other == null || (other.block() != Blocks.air && !other.block().alwaysReplace) || isSpawnPoint(other)){
|
||||
if(other == null || (other.block() != Blocks.air && !other.block().alwaysReplace) || isSpawnPoint(other) || !other.floor().placeableOn){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}else {
|
||||
return (tile.getTeam() == Team.none || tile.getTeam() == team)
|
||||
return (tile.getTeam() == Team.none || tile.getTeam() == team) && tile.floor().placeableOn
|
||||
&& ((type.canReplace(tile.block()) && !(type == tile.block() && rotation == tile.getRotation() && type.rotate)) || tile.block().alwaysReplace)
|
||||
&& tile.block().isMultiblock() == type.isMultiblock() || tile.block() == Blocks.air;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user