private function checkForVertical($railType, $currentDirection)
{
switch ($railType) {
case Rail::SLOPED_ASCENDING_NORTH:
switch ($currentDirection) {
case Entity::NORTH:
// Headed north up
$diff = $this->x - $this->getFloorX();
if ($diff !== 0 and $diff <= 0.5) {
$dx = $this->getFloorX() - 0.1 - $this->x;
$this->move($dx, 1, 0);
return true;
}
break;
case ENTITY::SOUTH:
// Headed south down
$diff = $this->x - $this->getFloorX();
if ($diff !== 0 and $diff >= 0.5) {
$dx = $this->getFloorX() + 1 - $this->x;
$this->move($dx, -1, 0);
return true;
}
break;
}
break;
case Rail::SLOPED_ASCENDING_SOUTH:
switch ($currentDirection) {
case Entity::SOUTH:
// Headed south up
$diff = $this->x - $this->getFloorX();
if ($diff !== 0 and $diff >= 0.5) {
$dx = $this->getFloorX() + 1 - $this->x;
$this->move($dx, 1, 0);
return true;
}
break;
case Entity::NORTH:
// Headed north down
$diff = $this->x - $this->getFloorX();
if ($diff !== 0 and $diff <= 0.5) {
$dx = $this->getFloorX() - 0.1 - $this->x;
$this->move($dx, -1, 0);
return true;
}
break;
}
break;
case Rail::SLOPED_ASCENDING_EAST:
switch ($currentDirection) {
case Entity::EAST:
// Headed east up
$diff = $this->z - $this->getFloorZ();
if ($diff !== 0 and $diff <= 0.5) {
$dz = $this->getFloorZ() - 0.1 - $this->z;
$this->move(0, 1, $dz);
return true;
}
break;
case Entity::WEST:
// Headed west down
$diff = $this->z - $this->getFloorZ();
if ($diff !== 0 and $diff >= 0.5) {
$dz = $this->getFloorZ() + 1 - $this->z;
$this->move(0, -1, $dz);
return true;
}
break;
}
break;
case Rail::SLOPED_ASCENDING_WEST:
switch ($currentDirection) {
case Entity::WEST:
// Headed west up
$diff = $this->z - $this->getFloorZ();
if ($diff !== 0 and $diff >= 0.5) {
$dz = $this->getFloorZ() + 1 - $this->z;
$this->move(0, 1, $dz);
return true;
}
break;
case Entity::EAST:
// Headed east down
$diff = $this->z - $this->getFloorZ();
if ($diff !== 0 and $diff <= 0.5) {
$dz = $this->getFloorZ() - 0.1 - $this->z;
$this->move(0, -1, $dz);
return true;
}
break;
}
break;
}
return false;
}