World microapi
Deploy Promiscuity Auth API / deploy (push) Successful in 49s
Deploy Promiscuity Character API / deploy (push) Successful in 46s
Deploy Promiscuity Crafting API / deploy (push) Successful in 47s
Deploy Promiscuity Inventory API / deploy (push) Successful in 47s
Deploy Promiscuity Locations API / deploy (push) Successful in 48s
Deploy Promiscuity Mail API / deploy (push) Successful in 46s
k8s smoke test / test (push) Has been cancelled
Deploy Promiscuity Auth API / deploy (push) Successful in 49s
Deploy Promiscuity Character API / deploy (push) Successful in 46s
Deploy Promiscuity Crafting API / deploy (push) Successful in 47s
Deploy Promiscuity Inventory API / deploy (push) Successful in 47s
Deploy Promiscuity Locations API / deploy (push) Successful in 48s
Deploy Promiscuity Mail API / deploy (push) Successful in 46s
k8s smoke test / test (push) Has been cancelled
This commit is contained in:
@@ -4,11 +4,13 @@ const CHARACTER_API_URL := "https://pchar.ranaze.com/api/Characters"
|
||||
const LOCATION_API_URL := "https://ploc.ranaze.com/api/Locations"
|
||||
const INVENTORY_API_URL := "https://pinv.ranaze.com/api/inventory"
|
||||
const MAIL_API_URL := "https://pmail.ranaze.com/api/mail"
|
||||
const WORLD_API_URL := "https://pworld.ranaze.com/api/world"
|
||||
const START_SCREEN_SCENE := "res://scenes/UI/start_screen.tscn"
|
||||
const SETTINGS_SCENE := "res://scenes/UI/Settings.tscn"
|
||||
const CHARACTER_SLOT_COUNT := 6
|
||||
const VISIBLE_CHARACTERS_REFRESH_INTERVAL := 5.0
|
||||
const HEARTBEAT_INTERVAL := 10.0
|
||||
const WORLD_CYCLE_REFRESH_INTERVAL := 15.0
|
||||
|
||||
@export var tile_size := 8.0
|
||||
@export var block_height := 1.0
|
||||
@@ -77,6 +79,9 @@ var _mail_sent: Array = []
|
||||
var _mail_request_in_flight := false
|
||||
var _selected_inbox_mail_id := ""
|
||||
var _selected_sent_mail_id := ""
|
||||
var _world_cycle_request_in_flight := false
|
||||
var _world_cycle_refresh_elapsed := 0.0
|
||||
var _world_cycle: Dictionary = {}
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -102,6 +107,7 @@ func _ready() -> void:
|
||||
_block.visible = false
|
||||
_deactivate_player_for_load()
|
||||
await _load_existing_locations()
|
||||
_refresh_world_cycle()
|
||||
_refresh_visible_characters()
|
||||
_ensure_selected_location_exists(_center_coord)
|
||||
_rebuild_tiles(_center_coord)
|
||||
@@ -114,12 +120,16 @@ func _process(_delta: float) -> void:
|
||||
return
|
||||
_visible_character_refresh_elapsed += _delta
|
||||
_heartbeat_elapsed += _delta
|
||||
_world_cycle_refresh_elapsed += _delta
|
||||
if _visible_character_refresh_elapsed >= VISIBLE_CHARACTERS_REFRESH_INTERVAL:
|
||||
_visible_character_refresh_elapsed = 0.0
|
||||
_refresh_visible_characters()
|
||||
if _heartbeat_elapsed >= HEARTBEAT_INTERVAL:
|
||||
_heartbeat_elapsed = 0.0
|
||||
_send_presence_heartbeat()
|
||||
if _world_cycle_refresh_elapsed >= WORLD_CYCLE_REFRESH_INTERVAL:
|
||||
_world_cycle_refresh_elapsed = 0.0
|
||||
_refresh_world_cycle()
|
||||
if _inventory_menu.visible or _mail_menu.visible:
|
||||
return
|
||||
var target_world_pos := _get_stream_position()
|
||||
@@ -1321,8 +1331,52 @@ func _refresh_visible_locations() -> void:
|
||||
_refresh_visible_locations_async()
|
||||
|
||||
|
||||
func _refresh_visible_locations_async() -> void:
|
||||
await _load_existing_locations()
|
||||
func _refresh_visible_locations_async() -> void:
|
||||
await _load_existing_locations()
|
||||
|
||||
|
||||
func _refresh_world_cycle() -> void:
|
||||
if _world_cycle_request_in_flight:
|
||||
return
|
||||
_refresh_world_cycle_async()
|
||||
|
||||
|
||||
func _refresh_world_cycle_async() -> void:
|
||||
_world_cycle_request_in_flight = true
|
||||
|
||||
var request := HTTPRequest.new()
|
||||
add_child(request)
|
||||
|
||||
var headers := PackedStringArray()
|
||||
if not AuthState.access_token.is_empty():
|
||||
headers.append("Authorization: Bearer %s" % AuthState.access_token)
|
||||
|
||||
var err := request.request("%s/cycle" % WORLD_API_URL, headers, HTTPClient.METHOD_GET)
|
||||
if err != OK:
|
||||
push_warning("Failed to request world cycle: %s" % err)
|
||||
request.queue_free()
|
||||
_world_cycle_request_in_flight = false
|
||||
return
|
||||
|
||||
var result: Array = await request.request_completed
|
||||
request.queue_free()
|
||||
|
||||
var result_code: int = result[0]
|
||||
var response_code: int = result[1]
|
||||
var response_body: String = result[3].get_string_from_utf8()
|
||||
if result_code != HTTPRequest.RESULT_SUCCESS or response_code < 200 or response_code >= 300:
|
||||
push_warning("Failed to load world cycle (%s/%s): %s" % [result_code, response_code, response_body])
|
||||
_world_cycle_request_in_flight = false
|
||||
return
|
||||
|
||||
var parsed: Variant = JSON.parse_string(response_body)
|
||||
if typeof(parsed) != TYPE_DICTIONARY:
|
||||
push_warning("World cycle response was not an object.")
|
||||
_world_cycle_request_in_flight = false
|
||||
return
|
||||
|
||||
_world_cycle = parsed as Dictionary
|
||||
_world_cycle_request_in_flight = false
|
||||
|
||||
|
||||
func _try_interact_current_tile() -> void:
|
||||
|
||||
Reference in New Issue
Block a user