Fix mystery items not spawning, adjust spawning rates, fix pause/unpausing for debug menu

This commit is contained in:
2026-06-13 01:26:38 -07:00
parent 8575cd6ddf
commit 3ab491e0af
13 changed files with 288 additions and 22 deletions
-2
View File
@@ -398,12 +398,10 @@ public partial class Game : Node3D, IGame
})
.Handle((in GameState.Output.OpenDebugMenu _) =>
{
GameRepo.Pause();
InGameUI.DebugMenu.Show();
})
.Handle((in GameState.Output.CloseDebugMenu _) =>
{
GameRepo.Resume();
InGameUI.DebugMenu.Hide();
})
.Handle((in GameState.Output.OpenTeleportScreen _) =>
+1 -3
View File
@@ -53,11 +53,9 @@ public class ItemDatabase
if (itemsToExclude.Any())
validItems = [.. validItems.Except(itemsToExclude)];
validItems = [.. validItems.Where(x => x.ItemTag != ItemTag.MysteryItem)];
var weights = validItems.Select(x => x.SpawnRate).ToArray();
var index = rng.RandWeighted(weights);
GD.Print($"Item Spawn Index: {index}, Array Size: {validItems.Count()}");
GD.Print($"Item Spawn Index: {index}, Array Size: {validItems.Length}");
var selectedItem = validItems[index];
return selectedItem;
}
@@ -64,5 +64,5 @@ ThrowDamage = 5
ItemTag = 0
Texture = ExtResource("1_n75f4")
RarityTag = 0
SpawnRate = 0.3
SpawnRate = 0.1
SpawnsOn = SubResource("Resource_8i8u4")
@@ -1,8 +1,39 @@
[gd_resource type="Resource" script_class="ConsumableItemStats" load_steps=3 format=3 uid="uid://css0wjctm4wi6"]
[gd_resource type="Resource" script_class="ConsumableItemStats" load_steps=5 format=3 uid="uid://css0wjctm4wi6"]
[ext_resource type="Script" uid="uid://c4hhsqjy3qknn" path="res://src/map/FloorSpawnTable.cs" id="1_g6l5u"]
[ext_resource type="Texture2D" uid="uid://ltbd7nw0ugxf" path="res://src/items/consumable/texture/ancient medicine.png" id="1_xsvjk"]
[ext_resource type="Script" uid="uid://cymeea1n4f04i" path="res://src/items/consumable/ConsumableItemStats.cs" id="2_g6l5u"]
[sub_resource type="Resource" id="Resource_bqplh"]
script = ExtResource("1_g6l5u")
Altar = true
Floor01 = true
Floor02 = true
Floor03 = true
Floor04 = true
Floor05 = true
Floor06 = true
Floor07 = true
Floor09 = true
Floor10 = true
Floor11 = true
Floor12 = true
Floor13 = true
Floor14 = true
Floor15 = true
BossFloorA = false
BossFloorB = false
River = false
Server = false
Platform = false
Grassland = false
Cellular = false
GoddessOfGuidance = false
TrueGoddessOfGuidance = false
FinalFloor = false
BadEnd = false
HeartOfAllThings = false
[resource]
script = ExtResource("2_g6l5u")
HealHPAmount = 0
@@ -15,7 +46,6 @@ StatDescription = "Cures all status effects and restores parameters to normal."
FlavorText = "An ancient capsule meant to relieve patients of advanced ailments.
"
SpawnRate = 0.2
BonusAttack = 0
BonusDefense = 0
BonusLuck = 0.05
@@ -32,3 +62,6 @@ ThrowSpeed = 12.0
ThrowDamage = 5
ItemTag = 0
Texture = ExtResource("1_xsvjk")
RarityTag = 0
SpawnRate = 0.1
SpawnsOn = SubResource("Resource_bqplh")
@@ -1,8 +1,39 @@
[gd_resource type="Resource" script_class="ConsumableItemStats" load_steps=3 format=3 uid="uid://75fpkwfp0t0k"]
[gd_resource type="Resource" script_class="ConsumableItemStats" load_steps=5 format=3 uid="uid://75fpkwfp0t0k"]
[ext_resource type="Texture2D" uid="uid://lm4kotm2dd6j" path="res://src/items/consumable/texture/Catholicon Draught.png" id="1_5rfk4"]
[ext_resource type="Script" uid="uid://c4hhsqjy3qknn" path="res://src/map/FloorSpawnTable.cs" id="1_uec1i"]
[ext_resource type="Script" uid="uid://cymeea1n4f04i" path="res://src/items/consumable/ConsumableItemStats.cs" id="2_uec1i"]
[sub_resource type="Resource" id="Resource_bqplh"]
script = ExtResource("1_uec1i")
Altar = true
Floor01 = true
Floor02 = true
Floor03 = true
Floor04 = true
Floor05 = true
Floor06 = true
Floor07 = true
Floor09 = true
Floor10 = true
Floor11 = true
Floor12 = true
Floor13 = true
Floor14 = true
Floor15 = true
BossFloorA = false
BossFloorB = false
River = false
Server = false
Platform = false
Grassland = false
Cellular = false
GoddessOfGuidance = false
TrueGoddessOfGuidance = false
FinalFloor = false
BadEnd = false
HeartOfAllThings = false
[resource]
script = ExtResource("2_uec1i")
HealHPAmount = 0
@@ -16,7 +47,6 @@ If VT is full: raises max VT by 8"
FlavorText = "A panacea to invigorate oneself
"
SpawnRate = 0.5
BonusAttack = 0
BonusDefense = 0
BonusLuck = 0.05
@@ -33,3 +63,6 @@ ThrowSpeed = 12.0
ThrowDamage = 5
ItemTag = 0
Texture = ExtResource("1_5rfk4")
RarityTag = 0
SpawnRate = 0.1
SpawnsOn = SubResource("Resource_bqplh")
@@ -1,8 +1,39 @@
[gd_resource type="Resource" script_class="ConsumableItemStats" load_steps=3 format=3 uid="uid://d2b1mm31e1rsk"]
[gd_resource type="Resource" script_class="ConsumableItemStats" load_steps=5 format=3 uid="uid://d2b1mm31e1rsk"]
[ext_resource type="Script" uid="uid://c4hhsqjy3qknn" path="res://src/map/FloorSpawnTable.cs" id="1_atayo"]
[ext_resource type="Texture2D" uid="uid://dk4m3ssv1o71v" path="res://src/items/consumable/texture/eucharistia.png" id="1_ptra5"]
[ext_resource type="Script" uid="uid://cymeea1n4f04i" path="res://src/items/consumable/ConsumableItemStats.cs" id="2_iob5m"]
[sub_resource type="Resource" id="Resource_bqplh"]
script = ExtResource("1_atayo")
Altar = true
Floor01 = true
Floor02 = true
Floor03 = true
Floor04 = true
Floor05 = true
Floor06 = true
Floor07 = true
Floor09 = true
Floor10 = true
Floor11 = true
Floor12 = true
Floor13 = true
Floor14 = true
Floor15 = true
BossFloorA = false
BossFloorB = false
River = false
Server = false
Platform = false
Grassland = false
Cellular = false
GoddessOfGuidance = false
TrueGoddessOfGuidance = false
FinalFloor = false
BadEnd = false
HeartOfAllThings = false
[resource]
script = ExtResource("2_iob5m")
HealHPAmount = 999
@@ -15,7 +46,6 @@ StatDescription = "Restores All HP and all VT.
Raise each by 25 if both are Full."
FlavorText = "Rare holy imbibement.
"
SpawnRate = 0.1
BonusAttack = 0
BonusDefense = 0
BonusLuck = 0.05
@@ -32,3 +62,6 @@ ThrowSpeed = 12.0
ThrowDamage = 1
ItemTag = 0
Texture = ExtResource("1_ptra5")
RarityTag = 0
SpawnRate = 0.1
SpawnsOn = SubResource("Resource_bqplh")
@@ -1,8 +1,39 @@
[gd_resource type="Resource" script_class="ConsumableItemStats" load_steps=3 format=3 uid="uid://bnec53frgyue8"]
[gd_resource type="Resource" script_class="ConsumableItemStats" load_steps=5 format=3 uid="uid://bnec53frgyue8"]
[ext_resource type="Script" uid="uid://c4hhsqjy3qknn" path="res://src/map/FloorSpawnTable.cs" id="1_8eiok"]
[ext_resource type="Texture2D" uid="uid://fdbkth1vvud2" path="res://src/items/consumable/texture/Haoma Draught.png" id="1_ctwnv"]
[ext_resource type="Script" uid="uid://cymeea1n4f04i" path="res://src/items/consumable/ConsumableItemStats.cs" id="2_wmtl1"]
[sub_resource type="Resource" id="Resource_bqplh"]
script = ExtResource("1_8eiok")
Altar = true
Floor01 = true
Floor02 = true
Floor03 = true
Floor04 = true
Floor05 = true
Floor06 = true
Floor07 = true
Floor09 = true
Floor10 = true
Floor11 = true
Floor12 = true
Floor13 = true
Floor14 = true
Floor15 = true
BossFloorA = false
BossFloorB = false
River = false
Server = false
Platform = false
Grassland = false
Cellular = false
GoddessOfGuidance = false
TrueGoddessOfGuidance = false
FinalFloor = false
BadEnd = false
HeartOfAllThings = false
[resource]
script = ExtResource("2_wmtl1")
HealHPAmount = 0
@@ -16,7 +47,6 @@ If VT is full: raises max VT by 25"
FlavorText = "A divine draught to invigorate oneself.
"
SpawnRate = 0.2
BonusAttack = 0
BonusDefense = 0
BonusLuck = 0.05
@@ -33,3 +63,6 @@ ThrowSpeed = 12.0
ThrowDamage = 5
ItemTag = 0
Texture = ExtResource("1_ctwnv")
RarityTag = 0
SpawnRate = 0.1
SpawnsOn = SubResource("Resource_bqplh")
@@ -1,7 +1,38 @@
[gd_resource type="Resource" script_class="ConsumableItemStats" load_steps=3 format=3 uid="uid://bjwbx3ymt8o7"]
[gd_resource type="Resource" script_class="ConsumableItemStats" load_steps=5 format=3 uid="uid://bjwbx3ymt8o7"]
[ext_resource type="Script" uid="uid://cymeea1n4f04i" path="res://src/items/consumable/ConsumableItemStats.cs" id="1_51ovu"]
[ext_resource type="Texture2D" uid="uid://esqaln68twiw" path="res://src/items/Icons/Unidentified Item.png" id="1_g5ngs"]
[ext_resource type="Script" uid="uid://c4hhsqjy3qknn" path="res://src/map/FloorSpawnTable.cs" id="1_njt38"]
[sub_resource type="Resource" id="Resource_vtqf0"]
script = ExtResource("1_njt38")
Altar = true
Floor01 = true
Floor02 = true
Floor03 = true
Floor04 = true
Floor05 = true
Floor06 = true
Floor07 = true
Floor09 = true
Floor10 = true
Floor11 = true
Floor12 = true
Floor13 = true
Floor14 = true
Floor15 = true
BossFloorA = false
BossFloorB = false
River = false
Server = false
Platform = false
Grassland = false
Cellular = false
GoddessOfGuidance = false
TrueGoddessOfGuidance = false
FinalFloor = false
BadEnd = false
HeartOfAllThings = false
[resource]
script = ExtResource("1_51ovu")
@@ -13,7 +44,6 @@ HealsStatusAilments = false
Name = "Unknown Restorative"
StatDescription = "Unidentified Restorative."
FlavorText = ""
SpawnRate = 0.05
BonusAttack = 0
BonusDefense = 0
BonusLuck = 0.05
@@ -30,4 +60,7 @@ ThrowSpeed = 12.0
ThrowDamage = 5
ItemTag = 2
Texture = ExtResource("1_g5ngs")
RarityTag = 0
SpawnRate = 0.5
SpawnsOn = SubResource("Resource_vtqf0")
metadata/_custom_type_script = "uid://cymeea1n4f04i"
@@ -1,8 +1,39 @@
[gd_resource type="Resource" script_class="ConsumableItemStats" load_steps=3 format=3 uid="uid://d0cxrf0nldona"]
[gd_resource type="Resource" script_class="ConsumableItemStats" load_steps=5 format=3 uid="uid://d0cxrf0nldona"]
[ext_resource type="Texture2D" uid="uid://xiqfet2fnnrs" path="res://src/items/consumable/texture/Somalata Electuary.png" id="1_1emhh"]
[ext_resource type="Script" uid="uid://c4hhsqjy3qknn" path="res://src/map/FloorSpawnTable.cs" id="1_xv45j"]
[ext_resource type="Script" uid="uid://cymeea1n4f04i" path="res://src/items/consumable/ConsumableItemStats.cs" id="2_xv45j"]
[sub_resource type="Resource" id="Resource_bqplh"]
script = ExtResource("1_xv45j")
Altar = true
Floor01 = true
Floor02 = true
Floor03 = true
Floor04 = true
Floor05 = true
Floor06 = true
Floor07 = true
Floor09 = true
Floor10 = true
Floor11 = true
Floor12 = true
Floor13 = true
Floor14 = true
Floor15 = true
BossFloorA = false
BossFloorB = false
River = false
Server = false
Platform = false
Grassland = false
Cellular = false
GoddessOfGuidance = false
TrueGoddessOfGuidance = false
FinalFloor = false
BadEnd = false
HeartOfAllThings = false
[resource]
script = ExtResource("2_xv45j")
HealHPAmount = 60
@@ -16,7 +47,6 @@ If HP is full: raises max HP by 16."
FlavorText = "A portion of the sacred plant, ground into a restorative electuary.
"
SpawnRate = 0.4
BonusAttack = 0
BonusDefense = 0
BonusLuck = 0.05
@@ -33,3 +63,6 @@ ThrowSpeed = 12.0
ThrowDamage = 5
ItemTag = 0
Texture = ExtResource("1_1emhh")
RarityTag = 0
SpawnRate = 0.1
SpawnsOn = SubResource("Resource_bqplh")
@@ -1,8 +1,39 @@
[gd_resource type="Resource" script_class="ConsumableItemStats" load_steps=3 format=3 uid="uid://ypw2yg10430p"]
[gd_resource type="Resource" script_class="ConsumableItemStats" load_steps=5 format=3 uid="uid://ypw2yg10430p"]
[ext_resource type="Script" uid="uid://c4hhsqjy3qknn" path="res://src/map/FloorSpawnTable.cs" id="1_766xm"]
[ext_resource type="Texture2D" uid="uid://dy525pkru5nld" path="res://src/items/consumable/texture/Xiandan Draught.png" id="1_ur5kc"]
[ext_resource type="Script" uid="uid://cymeea1n4f04i" path="res://src/items/consumable/ConsumableItemStats.cs" id="2_766xm"]
[sub_resource type="Resource" id="Resource_bqplh"]
script = ExtResource("1_766xm")
Altar = true
Floor01 = true
Floor02 = true
Floor03 = true
Floor04 = true
Floor05 = true
Floor06 = true
Floor07 = true
Floor09 = true
Floor10 = true
Floor11 = true
Floor12 = true
Floor13 = true
Floor14 = true
Floor15 = true
BossFloorA = false
BossFloorB = false
River = false
Server = false
Platform = false
Grassland = false
Cellular = false
GoddessOfGuidance = false
TrueGoddessOfGuidance = false
FinalFloor = false
BadEnd = false
HeartOfAllThings = false
[resource]
script = ExtResource("2_766xm")
HealHPAmount = 0
@@ -16,7 +47,6 @@ If VT is full: raises max VT by 16"
FlavorText = "A compound elixir to invigorate oneself.
"
SpawnRate = 0.4
BonusAttack = 0
BonusDefense = 0
BonusLuck = 0.05
@@ -33,3 +63,6 @@ ThrowSpeed = 12.0
ThrowDamage = 5
ItemTag = 0
Texture = ExtResource("1_ur5kc")
RarityTag = 0
SpawnRate = 0.1
SpawnsOn = SubResource("Resource_bqplh")
@@ -1,8 +1,39 @@
[gd_resource type="Resource" script_class="ConsumableItemStats" load_steps=3 format=3 uid="uid://lu0ddu3538p6"]
[gd_resource type="Resource" script_class="ConsumableItemStats" load_steps=5 format=3 uid="uid://lu0ddu3538p6"]
[ext_resource type="Texture2D" uid="uid://cd6p73amcfr4b" path="res://src/items/consumable/texture/Ydunic Electuary.png" id="1_rb6df"]
[ext_resource type="Script" uid="uid://c4hhsqjy3qknn" path="res://src/map/FloorSpawnTable.cs" id="1_x1p6p"]
[ext_resource type="Script" uid="uid://cymeea1n4f04i" path="res://src/items/consumable/ConsumableItemStats.cs" id="2_x1p6p"]
[sub_resource type="Resource" id="Resource_bqplh"]
script = ExtResource("1_x1p6p")
Altar = true
Floor01 = true
Floor02 = true
Floor03 = true
Floor04 = true
Floor05 = true
Floor06 = true
Floor07 = true
Floor09 = true
Floor10 = true
Floor11 = true
Floor12 = true
Floor13 = true
Floor14 = true
Floor15 = true
BossFloorA = false
BossFloorB = false
River = false
Server = false
Platform = false
Grassland = false
Cellular = false
GoddessOfGuidance = false
TrueGoddessOfGuidance = false
FinalFloor = false
BadEnd = false
HeartOfAllThings = false
[resource]
script = ExtResource("2_x1p6p")
HealHPAmount = 30
@@ -16,7 +47,6 @@ If HP is full: raises max HP by 8."
FlavorText = "A fragment of divine fruit, ground into a restorative electuary.
"
SpawnRate = 0.5
BonusAttack = 0
BonusDefense = 0
BonusLuck = 0.05
@@ -33,3 +63,6 @@ ThrowSpeed = 12.0
ThrowDamage = 5
ItemTag = 0
Texture = ExtResource("1_rb6df")
RarityTag = 0
SpawnRate = 0.1
SpawnsOn = SubResource("Resource_bqplh")
+5
View File
@@ -73,6 +73,7 @@ public partial class Map : Node3D, IMap
public async Task LoadFloor(FloorScene floorToLoad)
{
GD.Print($"Pause for load at {DateTime.Now.Minute}:{DateTime.Now.Second}:{DateTime.Now.Millisecond}");
Game.Pause();
// Clean up current floor
CleanupCurrentFloor();
@@ -84,6 +85,7 @@ public partial class Map : Node3D, IMap
public async Task LoadFloorByPath(string filePath)
{
GD.Print($"Pause for load at {DateTime.Now.Minute}:{DateTime.Now.Second}:{DateTime.Now.Millisecond}");
Game.Pause();
// Clean up current floor
CleanupCurrentFloor();
@@ -117,12 +119,14 @@ public partial class Map : Node3D, IMap
{
SpawnPointCreated?.Invoke((Vector3.Forward, new Vector3(-999, -999, -999)));
var newFloor = await LoadSceneFile(filePath);
GD.Print($"Floor finished load at {DateTime.Now.Minute}:{DateTime.Now.Second}:{DateTime.Now.Millisecond}");
// New floor created, remove old floor
ClearFloor();
// Setup new floor
AddChild(newFloor);
GD.Print($"Floor added at {DateTime.Now.Minute:D2}:{DateTime.Now.Second:D2}:{DateTime.Now.Millisecond}");
CurrentFloor = newFloor as IDungeonFloor;
CurrentFloor.InitializeDungeon();
SpawnPointCreated?.Invoke(CurrentFloor.GetPlayerSpawnPoint());
@@ -134,6 +138,7 @@ public partial class Map : Node3D, IMap
SpawnItems();
CurrentFloor.FloorIsLoaded = true;
FloorLoaded?.Invoke();
GD.Print($"Floor loaded invoked {DateTime.Now.Minute}:{DateTime.Now.Second}:{DateTime.Now.Millisecond}");
}
private void CleanupCurrentFloor()
@@ -79,6 +79,7 @@ public partial class MonsterRoom : DungeonRoom
if (spawnableItems.Count() == 0)
break;
var selectedItem = database.PickItemFromList(spawnableItems) as Node3D;
GD.Print($"Item spawned: {(selectedItem as IBaseInventoryItem).ItemName}");
var duplicated = selectedItem.Duplicate((int)DuplicateFlags.UseInstantiation) as Node3D;
AddChild(duplicated);
duplicated.Position = new Vector3(spawnPoint.Position.X, 0, spawnPoint.Position.Z);