Исправление. # ERROR: res://scenes/tilemap/tilemap.gd:396 - Invalid access to property or key 'online' on a base object of type 'Nil'.
This commit is contained in:
@@ -380,22 +380,33 @@ func _process(delta) -> void:
|
||||
update_scale_label()
|
||||
|
||||
|
||||
func _response(result, code, _headers: Array, body: PackedByteArray, req, tile: Tile) -> void:
|
||||
func process_online(result):
|
||||
# ERROR: res://scenes/tilemap/tilemap.gd:396 - Invalid access to property or key 'online' on a base object of type 'Nil'.
|
||||
var unit_instance: = network.get_unit_instance('уарэп-карта')
|
||||
_req_count -= 1
|
||||
remove_child(req)
|
||||
req.queue_free()
|
||||
if not unit_instance: return
|
||||
|
||||
if result != HTTPRequest.RESULT_SUCCESS:
|
||||
if unit_instance.online:
|
||||
unit_instance.online = false
|
||||
unit_instance.emit_signal('line_changed', unit_instance)
|
||||
_queue[tile.i] = tile
|
||||
return
|
||||
return false
|
||||
|
||||
unit_instance.rx_tick = Time.get_ticks_msec()
|
||||
if not unit_instance.online:
|
||||
unit_instance.online = true
|
||||
unit_instance.emit_signal('line_changed', unit_instance)
|
||||
return true
|
||||
|
||||
|
||||
func _response(result, code, _headers: Array, body: PackedByteArray, req, tile: Tile) -> void:
|
||||
_req_count -= 1
|
||||
remove_child(req)
|
||||
req.queue_free()
|
||||
|
||||
if process_online(result):
|
||||
_queue[tile.i] = tile
|
||||
else:
|
||||
return
|
||||
|
||||
if code == 404:
|
||||
push_error('на сервере нет \"%s\"' % tile.url)
|
||||
@@ -405,11 +416,6 @@ func _response(result, code, _headers: Array, body: PackedByteArray, req, tile:
|
||||
push_error('не удалось получить изображение (неверный формат?) из \"%s\"' % tile.url)
|
||||
return
|
||||
|
||||
unit_instance.rx_tick = Time.get_ticks_msec()
|
||||
if not unit_instance.online:
|
||||
unit_instance.online = true
|
||||
unit_instance.emit_signal('line_changed', unit_instance)
|
||||
|
||||
tile.texture = ImageTexture.create_from_image(image)
|
||||
_cache[tile.i] = tile
|
||||
|
||||
|
||||
Reference in New Issue
Block a user