mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-12-18 00:59:05 +00:00
Added getCount() method to World
This commit is contained in:
@@ -12,7 +12,7 @@ import java.util.Random;
|
||||
public class RadioactiveWorldUtils {
|
||||
|
||||
/**
|
||||
* Generate a list of biomass blobs for a world
|
||||
* Generate a list of radioactive obstacles for a world
|
||||
*/
|
||||
public static ArrayList<RadioactiveObstacle> generateRadioactiveObstacles(World world, int minCount, int maxCount) {
|
||||
|
||||
@@ -24,15 +24,7 @@ public class RadioactiveWorldUtils {
|
||||
// of radioactive objects, set the desired amount of radioactive objects to the
|
||||
// plain tile count
|
||||
TileMap m = world.getTileMap();
|
||||
int plainCount = 0;
|
||||
for (int y = 0; y < world.getWorldSize(); y++) {
|
||||
for (int x = 0; x < world.getWorldSize(); x++) {
|
||||
|
||||
if (m.getTileIdAt(x, y) == TilePlain.ID) {
|
||||
plainCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
int plainCount = world.getCount(TilePlain.ID);
|
||||
|
||||
if (radioactiveObjCount > plainCount) {
|
||||
radioactiveObjCount = plainCount;
|
||||
|
||||
Reference in New Issue
Block a user