Guarantee a nearby gas giant
This commit is contained in:
parent
8231e165ff
commit
31ebfa905e
2 changed files with 26 additions and 2 deletions
|
|
@ -20,6 +20,19 @@ func _initialize() -> void:
|
|||
func _process(delta: float) -> bool:
|
||||
elapsed += delta
|
||||
if stage == 0:
|
||||
var nearby_chunk: Vector2i = WorldGen.NEARBY_GAS_GIANT_CHUNK
|
||||
var nearby_data: Dictionary = WorldGen.planet_data_at_chunk(nearby_chunk)
|
||||
var nearby_position: Vector2 = WorldGen.chunk_origin(nearby_chunk) + nearby_data.local_pos
|
||||
if not WorldGen.has_planet_at_chunk(nearby_chunk):
|
||||
return _fail("nearby gas giant chunk does not contain a planet")
|
||||
if WorldGen.biome_at_chunk(nearby_chunk) != WorldGen.Biome.SPACE:
|
||||
return _fail("nearby gas giant is not in the normal space biome")
|
||||
if String(nearby_data.get("planet_type", "")) != "gas_giant" \
|
||||
or String(nearby_data.get("resource_type", "")) != "gas":
|
||||
return _fail("nearby guaranteed planet is not a gas source")
|
||||
if nearby_position.length() > WorldGen.CHUNK_SIZE * 2.0:
|
||||
return _fail("nearby gas giant spawned too far away: %s" % nearby_position)
|
||||
|
||||
var found_giant: bool = false
|
||||
for x in range(-12, 13):
|
||||
for y in range(-12, 13):
|
||||
|
|
|
|||
Loading…
Reference in a new issue