public static ZoneIsInArea ( int zoneAbs, int zoneOrd, int horizontalZonesNumber, int verticalZonesNumber ) : bool | ||
zoneAbs | int | |
zoneOrd | int | |
horizontalZonesNumber | int | |
verticalZonesNumber | int | |
Résultat | bool |
static void GenerateOutpostLayoutCommandRoom() { Rot4 commandRoomCardinal; bool freeZoneIsFound = Zone.GetRandomFreeCardinalZoneAdjacentTo(mainRoomZoneAbs, mainRoomZoneOrd, out commandRoomCardinal, zoneMap, horizontalZonesNumber, verticalZonesNumber); if (freeZoneIsFound == false) { Log.Warning("MiningCo. OutpostGenerator: failed to find a free zone for the command room."); return; } int commandRoomZoneAbs = 0; int commandRoomZoneOrd = 0; Zone.GetAdjacentZone(mainRoomZoneAbs, mainRoomZoneOrd, commandRoomCardinal, out commandRoomZoneAbs, out commandRoomZoneOrd); float dropZoneSideSelector = Rand.Value; Rot4 relativeRotation = Rot4.North; Rot4 absoluteRotation = Rot4.North; if (dropZoneSideSelector < 0.5f) { // Drop zone is "on the west" of command room. relativeRotation = Rot4.West; absoluteRotation = new Rot4((commandRoomCardinal.AsInt + relativeRotation.AsInt) % 4); } else { // Drop zone is "on the east" of command room. relativeRotation = Rot4.East; absoluteRotation = new Rot4((commandRoomCardinal.AsInt + relativeRotation.AsInt) % 4); } int dropZoneAbs = 0; int dropZoneOrd = 0; Zone.GetAdjacentZone(commandRoomZoneAbs, commandRoomZoneOrd, absoluteRotation, out dropZoneAbs, out dropZoneOrd); if ((Zone.ZoneIsInArea(dropZoneAbs, dropZoneOrd, horizontalZonesNumber, verticalZonesNumber) == false) || (zoneMap[dropZoneOrd, dropZoneAbs].zoneType != ZoneType.NotYetGenerated)) { // Get the opposite side. relativeRotation = new Rot4((relativeRotation.AsInt + 2) % 4); absoluteRotation = new Rot4((absoluteRotation.AsInt + 2) % 4); Zone.GetAdjacentZone(commandRoomZoneAbs, commandRoomZoneOrd, absoluteRotation, out dropZoneAbs, out dropZoneOrd); if ((Zone.ZoneIsInArea(dropZoneAbs, dropZoneOrd, horizontalZonesNumber, verticalZonesNumber) == false) || (zoneMap[dropZoneOrd, dropZoneAbs].zoneType != ZoneType.NotYetGenerated)) { Log.Warning("MiningCo. OutpostGenerator: failed to find a free zone for the drop zone."); return; } } zoneMap[commandRoomZoneOrd, commandRoomZoneAbs] = new ZoneProperties(ZoneType.SmallRoomCommandRoom, commandRoomCardinal, relativeRotation); relativeRotation.Rotate(RotationDirection.Clockwise); // Rotate 2 times to get the opposite direction. relativeRotation.Rotate(RotationDirection.Clockwise); zoneMap[dropZoneOrd, dropZoneAbs] = new ZoneProperties(ZoneType.DropZone, commandRoomCardinal, relativeRotation); }
static void GenerateOutpostLayoutPowerSupply() { Rot4 batteryRoomCardinal; bool freeZoneIsFound = Zone.GetRandomFreeCardinalZoneAdjacentTo(mainRoomZoneAbs, mainRoomZoneOrd, out batteryRoomCardinal, zoneMap, horizontalZonesNumber, verticalZonesNumber); if (freeZoneIsFound == false) { Log.Warning("MiningCo. OutpostGenerator: failed to find a free zone for the battery room."); return; } int batteryRoomZoneAbs = 0; int batteryRoomZoneOrd = 0; Zone.GetAdjacentZone(mainRoomZoneAbs, mainRoomZoneOrd, batteryRoomCardinal, out batteryRoomZoneAbs, out batteryRoomZoneOrd); float solarPanelZoneSideSelector = Rand.Value; Rot4 relativeRotation = Rot4.North; Rot4 absoluteRotation = Rot4.North; if (solarPanelZoneSideSelector < 0.5f) { // Solar zone is "on the west" of battery room. relativeRotation = Rot4.West; absoluteRotation = new Rot4((batteryRoomCardinal.AsInt + relativeRotation.AsInt) % 4); } else { // Solar zone is "on the east" of battery room. relativeRotation = Rot4.East; absoluteRotation = new Rot4((batteryRoomCardinal.AsInt + relativeRotation.AsInt) % 4); } int solarPanelZoneAbs = 0; int solarPanelZoneOrd = 0; Zone.GetAdjacentZone(batteryRoomZoneAbs, batteryRoomZoneOrd, absoluteRotation, out solarPanelZoneAbs, out solarPanelZoneOrd); if ((Zone.ZoneIsInArea(solarPanelZoneAbs, solarPanelZoneOrd, horizontalZonesNumber, verticalZonesNumber) == false) || (zoneMap[solarPanelZoneOrd, solarPanelZoneAbs].zoneType != ZoneType.NotYetGenerated)) { // Get the opposite side. relativeRotation = new Rot4((relativeRotation.AsInt + 2) % 4); absoluteRotation = new Rot4((absoluteRotation.AsInt + 2) % 4); Zone.GetAdjacentZone(batteryRoomZoneAbs, batteryRoomZoneOrd, absoluteRotation, out solarPanelZoneAbs, out solarPanelZoneOrd); if ((Zone.ZoneIsInArea(solarPanelZoneAbs, solarPanelZoneOrd, horizontalZonesNumber, verticalZonesNumber) == false) || (zoneMap[solarPanelZoneOrd, solarPanelZoneAbs].zoneType != ZoneType.NotYetGenerated)) { Log.Warning("MiningCo. OutpostGenerator: failed to find a free zone for the solar panels."); return; } } zoneMap[batteryRoomZoneOrd, batteryRoomZoneAbs] = new ZoneProperties(ZoneType.SmallRoomBatteryRoom, batteryRoomCardinal, relativeRotation); relativeRotation.Rotate(RotationDirection.Clockwise); // Rotate 2 times to get the opposite direction. relativeRotation.Rotate(RotationDirection.Clockwise); zoneMap[solarPanelZoneOrd, solarPanelZoneAbs] = new ZoneProperties(ZoneType.SolarPanelZone, batteryRoomCardinal, relativeRotation); }