✨ added InventoryListener and made field interaction area activate only when the right item (seed) is in the inventory
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=14 format=3 uid="uid://b1d2e7ely6hyw"]
|
||||
[gd_scene load_steps=17 format=3 uid="uid://b1d2e7ely6hyw"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bdffon388rkty" path="res://scripts/CSharp/Common/Farming/FieldBehaviour2D.cs" id="1_qa01x"]
|
||||
[ext_resource type="Texture2D" uid="uid://cgmu3qlovdr22" path="res://art/masks/field_outline_1.png" id="2_w8caw"]
|
||||
@@ -13,10 +13,13 @@
|
||||
[ext_resource type="Script" uid="uid://b5dotkx17gvxg" path="res://scripts/CSharp/Low Code/Events/EventRaiser.cs" id="9_teirr"]
|
||||
[ext_resource type="Texture2D" uid="uid://bovypw2hsn2nq" path="res://art/masks/field_outline_1_outline.png" id="9_wx561"]
|
||||
[ext_resource type="Resource" uid="uid://b4hawvsc7cmkn" path="res://resources/low code/farming/event_newPlantCreated.tres" id="10_wx561"]
|
||||
[ext_resource type="Script" uid="uid://3t0af586fimq" path="res://scripts/CSharp/Common/Inventory/InventoryListener.cs" id="14_w08sx"]
|
||||
[ext_resource type="Resource" uid="uid://d1uuxp1lp4aro" path="res://resources/items/tomato_seed.tres" id="15_i4qwg"]
|
||||
[ext_resource type="Resource" uid="uid://duq7tshxv6uhp" path="res://resources/items/beet_seed.tres" id="16_i4qwg"]
|
||||
|
||||
[node name="BaseField" type="Node2D"]
|
||||
|
||||
[node name="FieldBehaviour" type="Sprite2D" parent="." node_paths=PackedStringArray("_fieldSprite", "_maskSprite", "_outlineSprite", "PlantingInteraction", "PlantingPlaceholder")]
|
||||
[node name="FieldBehaviour" type="Sprite2D" parent="." node_paths=PackedStringArray("_fieldSprite", "_maskSprite", "_outlineSprite", "PlantingInteraction", "PlantingPlaceholder", "FieldInteractionArea")]
|
||||
z_index = -1
|
||||
scale = Vector2(0.9, 1)
|
||||
script = ExtResource("1_qa01x")
|
||||
@@ -30,6 +33,7 @@ Watered = ExtResource("6_7m4xq")
|
||||
PlantingInteraction = NodePath("../InteractionArea")
|
||||
PlantingPlaceholder = NodePath("PlantPlaceholder")
|
||||
ItemRepository = ExtResource("7_w8caw")
|
||||
FieldInteractionArea = NodePath("../InteractionArea")
|
||||
|
||||
[node name="MaskedField" type="Sprite2D" parent="FieldBehaviour"]
|
||||
clip_children = 1
|
||||
@@ -49,11 +53,17 @@ texture = ExtResource("9_wx561")
|
||||
|
||||
[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("7_2eegd")]
|
||||
position = Vector2(-26, -57)
|
||||
_active = false
|
||||
_spritesToOutline = [NodePath("../FieldBehaviour/OutlineSprite")]
|
||||
|
||||
[node name="PlantCreationEventRaiser" type="Node" parent="."]
|
||||
script = ExtResource("9_teirr")
|
||||
_eventResources = Array[Object]([ExtResource("10_wx561")])
|
||||
|
||||
[node name="InventoryListener" type="Node" parent="."]
|
||||
script = ExtResource("14_w08sx")
|
||||
_itemResourcesToListenFor = Array[Object]([ExtResource("15_i4qwg"), ExtResource("16_i4qwg")])
|
||||
|
||||
[connection signal="Planted" from="FieldBehaviour" to="PlantCreationEventRaiser" method="RaiseEvents"]
|
||||
[connection signal="Interacted" from="InteractionArea" to="FieldBehaviour" method="Farm"]
|
||||
[connection signal="ItemInstanceActivated" from="InventoryListener" to="FieldBehaviour" method="ActivatedSeedInInventory"]
|
||||
|
||||
Reference in New Issue
Block a user