Add transfer amounts and active gas vents
This commit is contained in:
parent
31ebfa905e
commit
e4df9bc41a
8 changed files with 147 additions and 12 deletions
12
RockField.gd
12
RockField.gd
|
|
@ -26,6 +26,12 @@ var rng: RandomNumberGenerator = RandomNumberGenerator.new()
|
|||
|
||||
|
||||
func _ready() -> void:
|
||||
# Gas giants have their own gas vents and must never receive ore pickups.
|
||||
# This check happens before the initial population pass, unlike merely
|
||||
# hiding the field later from PlanetSurfaceController.
|
||||
if GameState.planet_type == "gas_giant":
|
||||
set_process(false)
|
||||
return
|
||||
rng.randomize()
|
||||
# Populate immediately rather than waiting out the first interval, so
|
||||
# the surface isn't visibly empty for half a second on arrival.
|
||||
|
|
@ -65,7 +71,7 @@ func _spawn_rock(centre: Vector2) -> void:
|
|||
var rock: Area2D = rock_scene.instantiate()
|
||||
rock.position = centre + Vector2(cos(angle), sin(angle)) * distance
|
||||
rock.build_shape(rng.randi())
|
||||
# Deferred: update_rocks() runs from _ready(), and Godot refuses a
|
||||
# direct add_child() while the tree is still setting up children.
|
||||
get_parent().add_child.call_deferred(rock)
|
||||
# Keep pickups under this field so its visibility and lifecycle really
|
||||
# own them. Deferred is still required because this can run from _ready().
|
||||
add_child.call_deferred(rock)
|
||||
rocks.append(rock)
|
||||
|
|
|
|||
Loading…
Reference in a new issue