| 4 | //check if there are other stations squareSize squares nearby
| 4 | local newX = oldX;
|
|---|
| 5 | local squareSize = AIStation.GetCoverageRadius(stationType);
| 5 | local newY = oldY;
|
|---|
| 6 | if (stationId == null) {
| 6 |
|
|---|
| 7 | squareSize = squareSize * 2;
| 7 | if (offsetX > 0) {
|
|---|
| 8 | }
| 8 | for (local x = offsetX; x > 0; x--) {
|
|---|
| 9 |
| 9 | if (AIMap.IsValidTile(AIMap.GetTileIndex(newX + 1, newY))) {
|
|---|
| 10 | local square = AITileList();
| 10 | newX = newX + 1;
|
|---|
| 11 | if(!AIController.GetSetting("is_friendly")) {
| 11 | }
|
|---|
| 12 | //dont care about enemy stations when is_friendly is off
| 12 | }
|
|---|
| 13 | square.AddRectangle(Utils.getValidOffsetTile(tile, (-1) * squareSize, (-1) * squareSize),
| 13 | } else {
|
|---|
| 14 | Utils.getValidOffsetTile(tile, squareSize, squareSize));
| 14 | for (local x = offsetX; x < 0; x++) {
|
|---|
| 15 |
| 15 | if (AIMap.IsValidTile(AIMap.GetTileIndex(newX - 1, newY))) {
|
|---|
| 16 | //if another road station of mine is nearby return true
| 16 | newX = newX - 1;
|
|---|
| 17 | for(local tile = square.Begin(); square.HasNext(); tile = square.Next()) {
| 17 | }
|
|---|
| 18 | if(Utils.isTileMyRoadStation(tile, cargoClass)) { //negate second expression to merge your stations
| 18 | }
|
|---|
| 19 | return true;
| | |
|---|
| 20 | }
| | |
|---|
| 21 | }
| | |
|---|
| 22 | }
| | |
|---|
| 23 | else {
| | |
|---|
| 24 | square.AddRectangle(Utils.getValidOffsetTile(tile, (-1) * squareSize, (-1) * squareSize),
| | |
|---|
| 25 | Utils.getValidOffsetTile(tile, squareSize, squareSize));
| | |
|---|
| 26 |
| | |
|---|
| 27 | //if any other station is nearby, except my own airports, return true
| | |
|---|
| 28 | for (local tile = square.Begin(); square.HasNext(); tile = square.Next()) {
| | |
|---|
| 29 | if(AITile.IsStationTile(tile)) {
| | |
|---|
| 30 | if (AITile.GetOwner(tile) != AICompany.ResolveCompanyID(AICompany.COMPANY_SELF)) {
| | |
|---|
| 31 | return true;
| | |
|---|
| 32 | } else {
| | |
|---|
| 33 | local stationTiles = AITileList_StationType(AIStation.GetStationID(tile), stationType);
| | |
|---|
| 34 | if (stationTiles.HasItem(tile)) {
| | |
|---|
| 35 | return true;
| | |
|---|
| 36 | }
| | |
|---|
| 37 | }
| | |
|---|
| 38 | }
| | |
|---|
| 39 | }
| | |
|---|
| 40 | }
| | |
|---|
| 41 |
| | |
|---|
| 42 | if(!((AITile.IsBuildable(tile) || AIRoad.IsRoadTile(tile)) && AITile.GetSlope(tile) == AITile.SLOPE_FLAT)) {
| | |
|---|
| 43 | return true;
| | |
|---|