feature/showcase_bugfixing_kathi_partII #16

Merged
Jonathan merged 33 commits from feature/showcase_bugfixing_kathi_partII into develop 2025-10-24 18:31:56 +02:00
4 changed files with 83 additions and 1 deletions
Showing only changes of commit 6ae877f2ab - Show all commits
@@ -0,0 +1,20 @@
[gd_scene load_steps=5 format=3 uid="uid://bs4t0t7o4jmam"]
[ext_resource type="Script" uid="uid://doxr432r22dd0" path="res://scripts/CSharp/Common/Items/InventoryDependentInteractable.cs" id="1_cu47d"]
[ext_resource type="Resource" uid="uid://cndd64batns31" path="res://resources/items/wateringcan.tres" id="2_s5peo"]
[ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="3_wsetd"]
[ext_resource type="Texture2D" uid="uid://bleimj6jr1jka" path="res://art/general/rectangle.png" id="4_1dub8"]
[node name="InventoryDependentInteractableTest" type="Node2D" node_paths=PackedStringArray("_interactionArea")]
script = ExtResource("1_cu47d")
_interactionArea = NodePath("InteractionArea")
_itemsToReactTo = Array[Object]([ExtResource("2_s5peo")])
_activateOnItem = true
[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("3_wsetd")]
_active = false
_spriteToOutline = NodePath("../Sprite2D")
[node name="Sprite2D" type="Sprite2D" parent="."]
scale = Vector2(0.5, 0.5)
texture = ExtResource("4_1dub8")
+5 -1
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=114 format=3 uid="uid://gigb28qk8t12"]
[gd_scene load_steps=115 format=3 uid="uid://gigb28qk8t12"]
[ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/characters/Player2D.tscn" id="1_7wfwe"]
[ext_resource type="Texture2D" uid="uid://8sr11ex30n0m" path="res://art/mockups/Kenney_Backgrounds/Samples/uncolored_hills.png" id="2_7b2ri"]
@@ -64,6 +64,7 @@
[ext_resource type="Script" uid="uid://dnipeibppjirs" path="res://scripts/CSharp/Common/NPC/DialogicOverlayStarter.cs" id="51_uxa2m"]
[ext_resource type="Script" uid="uid://d2486x6upmwqq" path="res://scripts/GdScript/dialogic_starter.gd" id="52_lwk6t"]
[ext_resource type="PackedScene" uid="uid://sbf12hin4kes" path="res://prefabs/Interactables/trash_object.tscn" id="53_ycj14"]
[ext_resource type="PackedScene" uid="uid://bs4t0t7o4jmam" path="res://prefabs/Interactables/inventory_dependent_interactable_test.tscn" id="54_fv1t2"]
[ext_resource type="PackedScene" uid="uid://muuxxgvx33fp" path="res://prefabs/farm/duck.tscn" id="62_i36hd"]
[ext_resource type="Script" uid="uid://cldtt4atgymm5" path="res://scripts/CSharp/Common/Quest/QuestTrigger.cs" id="66_2065p"]
[ext_resource type="Resource" uid="uid://cm8kftow8br00" path="res://resources/quests/demo/1_talk_yeli_1.tres" id="67_tm0yg"]
@@ -2275,6 +2276,9 @@ rotation = 1.77025
offset = Vector2(0, 0)
region_rect = Rect2(1048, 1092, 348, 106)
[node name="InventoryDependentInteractableTest" parent="YSorted" instance=ExtResource("54_fv1t2")]
position = Vector2(10868, 3000)
[node name="CanvasLayer" parent="." instance=ExtResource("32_2nee2")]
[node name="Inventory" parent="CanvasLayer" index="1"]
@@ -0,0 +1,57 @@
using Babushka.scripts.CSharp.Common.CharacterControls;
kziolkowski marked this conversation as resolved
Review

Wird das script irgenwo benutzt außer in der InventoryDependentInteractable test scene?

Wird das script irgenwo benutzt außer in der InventoryDependentInteractable test scene?
using Babushka.scripts.CSharp.Common.Inventory;
using Godot;
using Godot.Collections;
namespace Babushka.scripts.CSharp.Common.Items;
public partial class InventoryDependentInteractable : Node2D
{
[Export] private InteractionArea2D _interactionArea;
[Export] private Array<ItemResource> _itemsToReactTo;
[Export] private bool _activateOnItem = true;
private InventoryManager _inventoryManager;
private InventoryInstance _inventoryInstance;
public override void _Ready()
{
_inventoryManager = InventoryManager.Instance;
_inventoryInstance = _inventoryManager.playerInventory;
_inventoryManager.SlotIndexChanged += HandleInventorySelectedSlotIndexChanged;
}
private void HandleInventorySelectedSlotIndexChanged(int newIndex)
{
int currentSlotIndex = InventoryManager.Instance.CurrentSelectedSlotIndex;
ItemInstance? item = InventoryManager.Instance.playerInventory.Slots[currentSlotIndex].itemInstance;
if (item != null)
{
if (_activateOnItem)
{
_interactionArea.IsActive = Match(item.blueprint);
}
else
{
_interactionArea.IsActive = !Match(item.blueprint);
}
}
}
private bool Match(ItemResource inventoryItem)
{
bool matched = false;
foreach (ItemResource item in _itemsToReactTo)
{
if (inventoryItem == item)
{
matched = true;
}
}
return matched;
}
}
@@ -0,0 +1 @@
uid://doxr432r22dd0