feat: add nearby social interactions
This commit is contained in:
@@ -12,6 +12,8 @@ const CAMERA_LIMIT_LEFT: int = -1280
|
||||
const CAMERA_LIMIT_TOP: int = -960
|
||||
const CAMERA_LIMIT_RIGHT: int = 1280
|
||||
const CAMERA_LIMIT_BOTTOM: int = 960
|
||||
const WELCOME_DIALOG_SCENE: PackedScene = preload("res://scenes/ui/welcome_dialog.tscn")
|
||||
const WELCOME_DIALOG_NAME: String = "WelcomeDialog"
|
||||
|
||||
@onready var player: PlayerController = $YSortWorld/Characters/Players/Player
|
||||
@onready var playerCamera: Camera2D = $YSortWorld/Characters/Players/Player/Camera2D
|
||||
@@ -20,8 +22,35 @@ const CAMERA_LIMIT_BOTTOM: int = 960
|
||||
func _ready() -> void:
|
||||
_apply_spawn_point()
|
||||
_configure_camera()
|
||||
_discover_destination()
|
||||
call_deferred("_show_registration_welcome")
|
||||
|
||||
func _show_registration_welcome() -> void:
|
||||
var auth_manager: Node = get_node_or_null("/root/AuthManager")
|
||||
if auth_manager == null or not auth_manager.has_method("consume_registration_welcome"):
|
||||
return
|
||||
if not bool(auth_manager.call("consume_registration_welcome")):
|
||||
return
|
||||
var root: Window = get_tree().root
|
||||
if root.has_node(WELCOME_DIALOG_NAME):
|
||||
return
|
||||
var dialog: CanvasLayer = WELCOME_DIALOG_SCENE.instantiate() as CanvasLayer
|
||||
if dialog == null:
|
||||
return
|
||||
dialog.name = WELCOME_DIALOG_NAME
|
||||
root.add_child(dialog)
|
||||
|
||||
func _discover_destination() -> void:
|
||||
var destination_id := SceneManager.get_next_destination_id()
|
||||
if destination_id.is_empty():
|
||||
destination_id = "square_center"
|
||||
var socialManager := get_node_or_null("/root/SocialManager")
|
||||
if socialManager != null and socialManager.has_method("discover_destination"):
|
||||
socialManager.call("discover_destination", destination_id)
|
||||
|
||||
func _apply_spawn_point() -> void:
|
||||
if player.has_scene_position_override:
|
||||
return
|
||||
var spawnName: String = SceneManager.get_next_spawn_name()
|
||||
var markerName: String = spawnName if not spawnName.is_empty() else "DefaultSpawn"
|
||||
var marker := $Markers.get_node_or_null(markerName) as Marker2D
|
||||
|
||||
Reference in New Issue
Block a user