Prepping for map stuff
This commit is contained in:
@@ -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"]
|
@@ -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")
|
||||
|
@@ -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)
|
||||
|
8
scripts/Map/Map.gd
Normal file
8
scripts/Map/Map.gd
Normal file
@@ -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()
|
1
scripts/Map/Map.gd.uid
Normal file
1
scripts/Map/Map.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c37crdel0m5mw
|
@@ -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;
|
@@ -1 +0,0 @@
|
||||
uid://dbah1pmk8jola
|
Reference in New Issue
Block a user