From f079f4366499cd36fe8cc8b942603f6631bfd7a7 Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Thu, 8 May 2025 09:24:22 -0500 Subject: [PATCH] Prepping for map stuff --- scenes/MapBounds.tscn | 14 -------------- scenes/Maps/TestMap/TestMap.tscn | 8 ++++++-- scripts/Entity/OverworldEntity.gd | 11 ----------- scripts/Map/Map.gd | 8 ++++++++ scripts/Map/Map.gd.uid | 1 + scripts/MapBounds.gd | 15 --------------- scripts/MapBounds.gd.uid | 1 - 7 files changed, 15 insertions(+), 43 deletions(-) delete mode 100644 scenes/MapBounds.tscn create mode 100644 scripts/Map/Map.gd create mode 100644 scripts/Map/Map.gd.uid delete mode 100644 scripts/MapBounds.gd delete mode 100644 scripts/MapBounds.gd.uid diff --git a/scenes/MapBounds.tscn b/scenes/MapBounds.tscn deleted file mode 100644 index 3bce8ba..0000000 --- a/scenes/MapBounds.tscn +++ /dev/null @@ -1,14 +0,0 @@ -[gd_scene load_steps=3 format=3 uid="uid://cy4r0tp2htivb"] - -[ext_resource type="Script" uid="uid://dbah1pmk8jola" path="res://scripts/MapBounds.gd" id="1_43dqt"] - -[sub_resource type="BoxShape3D" id="BoxShape3D_ep4u2"] - -[node name="MapBounds" type="Area3D"] -script = ExtResource("1_43dqt") - -[node name="CollisionShape3D" type="CollisionShape3D" parent="."] -shape = SubResource("BoxShape3D_ep4u2") - -[connection signal="body_entered" from="." to="." method="_on_body_entered"] -[connection signal="body_exited" from="." to="." method="_on_body_exited"] diff --git a/scenes/Maps/TestMap/TestMap.tscn b/scenes/Maps/TestMap/TestMap.tscn index 595a717..fd905b0 100644 --- a/scenes/Maps/TestMap/TestMap.tscn +++ b/scenes/Maps/TestMap/TestMap.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=11 format=3 uid="uid://dx6fv8n4jl5ku"] +[gd_scene load_steps=12 format=3 uid="uid://dx6fv8n4jl5ku"] [ext_resource type="PackedScene" uid="uid://yhtpoum3eek7" path="res://scenes/Entities/Rosa.tscn" id="1_7b7hx"] +[ext_resource type="Script" uid="uid://c37crdel0m5mw" path="res://scripts/Map/Map.gd" id="1_ru75d"] [ext_resource type="PackedScene" uid="uid://dr4b2pmsknuhc" path="res://scenes/Entities/TestNPC.tscn" id="2_cg1ph"] [ext_resource type="PackedScene" uid="uid://lh713g04d3bg" path="res://scenes/Maps/TestMap/TestMapGround.tscn" id="3_gxq5o"] [ext_resource type="PackedScene" uid="uid://boj5o4fx41rv8" path="res://scenes/Maps/TestMap/TestMapBuilding.tscn" id="4_brp0k"] @@ -21,7 +22,10 @@ sky_material = SubResource("ProceduralSkyMaterial_e1h75") sky = SubResource("Sky_weucl") ambient_light_source = 1 -[node name="Some-map" type="Node3D"] +[node name="TestMap" type="Node3D" node_paths=PackedStringArray("mapEnterEvent")] +script = ExtResource("1_ru75d") +mapName = "My cool map" +mapEnterEvent = NodePath("") [node name="WorldEnvironment" type="WorldEnvironment" parent="."] environment = SubResource("Environment_nyivo") diff --git a/scripts/Entity/OverworldEntity.gd b/scripts/Entity/OverworldEntity.gd index eb6e9e5..f202060 100644 --- a/scripts/Entity/OverworldEntity.gd +++ b/scripts/Entity/OverworldEntity.gd @@ -21,9 +21,6 @@ var meshInstance:MeshInstance3D; var underFootTile:int = -1; var underFootPosition:Vector3; -var withinMapBounds:MapBounds; -var withinBoundsLastFrame:bool = true; - func _updateMaterial(): if !meshInstance: return @@ -140,14 +137,6 @@ func _ready() -> void: func _process(delta:float) -> void: if isPaused(): return; - - # Handle entity leaving map bounds - if !withinMapBounds: - # if !withinBoundsLastFrame: - # print("Entity ", self.name, " was out of map bounds for two frames"); - withinBoundsLastFrame = false; - else: - withinBoundsLastFrame = true; # Update logic updateOverworldLogic(delta) diff --git a/scripts/Map/Map.gd b/scripts/Map/Map.gd new file mode 100644 index 0000000..3cfa3f0 --- /dev/null +++ b/scripts/Map/Map.gd @@ -0,0 +1,8 @@ +class_name Map extends Node + +@export var mapName:String = "Map" +@export var mapEnterEvent:Event = null + +func _ready() -> void: + if mapEnterEvent: + mapEnterEvent.start() \ No newline at end of file diff --git a/scripts/Map/Map.gd.uid b/scripts/Map/Map.gd.uid new file mode 100644 index 0000000..dc67b0b --- /dev/null +++ b/scripts/Map/Map.gd.uid @@ -0,0 +1 @@ +uid://c37crdel0m5mw diff --git a/scripts/MapBounds.gd b/scripts/MapBounds.gd deleted file mode 100644 index 96693a4..0000000 --- a/scripts/MapBounds.gd +++ /dev/null @@ -1,15 +0,0 @@ -extends Area3D -class_name MapBounds - -func _ready() -> void: - pass - -func _on_body_entered(body: Node3D) -> void: - if (!body is OverworldEntity): - return - (body as OverworldEntity).withinMapBounds = self; - -func _on_body_exited(body: Node3D) -> void: - if (!body is OverworldEntity): - return - (body as OverworldEntity).withinMapBounds = null; diff --git a/scripts/MapBounds.gd.uid b/scripts/MapBounds.gd.uid deleted file mode 100644 index aaab6dd..0000000 --- a/scripts/MapBounds.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://dbah1pmk8jola