Godot 4.5.1

This commit is contained in:
2025-12-14 22:43:11 +10:00
parent 5805ac2260
commit 4dd1ce64f5
433 changed files with 2922 additions and 585 deletions

View File

@@ -3,32 +3,32 @@ class_name OverworldScene extends Node
@export var map:Node3D = null
func _enter_tree() -> void:
OVERWORLD.mapChanged.connect(onMapChanged)
OVERWORLD.mapChanged.connect(onMapChanged)
func _ready() -> void:
pass
pass
func _exit_tree() -> void:
OVERWORLD.mapChanged.disconnect(onMapChanged)
OVERWORLD.mapChanged.disconnect(onMapChanged)
func onMapChanged(newMap:PackedScene, playerDestinationNodeName:String) -> void:
print("New map time.", newMap)
for childScene in map.get_children():
map.remove_child(childScene)
print("New map time.", newMap)
for childScene in map.get_children():
map.remove_child(childScene)
if !newMap:
return
var newMapInstance = newMap.instantiate()
map.add_child(newMapInstance)
if !newMap:
return
var newMapInstance = newMap.instantiate()
map.add_child(newMapInstance)
# Find Player.
if playerDestinationNodeName:
var player = newMapInstance.get_node("Player")
var destNode = newMapInstance.get_node(playerDestinationNodeName)
if player && player is Player && destNode:
player.global_position = destNode.global_position
player.global_rotation.y = destNode.global_rotation.y
elif playerDestinationNodeName:
push_error("Player, or destination node not found in new map.")
pass
# Find Player.
if playerDestinationNodeName:
var player = newMapInstance.get_node("Player")
var destNode = newMapInstance.get_node(playerDestinationNodeName)
if player && player is Player && destNode:
player.global_position = destNode.global_position
player.global_rotation.y = destNode.global_rotation.y
elif playerDestinationNodeName:
push_error("Player, or destination node not found in new map.")
pass