Endless location generation
All checks were successful
All checks were successful
This commit is contained in:
parent
e79f473ce4
commit
9809869cbe
@ -29,6 +29,8 @@ var _character_id := ""
|
||||
var _persisted_coord := Vector2i.ZERO
|
||||
var _coord_sync_in_flight := false
|
||||
var _queued_coord_sync: Variant = null
|
||||
var _locations_refresh_in_flight := false
|
||||
var _queued_locations_refresh := false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@ -63,8 +65,8 @@ func _process(_delta: float) -> void:
|
||||
if target_coord == _center_coord:
|
||||
return
|
||||
_center_coord = target_coord
|
||||
_rebuild_tiles(_center_coord)
|
||||
_queue_coord_sync(_center_coord)
|
||||
_queue_locations_refresh()
|
||||
|
||||
|
||||
func _get_stream_position() -> Vector3:
|
||||
@ -208,6 +210,7 @@ func _selected_location_name(coord: Vector2i) -> String:
|
||||
|
||||
|
||||
func _load_existing_locations() -> void:
|
||||
_locations_refresh_in_flight = true
|
||||
_locations_loaded = false
|
||||
_known_locations.clear()
|
||||
|
||||
@ -268,6 +271,28 @@ func _load_existing_locations() -> void:
|
||||
push_warning("Visible locations request succeeded but returned 0 locations for character %s." % _character_id)
|
||||
|
||||
_locations_loaded = true
|
||||
_locations_refresh_in_flight = false
|
||||
_rebuild_tiles(_center_coord)
|
||||
if _queued_locations_refresh:
|
||||
_queued_locations_refresh = false
|
||||
_queue_locations_refresh()
|
||||
|
||||
|
||||
func _queue_locations_refresh() -> void:
|
||||
if _locations_refresh_in_flight:
|
||||
_queued_locations_refresh = true
|
||||
return
|
||||
_refresh_visible_locations()
|
||||
|
||||
|
||||
func _refresh_visible_locations() -> void:
|
||||
if _character_id.is_empty():
|
||||
return
|
||||
_refresh_visible_locations_async()
|
||||
|
||||
|
||||
func _refresh_visible_locations_async() -> void:
|
||||
await _load_existing_locations()
|
||||
|
||||
|
||||
func _queue_coord_sync(coord: Vector2i) -> void:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user