WIP fixing farming mechanic again

pull/12/head
kziolkowski 6 months ago
parent 7a3e96d679
commit a4f9511892

@ -4,12 +4,11 @@ importer="scene"
importer_version=1
type="PackedScene"
uid="uid://b3kyrsoobmkhp"
path="res://.godot/imported/best_house_blender.blend-ac89c74aef2f275bdf4b4baadee17c0c.scn"
valid=false
[deps]
source_file="res://art/mockups/3d/best_house_blender.blend"
dest_files=["res://.godot/imported/best_house_blender.blend-ac89c74aef2f275bdf4b4baadee17c0c.scn"]
[params]

@ -42,7 +42,7 @@ texture = ExtResource("4_yav45")
[node name="FieldTexture" type="Sprite2D" parent="FieldBehaviour/MaskedField"]
texture = ExtResource("6_a35l4")
[node name="BeetRoot" parent="FieldBehaviour" node_paths=PackedStringArray("_smallPlants", "_field") instance=ExtResource("8_tgwxi")]
[node name="BeetRoot" parent="FieldBehaviour" node_paths=PackedStringArray("_smallPlants", "_field") groups=["PlantGrowing"] instance=ExtResource("8_tgwxi")]
_smallPlants = [NodePath("SmallPlant/01"), NodePath("SmallPlant/02"), null, null]
_state = 2
_field = NodePath("..")

@ -1,4 +1,4 @@
[gd_scene load_steps=11 format=3 uid="uid://b1d2e7ely6hyw"]
[gd_scene load_steps=10 format=3 uid="uid://b1d2e7ely6hyw"]
[ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="1_jrdc4"]
[ext_resource type="Script" uid="uid://bdffon388rkty" path="res://scripts/CSharp/Common/Farming/FieldBehaviour2D.cs" id="2_vl3uw"]
@ -7,15 +7,11 @@
[ext_resource type="Texture2D" uid="uid://djpigvoyadvjs" path="res://art/masks/field_outline_3.png" id="5_4a8nv"]
[ext_resource type="Texture2D" uid="uid://c2pirgay3jfnn" path="res://art/farm/tilable grounds/böden/trockene farming erde.png" id="6_l7j4c"]
[ext_resource type="Texture2D" uid="uid://ctvdxwgmfaj5c" path="res://art/farm/tilable grounds/böden/nasse farming erde.png" id="7_f504p"]
[ext_resource type="PackedScene" uid="uid://c3hwbwo423nbm" path="res://prefabs/farm/beet_plant.tscn" id="8_pa15t"]
[ext_resource type="PackedScene" uid="uid://gishbn0a8eke" path="res://prefabs/farm/tomato_plant.tscn" id="8_jrdc4"]
[sub_resource type="CircleShape2D" id="CircleShape2D_yi42k"]
[sub_resource type="CircleShape2D" id="CircleShape2D_vl3uw"]
resource_local_to_scene = true
radius = 201.345
[sub_resource type="CircleShape2D" id="CircleShape2D_femni"]
resource_local_to_scene = true
radius = 194.926
radius = 300.0
[node name="BaseField" type="Node2D"]
@ -33,26 +29,13 @@ _maskSprite = NodePath("MaskedField")
_maskTexture = Array[Texture2D]([ExtResource("3_uqkef"), ExtResource("4_di17a"), ExtResource("5_4a8nv")])
Tilled = ExtResource("6_l7j4c")
Watered = ExtResource("7_f504p")
_growingCollider = NodePath("BasePlant/InteractionArea")
_growingCollider = NodePath("BasePlant2/InteractionArea")
[node name="BasePlant" parent="FieldBehaviour" node_paths=PackedStringArray("_smallPlants", "_field") instance=ExtResource("8_pa15t")]
_smallPlants = [NodePath("SmallPlant/01"), NodePath("SmallPlant/02"), null, null]
[node name="BasePlant2" parent="FieldBehaviour" node_paths=PackedStringArray("_field") groups=["PlantGrowing"] instance=ExtResource("8_jrdc4")]
_field = NodePath("..")
[node name="BigPlant" parent="FieldBehaviour/BasePlant" index="2"]
position = Vector2(6, -161)
[node name="InteractionArea" parent="FieldBehaviour/BasePlant" index="3"]
z_index = 3
[node name="CollisionShape3D" parent="FieldBehaviour/BasePlant/InteractionArea/Area2D" index="0"]
shape = SubResource("CircleShape2D_yi42k")
[node name="CollisionShape3D" parent="FieldBehaviour/BasePlant/ReadyPlantInventoryItem/InteractionArea2/Area2D" index="0"]
shape = SubResource("CircleShape2D_femni")
[node name="ReadyPlant" parent="FieldBehaviour/BasePlant/ReadyPlantInventoryItem" index="5"]
position = Vector2(0, -291.3)
[node name="CollisionShape3D" parent="FieldBehaviour/BasePlant2/ReadyPlantInventoryItem/InteractionArea2/Area2D" index="0"]
shape = SubResource("CircleShape2D_vl3uw")
[node name="MaskedField" type="Sprite2D" parent="FieldBehaviour"]
clip_children = 1
@ -62,9 +45,6 @@ texture = ExtResource("4_di17a")
[node name="FieldTexture" type="Sprite2D" parent="FieldBehaviour/MaskedField"]
texture = ExtResource("6_l7j4c")
[connection signal="Interacted" from="InteractionArea2" to="FieldBehaviour/BasePlant" method="Grow"]
[editable path="FieldBehaviour/BasePlant"]
[editable path="FieldBehaviour/BasePlant/InteractionArea"]
[editable path="FieldBehaviour/BasePlant/ReadyPlantInventoryItem"]
[editable path="FieldBehaviour/BasePlant/ReadyPlantInventoryItem/InteractionArea2"]
[editable path="FieldBehaviour/BasePlant2"]
[editable path="FieldBehaviour/BasePlant2/ReadyPlantInventoryItem"]
[editable path="FieldBehaviour/BasePlant2/ReadyPlantInventoryItem/InteractionArea2"]

@ -1,4 +1,4 @@
[gd_scene load_steps=11 format=3 uid="uid://gishbn0a8eke"]
[gd_scene load_steps=12 format=3 uid="uid://gishbn0a8eke"]
[ext_resource type="Script" uid="uid://cms357f23fmfy" path="res://scripts/CSharp/Common/Farming/PlantBehaviour2D.cs" id="1_66p1c"]
[ext_resource type="Texture2D" uid="uid://dtr4uga5uspg" path="res://art/farm/farming/farmobjekte/tomaten/tomaten baby.png" id="2_vjw4j"]
@ -8,6 +8,7 @@
[ext_resource type="PackedScene" uid="uid://dpbbroif2tnil" path="res://prefabs/interactions/generic_item_on_ground_2d.tscn" id="6_gdrin"]
[ext_resource type="Resource" uid="uid://blr8tine5m0ma" path="res://resources/items/tomato.tres" id="7_di4m0"]
[ext_resource type="Texture2D" uid="uid://cnwd3mb3jnuxm" path="res://art/farm/farming/farmobjekte/tomaten/teen adulte tomaten.png" id="8_evgr8"]
[ext_resource type="Texture2D" uid="uid://bleimj6jr1jka" path="res://art/general/rectangle.png" id="9_vjw4j"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_u4cty"]
shader = ExtResource("3_7hdur")
@ -25,7 +26,7 @@ shader_parameter/offset = 0.0
resource_local_to_scene = true
radius = 300.0
[node name="BasePlant" type="Node2D" node_paths=PackedStringArray("_seeds", "_smallPlants", "_bigPlants", "_readyPlants", "_harvestablePlant")]
[node name="BasePlant" type="Node2D" node_paths=PackedStringArray("_seeds", "_smallPlants", "_bigPlants", "_readyPlants", "_harvestablePlant", "_magicEffect")]
z_index = 1
y_sort_enabled = true
script = ExtResource("1_66p1c")
@ -34,6 +35,7 @@ _smallPlants = [NodePath("SmallPlant/01"), NodePath("SmallPlant/02"), NodePath("
_bigPlants = [NodePath("BigPlant/01"), NodePath("BigPlant/02"), NodePath("BigPlant/03"), NodePath("BigPlant/04")]
_readyPlants = [NodePath("ReadyPlantInventoryItem/ReadyPlant/01"), NodePath("ReadyPlantInventoryItem/ReadyPlant/02"), NodePath("ReadyPlantInventoryItem/ReadyPlant/03"), NodePath("ReadyPlantInventoryItem/ReadyPlant/04")]
_harvestablePlant = NodePath("ReadyPlantInventoryItem")
_magicEffect = NodePath("magic vfx")
[node name="Seeds" type="Node2D" parent="."]
position = Vector2(0, 0.5)
@ -188,6 +190,25 @@ texture = ExtResource("8_evgr8")
region_enabled = true
region_rect = Rect2(1167, 863, 528, 785)
[node name="magic vfx" type="CPUParticles2D" parent="."]
position = Vector2(-133, -347)
rotation = -0.333807
emitting = false
amount = 20
texture = ExtResource("9_vjw4j")
lifetime = 0.5
randomness = 1.0
local_coords = true
draw_order = 1
emission_shape = 2
emission_sphere_radius = 128.0
linear_accel_min = 44.07
linear_accel_max = 78.81
scale_amount_min = 0.01
scale_amount_max = 0.1
color = Color(0.400601, 0.62444, 0.791217, 1)
hue_variation_max = 0.4
[connection signal="Interacted" from="InteractionArea" to="." method="Grow"]
[editable path="ReadyPlantInventoryItem"]

@ -24,12 +24,12 @@ buses/default_bus_layout="uid://b6dwkmkyb0axk"
[autoload]
SceneTransition="*res://scenes/SceneTransition.tscn"
Dialogic="*res://addons/dialogic/Core/DialogicGameHandler.gd"
InventoryManager="*res://scripts/CSharp/Common/Inventory/InventoryManager.cs"
Signal_Debugger="*res://addons/SignalVisualizer/Debugger/SignalDebugger.gd"
QuestManager="*res://scripts/CSharp/Common/Quest/QuestManager.cs"
FightManagerAutoload="*res://prefabs/fight/fight_manager_autoload.tscn"
Signal_Debugger="*res://addons/SignalVisualizer/Debugger/SignalDebugger.gd"
SceneTransition="*res://scenes/SceneTransition.tscn"
[dialogic]

@ -2197,9 +2197,6 @@ offset_top = 0.228533
offset_right = -456.339
offset_bottom = 30.2285
[node name="Control" parent="CanvasLayer" index="3"]
visible = false
[node name="Audio" type="Node" parent="."]
[node name="Background Music Ramp up" type="AudioStreamPlayer2D" parent="Audio"]

@ -22,7 +22,7 @@ radius = 509.071
[node name="VesnasRoom" type="Node2D"]
y_sort_enabled = true
script = ExtResource("1_c6eln")
_sceneNamesToLoad = PackedStringArray("res://scenes/Babushka_scene_indoor_common_room.tscn")
_sceneNamesToLoad = PackedStringArray("res://scenes/Babushka_scene_indoor_common_room.tscn", "res://scenes/Babushka_scene_forest_fight_1_2d.tscn")
[node name="Colliders" type="Node2D" parent="."]
position = Vector2(1297, 5292)
@ -96,6 +96,7 @@ _followNode = NodePath("../Vesna/CharacterBody2D")
[node name="BedInteraction" parent="." instance=ExtResource("8_phqdf")]
position = Vector2(-1429, 487)
_id = 1
[node name="DoorInteraction" parent="." instance=ExtResource("8_phqdf")]
position = Vector2(777, 201)
@ -104,6 +105,7 @@ _id = 0
[node name="CollisionShape3D" parent="DoorInteraction/Area2D" index="0"]
shape = SubResource("CircleShape2D_2spkc")
[connection signal="InteractedTool" from="BedInteraction" to="." method="LoadSceneAtIndex"]
[connection signal="Interacted" from="DoorInteraction" to="." method="LoadScene"]
[editable path="Vesna"]

@ -40,22 +40,27 @@ public partial class FieldBehaviour2D : Sprite2D
{
case FieldState.Empty:
FieldState = FieldState.Empty;
GD.Print("FieldState is Empty.");
break;
case FieldState.Tilled:
FieldState = FieldState.Tilled;
_fieldSprite.Texture = Tilled;
_growingCollider.Visible = false;
GD.Print("FieldState is Tilled.");
break;
case FieldState.Watered:
FieldState = FieldState.Watered;
_fieldSprite.Texture = Watered;
_growingCollider.Visible = true;
GD.Print("FieldState is Watered.");
break;
case FieldState.Planted:
FieldState = FieldState.Planted;
GD.Print("FieldState is Planted.");
break;
default:
FieldState = FieldState.NotFound;
GD.Print("FieldState is NotFound.");
break;
}
}
@ -63,8 +68,7 @@ public partial class FieldBehaviour2D : Sprite2D
public void Water()
{
FieldState = FieldState.Watered;
_fieldSprite.Texture = Watered;
UpdateFieldState(FieldState.Watered);
}
/// <summary>

@ -41,6 +41,7 @@ public partial class PlantBehaviour2D : Node2D
if (_field.FieldState != FieldState.Watered || !_magicWordSaid)
return;
GD.Print("Trying to grow something here.");
GetTree().CallGroup("PlantGrowing", Player2D.MethodName.PlayFarmingAnimation);
switch (_state)
@ -49,18 +50,21 @@ public partial class PlantBehaviour2D : Node2D
_state = PlantState.Planted;
_currentPlantSprite = GetRandomSprite(_seeds);
_currentPlantSprite.Visible = true;
GD.Print("PlantState is none.");
break;
case PlantState.Planted:
_state = PlantState.SmallPlant;
_currentPlantSprite.Visible = false;
_currentPlantSprite = GetRandomSprite(_smallPlants);
_currentPlantSprite.Visible = true;
GD.Print("PlantState is planted.");
break;
case PlantState.SmallPlant:
_state = PlantState.BigPlant;
_currentPlantSprite.Visible = false;
_currentPlantSprite = GetRandomSprite(_bigPlants);
_currentPlantSprite.Visible = true;
GD.Print("PlantState is Smallplant.");
break;
case PlantState.BigPlant:
_state = PlantState.Ready;
@ -68,6 +72,7 @@ public partial class PlantBehaviour2D : Node2D
_currentPlantSprite = GetRandomSprite(_readyPlants);
_harvestablePlant.IsActive = true;
_currentPlantSprite.Visible = true;
GD.Print("PlantState is BigPlant.");
break;
case PlantState.Ready:
_state = PlantState.None;

Loading…
Cancel
Save