Small adjustment to map loading stuff

This commit is contained in:
2025-09-30 18:20:55 -07:00
parent 6f582fcca1
commit abf34d7d9e
9 changed files with 21 additions and 20 deletions

View File

@@ -9,7 +9,7 @@ public partial class DungeonFloorLayoutNode : EditorPlugin
{
// Initialization of the plugin goes here.
var script = GD.Load<Script>("res://addons/dungeon_floor_layout/DungeonFloorLayout.cs");
var texture = GD.Load<Texture2D>("res://addons/dungeon_floor_layout/icon_door.png");
var texture = GD.Load<Texture2D>("res://addons/dungeon_floor_layout/icon.png");
AddCustomType(nameof(DungeonFloorLayout), nameof(LayoutType), script, texture);
}

View File

Before

Width:  |  Height:  |  Size: 161 B

After

Width:  |  Height:  |  Size: 161 B

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://cgd2d4fusp4pg"
path="res://.godot/imported/icon_door.png-437da3e7d1cb55961e6afceef56e9ea2.ctex"
path="res://.godot/imported/icon.png-f075641bee242eff6dcbc69a1dabede8.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/dungeon_floor_layout/icon_door.png"
dest_files=["res://.godot/imported/icon_door.png-437da3e7d1cb55961e6afceef56e9ea2.ctex"]
source_file="res://addons/dungeon_floor_layout/icon.png"
dest_files=["res://.godot/imported/icon.png-f075641bee242eff6dcbc69a1dabede8.ctex"]
[params]

View File

@@ -10,7 +10,7 @@ public partial class SpecialFloorLayoutNode : EditorPlugin
{
// Initialization of the plugin goes here.
var script = GD.Load<Script>("res://addons/special_floor_layout_node/SpecialFloorLayout.cs");
var texture = GD.Load<Texture2D>("res://addons/special_floor_layout_node/icon_door.png");
var texture = GD.Load<Texture2D>("res://addons/special_floor_layout_node/icon.png");
AddCustomType(nameof(SpecialFloorLayout), nameof(LayoutType), script, texture);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

View File

@@ -2,16 +2,16 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://pxevsja7e3s0"
path="res://.godot/imported/icon_door.png-d7e4ac87b8cdfac1c9f03b9aff4c7e79.ctex"
uid="uid://dkj2u56olatdq"
path="res://.godot/imported/icon.png-f3d3329191ced87c3dfb24631add3cb6.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/special_floor_layout_node/icon_door.png"
dest_files=["res://.godot/imported/icon_door.png-d7e4ac87b8cdfac1c9f03b9aff4c7e79.ctex"]
source_file="res://addons/special_floor_layout_node/icon.png"
dest_files=["res://.godot/imported/icon.png-f3d3329191ced87c3dfb24631add3cb6.ctex"]
[params]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 B

View File

@@ -23,6 +23,9 @@ public partial class Map : Node3D, IMap
[Dependency]
public IPlayer Player => this.DependOn<IPlayer>();
[Node]
public Node MapOrder { get; set; } = default!;
#region Save
public ISaveChunk<MapInfo> MapChunk { get; set; } = default!;
@@ -35,9 +38,6 @@ public partial class Map : Node3D, IMap
public ISaveChunk<GameData> GameChunk => this.DependOn<ISaveChunk<GameData>>();
#endregion
[Export]
private Array<LayoutType> Floors { get; set; } = default!;
public IDungeonFloor CurrentFloor { get; private set; }
public AutoProp<int> CurrentFloorNumber { get; private set; } = new AutoProp<int>(0);
@@ -69,7 +69,7 @@ public partial class Map : Node3D, IMap
public async Task LoadFloor()
{
var floor = GetChildren().OfType<LayoutType>().ElementAt(CurrentFloorNumber.Value);
var floor = MapOrder.GetChildren().OfType<LayoutType>().ElementAt(CurrentFloorNumber.Value);
var sceneToLoad = LayoutToScenePathConverter.Convert(floor);
await LoadFloor(sceneToLoad);
if (CurrentFloor is DungeonFloor dungeonFloor && floor is DungeonFloorLayout dungeonFloorLayout)
@@ -108,7 +108,6 @@ public partial class Map : Node3D, IMap
private void ClearCurrentMap()
{
CurrentFloor?.CallDeferred(MethodName.QueueFree, []);
Floors.Remove(Floors.First());
}
private void SetupDungeonFloor()

View File

@@ -56,9 +56,8 @@ _data = {
&"fade_out": SubResource("Animation_v14r0")
}
[node name="Map" type="Node3D" node_paths=PackedStringArray("Floors")]
[node name="Map" type="Node3D"]
script = ExtResource("1_bw70o")
Floors = [3, 2, 0, 4, 1, 5, 6]
[node name="ColorRect" type="ColorRect" parent="."]
anchors_preset = 15
@@ -74,16 +73,19 @@ libraries = {
&"": SubResource("AnimationLibrary_00xd7")
}
[node name="Overworld (Add SpecialFloorLayout node for special floors and pick the FloorName from the list)" type="Node" parent="."]
[node name="MapOrder" type="Node" parent="."]
unique_name_in_owner = true
[node name="Overworld (Add SpecialFloorLayout node for special floors and pick the FloorName from the list)" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7")
metadata/_custom_type_script = "uid://cabvj6s31iucg"
[node name="Altar (Arrange order of nodes to change default load order)" type="Node" parent="."]
[node name="Altar (Arrange order of nodes to change default load order)" type="Node" parent="MapOrder"]
script = ExtResource("2_00xd7")
FloorName = 1
metadata/_custom_type_script = "uid://cabvj6s31iucg"
[node name="Floor01 (Press Populate Map Data Button to load floor from SetAFloors folder)" type="Node" parent="."]
[node name="Floor01 (Press Populate Map Data Button to load floor from SetAFloors folder)" type="Node" parent="MapOrder"]
script = ExtResource("3_v14r0")
LayoutWithSpawnRate = Dictionary[String, float]({})
EnemySpawnRates = {
@@ -91,7 +93,7 @@ EnemySpawnRates = {
}
metadata/_custom_type_script = "uid://ci7o3nn4mdo8o"
[node name="Floor02 (Add DungeonFloorLayout node for regular dungeon floors)" type="Node" parent="."]
[node name="Floor02 (Add DungeonFloorLayout node for regular dungeon floors)" type="Node" parent="MapOrder"]
script = ExtResource("3_v14r0")
LayoutWithSpawnRate = Dictionary[String, float]({})
EnemySpawnRates = {