mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:15:45 +00:00
Auto Pickup
This commit is contained in:
parent
e56b896365
commit
488d02ef81
24 changed files with 148 additions and 19 deletions
|
|
@ -1,8 +1,7 @@
|
||||||
[gd_resource type="Resource" script_class="LootItem" load_steps=5 format=3 uid="uid://ct1fa2huvy34n"]
|
[gd_resource type="Resource" script_class="LootItem" load_steps=4 format=3 uid="uid://ct1fa2huvy34n"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://epnwjptvks3t" path="res://Scripts/Resources/LootItem.cs" id="1_31o2l"]
|
[ext_resource type="Script" uid="uid://epnwjptvks3t" path="res://Scripts/Resources/LootItem.cs" id="1_31o2l"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c5g0qg6u2gm6f" path="res://Sprites/Items/Ammo1.png" id="1_bpftr"]
|
[ext_resource type="Texture2D" uid="uid://c5g0qg6u2gm6f" path="res://Sprites/Items/Ammo1.png" id="1_bpftr"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cjv4yahpb0h2l" path="res://Scenes/HUD/Items/ammo.tscn" id="1_qkp4b"]
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3y0hf"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_3y0hf"]
|
||||||
atlas = ExtResource("1_bpftr")
|
atlas = ExtResource("1_bpftr")
|
||||||
|
|
@ -10,6 +9,7 @@ atlas = ExtResource("1_bpftr")
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_31o2l")
|
script = ExtResource("1_31o2l")
|
||||||
ItemName = &"Ice Ammo"
|
ItemName = &"Ice Ammo"
|
||||||
|
ShortName = null
|
||||||
ItemDescription = &"Ammo for Ice-Based Weapons"
|
ItemDescription = &"Ammo for Ice-Based Weapons"
|
||||||
ItemKey = &"ICE_AMMO"
|
ItemKey = &"ICE_AMMO"
|
||||||
Item = 3
|
Item = 3
|
||||||
|
|
@ -19,6 +19,6 @@ PickupIfMaxed = false
|
||||||
ConsumeOnUse = true
|
ConsumeOnUse = true
|
||||||
UiType = 2
|
UiType = 2
|
||||||
Selectable = false
|
Selectable = false
|
||||||
|
AutoPickup = true
|
||||||
InventorySprite = SubResource("AtlasTexture_3y0hf")
|
InventorySprite = SubResource("AtlasTexture_3y0hf")
|
||||||
HudItemScene = ExtResource("1_qkp4b")
|
|
||||||
DropScenePath = &"res://Scenes/Items/Ammo1.tscn"
|
DropScenePath = &"res://Scenes/Items/Ammo1.tscn"
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("2_fg25e")
|
script = ExtResource("2_fg25e")
|
||||||
ItemName = &"Green Points"
|
ItemName = &"Green Points"
|
||||||
|
ShortName = null
|
||||||
ItemDescription = &"Used for upgrades"
|
ItemDescription = &"Used for upgrades"
|
||||||
ItemKey = &"GREEN_POINTS"
|
ItemKey = &"GREEN_POINTS"
|
||||||
Item = 11
|
Item = 11
|
||||||
|
|
@ -15,6 +16,7 @@ PickupIfMaxed = false
|
||||||
ConsumeOnUse = true
|
ConsumeOnUse = true
|
||||||
UiType = 0
|
UiType = 0
|
||||||
Selectable = false
|
Selectable = false
|
||||||
|
AutoPickup = true
|
||||||
InventorySprite = ExtResource("1_b4fj2")
|
InventorySprite = ExtResource("1_b4fj2")
|
||||||
DropScenePath = &"res://Scenes/Items/Green_Points_Pickup.tscn"
|
DropScenePath = &"res://Scenes/Items/Green_Points_Pickup.tscn"
|
||||||
metadata/_custom_type_script = "uid://epnwjptvks3t"
|
metadata/_custom_type_script = "uid://epnwjptvks3t"
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ metadata/_custom_type_script = "uid://bxgjw8wis5l0t"
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_hyh2l")
|
script = ExtResource("1_hyh2l")
|
||||||
ItemName = &"Health"
|
ItemName = &"Health"
|
||||||
|
ShortName = null
|
||||||
ItemDescription = &"Gives back 25% of Max Health on use"
|
ItemDescription = &"Gives back 25% of Max Health on use"
|
||||||
ItemKey = &"HEALTH"
|
ItemKey = &"HEALTH"
|
||||||
Item = 4
|
Item = 4
|
||||||
|
|
@ -23,6 +24,7 @@ PickupIfMaxed = false
|
||||||
ConsumeOnUse = true
|
ConsumeOnUse = true
|
||||||
UiType = 0
|
UiType = 0
|
||||||
Selectable = true
|
Selectable = true
|
||||||
|
AutoPickup = true
|
||||||
InventorySprite = ExtResource("1_xg75n")
|
InventorySprite = ExtResource("1_xg75n")
|
||||||
DropScenePath = &"res://Scenes/Items/Heart_Pickup.tscn"
|
DropScenePath = &"res://Scenes/Items/Heart_Pickup.tscn"
|
||||||
metadata/_custom_type_script = "uid://epnwjptvks3t"
|
metadata/_custom_type_script = "uid://epnwjptvks3t"
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("2_swcup")
|
script = ExtResource("2_swcup")
|
||||||
ItemName = &"Credits"
|
ItemName = &"Credits"
|
||||||
|
ShortName = null
|
||||||
ItemDescription = &"Can be used to buy things"
|
ItemDescription = &"Can be used to buy things"
|
||||||
ItemKey = &"CREDITS"
|
ItemKey = &"CREDITS"
|
||||||
Item = 12
|
Item = 12
|
||||||
|
|
@ -15,6 +16,7 @@ PickupIfMaxed = false
|
||||||
ConsumeOnUse = true
|
ConsumeOnUse = true
|
||||||
UiType = 0
|
UiType = 0
|
||||||
Selectable = true
|
Selectable = true
|
||||||
|
AutoPickup = true
|
||||||
InventorySprite = ExtResource("1_woor7")
|
InventorySprite = ExtResource("1_woor7")
|
||||||
DropScenePath = &"res://Scenes/Items/Credits_Pickup.tscn"
|
DropScenePath = &"res://Scenes/Items/Credits_Pickup.tscn"
|
||||||
metadata/_custom_type_script = "uid://epnwjptvks3t"
|
metadata/_custom_type_script = "uid://epnwjptvks3t"
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("2_x45it")
|
script = ExtResource("2_x45it")
|
||||||
ItemName = &"Nuclear Ammo"
|
ItemName = &"Nuclear Ammo"
|
||||||
|
ShortName = null
|
||||||
ItemDescription = &"Ammo for Nuclear weapons"
|
ItemDescription = &"Ammo for Nuclear weapons"
|
||||||
ItemKey = &"NUCLEAR_AMMO"
|
ItemKey = &"NUCLEAR_AMMO"
|
||||||
Item = 3
|
Item = 3
|
||||||
|
|
@ -15,5 +16,6 @@ PickupIfMaxed = false
|
||||||
ConsumeOnUse = true
|
ConsumeOnUse = true
|
||||||
UiType = 2
|
UiType = 2
|
||||||
Selectable = false
|
Selectable = false
|
||||||
|
AutoPickup = true
|
||||||
InventorySprite = ExtResource("1_6ly0q")
|
InventorySprite = ExtResource("1_6ly0q")
|
||||||
DropScenePath = &"res://Scenes/Items/Nuclear_Gun_Pickup.tscn"
|
DropScenePath = &"res://Scenes/Items/Nuclear_Gun_Pickup.tscn"
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("2_rxsju")
|
script = ExtResource("2_rxsju")
|
||||||
ItemName = &"Points"
|
ItemName = &"Points"
|
||||||
|
ShortName = null
|
||||||
ItemDescription = &"Necessari for upgrades"
|
ItemDescription = &"Necessari for upgrades"
|
||||||
ItemKey = &"POINTS"
|
ItemKey = &"POINTS"
|
||||||
Item = 11
|
Item = 11
|
||||||
|
|
@ -15,6 +16,7 @@ PickupIfMaxed = false
|
||||||
ConsumeOnUse = true
|
ConsumeOnUse = true
|
||||||
UiType = 0
|
UiType = 0
|
||||||
Selectable = false
|
Selectable = false
|
||||||
|
AutoPickup = true
|
||||||
InventorySprite = ExtResource("1_nsfmo")
|
InventorySprite = ExtResource("1_nsfmo")
|
||||||
DropScenePath = &"res://Scenes/Items/Points_Pickup.tscn"
|
DropScenePath = &"res://Scenes/Items/Points_Pickup.tscn"
|
||||||
metadata/_custom_type_script = "uid://epnwjptvks3t"
|
metadata/_custom_type_script = "uid://epnwjptvks3t"
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_vw5ht")
|
script = ExtResource("1_vw5ht")
|
||||||
ItemName = &"Power"
|
ItemName = &"Power"
|
||||||
|
ShortName = null
|
||||||
ItemDescription = &"Necessary for upgrades"
|
ItemDescription = &"Necessary for upgrades"
|
||||||
ItemKey = &"POWER"
|
ItemKey = &"POWER"
|
||||||
Item = 10
|
Item = 10
|
||||||
|
|
@ -15,5 +16,6 @@ PickupIfMaxed = false
|
||||||
ConsumeOnUse = true
|
ConsumeOnUse = true
|
||||||
UiType = 2
|
UiType = 2
|
||||||
Selectable = false
|
Selectable = false
|
||||||
|
AutoPickup = true
|
||||||
InventorySprite = ExtResource("1_cang8")
|
InventorySprite = ExtResource("1_cang8")
|
||||||
DropScenePath = &"res://Scenes/Items/Power_Pickup.tscn"
|
DropScenePath = &"res://Scenes/Items/Power_Pickup.tscn"
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ metadata/_custom_type_script = "uid://bxgjw8wis5l0t"
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("2_xsuq5")
|
script = ExtResource("2_xsuq5")
|
||||||
ItemName = &"Shield Charge"
|
ItemName = &"Shield Charge"
|
||||||
|
ShortName = null
|
||||||
ItemDescription = &"Recharges the shield by 25%"
|
ItemDescription = &"Recharges the shield by 25%"
|
||||||
ItemKey = &"SHIELD"
|
ItemKey = &"SHIELD"
|
||||||
Item = 8
|
Item = 8
|
||||||
|
|
@ -23,6 +24,7 @@ PickupIfMaxed = false
|
||||||
ConsumeOnUse = true
|
ConsumeOnUse = true
|
||||||
UiType = 0
|
UiType = 0
|
||||||
Selectable = true
|
Selectable = true
|
||||||
|
AutoPickup = true
|
||||||
InventorySprite = ExtResource("1_0hq6q")
|
InventorySprite = ExtResource("1_0hq6q")
|
||||||
DropScenePath = &"res://Scenes/Items/Shield_Pickup.tscn"
|
DropScenePath = &"res://Scenes/Items/Shield_Pickup.tscn"
|
||||||
metadata/_custom_type_script = "uid://epnwjptvks3t"
|
metadata/_custom_type_script = "uid://epnwjptvks3t"
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ metadata/_custom_type_script = "uid://b6fmrnipv88bk"
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_lus3u")
|
script = ExtResource("1_lus3u")
|
||||||
ItemName = &"SnowBall Bomb"
|
ItemName = &"SnowBall Bomb"
|
||||||
|
ShortName = null
|
||||||
ItemDescription = &"A snowball packed of explosive, explodes on contact"
|
ItemDescription = &"A snowball packed of explosive, explodes on contact"
|
||||||
ItemKey = &"SPIDER_BOMB"
|
ItemKey = &"SPIDER_BOMB"
|
||||||
Item = 5
|
Item = 5
|
||||||
|
|
@ -45,6 +46,7 @@ PickupIfMaxed = false
|
||||||
ConsumeOnUse = false
|
ConsumeOnUse = false
|
||||||
UiType = 0
|
UiType = 0
|
||||||
Selectable = true
|
Selectable = true
|
||||||
|
AutoPickup = true
|
||||||
InventorySprite = SubResource("AtlasTexture_gpot4")
|
InventorySprite = SubResource("AtlasTexture_gpot4")
|
||||||
DropScenePath = &"res://Scenes/Items/SpiderBomb_Pickup.tscn"
|
DropScenePath = &"res://Scenes/Items/SpiderBomb_Pickup.tscn"
|
||||||
metadata/_custom_type_script = "uid://epnwjptvks3t"
|
metadata/_custom_type_script = "uid://epnwjptvks3t"
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("3_ajs4l")
|
script = ExtResource("3_ajs4l")
|
||||||
ItemName = &"Yin-Yang Ammo"
|
ItemName = &"Yin-Yang Ammo"
|
||||||
|
ShortName = null
|
||||||
ItemDescription = &"Ammo for Ying-Yang based weapons"
|
ItemDescription = &"Ammo for Ying-Yang based weapons"
|
||||||
ItemKey = &"YINYANG_AMMO"
|
ItemKey = &"YINYANG_AMMO"
|
||||||
Item = 3
|
Item = 3
|
||||||
|
|
@ -15,5 +16,6 @@ PickupIfMaxed = false
|
||||||
ConsumeOnUse = true
|
ConsumeOnUse = true
|
||||||
UiType = 2
|
UiType = 2
|
||||||
Selectable = false
|
Selectable = false
|
||||||
|
AutoPickup = true
|
||||||
InventorySprite = ExtResource("1_jt7l8")
|
InventorySprite = ExtResource("1_jt7l8")
|
||||||
DropScenePath = &"res://Scenes/Items/Yin_Yang_Ammo.tscn"
|
DropScenePath = &"res://Scenes/Items/Yin_Yang_Ammo.tscn"
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
[gd_scene load_steps=6 format=3 uid="uid://cmr6fclttrpkb"]
|
[gd_scene load_steps=5 format=3 uid="uid://cmr6fclttrpkb"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://b3h7b30kerf60" path="res://Scripts/Interactables/ItemPickup.cs" id="1_it180"]
|
[ext_resource type="Script" uid="uid://b3h7b30kerf60" path="res://Scripts/Interactables/ItemPickup.cs" id="1_it180"]
|
||||||
[ext_resource type="Resource" uid="uid://ct1fa2huvy34n" path="res://Resources/Items/Ammo1.tres" id="2_j10i4"]
|
[ext_resource type="Resource" uid="uid://ct1fa2huvy34n" path="res://Resources/Items/Ammo1.tres" id="2_j10i4"]
|
||||||
[ext_resource type="Script" uid="uid://epnwjptvks3t" path="res://Scripts/Resources/LootItem.cs" id="2_k1yis"]
|
|
||||||
[ext_resource type="SpriteFrames" uid="uid://pmwatoyt2ase" path="res://Resources/Sprites/Ammo_Inventory_Sprite.tres" id="3_6n103"]
|
[ext_resource type="SpriteFrames" uid="uid://pmwatoyt2ase" path="res://Resources/Sprites/Ammo_Inventory_Sprite.tres" id="3_6n103"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_6vv2s"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_6vv2s"]
|
||||||
|
|
@ -11,10 +10,12 @@
|
||||||
collision_layer = 4
|
collision_layer = 4
|
||||||
collision_mask = 2
|
collision_mask = 2
|
||||||
script = ExtResource("1_it180")
|
script = ExtResource("1_it180")
|
||||||
LootTable = Array[ExtResource("2_k1yis")]([ExtResource("2_j10i4")])
|
LootTable = [ExtResource("2_j10i4")]
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource("CircleShape2D_6vv2s")
|
shape = SubResource("CircleShape2D_6vv2s")
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
sprite_frames = ExtResource("3_6n103")
|
sprite_frames = ExtResource("3_6n103")
|
||||||
|
|
||||||
|
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||||
|
|
|
||||||
|
|
@ -32,3 +32,5 @@ shape = SubResource("CircleShape2D_6vv2s")
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
sprite_frames = SubResource("SpriteFrames_4vvwn")
|
sprite_frames = SubResource("SpriteFrames_4vvwn")
|
||||||
|
|
||||||
|
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||||
|
|
|
||||||
|
|
@ -32,3 +32,5 @@ shape = SubResource("CircleShape2D_6vv2s")
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
sprite_frames = SubResource("SpriteFrames_6m0m2")
|
sprite_frames = SubResource("SpriteFrames_6m0m2")
|
||||||
|
|
||||||
|
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
[gd_scene load_steps=37 format=3 uid="uid://1yxieu8ekvkm"]
|
[gd_scene load_steps=36 format=3 uid="uid://1yxieu8ekvkm"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://b3h7b30kerf60" path="res://Scripts/Interactables/ItemPickup.cs" id="1_clwuw"]
|
[ext_resource type="Script" uid="uid://b3h7b30kerf60" path="res://Scripts/Interactables/ItemPickup.cs" id="1_clwuw"]
|
||||||
[ext_resource type="Script" uid="uid://epnwjptvks3t" path="res://Scripts/Resources/LootItem.cs" id="2_7y15p"]
|
|
||||||
[ext_resource type="Resource" uid="uid://ciybnocjfpshh" path="res://Resources/Items/Heart_Extend_Pickup.tres" id="3_clwuw"]
|
[ext_resource type="Resource" uid="uid://ciybnocjfpshh" path="res://Resources/Items/Heart_Extend_Pickup.tres" id="3_clwuw"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c6gjpfxrux5uq" path="res://Sprites/Items/Heart_Extend_Animated.png" id="4_clwuw"]
|
[ext_resource type="Texture2D" uid="uid://c6gjpfxrux5uq" path="res://Sprites/Items/Heart_Extend_Animated.png" id="4_clwuw"]
|
||||||
|
|
||||||
|
|
@ -229,7 +228,7 @@ animations = [{
|
||||||
collision_layer = 4
|
collision_layer = 4
|
||||||
collision_mask = 2
|
collision_mask = 2
|
||||||
script = ExtResource("1_clwuw")
|
script = ExtResource("1_clwuw")
|
||||||
LootTable = Array[ExtResource("2_7y15p")]([ExtResource("3_clwuw")])
|
LootTable = [ExtResource("3_clwuw")]
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource("CircleShape2D_6vv2s")
|
shape = SubResource("CircleShape2D_6vv2s")
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
[gd_scene load_steps=8 format=3 uid="uid://b2tihw3iawd2l"]
|
[gd_scene load_steps=7 format=3 uid="uid://b2tihw3iawd2l"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://b3h7b30kerf60" path="res://Scripts/Interactables/ItemPickup.cs" id="1_j5s0a"]
|
[ext_resource type="Script" uid="uid://b3h7b30kerf60" path="res://Scripts/Interactables/ItemPickup.cs" id="1_j5s0a"]
|
||||||
[ext_resource type="Script" uid="uid://epnwjptvks3t" path="res://Scripts/Resources/LootItem.cs" id="2_4oifc"]
|
|
||||||
[ext_resource type="Resource" uid="uid://dodwpect0ldjf" path="res://Resources/Items/Heart_Pickup.tres" id="3_dqwsj"]
|
[ext_resource type="Resource" uid="uid://dodwpect0ldjf" path="res://Resources/Items/Heart_Pickup.tres" id="3_dqwsj"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dlkqy5jgchwy" path="res://Sprites/Items/Heart_Pickup.png" id="4_iu1v6"]
|
[ext_resource type="Texture2D" uid="uid://dlkqy5jgchwy" path="res://Sprites/Items/Heart_Pickup.png" id="4_iu1v6"]
|
||||||
|
|
||||||
|
|
@ -26,10 +25,12 @@ animations = [{
|
||||||
collision_layer = 4
|
collision_layer = 4
|
||||||
collision_mask = 2
|
collision_mask = 2
|
||||||
script = ExtResource("1_j5s0a")
|
script = ExtResource("1_j5s0a")
|
||||||
LootTable = Array[ExtResource("2_4oifc")]([ExtResource("3_dqwsj")])
|
LootTable = [ExtResource("3_dqwsj")]
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource("CircleShape2D_6vv2s")
|
shape = SubResource("CircleShape2D_6vv2s")
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
sprite_frames = SubResource("SpriteFrames_f6vxc")
|
sprite_frames = SubResource("SpriteFrames_f6vxc")
|
||||||
|
|
||||||
|
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||||
|
|
|
||||||
|
|
@ -32,3 +32,5 @@ shape = SubResource("CircleShape2D_6vv2s")
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
sprite_frames = SubResource("SpriteFrames_koe11")
|
sprite_frames = SubResource("SpriteFrames_koe11")
|
||||||
|
|
||||||
|
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||||
|
|
|
||||||
|
|
@ -32,3 +32,5 @@ shape = SubResource("CircleShape2D_6vv2s")
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
sprite_frames = SubResource("SpriteFrames_y2inf")
|
sprite_frames = SubResource("SpriteFrames_y2inf")
|
||||||
|
|
||||||
|
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||||
|
|
|
||||||
|
|
@ -32,3 +32,5 @@ shape = SubResource("CircleShape2D_6vv2s")
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
sprite_frames = SubResource("SpriteFrames_ga0s1")
|
sprite_frames = SubResource("SpriteFrames_ga0s1")
|
||||||
|
|
||||||
|
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||||
|
|
|
||||||
|
|
@ -32,3 +32,5 @@ shape = SubResource("CircleShape2D_6vv2s")
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
sprite_frames = SubResource("SpriteFrames_qfvur")
|
sprite_frames = SubResource("SpriteFrames_qfvur")
|
||||||
|
|
||||||
|
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
[gd_scene load_steps=8 format=3 uid="uid://sjxkj5jdndxb"]
|
[gd_scene load_steps=7 format=3 uid="uid://sjxkj5jdndxb"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://b3h7b30kerf60" path="res://Scripts/Interactables/ItemPickup.cs" id="1_o42iv"]
|
[ext_resource type="Script" uid="uid://b3h7b30kerf60" path="res://Scripts/Interactables/ItemPickup.cs" id="1_o42iv"]
|
||||||
[ext_resource type="Resource" uid="uid://diqm2ju0xakkt" path="res://Resources/Items/Yin_Yang_Ammo.tres" id="2_o42iv"]
|
[ext_resource type="Resource" uid="uid://diqm2ju0xakkt" path="res://Resources/Items/Yin_Yang_Ammo.tres" id="2_o42iv"]
|
||||||
[ext_resource type="Script" uid="uid://epnwjptvks3t" path="res://Scripts/Resources/LootItem.cs" id="2_q76u6"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://b61po207ggn63" path="res://Sprites/Items/Yin_Ammo.png" id="3_o42iv"]
|
[ext_resource type="Texture2D" uid="uid://b61po207ggn63" path="res://Sprites/Items/Yin_Ammo.png" id="3_o42iv"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_6vv2s"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_6vv2s"]
|
||||||
|
|
@ -26,10 +25,12 @@ animations = [{
|
||||||
collision_layer = 4
|
collision_layer = 4
|
||||||
collision_mask = 2
|
collision_mask = 2
|
||||||
script = ExtResource("1_o42iv")
|
script = ExtResource("1_o42iv")
|
||||||
LootTable = Array[ExtResource("2_q76u6")]([ExtResource("2_o42iv")])
|
LootTable = [ExtResource("2_o42iv")]
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource("CircleShape2D_6vv2s")
|
shape = SubResource("CircleShape2D_6vv2s")
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
sprite_frames = SubResource("SpriteFrames_8gvnj")
|
sprite_frames = SubResource("SpriteFrames_8gvnj")
|
||||||
|
|
||||||
|
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||||
|
|
|
||||||
|
|
@ -505,6 +505,36 @@ StartingAiState = 1
|
||||||
[node name="HeartPickup" parent="Parallax2D/Factory Tilemaps/Debug Room" instance=ExtResource("27_jn1m0")]
|
[node name="HeartPickup" parent="Parallax2D/Factory Tilemaps/Debug Room" instance=ExtResource("27_jn1m0")]
|
||||||
position = Vector2(-767, -395)
|
position = Vector2(-767, -395)
|
||||||
|
|
||||||
|
[node name="HeartPickup2" parent="Parallax2D/Factory Tilemaps/Debug Room" instance=ExtResource("27_jn1m0")]
|
||||||
|
position = Vector2(-485.312, -517.597)
|
||||||
|
|
||||||
|
[node name="HeartPickup3" parent="Parallax2D/Factory Tilemaps/Debug Room" instance=ExtResource("27_jn1m0")]
|
||||||
|
position = Vector2(-484.343, -498.209)
|
||||||
|
|
||||||
|
[node name="HeartPickup4" parent="Parallax2D/Factory Tilemaps/Debug Room" instance=ExtResource("27_jn1m0")]
|
||||||
|
position = Vector2(-462.532, -520.02)
|
||||||
|
|
||||||
|
[node name="HeartPickup5" parent="Parallax2D/Factory Tilemaps/Debug Room" instance=ExtResource("27_jn1m0")]
|
||||||
|
position = Vector2(-460.836, -501.117)
|
||||||
|
|
||||||
|
[node name="HeartPickup6" parent="Parallax2D/Factory Tilemaps/Debug Room" instance=ExtResource("27_jn1m0")]
|
||||||
|
position = Vector2(-439.025, -521.716)
|
||||||
|
|
||||||
|
[node name="HeartPickup7" parent="Parallax2D/Factory Tilemaps/Debug Room" instance=ExtResource("27_jn1m0")]
|
||||||
|
position = Vector2(-439.025, -501.602)
|
||||||
|
|
||||||
|
[node name="HeartPickup8" parent="Parallax2D/Factory Tilemaps/Debug Room" instance=ExtResource("27_jn1m0")]
|
||||||
|
position = Vector2(-411.156, -521.232)
|
||||||
|
|
||||||
|
[node name="HeartPickup9" parent="Parallax2D/Factory Tilemaps/Debug Room" instance=ExtResource("27_jn1m0")]
|
||||||
|
position = Vector2(-414.548, -502.572)
|
||||||
|
|
||||||
|
[node name="HeartPickup10" parent="Parallax2D/Factory Tilemaps/Debug Room" instance=ExtResource("27_jn1m0")]
|
||||||
|
position = Vector2(-391.041, -523.171)
|
||||||
|
|
||||||
|
[node name="HeartPickup11" parent="Parallax2D/Factory Tilemaps/Debug Room" instance=ExtResource("27_jn1m0")]
|
||||||
|
position = Vector2(-392.495, -504.753)
|
||||||
|
|
||||||
[node name="RedKeycard_Switch_3" parent="Parallax2D/Factory Tilemaps/Debug Room" node_paths=PackedStringArray("Targets") instance=ExtResource("17_e3v0b")]
|
[node name="RedKeycard_Switch_3" parent="Parallax2D/Factory Tilemaps/Debug Room" node_paths=PackedStringArray("Targets") instance=ExtResource("17_e3v0b")]
|
||||||
position = Vector2(-701, -486)
|
position = Vector2(-701, -486)
|
||||||
Targets = [NodePath("../HorizontalForceField")]
|
Targets = [NodePath("../HorizontalForceField")]
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Cirno.Scripts.Resources;
|
using System.Linq;
|
||||||
|
using Cirno.Scripts.Resources;
|
||||||
using Godot;
|
using Godot;
|
||||||
using Godot.Collections;
|
using Godot.Collections;
|
||||||
|
|
||||||
|
|
@ -8,19 +9,66 @@ public partial class ItemPickup : Interactable
|
||||||
{
|
{
|
||||||
[Export] public Array<LootItem> LootTable = [];
|
[Export] public Array<LootItem> LootTable = [];
|
||||||
|
|
||||||
|
private bool _autoPickup = false;
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
_autoPickup = LootTable.Any(x => x.AutoPickup);
|
||||||
|
// if (LootTable.Any(x => x.AutoPickup))
|
||||||
|
// {
|
||||||
|
// _autoPickup = true;
|
||||||
|
// }
|
||||||
|
|
||||||
|
//this.AreaEntered += _on_area_entered;
|
||||||
|
}
|
||||||
|
|
||||||
public override bool Activate(ActivationType activationType = ActivationType.Toggle)
|
public override bool Activate(ActivationType activationType = ActivationType.Toggle)
|
||||||
{
|
{
|
||||||
GD.Print("Attempting to Pickup Item");
|
GD.Print("Attempting to Pickup Item");
|
||||||
|
|
||||||
if (!MeetsRequirements()) return false;
|
if (!MeetsRequirements()) return false;
|
||||||
|
AddItemsToInventory();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddItemsToInventory()
|
||||||
|
{
|
||||||
|
var failedItems = new Array<LootItem>();
|
||||||
foreach (var item in LootTable)
|
foreach (var item in LootTable)
|
||||||
{
|
{
|
||||||
InventoryManager.Instance.AddItem(item);
|
if (!InventoryManager.Instance.AddItem(item))
|
||||||
|
{
|
||||||
|
failedItems.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (failedItems.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var failedItem in failedItems)
|
||||||
|
{
|
||||||
|
var dup = this.Duplicate() as ItemPickup;
|
||||||
|
this.AddSibling(dup);
|
||||||
|
dup.LootTable = [failedItem];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delet This
|
// Delet This
|
||||||
QueueFree();
|
QueueFree();
|
||||||
|
}
|
||||||
return true;
|
|
||||||
|
private void _on_area_entered(Area2D area)
|
||||||
|
{
|
||||||
|
if (!_autoPickup) return;
|
||||||
|
if (area is InteractionController interactionController)
|
||||||
|
{
|
||||||
|
//Check if items are not maxed to avoid a looping autopickup situation
|
||||||
|
var canAdd = LootTable.Aggregate(false, (current, item) => current || InventoryManager.Instance.CanAddItem(item.ItemKey));
|
||||||
|
|
||||||
|
if (canAdd)
|
||||||
|
{
|
||||||
|
AddItemsToInventory();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -52,6 +52,11 @@ public partial class InventoryManager : Node2D
|
||||||
return _itemsDict.TryGetValue(key, out item);
|
return _itemsDict.TryGetValue(key, out item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LootItem FindItemInDb(string key)
|
||||||
|
{
|
||||||
|
return ItemsDatabase.GetLootItem(key);
|
||||||
|
}
|
||||||
|
|
||||||
public bool HasItems(IList<string> itemKeys)
|
public bool HasItems(IList<string> itemKeys)
|
||||||
{
|
{
|
||||||
return itemKeys.Aggregate(false, (current, item) => current || GetItemCount(item) > 0);
|
return itemKeys.Aggregate(false, (current, item) => current || GetItemCount(item) > 0);
|
||||||
|
|
@ -87,6 +92,19 @@ public partial class InventoryManager : Node2D
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool CanAddItem(string itemKey)
|
||||||
|
{
|
||||||
|
|
||||||
|
var found = TryGetItem(itemKey, out var itm);
|
||||||
|
if (found)
|
||||||
|
{
|
||||||
|
return (itm.Count < itm.Item.Max);
|
||||||
|
}
|
||||||
|
|
||||||
|
var dbItem = FindItemInDb(itemKey);
|
||||||
|
return dbItem != null;
|
||||||
|
}
|
||||||
|
|
||||||
public bool AddItem(LootItem item)
|
public bool AddItem(LootItem item)
|
||||||
{
|
{
|
||||||
//var item = new LootItem() { Item = type, Amount = amount };
|
//var item = new LootItem() { Item = type, Amount = amount };
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ public partial class LootItem : Resource
|
||||||
[Export] public bool ConsumeOnUse;
|
[Export] public bool ConsumeOnUse;
|
||||||
[Export] public UiItemType UiType;
|
[Export] public UiItemType UiType;
|
||||||
[Export] public bool Selectable;
|
[Export] public bool Selectable;
|
||||||
|
[Export] public bool AutoPickup { get; private set; } = false;
|
||||||
[Export] public Texture2D InventorySprite;
|
[Export] public Texture2D InventorySprite;
|
||||||
//[Export] public SpriteFrames WorldSprite;
|
//[Export] public SpriteFrames WorldSprite;
|
||||||
//[Export] public PackedScene HudItemScene;
|
//[Export] public PackedScene HudItemScene;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue