Mergepoint II

This commit is contained in:
Pal
2025-09-26 04:08:37 -07:00
21 changed files with 170 additions and 2213 deletions

View File

@@ -4,6 +4,8 @@ using Chickensoft.GodotNodeInterfaces;
using Chickensoft.SaveFileBuilder;
using Godot;
using System.Collections.Generic;
using System.Collections.Immutable;
using Zennysoft.Ma.Adapter;
namespace Zennysoft.Game.Ma;
@@ -13,7 +15,7 @@ public interface IMap : INode3D, IProvide<ISaveChunk<MapData>>
void LoadFloor();
List<string> FloorScenes { get; }
ImmutableDictionary<Floor, string> FloorScenes { get; }
IDungeonFloor CurrentFloor { get; }

View File

@@ -5,6 +5,7 @@ using Chickensoft.LogicBlocks;
using Chickensoft.SaveFileBuilder;
using Godot;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Zennysoft.Ma.Adapter;
@@ -31,9 +32,9 @@ public partial class Map : Node3D, IMap
#endregion
[Export]
private Godot.Collections.Array<PackedScene> _floors { get; set; } = default!;
private Godot.Collections.Array<Floor> Floors { get; set; } = default!;
public List<string> FloorScenes { get; private set; } = [];
public ImmutableDictionary<Floor, string> FloorScenes { get; private set; }
public IDungeonFloor CurrentFloor { get; private set; }
@@ -41,77 +42,76 @@ public partial class Map : Node3D, IMap
public void OnResolved()
{
MapChunk = new SaveChunk<MapData>(
onSave: (chunk) => new MapData()
{
FloorScenes = FloorScenes,
},
onLoad: (chunk, data) =>
{
FloorScenes = data.FloorScenes;
}
);
GameChunk.AddChunk(MapChunk);
GameChunk.AddChunk(MapChunk);
this.Provide();
this.Provide();
InitializeMapData();
InitializeMapData();
}
public void InitializeMapData()
{
ClearMap();
FloorScenes = [];
foreach (var floor in _floors)
FloorScenes.Add(floor.ResourcePath);
CurrentFloorNumber.OnNext(0);
ClearMap();
FloorScenes = ImmutableDictionary<Floor, string>.Empty
.Add(Floor.Overworld, $"res://src/map/overworld/Overworld.tscn")
.Add(Floor.Altar, $"res://src/map/dungeon/floors/Floor00.tscn")
.Add(Floor.BossFloorA, $"res://src/map/dungeon/rooms/Set A/15. Boss Floor A.tscn")
.Add(Floor.BossFloorB, $"res://src/map/dungeon/rooms/Set B/34. Boss Floor B.tscn")
.Add(Floor.GoddessOfGuidanceFloor, $"res://src/map/dungeon/rooms/Set B/35. Goddess of Guidance's Room.tscn")
.Add(Floor.VoidRoom, $"res://src/map/dungeon/rooms/Set B/30. Void Room.tscn")
.Add(Floor.FinalFloor, $"res://src/map/dungeon/rooms/Set B/36. Final Floor.tscn")
.Add(Floor.Floor01, $"res://src/map/dungeon/floors/Floor01.tscn")
.Add(Floor.Floor02, $"res://src/map/dungeon/floors/Floor02.tscn")
.Add(Floor.Floor03, $"res://src/map/dungeon/floors/Floor03.tscn")
.Add(Floor.Floor04, $"res://src/map/dungeon/floors/Floor04.tscn")
.Add(Floor.Floor05, $"res://src/map/dungeon/floors/Floor05.tscn");
CurrentFloorNumber.OnNext(0);
}
public void LoadMap()
{
LoadFloor();
CurrentFloor.InitializeDungeon();
var transform = GetPlayerSpawnPosition();
Player.TeleportPlayer(transform);
CurrentFloor.FloorIsLoaded = true;
LoadFloor();
CurrentFloor.InitializeDungeon();
var transform = GetPlayerSpawnPosition();
Player.TeleportPlayer(transform);
CurrentFloor.FloorIsLoaded = true;
}
private void ClearMap()
{
CurrentFloor?.CallDeferred(MethodName.QueueFree, []);
CurrentFloor?.CallDeferred(MethodName.QueueFree, []);
}
public void SpawnNextFloor()
{
ClearMap();
LoadFloor();
CurrentFloor.InitializeDungeon();
var transform = GetPlayerSpawnPosition();
Player.TeleportPlayer(transform);
CurrentFloor.FloorIsLoaded = true;
CurrentFloorNumber.OnNext(CurrentFloorNumber.Value + 1);
ClearMap();
LoadFloor();
CurrentFloor.InitializeDungeon();
var transform = GetPlayerSpawnPosition();
Player.TeleportPlayer(transform);
CurrentFloor.FloorIsLoaded = true;
CurrentFloorNumber.OnNext(CurrentFloorNumber.Value + 1);
}
public IDungeonRoom GetPlayersCurrentRoom()
{
var rooms = CurrentFloor.Rooms;
var playersRoom = rooms.SingleOrDefault(x => x.IsPlayerInRoom);
return playersRoom;
var rooms = CurrentFloor.Rooms;
var playersRoom = rooms.SingleOrDefault(x => x.IsPlayerInRoom);
return playersRoom;
}
public Transform3D GetPlayerSpawnPosition() => CurrentFloor.GetPlayerSpawnPoint();
public void LoadFloor()
{
ClearMap();
var currentFloorScene = FloorScenes.First();
var instantiator = new Instantiator(GetTree());
var loadedScene = instantiator.LoadAndInstantiate<Node3D>(currentFloorScene);
AddChild(loadedScene);
CurrentFloor = (IDungeonFloor)loadedScene;
FloorScenes.Remove(currentFloorScene);
var transform = GetPlayerSpawnPosition();
Player.TeleportPlayer(transform);
ClearMap();
FloorScenes.TryGetValue(Floors.First(), out var currentFloorScene);
var instantiator = new Instantiator(GetTree());
var loadedScene = instantiator.LoadAndInstantiate<Node3D>(currentFloorScene);
AddChild(loadedScene);
CurrentFloor = (IDungeonFloor)loadedScene;
Floors.Remove(Floors.First());
var transform = GetPlayerSpawnPosition();
Player.TeleportPlayer(transform);
}
}

View File

@@ -1,17 +1,7 @@
[gd_scene load_steps=10 format=3 uid="uid://by67pn7fdsg1m"]
[gd_scene load_steps=2 format=3 uid="uid://by67pn7fdsg1m"]
[ext_resource type="Script" uid="uid://14e8mu48ed4" path="res://src/map/Map.cs" id="1_bw70o"]
[ext_resource type="PackedScene" uid="uid://dl6h1djc27ddl" path="res://src/map/dungeon/floors/Floor00.tscn" id="2_ne2vg"]
[ext_resource type="PackedScene" uid="uid://jha0mhct0e7i" path="res://src/map/dungeon/rooms/Set B/40. Goddess of Guidance's Room - True Form.tscn" id="3_ne2vg"]
[ext_resource type="PackedScene" uid="uid://5ja3qxn8h7iw" path="res://src/map/dungeon/rooms/Set A/15. Boss Floor A.tscn" id="6_abpbr"]
[ext_resource type="PackedScene" uid="uid://dvnc26rebk6o0" path="res://src/map/overworld/Overworld.tscn" id="6_ne2vg"]
[ext_resource type="PackedScene" uid="uid://ceo7ph483io44" path="res://src/map/dungeon/rooms/Set B/34. Boss Floor B.tscn" id="7_caf7v"]
[ext_resource type="PackedScene" uid="uid://bo20ffw2ygbks" path="res://src/map/dungeon/rooms/Set B/35. Goddess of Guidance's Room.tscn" id="8_y74f3"]
[ext_resource type="PackedScene" uid="uid://dttk7gis5ibge" path="res://src/map/dungeon/rooms/Set B/30. Void Room.tscn" id="9_dbqu2"]
[ext_resource type="PackedScene" uid="uid://cyrrhoarhxlhg" path="res://src/map/dungeon/rooms/Set B/36. Final Floor.tscn" id="10_xcm54"]
[node name="Map" type="Node3D"]
script = ExtResource("1_bw70o")
_floors = Array[PackedScene]([ExtResource("7_caf7v"), ExtResource("6_abpbr"), ExtResource("6_ne2vg"), ExtResource("8_y74f3"), ExtResource("2_ne2vg"), ExtResource("9_dbqu2"), ExtResource("3_ne2vg"), ExtResource("10_xcm54")])
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
Floors = Array[int]([3, 2, 0, 4, 1, 5, 6])

View File

@@ -1,6 +1,7 @@
[gd_scene load_steps=102 format=4 uid="uid://bo20ffw2ygbks"]
[ext_resource type="Script" uid="uid://xd6tx3lifebl" path="res://src/map/dungeon/code/SpecialFloor.cs" id="1_j4ho3"]
<<<<<<< HEAD
[ext_resource type="Texture2D" uid="uid://ddrvsy7psmwig" path="res://src/map/dungeon/models/Outdated/Set B/35. Goddess of Guidance's Floor/GoG Room mirrored_DARKER_STONE_AREA_2.png" id="2_jbyuo"]
[ext_resource type="Texture2D" uid="uid://dk2cj5rcnkxnf" path="res://src/map/dungeon/models/Outdated/Set B/35. Goddess of Guidance's Floor/GoG Room mirrored_CEILING_AREA2.jpg" id="3_nadnf"]
[ext_resource type="Texture2D" uid="uid://bfr26em2xh1r1" path="res://src/map/dungeon/models/Outdated/Set B/35. Goddess of Guidance's Floor/GoG Room mirrored_STONE_PANEL_AREA2png.png" id="4_bb3ot"]
@@ -15,6 +16,22 @@
[ext_resource type="Texture2D" uid="uid://dd1jvmfs1cbbg" path="res://src/map/dungeon/models/Outdated/Set B/35. Goddess of Guidance's Floor/GoG Room mirrored_floral_single_tile.jpg" id="13_aytwf"]
[ext_resource type="Texture2D" uid="uid://nvg6i8gbgqjv" path="res://src/map/dungeon/models/Outdated/Set B/35. Goddess of Guidance's Floor/GoG Room mirrored_angkor_mural.jpg" id="14_tf4w3"]
[ext_resource type="Texture2D" uid="uid://3w1ac5fvks5v" path="res://src/map/dungeon/models/Outdated/Set B/35. Goddess of Guidance's Floor/GoG Room mirrored_area_2_big_tile.png" id="15_nduur"]
=======
[ext_resource type="Texture2D" uid="uid://ddrvsy7psmwig" path="res://src/map/dungeon/models/Set B/35. Goddess of Guidance's Floor/GoG Room mirrored_DARKER_STONE_AREA_2.png" id="2_jbyuo"]
[ext_resource type="Texture2D" uid="uid://dk2cj5rcnkxnf" path="res://src/map/dungeon/models/Set B/35. Goddess of Guidance's Floor/GoG Room mirrored_CEILING_AREA2.jpg" id="3_nadnf"]
[ext_resource type="Texture2D" uid="uid://bfr26em2xh1r1" path="res://src/map/dungeon/models/Set B/35. Goddess of Guidance's Floor/GoG Room mirrored_STONE_PANEL_AREA2png.png" id="4_bb3ot"]
[ext_resource type="Texture2D" uid="uid://bq8mvoumy8jmk" path="res://src/map/dungeon/models/Set B/35. Goddess of Guidance's Floor/GoG Room mirrored_swirled_column _AREA2.png" id="5_f7fde"]
[ext_resource type="Texture2D" uid="uid://i1x50ruj46r4" path="res://src/map/dungeon/models/Set B/35. Goddess of Guidance's Floor/GoG Room mirrored_asdasd.png" id="6_j4ho3"]
[ext_resource type="Texture2D" uid="uid://dmr6lrd2vv11p" path="res://src/map/dungeon/models/Set B/35. Goddess of Guidance's Floor/GoG Room mirrored_HAND-CYCLE-FLOOR.png" id="7_qt11j"]
[ext_resource type="Texture2D" uid="uid://000xg7ey7p71" path="res://src/map/dungeon/models/Set B/35. Goddess of Guidance's Floor/GoG Room mirrored_AREA_2_MAIN_STON2E.png" id="8_tkf4r"]
[ext_resource type="Texture2D" uid="uid://c7yaqdtmf0w4o" path="res://src/map/dungeon/models/Set B/35. Goddess of Guidance's Floor/GoG Room mirrored_swirled_column _AREA222.png" id="9_fs8fd"]
[ext_resource type="Texture2D" uid="uid://d2np2n5rkhhes" path="res://src/map/dungeon/models/Set B/35. Goddess of Guidance's Floor/GoG Room mirrored_WHITE METAL 2E.png" id="10_rfnlw"]
[ext_resource type="Texture2D" uid="uid://dti0ir01a1s87" path="res://src/map/dungeon/models/Set B/35. Goddess of Guidance's Floor/GoG Room mirrored_WHITE_layer_brick1.png" id="11_6bh8x"]
[ext_resource type="Texture2D" uid="uid://bxf4worc2uvfp" path="res://src/map/dungeon/models/Set B/35. Goddess of Guidance's Floor/GoG Room mirrored_burned-thing.png" id="12_itdxh"]
[ext_resource type="Texture2D" uid="uid://dd1jvmfs1cbbg" path="res://src/map/dungeon/models/Set B/35. Goddess of Guidance's Floor/GoG Room mirrored_floral_single_tile.jpg" id="13_aytwf"]
[ext_resource type="Texture2D" uid="uid://nvg6i8gbgqjv" path="res://src/map/dungeon/models/Set B/35. Goddess of Guidance's Floor/GoG Room mirrored_angkor_mural.jpg" id="14_tf4w3"]
[ext_resource type="Texture2D" uid="uid://3w1ac5fvks5v" path="res://src/map/dungeon/models/Set B/35. Goddess of Guidance's Floor/GoG Room mirrored_area_2_big_tile.png" id="15_nduur"]
>>>>>>> 7e9114bfd1f6c5dd447c4c4e54a2e8ccb9f38e24
[ext_resource type="Shader" uid="uid://beg8sp6kw66w8" path="res://src/map/map shaders/GOGROOM Water.gdshader" id="16_q4do2"]
[ext_resource type="PackedScene" uid="uid://dbvr8ewajja6a" path="res://src/enemy/EnemyDatabase.tscn" id="17_j4ho3"]
[ext_resource type="PackedScene" uid="uid://bs56ccgosmu47" path="res://src/enemy/enemy_types/01. sproingy/Sproingy.tscn" id="18_qt11j"]