implement tunnels
This commit is contained in:
@@ -269,7 +269,8 @@ int BuildingSystem::demolish(EntityId id)
|
||||
{
|
||||
if (it->id == id)
|
||||
{
|
||||
if (it->type == BuildingType::Belt || it->type == BuildingType::Splitter)
|
||||
if (it->type == BuildingType::Belt || it->type == BuildingType::Splitter
|
||||
|| it->type == BuildingType::TunnelEntry || it->type == BuildingType::TunnelExit)
|
||||
{
|
||||
m_belts.removeTile(it->anchor);
|
||||
}
|
||||
@@ -424,6 +425,16 @@ void BuildingSystem::tickConstruction(Tick currentTick)
|
||||
mask.outputPorts[0].direction,
|
||||
mask.outputPorts[1].direction);
|
||||
}
|
||||
else if (front.type == BuildingType::TunnelEntry)
|
||||
{
|
||||
const BuildingDef* bdef = findBuildingDef(front.type);
|
||||
const int maxDist = (bdef && bdef->tunnelMaxDistance) ? *bdef->tunnelMaxDistance : 0;
|
||||
m_belts.placeTunnelEntry(front.anchor, front.rotation, maxDist);
|
||||
}
|
||||
else if (front.type == BuildingType::TunnelExit)
|
||||
{
|
||||
m_belts.placeTunnelExit(front.anchor, front.rotation);
|
||||
}
|
||||
|
||||
m_buildings.push_back(std::move(building));
|
||||
|
||||
@@ -902,7 +913,8 @@ bool BuildingSystem::removeBuilding(EntityId id)
|
||||
{
|
||||
if (it->id == id)
|
||||
{
|
||||
if (it->type == BuildingType::Belt || it->type == BuildingType::Splitter)
|
||||
if (it->type == BuildingType::Belt || it->type == BuildingType::Splitter
|
||||
|| it->type == BuildingType::TunnelEntry || it->type == BuildingType::TunnelExit)
|
||||
{
|
||||
m_belts.removeTile(it->anchor);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user