mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 09:55:35 +00:00
Random weapons from pool
This commit is contained in:
parent
a2a18c69fc
commit
57ff504628
6 changed files with 71 additions and 8 deletions
|
|
@ -11,6 +11,7 @@ ShortName = &"IC-18"
|
|||
ItemDescription = &"Shoots ice pellets at a high rate"
|
||||
ItemKey = &"ICICLE_REPEATER"
|
||||
Item = 9
|
||||
Price = 0
|
||||
WeaponData = ExtResource("3_5vsuk")
|
||||
Amount = 1
|
||||
Max = 1
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ ShortName = &"SM-3"
|
|||
ItemDescription = &"A weapon that shoots explosive Yin-Yang Orbs"
|
||||
ItemKey = &"YINYANG_GUN"
|
||||
Item = 9
|
||||
Price = 0
|
||||
WeaponData = ExtResource("1_cuxft")
|
||||
Amount = 1
|
||||
Max = 1
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_resource type="Resource" script_class="RogueliteMapTheme" load_steps=49 format=3 uid="uid://cw6868vuvuynh"]
|
||||
[gd_resource type="Resource" script_class="RogueliteMapTheme" load_steps=54 format=3 uid="uid://cw6868vuvuynh"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bwtif3if3ea0u" path="res://Scripts/Resources/RogueliteMapTheme.cs" id="1_2rtdw"]
|
||||
[ext_resource type="Resource" uid="uid://cltxhkrqp055v" path="res://Resources/Items/Money_Pickup.tres" id="1_ae3bb"]
|
||||
|
|
@ -45,6 +45,10 @@
|
|||
[ext_resource type="PackedScene" uid="uid://cl7s06sk106uo" path="res://Scenes/Props/VendingMachine.tscn" id="30_exyjy"]
|
||||
[ext_resource type="Resource" uid="uid://bdpbekqhuuq4l" path="res://Resources/Items/Shield_Extend_Pickup.tres" id="41_tsgja"]
|
||||
[ext_resource type="Resource" uid="uid://ciybnocjfpshh" path="res://Resources/Items/Heart_Extend_Pickup.tres" id="42_qo6vk"]
|
||||
[ext_resource type="Resource" uid="uid://bgcgeg187vg1h" path="res://Resources/Items/IcicleRepeater.tres" id="45_f7mru"]
|
||||
[ext_resource type="Resource" uid="uid://dau0s8ob7qnpc" path="res://Resources/Items/IceShotgun.tres" id="46_3kwn2"]
|
||||
[ext_resource type="Resource" uid="uid://brsukcuyoq364" path="res://Resources/Items/NuclearGunPickup.tres" id="47_to7mi"]
|
||||
[ext_resource type="Resource" uid="uid://ccmuffmnevrt4" path="res://Resources/Items/Yin_Yang_Gun_Pickup.tres" id="48_w335g"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_nnvxo"]
|
||||
script = ExtResource("11_eegnh")
|
||||
|
|
@ -61,6 +65,11 @@ script = ExtResource("11_eegnh")
|
|||
Items = Array[Object]([ExtResource("9_to7mi"), ExtResource("3_tsgja"), ExtResource("10_w335g"), ExtResource("6_cxv74"), ExtResource("9_to7mi"), ExtResource("5_ga54h"), ExtResource("41_tsgja"), ExtResource("42_qo6vk"), ExtResource("7_f7mru"), ExtResource("4_qo6vk"), ExtResource("2_p3lfl"), ExtResource("8_3kwn2")])
|
||||
metadata/_custom_type_script = "uid://rgx0g5iqksnn"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_eegnh"]
|
||||
script = ExtResource("11_eegnh")
|
||||
Items = Array[Object]([ExtResource("45_f7mru"), ExtResource("46_3kwn2"), ExtResource("47_to7mi"), ExtResource("48_w335g")])
|
||||
metadata/_custom_type_script = "uid://rgx0g5iqksnn"
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_2rtdw")
|
||||
HorizontalDoorPrefab = ExtResource("2_y7x1u")
|
||||
|
|
@ -78,5 +87,6 @@ EnemyDropChance = 10.0
|
|||
ChestLootTable = SubResource("Resource_nnvxo")
|
||||
ShopLootTable = SubResource("Resource_11cll")
|
||||
EnemiesLootTable = SubResource("Resource_tsgja")
|
||||
WeaponsLootTable = SubResource("Resource_eegnh")
|
||||
Rooms = Array[Object]([ExtResource("5_sludw"), ExtResource("6_b3pjl"), ExtResource("7_nil27"), ExtResource("8_pmfuo"), ExtResource("9_0lwa1"), ExtResource("10_03ih2"), ExtResource("11_modrh"), ExtResource("12_exyjy"), ExtResource("13_2j670"), ExtResource("14_rjphh"), ExtResource("15_2gg5d"), ExtResource("16_402ix"), ExtResource("17_52l5g"), ExtResource("18_gh41q"), ExtResource("19_bn1n6"), ExtResource("20_0on7r"), ExtResource("23_p3lfl"), ExtResource("24_tsgja"), ExtResource("21_m2nxl"), ExtResource("22_ae3bb")])
|
||||
metadata/_custom_type_script = "uid://bwtif3if3ea0u"
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
[gd_scene load_steps=8 format=4 uid="uid://j71ehkbbalh2"]
|
||||
[gd_scene load_steps=7 format=4 uid="uid://j71ehkbbalh2"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b2j00riayxkit" path="res://Scripts/Controllers/RogueliteRoom.cs" id="1_08gfs"]
|
||||
[ext_resource type="Resource" uid="uid://crqgvauqarfaq" path="res://Resources/RogueliteMaps/TreasureRoom1.tres" id="2_08gfs"]
|
||||
[ext_resource type="TileSet" uid="uid://6k28roiljylj" path="res://Tilesets/factory_tileset.tres" id="5_ojht1"]
|
||||
[ext_resource type="PackedScene" uid="uid://cnhgvn2salyxl" path="res://Scenes/Items/Icicle_Repeater.tscn" id="5_xa3gk"]
|
||||
[ext_resource type="Script" uid="uid://krean0uywtms" path="res://Scripts/TilemapAvoidance.cs" id="6_jf212"]
|
||||
|
||||
[sub_resource type="NavigationPolygon" id="NavigationPolygon_rlq0q"]
|
||||
|
|
@ -45,9 +44,6 @@ metadata/_edit_lock_ = true
|
|||
[node name="Actors" type="Node2D" parent="Tilemaps"]
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="IcicleRepeater" parent="Tilemaps/Actors" instance=ExtResource("5_xa3gk")]
|
||||
position = Vector2(160, 95)
|
||||
|
||||
[node name="EnemySpawners" type="Node2D" parent="."]
|
||||
|
||||
[node name="NavigationRegion2D" type="NavigationRegion2D" parent="."]
|
||||
|
|
@ -63,4 +59,9 @@ collision_mask = 2
|
|||
position = Vector2(162, 94.5)
|
||||
shape = SubResource("RectangleShape2D_rlq0q")
|
||||
|
||||
[node name="Treasures" type="Node2D" parent="."]
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="Treasures"]
|
||||
position = Vector2(160, 96)
|
||||
|
||||
[connection signal="area_entered" from="PlayerEnterDetector" to="." method="OnRoomEntered"]
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ public partial class RogueliteRoom : Node2D
|
|||
{
|
||||
SpawnEnemies();
|
||||
SpawnFeatures();
|
||||
SpawnFixedWeapons();
|
||||
//HandleDoors(connectionChecker);
|
||||
//AddDebugLabel();
|
||||
return this;
|
||||
|
|
@ -203,8 +204,6 @@ public partial class RogueliteRoom : Node2D
|
|||
|
||||
_connections.Add(connection);
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -247,6 +246,56 @@ public partial class RogueliteRoom : Node2D
|
|||
}
|
||||
}
|
||||
|
||||
private void SpawnFixedWeapons()
|
||||
{
|
||||
var markersContainer = this.GetNodeOrNull("Treasures");
|
||||
if (markersContainer == null) return;
|
||||
|
||||
var markerNodes = markersContainer.GetChildren();
|
||||
|
||||
var itemsPool = MapTheme.WeaponsLootTable.Items.ToList().Shuffle().ToList();
|
||||
|
||||
var playerItems = InventoryManager.Instance.Items;
|
||||
|
||||
foreach (var itemContainer in playerItems)
|
||||
{
|
||||
if (itemsPool.Contains(itemContainer.Item))
|
||||
{
|
||||
itemsPool.Remove(itemContainer.Item);
|
||||
}
|
||||
}
|
||||
|
||||
if (itemsPool.Count == 0)
|
||||
{
|
||||
GD.Print("No items to spawn in the item room found");
|
||||
return;
|
||||
}
|
||||
|
||||
Queue<LootItem> spawnQueue = new();
|
||||
foreach (var item in itemsPool)
|
||||
{
|
||||
spawnQueue.Enqueue(item);
|
||||
}
|
||||
|
||||
foreach (var markerNode in markerNodes)
|
||||
{
|
||||
if (markerNode is not Marker2D marker)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var itemFound = spawnQueue.TryDequeue(out var item);
|
||||
|
||||
if (!itemFound) return;
|
||||
|
||||
GD.Print($"Spawning {item.ItemKey} in treasure spot");
|
||||
|
||||
// Spawn
|
||||
var dropScene = GD.Load<PackedScene>(item.DropScenePath);
|
||||
var dropInstance = marker.CreateChild<Node2D>(dropScene);
|
||||
}
|
||||
}
|
||||
|
||||
private void SpawnFeatures()
|
||||
{
|
||||
// Get feature markers
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ public partial class RogueliteMapTheme : Resource
|
|||
[Export] public LootTable ChestLootTable { get; set; }
|
||||
[Export] public LootTable ShopLootTable { get; set; }
|
||||
[Export] public LootTable EnemiesLootTable { get; set; }
|
||||
[Export] public LootTable WeaponsLootTable { get; set; }
|
||||
|
||||
[ExportCategory("Rooms")]
|
||||
[Export] public Array<RogueliteRoomResource> Rooms { get; set; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue